I need a structure that contains a buffer and I have defined it as follows
MYSTRUCT struct
buffer BYTE[4096] ?
MYSTRUCT ends
Is this what I expect as it compiles ok.
ie: I have a buffer of 4096 bytes
Yes :U
Striker, I can think of something else you could try. I'm no pro at this and this code is untested:
.data
MYSTRUCT struct
lpBuffer DWORD 0 ; lpBuffer is a pointer
MYSTRUCT ends
.code
invoke LocalAlloc, LPTR, nBytes ; locked buffer of nBytes
; If the function fails, the return value is NULL.
; To get extended error information, call GetLastError.
mov MYSTRUCT.lpBuffer, eax ; save our pointer
; When the buffer is no longer needed, it must be freed!
invoke LocalFree, MYSTRUCT.lpBuffer
GlobalAlloc GPTR will also work, but they all access the same flat memory in Win32.
Mark,
Thanks, but I wanted the memory fixed and not dynamic.
Ill keep you approach in mind though.
Thanks Thomas.
Rgs, striker
James, I think LPTR signifies LMEM_FIXED + LMEM_ZEROINIT, and nBytes can be a literal value, variable, or constant. Hope that helps. :)