News:

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

DEFINE_GUID equivalent in ASM?

Started by georgek01, June 28, 2005, 06:48:45 AM

Previous topic - Next topic

georgek01

How do I build a GUID for use in ASM? I need to pass a GUID into 'SetupDiGetClassDevs' for enumeration later. C developers have the 'DEFINE_GUID' macro - is there something similar for ASM?
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

Jeff

if you happen to have the platformSDK, you could check out the guiddef.h file which has the following definition:
#ifdef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
        EXTERN_C const GUID DECLSPEC_SELECTANY name \
                = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
    EXTERN_C const GUID FAR name
#endif // INITGUID


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


now i dont know the usage so the translation will be up to you.  :)

here's my guess:

GUID STRUCT
    Data1 DWORD ?
    Data2 WORD ?
    Data3 WORD ?
    Data4 BYTE 8 DUP(?)
GUID ENDS

DEFINE_GUID MACRO name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8
    PUBLIC name
IFDEF INITGUID
    name GUID <l,w1,w2,<b1,b2,b3,b4,b5,b6,b7,b8>>
ELSE
    name GUID <>
ENDIF
ENDM

not sure of an equivalent to __declspec(selectany) in MASM but i guess PUBLIC does enough.

georgek01

Thanks, I'll play around with your suggestion.



What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)