advapi32: Replace UuidToStringW call with a sprintfW.
This commit is contained in:
parent
d38cd2a54e
commit
9fca0f27d0
@ -294,20 +294,31 @@ static void CRYPT_CreateMachineGuid(void)
|
|||||||
if (lib)
|
if (lib)
|
||||||
{
|
{
|
||||||
RPC_STATUS (RPC_ENTRY *pUuidCreate)(UUID *);
|
RPC_STATUS (RPC_ENTRY *pUuidCreate)(UUID *);
|
||||||
RPC_STATUS (RPC_ENTRY *pUuidToString)(UUID *, WCHAR **);
|
|
||||||
RPC_STATUS (RPC_ENTRY *pRpcStringFree)(WCHAR **);
|
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
WCHAR *uuidStr;
|
WCHAR buf[37];
|
||||||
|
RPC_STATUS rs;
|
||||||
|
static const WCHAR uuidFmt[] = {
|
||||||
|
'%','0','8','x','-','%','0','4','x','-',
|
||||||
|
'%','0','4','x','-','%','0','2','x',
|
||||||
|
'%','0','2','x','-','%','0','2','x',
|
||||||
|
'%','0','2','x','%','0','2','x',
|
||||||
|
'%','0','2','x','%','0','2','x',
|
||||||
|
'%','0','2','x',0 };
|
||||||
|
|
||||||
pUuidCreate = GetProcAddress(lib, "UuidCreate");
|
pUuidCreate = GetProcAddress(lib, "UuidCreate");
|
||||||
pUuidToString = GetProcAddress(lib, "UuidToStringW");
|
rs = pUuidCreate(&uuid);
|
||||||
pRpcStringFree = GetProcAddress(lib, "RpcStringFreeW");
|
if (rs == S_OK)
|
||||||
pUuidCreate(&uuid);
|
{
|
||||||
pUuidToString(&uuid, &uuidStr);
|
sprintfW(buf, uuidFmt,
|
||||||
|
uuid.Data1, uuid.Data2, uuid.Data3,
|
||||||
|
uuid.Data4[0], uuid.Data4[1],
|
||||||
|
uuid.Data4[2], uuid.Data4[3],
|
||||||
|
uuid.Data4[4], uuid.Data4[5],
|
||||||
|
uuid.Data4[6], uuid.Data4[7] );
|
||||||
RegSetValueExW(key, machineGuidW, 0, REG_SZ,
|
RegSetValueExW(key, machineGuidW, 0, REG_SZ,
|
||||||
(const BYTE *)uuidStr,
|
(const BYTE *)buf,
|
||||||
(lstrlenW(uuidStr)+1)*sizeof(WCHAR));
|
(lstrlenW(buf)+1)*sizeof(WCHAR));
|
||||||
pRpcStringFree(&uuidStr);
|
}
|
||||||
FreeLibrary(lib);
|
FreeLibrary(lib);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user