Hi,

I have modified the procedure. Both in one ;) Less place.

Regards
Posted on 2003-06-05 16:27:59 by cakmak
Great cakmak,

I have include GetModulePath in the file. I aslo included a standalone GetModulePathW incase some-one running NT (like me) wants the ANSI version. I have changed the name of the file to GoLib.asm as it makes more sense than m32macro.asm. How would you feel about tackling a command line parser as well? With enough module functions moved to an asm file I can see this speeding up program entry significantly. API calls have such a huge penalty to pay in terms of speed.

I am going through the rest of the MASM32 Library and seeing what should be included - any ideas ?

dw2A,VALUE,lpBUFFER		convert DWORD to ANSI string

dw2W,VALUE,lpBUFFER convert DWORD to Unicode string

dw2hexA,VALUE,lpBUFFER convert DWORD to ANSI hexadecimal string
dw2hexW,VALUE,lpBUFFER convert DWORD to Unicode hexadecimal string

a2dw,STRING convert ANSI string to DWORD
u2dw,USTRING convert Unicode string to DWORD

LCopyStringA,SOURCE,DEST,LEN copy an ANSI string to buffer (with length)
<no Unicode version>

GetModulePathA,lpBUFFER get the path of the current module
GetModulePathW,lpBUFFER get the path of the current module - Unicode version
GetModulePath,lpBUFFER get the path of the current module - OS dependant version

StrLenA,STRING length of an ANSI string
StrLenW,USTRING length of a Unicode string

CopyStringA,STRING,lpBUFFER Copy an ANSI string to buffer
CopyStringW,USTRING,lpBUFFER Copy a Unicode string to buffer
Posted on 2003-06-05 16:51:04 by donkey
There was a slight error in the return value of LCopyStringA that has been corrected. New algo for StrLenW thanks in part to roticv. LCopyStringW has been added (Unicode implementation of LCopyStringA). Both LCopyStringA and LCopyStringW will now correctly return the offset for a concatenation of the next string.
Posted on 2003-06-06 11:41:00 by donkey
A couple of more changes. I'm not sure but I think a program that has a unicode function declared will fail on 9x so I seperated the two sets of functions and equated the names. There is still only one file but it now has a conditional compile that will only compile the function set that you want to use. To compile the Unciode version of the functions set the following equate before the #include:

UNICODE equ TRUE

The functions have the same names but a set of equates strip of the W so code can be more easily ported to unicode later if you desire (note that a2dw (ansi to dword) has changed to A2dw to distinguish it from the generic) :
[b]#IF UNICODE = TRUE[/b]

dw2a equ dw2W
dw2hex equ dw2hexW
a2dw equ u2dw
LCopyString equ LCopyStringW
GetModulePath equ GetModulePathW
StrLen equ StrLenW
CopyString equ CopyStringW
[b]#ELSE[/b]
dw2a equ dw2A
dw2hex equ dw2hexA
a2dw equ A2dw
LCopyString equ LCopyStringA
GetModulePath equ GetModulePathA
StrLen equ StrLenA
CopyString equ CopyStringA
[b]#ENDIF[/b]
GetModulePath no longer has an OS dependant version.
Posted on 2003-06-06 12:23:30 by donkey