Archive: create GUID


create GUID
  I have this instruction in NSIS script to create a GUID
System::Call 'ole32::CoCreateGuid(g .s)'

and then:
!if ${_RetVar} != s
Pop ${_RetVar}


In some weird cases the returned GUID is the string 'ole32::CoCreateGuid(g .s)'.
Does anyone knows something about it?


does this help?
http://nsis.sourceforge.net/Create_a...que_Identifier


Not really
  Thank you for replying. This is the code we used in the first place. Maybe it has a bug?


first example runs fine on win7


test

SetCompressor/SOLID bzip2
AutoCloseWindow true
ShowInstDetails nevershow
ShowUninstDetails nevershow
OutFile "test.exe"
>;--------------------------------
;Languages
LoadLanguageFile "${NSISDIR}\Contrib\Language files\english.nlf"
>;--------------------------------
;Installer Sections
Section
SectionEnd
>;--------------------------------
;Installer Functions

>Function .onInit
loop:
Call CreateGUID
Pop$0 ;contains GUID
messagebox mb_okcancel
|mb_defbutton1 "GUID: $0" idok loop
done:

Quit
FunctionEnd

>;Call CreateGUID
>;Pop $0 ;contains GUID
>Function CreateGUID
System::Call 'ole32::CoCreateGuid(g .s)'
>FunctionEnd
>

If you get the original string sent to System::Call, it means System::Call didn't do anything and just returned. That's why you just have the original string on the stack. That's... weird... Any more details on when this happens?

Total shot in the dark guess, but did you build your own version of System.dll by any chance?


I've had the EXACT same problem. Everything is original. It has only ever happend on customer systems though, and they report the error back to us. We have never been able to reproduce it ourselves. I'd say it maybe happens 1 in every 10,000 installs, maybe less frequently than that even.


You could put the call into a For loop for a few iterations until it either returns a GUID or throws an error message.

Stu


You could build System.dll with

SYSTEM_LOG_DEBUG
turn it on with
System:: Debug $OUTDIR\somelogfile.log
and request that log file when it happens.

The only possibility I see in the code is lack of memory. But the user would have seen that elsewhere...