Skip to content

Commit

Permalink
Change to Lexikos' ANSI-compatible CreateGUID
Browse files Browse the repository at this point in the history
  • Loading branch information
evilC committed Feb 25, 2018
1 parent 4f0f08e commit e75c4ca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Functions/CreateGUID.ahk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; By jNizM - https://autohotkey.com/boards/viewtopic.php?f=6&t=4732&p=87497#p87497
/*
CreateGUID(){
VarSetCapacity(foo_guid, 16, 0)
if !(DllCall("ole32.dll\CoCreateGuid", "Ptr", &foo_guid))
Expand All @@ -9,3 +10,16 @@ CreateGUID(){
}
return SubStr(fin_guid, 2, 36)
}
*/

; Lexikos' ANSI-compatible version
CreateGUID()
{
VarSetCapacity(pguid, 16)
if !(DllCall("ole32.dll\CoCreateGuid", "ptr", &pguid)) {
VarSetCapacity(sguid, 38 * 2 + 1)
if (DllCall("ole32.dll\StringFromGUID2", "ptr", &pguid, "ptr", &sguid, "int", 38 + 1))
return StrGet(&sguid, "UTF-16")
}
return ""
}

0 comments on commit e75c4ca

Please sign in to comment.