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?
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.
Thanks, I'll play around with your suggestion.