Maybe this question belongs to the masm-forum, but I wasn't sure, so I posted it here.
One example: in the masm32 directory example2/qikpad the 'write_to_disk' routine uses a $-sign after hMem:
In the MASM32 helpfile you can read, that $ returns the current offset address (but only in relation to maths operations, or not?).
:) Marwin
One example: in the masm32 directory example2/qikpad the 'write_to_disk' routine uses a $-sign after hMem:
Write_To_Disk proc lpszFile_Name:DWORD
LOCAL ln :DWORD
LOCAL hMem$ :DWORD
LOCAL hFile :DWORD
LOCAL bw :DWORD
LOCAL txtBuffer[64]
; -----------------------------------------
; truncate file to zero length if it exists
; -----------------------------------------
invoke CreateFile,lpszFile_Name, ; pointer to name of the file
GENERIC_WRITE, ; access (read-write) mode
NULL, ; share mode
NULL, ; pointer to security attributes
CREATE_ALWAYS, ; how to create
FILE_ATTRIBUTE_NORMAL, ; file attributes
NULL
mov hFile,eax
invoke GetWindowTextLength,hEdit
mov ln, eax
inc ln
invoke SysAllocStringByteLen,0,ln
mov hMem$, eax
In the MASM32 helpfile you can read, that $ returns the current offset address (but only in relation to maths operations, or not?).
:) Marwin
In the case of hMem$ it's only fifth character of idetifier, tha same as 'h' or 'M'.
You can use it according to masm name conversion:
Follow these rules to define a name for an identifier:
The first character of the identifier can be an alphabetic character (A?Z) or any of these four characters: @ _ $ ?
The other characters in the identifier can be any of the characters listed above or a decimal digit (0?9).
If you use it as operator it returns current location counter.
For example this code puts current eip value in eax:
Or you can use it to define data size:
See also this thread:
Using memory twice
You can use it according to masm name conversion:
Follow these rules to define a name for an identifier:
The first character of the identifier can be an alphabetic character (A?Z) or any of these four characters: @ _ $ ?
The other characters in the identifier can be any of the characters listed above or a decimal digit (0?9).
If you use it as operator it returns current location counter.
For example this code puts current eip value in eax:
call $+5
pop eax ; eax = eip
Or you can use it to define data size:
.data
SomeDataStart:
......
......
DataSize = $-SomeDataStart
See also this thread:
Using memory twice
Marwin,
Its a quirk of mine from writing in basic that the trailing $ on a variable is for a STRING.
The memory used is OLE string memory so it is appropriate. There is no convention in assembler for doing this so its by no means a rule, I used it because it made it visually easier to recognise the data type as STRING data.
Regards,
hutch@movsd.com
Its a quirk of mine from writing in basic that the trailing $ on a variable is for a STRING.
The memory used is OLE string memory so it is appropriate. There is no convention in assembler for doing this so its by no means a rule, I used it because it made it visually easier to recognise the data type as STRING data.
Regards,
hutch@movsd.com
Ok, thank you both. :alright: Until now I didn't know that you can also use other characters than letters and numbers.
:) Marwin
:) Marwin