-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCreateUUID.ahk
39 lines (32 loc) · 1.46 KB
/
CreateUUID.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; =============================================================================================================================================================
; Author ........: jNizM
; Released ......: 2021-10-13
; Modified ......: 2023-01-12
; Tested with....: AutoHotkey v2.0.2 (x64)
; Tested on .....: Windows 11 - 22H2 (x64)
; Function ......: CreateUUID()
;
; Parameter(s)...: No parameters used
;
; Return ........: Creates an Universally Unique IDentifier (UUID).
; A UUID provides a unique designation of an object such as an interface, a manager entry-point vector, or a client object.
; =============================================================================================================================================================
#Requires AutoHotkey v2.0
CreateUUID()
{
static RPC_S_OK := 0, UUID := ""
pUUID := Buffer(16)
if (DllCall("rpcrt4\UuidCreate", "Ptr", pUUID) = RPC_S_OK)
{
if (DllCall("rpcrt4\UuidToStringW", "Ptr", pUUID, "Ptr*", &StringUuid := 0) = RPC_S_OK)
{
UUID := StrGet(StringUuid)
DllCall("rpcrt4\RpcStringFreeW", "Ptr*", StringUuid)
}
}
return UUID
}
; =============================================================================================================================================================
; Example
; =============================================================================================================================================================
MsgBox CreateUUID()