The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Cobra on July 27, 2008, 02:46:13 PM

Title: [FIXED] MASM v9 problems
Post by: Cobra on July 27, 2008, 02:46:13 PM
I have MASM v9.00.21022.08 and whenever I try to assemble any file that includes windows.inc, it pops up this error:

windows.inc(17583) : error A2138:invalid data initializer


ImportRec RECORD Reserved : 11,NameType : 3,Type2 : 2

IMPORT_OBJECT_HEADER STRUCT
    Sig1 dw     ?
    Sig2 dw     ?
    Version dw  ?
    Machine dw  ?
    TimeDateStamp dd ?
    SizeOfData dd   ?
    union
        Ordinal dw  ?
        Hint dw     ?
    ends
    rImport ImportRec <>          ; <--- this is the problem line
IMPORT_OBJECT_HEADER ENDS


It assembles fine with MASM 6.15.  Any clues?

Thanks!
Title: Re: MASM v9 problems
Post by: Tedd on July 27, 2008, 03:03:16 PM
Try:
rImport ImportRec {}
Title: Re: MASM v9 problems
Post by: Cobra on July 27, 2008, 03:21:51 PM
Quote from: Tedd on July 27, 2008, 03:03:16 PM
Try:
rImport ImportRec {}


Same issue. <?> appears not to work as well. MASM v8 also has this problem.
Title: Re: MASM v9 problems
Post by: hutch-- on July 27, 2008, 06:17:07 PM
It appears that they have broken the RECORD notation again, I changed the format in recent windows.inc version so it was compatible withe version 8.0 but it appears something has changed again. It may be time to remove the RECORD satements from the complete file and keep them in another so its easier to fix.
Title: Re: MASM v9 problems
Post by: Cobra on July 27, 2008, 09:55:45 PM
Ok, it's really something stupid that causes the error. It's a simple fix.

Here's the original:

ImportRec RECORD Reserved : 11,NameType : 3,Type2 : 2

IMPORT_OBJECT_HEADER STRUCT
    Sig1 dw     ?
    Sig2 dw     ?
    Version dw  ?
    Machine dw  ?
    TimeDateStamp dd ?
    SizeOfData dd   ?
    union
        Ordinal dw  ?
        Hint dw     ?
    ends
    rImport ImportRec <>         
IMPORT_OBJECT_HEADER ENDS


Here's the fixed version:

ImportRec RECORD Reserved:11,NameType:3,Type2:2

IMPORT_OBJECT_HEADER STRUCT
    Sig1 WORD     ?
    Sig2 WORD     ?
    Version WORD  ?
    Machine WORD  ?
    TimeDateStamp DWORD ?
    SizeOfData DWORD   ?
    union
        Ordinal WORD  ?
        Hint WORD     ?
    ends
    rImport ImportRec <>
IMPORT_OBJECT_HEADER ENDS


I find it strange that it's the exact same thing but v9.00.21022.08 treats it differently. It works with v7 and v8 also.

I hope this helps those like myself that didn't know this.  :thumbu