News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

I hate Microsoft

Started by donkey, March 05, 2006, 07:29:31 PM

Previous topic - Next topic

donkey

Actually I don't really hate them but they frustrate me to no end. In an ongiong effort to make my life a living hell, I have undertaken the task of translating the complete .H files to GoAsm syntax along with all of the COM interfaces (to use with CoInvoke). I am currently on objidl.h, a rather massive file (I have finished winbase, winnt, commctrl,wingdi,shellapi, winerror,ddraw,winuser etc...). So I have to translate the MIDLs to GUIDs, the definition of a GUID is...

typedef struct _GUID
{
    unsigned long        Data1;
    unsigned short       Data2;
    unsigned short       Data3;
    unsigned char        Data4[8];
} GUID;


MIDLs are formatted as follows...

MIDL_IROTData("f29f6bc0-5021-11ce-aa15-00006901293f")

As you can see they in their infinite "wisdom" use DD,DW,DW,DW,DB+DB+DB+DB+DB+DB not DD,DW,DW,DB,DB,DB,DB,DB,DB,DB,DB, making parsing a tiny bit more complicated. The kicker is that the 3rd DW is not actually an Intel WORD as it is not little endian, it's just 2 bytes slapped together ala Motorola. A pain to figure out as I need output in the following format...

MIDL_IROTData equ <0xf29f6bc0, 0x5021, 0x11ce, 0xaa, 0x15, 0x00, 0x00, 0x69, 0x01, 0x29, 0x3f>

Sorry about this, just venting as usual.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

Oh by the way, the parser...

This is part of a callback that scans each line of the file in turn....

lea esi,buffer

mov edi,[pLineText]
mov eax,[edi]
cmp eax,";MID" ; checks for the commented out MIDL
jne >>.EXIT
// Parse the string
:
inc edi
mov al,[edi]
cmp al,"("
je >
mov [esi],al
inc esi
jmp <
:
mov D[esi]," equ"
add esi,4
mov D[esi]," <0x"
add esi,4
mov B[esi],0
add edi,2
:
mov al,[edi]
cmp al,"-"
je >
mov [esi],al
inc edi
inc esi
jmp <
:
mov D[esi],", 0x"
add esi,4
inc edi
:
mov al,[edi]
cmp al,"-"
je >
mov [esi],al
inc edi
inc esi
jmp <
:
mov D[esi],", 0x"
add esi,4
inc edi
:
mov al,[edi]
cmp al,"-"
je >
mov [esi],al
inc edi
inc esi
jmp <
:
mov D[esi],", 0x"
add esi,4
inc edi
:
// Special case for the last entry
mov ax,[edi]
add edi,2
mov [esi],ax
add esi,2
mov D[esi],", 0x"
add esi,4

mov ax,[edi]
add edi,2
mov [esi],ax
add esi,2
mov D[esi],", 0x"
add esi,4

// Parse the remainder 12 chars, 6 values
inc edi
mov ecx,5
:
mov ax,[edi]
add edi,2
mov [esi],ax
add esi,2
mov D[esi],", 0x"
add esi,4
dec ecx
jnz <

mov ax,[edi]
add edi,2
mov [esi],ax
add esi,2
mov B[esi],">"
add esi,1

mov B[esi],13
mov B[esi+1],10
add esi,1

lea ecx,buffer
mov eax,esi
sub eax,ecx
invoke WriteFile,[hOutFile],offset buffer,eax,offset cbWritten,NULL
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

drhowarddrfine

Yeah, and then you have to work on the hard part.

EduardoS

Donkey, the GUID isn't that?

typedef struct _GUID
{
    unsigned long        Data1;
    unsigned short       Data2;
    unsigned short       Data3;
    unsigned char        Data4[2];
    unsigned char        Data5[6];
} GUID;

donkey

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

P1

Donkey,

It seems to me that Hutch's script engine would make fast work of all this.

Regards,  P1  :8)

donkey

Hi P1,

The translation to GUID from MIDL is completed, actually I managed to finish objidl.h last night with all of the interfaces defined for use with GoAsm. I have only a few more "big" ones then all of the tiny support files. I hope to have them finished by the end of next weekend.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable