include \masm32\include\masm32rt.inc
.code
sia SID_IDENTIFIER_AUTHORITY <?>
start: inkey "Hi"
exit
end start
Masm (6.14, 6.15, 8.0, 9.0) yells rude words at me ("error A2181:initializer must be a string or single item"), but JWasm just performs what I expect it to do. Compliments to Japheth :U
Now what could be done for those have-nots who don't own a copy of JWasm??
Windows.inc:
QuoteSID_IDENTIFIER_AUTHORITY STRUCT
Value BYTE 6 dup(?)
SID_IDENTIFIER_AUTHORITY ENDS
It's simply that masm is fussier about types - since you're not initialising the structure with 6 bytes, it whines.
There is a simpler option - don't.
include \masm32\include\masm32rt.inc
.code
sia SID_IDENTIFIER_AUTHORITY <>
start: inkey "Hi"
exit
end start
Any array(dup) within structure that you want to set default initializers for needs another set of brackets ( <> or {} ) - exception to this are strings "" or '' which are by default byte arrays.
Initializing structure with a question mark (undefined) is superfluous(!!), despite what you see in other people's sources (and we see it a lot).
Structures without the need for default initializers are initialized like Tedd said(wrote).
The habit of putting "?" for every structure probably comes from the fact that most structures start with a non-array/structure/union member so putting ? does not come out as error.
imagine this same structure with a base type as first member:
SID_IDENTIFIER_AUTHORITY_TST STRUCT
dw1 dd ?
Value BYTE 6 dup(?)
SID_IDENTIFIER_AUTHORITY_TST ENDS
x SID_IDENTIFIER_AUTHORITY_TST <?> ; WORKS because of "DD"
so :
sia1 SID_IDENTIFIER_AUTHORITY <<?,1,,,1,?>>; blank initializers come about the same as "?"
sia2 SID_IDENTIFIER_AUTHORITY <"bytear">
And "SID_IDENTIFIER_AUTHORITY <?>" compiling in jwasm is indeed a small bug.
Quote from: drizz on March 19, 2011, 06:25:59 PM
Initializing structure with a question mark (undefined) is superfluous(!!), despite what you see in other people's sources (and we see it a lot).
Thanks a lot, Tedd and drizz - you made my day :U