.const
dwMsgTable dd WM_NULL
dd WM_CREAT
dd WM_DESTROY
dd WM_MOVE
..........................
..........................
dd WM_EXITSIZEMOVE
MSG_TABLE_LEN equ ($-dwMsgTable)/size of dword)

What does $ mean here?
thanks
Posted on 2003-08-24 02:38:55 by tomorrow
$ is the current location counter, that means it represents the address at that particular point in the program.
Posted on 2003-08-24 02:50:42 by donkey
because my english is bad,i can 't understand u ,but thank you as same?
Posted on 2003-08-24 03:05:01 by tomorrow
i think donkey is saying $ is like EIP wich is used in debuggers as the current place that you are at in the program...

so lets say the program comes to 00401025 $ would equal 00401025
Posted on 2003-08-24 03:42:27 by devilsclaw
Simply in this example:

When compiler encounter the "$" it puts curent state instead of $ char.
$-dwMsgTable ===> Lenght in bytes from $ (curent state) to dwMsgTable
As I'm assuming size of dword == 4
So ($-dwMsgTable)/size of dword) == Count of messages in dwMsgTable

BTW: MSG_TABLE_LEN is not to right choice of a name i would name it MSG_COUNT rather.
Posted on 2003-08-24 15:58:01 by AceEmbler
thank all the top
Posted on 2003-08-25 00:25:21 by tomorrow
I'll support all said till now with an example, that is very, very useful, and I use it a lot.

In the task, you need some embedded binary data in the code, but during development this data is likely to be replaced with some better data. In my case, this data is a bitmap, that I'd like to hide from resource viewers of crackers. Assume the bitmap is uli.bmp, I open it with BINTODB.EXE (from the masm package) , and save the result as uli_bmp.inc .
uli_bmp.inc has this content:


; E:\masm32\ULTRANO\DR0200\RES\uli.bmp 9 bytes
db 4,54,5,35,5,2,78,45,3


Then, in my code, hello.asm, I put this:



uli_bmp:
include uli_bmp.inc
uli_bmp_size equ $ - uli_bmp


and uli_bmp_size is now a constant, that has the value of 9. If later I modify uli.bmp and respectively uli_bmp.inc , I needn't modify my code at all! This always saves you time and nerve ;) .

A possible use of the uli_bmp_size is this:


local temp1 ; just to get the junk stuff,
; called number of bytes written in file1.
; Nagging, but essential
invoke WriteFile,file1,uli_bmp,uli_bmp_size,addr temp1,0
Posted on 2003-08-25 04:56:09 by Ultrano
Thank you very much,good luck to you
Posted on 2003-08-26 02:29:23 by tomorrow