I get error trying to use CoCreateGuid. I define:

.data 	
PG TYPEDEF PTR GUID
.data ?
lpGUID PG ?
The following line in the code

invoke CoCreateGuid, lpGUID
is checked against eax == S_OK which is never valid. ??? vesa
Posted on 2001-05-02 09:55:00 by vesa
my following c code works:


GUID myguid;
CoCreateGuid(&mguid);

so try

.data ?
lpGUID GUID <>

invoke CoCreateGuid, &lpGUID
Posted on 2001-05-02 15:24:00 by vineon
The GUID is defined in windows.inc, so you need not worry there. First, you need create one as a place holder for the result, either as .data or a LOCAL:

.data
MyGuid1 GUID  <>  ; not initialized

MyProc PROC params:DWORD
  LOCAL  MyOtherGuid:GUID

  invoke CoCreateGuid, ADDR MyGuid1
  invoke CoCreateGuid, ADDR MyOtherGuid

  ret
ENDP
OK, it's not a very useful example, as I don't use the GUIDS I cause to be created, but you should get the idea now how to use this API.
Posted on 2001-05-02 19:10:00 by Ernie
I have GUID creation program. It's for NASM. Probably this may help you.

	Bits	32

	Segment data Use32

;-------------------------------------------------------------------------
;
; Data section
;
;-------------------------------------------------------------------------

szFmt		DB	"%s", 9, "DD", 9, "%09Xh", 13, 10
		DB	9, 9, "DW", 9, "%05Xh", 13, 10
		DB	9, 9, "DW", 9, "%05Xh", 13, 10
		DB	9, 9, "DB", 9, "%03Xh, %03Xh, %03Xh, %03Xh", 13, 10
		DB	9, 9, "DB", 9, "%03Xh, %03Xh, %03Xh, %03Xh", 0
iGuid		TIMES 16 DB	0
szName		DB	"CLSID_Hello", 0

	Segment code Use32

;-------------------------------------------------------------------------
;
; Code section
;
;-------------------------------------------------------------------------

	Extern	CoCreateGuid
	Extern	printf
	
..start:

	; Create UID

	Push	DWord iGuid			; Pointer to GUID
	Call	CoCreateGuid			; Win32 api

	; Print
	
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	al, 
	Push	eax
	Xor	eax, eax
	Mov	ax, 
	Push	eax
	Xor	eax, eax
	Mov	ax, 
	Push	eax
	Push	DWord 
	Push	DWord szName
	Push	DWord szFmt
	Call	printf
	Add	esp, 52

	Ret
The output would be as

CLSID_Hello     DD      0E862739Fh
                DW      01F92h
                DW      040CAh
                DB      088h, 0E4h, 02Ch, 00Ch
                DB      080h, 0FAh, 090h, 0EAh
Jones.
Posted on 2001-05-02 23:06:00 by sjhenry
vineon, ernie, sjhenry Thanks for your replies! I misunderstood the explanations in in the Platform SDK. Now it works. vesa
Posted on 2001-05-03 02:20:00 by vesa