For those of you that may be interested, I have written a macro to do C++ translations of GUID's into the standard MASM format.

Here is the macro:
MGUID macro a_c_guid

LOCAL guidsize, guid1, guid2, guid3, guid4, guid5, guid6, guid7, guid8, guid9, guid10, guid11

quidsize = @SizeStr(a_c_guid)
if quidsize eq 36
guid1 SUBSTR <a_c_guid>, 1, 8
guid1 CATSTR <0>,guid1,<H>

guid2 SUBSTR <a_c_guid>, 10, 4
guid2 CATSTR <0>,guid2,<H>

guid3 SUBSTR <a_c_guid>, 15, 4
guid3 CATSTR <0>,guid3,<H>

guid4 SUBSTR <a_c_guid>, 20, 2
guid4 CATSTR <0>,guid4,<H>

guid5 SUBSTR <a_c_guid>, 22, 2
guid5 CATSTR <0>,guid5,<H>

guid6 SUBSTR <a_c_guid>, 25, 2
guid6 CATSTR <0>,guid6,<H>

guid7 SUBSTR <a_c_guid>, 27, 2
guid7 CATSTR <0>,guid7,<H>

guid8 SUBSTR <a_c_guid>, 29, 2
guid8 CATSTR <0>,guid8,<H>

guid9 SUBSTR <a_c_guid>, 31, 2
guid9 CATSTR <0>,guid9,<H>

guid10 SUBSTR <a_c_guid>, 33, 2
guid10 CATSTR <0>,guid10,<H>

guid11 SUBSTR <a_c_guid>, 35, 2
guid11 CATSTR <0>,guid11,<H>

else
echo
echo FORMAT: LABEL MGUID (00000000-0000-0000-0000-000000000000)
echo Must be 36 bytes long, including dashes!
echo
.err <MGUID ERROR>
endif

exitm <TEXTEQU !<{guid1, guid2, guid3, {guid4, guid5, guid6, guid7, guid8, guid9, guid10, guid11}}!> >
endm

Its quite simple to use. For example, copying a GUID from an IDL file:
//--- ISpNotifySource -------------------------------------------------------
[
object,
uuid(5EFF4AEF-8487-11D2-961C-00C04F8EE628),
helpstring("ISpNotifySource Interface"),
pointer_default(unique),
restricted
]


I use it in my MASM tanslation as:
sISpNotifySource [b]MGUID[/b] (5EFF4AEF-8487-11D2-961C-00C04F8EE628)

And the resulting code generated would be:


sISpNotifySource [b]TEXTEQU <{05EFF4AEFH, 08487H, 011D2H, {096H, 01CH, 000H, 0C0H, 04FH, 08EH, 0E6H, 028H}}>[/b]
The macro preformate every hex char set with the required '0' prefix, and 'H' suffix.

It is intended for include files, to easily define GUIDs for later use with the GUID struture (found in windows.inc).

Hope this helps your COM adventures ;)
:alright:
NaN
Posted on 2002-11-30 18:23:12 by NaN
Cool!

I was just finishing off a JScript function to do the same. However, your macro makes the generated source code more readable so I think I'll use it. Where should I store the macro? Just generate another include file?

Say, is Erine still in the COM community? He should know about our developments so he can include it in the next version of MASM32.

Thanks Nan :alright:
Posted on 2002-11-30 18:42:34 by Xtreme
Huh?


I gotta do wha?


Nan, thats a great macro. It's a real pain doing it manually (even if I'm the fastest copy and paster in the western hemispere).

Xtreme, I'm still around occasionally kicking in my 2 cents. However, other real world projects (not the least of which was geting married) have been eating up my time.

Why, I just spent last weekend in the Poconos horseback riding days and drinking nights. And the weekend before I was fleecing the Mohegan Indians out of several hundred dollars at their blackjack tables. Fun and games is over cause next we're doing the christmas decorations (something over the top, but minus a moving light show cause there is no time to build the interface from the computer to the light bulbs, and I'd prefer a moving choo-choo train anyway)
Posted on 2002-12-01 10:19:36 by Ernie
Thanx!

It has another usesful by-product as well. SInce your ASM source (or include) looks more like the C++ version for GUID names, its quick and ez to look up your component in the registry... cause the asm source and the registry keys are in the same format, making a search fast.... ;)

:alright:
NaN
Posted on 2002-12-01 17:46:34 by NaN