The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
September 25, 2021, 02:35:19 AM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  General Forums
| |-+  The Campus
| | |-+  DEFINE_GUID equivalent in ASM?
« previous next »
Pages: [1] Print
Author Topic: DEFINE_GUID equivalent in ASM?  (Read 4175 times)
georgek01
Member
*****
Gender: Male
Posts: 114



DEFINE_GUID equivalent in ASM?
« on: June 28, 2005, 06:48:45 AM »

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?
Logged

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

- ARISTOTLE (384-322 BC)
Jeff
Guest


Email
Re: DEFINE_GUID equivalent in ASM?
« Reply #1 on: June 28, 2005, 09:24:57 AM »

if you happen to have the platformSDK, you could check out the guiddef.h file which has the following definition:
Code:
#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:
Code:
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:
Code:
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.
Logged
georgek01
Member
*****
Gender: Male
Posts: 114



Re: DEFINE_GUID equivalent in ASM?
« Reply #2 on: June 28, 2005, 09:54:14 AM »

Thanks, I'll play around with your suggestion.



Logged

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

- ARISTOTLE (384-322 BC)
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!