Assembly language > Assembly discussions
SIZEOF and DUP
Greenhorn:
Hi,
if I declare an array with DUP and SIZEOF as the length-expression POASM throws an error:
error: Expected 'identifier'.
For example:
myArray BYTE SIZEOF(someStruct) DUP(0)
It would be a nice feature if POASM supports this. MASM does.
Regards
Greenhorn
Vortex:
Hi Greenhorn,
The code below works fine and eax returns 28h which is the correct result :
--- Code: ---.386
.model flat,stdcall
option casemap:none
BITMAPINFOHEADER STRUCT
biSize DWORD ?
biWidth DWORD ?
biHeight DWORD ?
biPlanes WORD ?
biBitCount WORD ?
biCompression DWORD ?
biSizeImage DWORD ?
biXPelsPerMeter DWORD ?
biYPelsPerMeter DWORD ?
biClrUsed DWORD ?
biClrImportant DWORD ?
BITMAPINFOHEADER ENDS
ExitProcess PROTO :DWORD
includelib \PellesC\lib\Win\kernel32.lib
.data
myArray BYTE SIZEOF(BITMAPINFOHEADER) dup(0)
x1 dd 10
.code
start:
mov eax,OFFSET x1 - OFFSET myArray
invoke ExitProcess,0
END start
--- End code ---
Greenhorn:
Hi Vortex,
hm, that irritates me.
POASM complains about the Name_ member:
--- Code: ---IMAGE_AUX_SYMBOL_EX union
struct Sym
WeakDefaultSymIndex DWORD ? ;// the weak extern default symbol index
WeakSearchType DWORD ?
rgbReserved BYTE 12 dup (?)
ends
struct File
Name_ BYTE sizeof(IMAGE_SYMBOL_EX) dup (?)
ends
struct Section_
Length_ DWORD ? ;// section length
NumberOfRelocations WORD ? ;// number of relocation entries
NumberOfLinenumbers WORD ? ;// number of line numbers
CheckSum DWORD ? ;// checksum for communal
Number SWORD ? ;// section number to associate with
Selection BYTE ? ;// communal selection type
bReserved BYTE ?
HighNumber SWORD ? ;// high bits of the section number
rgbReserved BYTE 2 dup (?)
ends
struct
TokenDef IMAGE_AUX_SYMBOL_TOKEN_DEF <>
rgbReserved BYTE 2 dup (?)
ends
struct CRC
crc DWORD ?
rgbReserved BYTE 16 dup (?)
ends
IMAGE_AUX_SYMBOL_EX ends
PIMAGE_AUX_SYMBOL_EX typedef ptr IMAGE_AUX_SYMBOL_EX
--- End code ---
So what's wrong in this ?
EDIT:
And here is the IMAGE_SYMBOL_EX structure:
--- Code: ---IMAGE_SYMBOL_EX struct
union N
ShortName BYTE 8 dup (?)
struct Name_
Short_ DWORD ? ;// if 0, use LongName
Long DWORD ? ;// offset into string table
ends
LongName DWORD 2 dup (?) ;// PBYTE [2]
ends
Value DWORD ?
SectionNumber SDWORD ?
Type_ WORD ?
StorageClass BYTE ?
NumberOfAuxSymbols BYTE ?
IMAGE_SYMBOL_EX ends
PIMAGE_SYMBOL_EX typedef ptr IMAGE_SYMBOL_EX
--- End code ---
Greenhorn
Vortex:
Hi Greenhorn,
If it's possible, could you post a code example simulating the issue?
Greenhorn:
Yes of course it is. ;)
I've translated some header files of the Windows SDK 7.1 and these structures are defined in the winnt.inc.
So I think it makes only sense if you have all the files for a proper test.
With JWASM it seems they work fine, but now I want to make them compatible for POASM.
However, the compressed archive is a little bit too big to attach it to a post here.
I hope it is OK for you if I send you a link for download via PM ...
Navigation
[0] Message Index
[#] Next page
Go to full version