システム dll 以外の外部依存関係を必要としない、wiki 上のNSIS を使用して GUID を生成する例(実際には 3 つの連続する方法) があります。
つまり、あなたが言及したコードのようなシステム管理を使用せず、CoCreateGuid()
ole32 から直接関数を呼び出します。
システム アクセサー: スタックを、指定した変数に自動的にポップするか、スタックに保持することができます。
Function CreateGUID
System::Call 'ole32::CoCreateGuid(g .s)'
FunctionEnd
ヘルパー マクロ:
!define CreateGUID `!insertmacro _CreateGUID`
!macro _CreateGUID _RetVar
Call CreateGUID
!if ${_RetVar} != s
Pop ${_RetVar}
!endif
!macroend
例:
;${CreateGUID} $0 ; $0 contains GUID (poped from the stack by the macro)
;${CreateGUID} s ; the value is kept on the stack, we pop it ourselves
;Pop $0 ;contains GUID