Alright, maybe I'm a little slow and missed something, but how in the hell can you convert a statement like this into assembly? DWORD dwSize=16384; LPNETRESOURCE lpData; lpData = (LPNETRESOURCE) malloc(dwSize); NETRESOURCE is a structure for those who don't know. Any input would be appreciated.
Posted on 2001-03-07 13:30:00 by Schwartzteufel
Remember, in assembly data is data and has no type! The code you gave is as follows:

.data
dwSize        DWORD       16384;
;Same as C (other than syntax)

.data?
lpData        DWORD       ?
;Pointers are just 32bit, so DWORD!

.code
...
     invoke malloc, dwSize
     mov lpData, eax
;No type casting, asm doesn't need it

...
     mov edx, lpData
     mov (NETRESOURCE PTR )., 
;I don't know what the structure of NETRESOURCE is sorry!
Thats basically it! There is nothing in 32 bit ASM other than Flag, 8bit, 16bit, and 32bit. You can define types, but I always find it gets in the way, if you stick to a naming convention (lp for pointers etc.) types only cause problems :P Mirno
Posted on 2001-03-07 13:39:00 by Mirno
I pretty much agree with Mirno, loose type defining is the way to go. However, I do find it very pleasent to define just a few types for special purposes, like "wchar" (just means WORD) or BSTR (just means DWORD). A good naming convention is the most helpful thing. However, since we're in 32 bit land now, all pointers are long. So I just use 'p' for pointer, then 'pp' for a pointer address. It works for me. :-)
Posted on 2001-03-07 14:51:00 by Ernie