advapi32: Make rpcrt4 a delayed import to work around circular dependencies with native.
This commit is contained in:
parent
5b3750e2a4
commit
58a698882d
|
@ -5,7 +5,8 @@ SRCDIR = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
MODULE = advapi32.dll
|
MODULE = advapi32.dll
|
||||||
IMPORTLIB = advapi32
|
IMPORTLIB = advapi32
|
||||||
IMPORTS = rpcrt4 kernel32 ntdll
|
IMPORTS = kernel32 ntdll
|
||||||
|
DELAYIMPORTS = rpcrt4
|
||||||
EXTRALIBS = @SECURITYLIB@
|
EXTRALIBS = @SECURITYLIB@
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
|
|
|
@ -284,40 +284,30 @@ static void CRYPT_CreateMachineGuid(void)
|
||||||
r = RegQueryValueExW(key, machineGuidW, NULL, NULL, NULL, &size);
|
r = RegQueryValueExW(key, machineGuidW, NULL, NULL, NULL, &size);
|
||||||
if (r == ERROR_FILE_NOT_FOUND)
|
if (r == ERROR_FILE_NOT_FOUND)
|
||||||
{
|
{
|
||||||
static const WCHAR rpcrt4[] = {
|
UUID uuid;
|
||||||
'r','p','c','r','t','4',0 };
|
WCHAR buf[37];
|
||||||
HMODULE lib = LoadLibraryW(rpcrt4);
|
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 };
|
||||||
|
|
||||||
if (lib)
|
rs = UuidCreate(&uuid);
|
||||||
{
|
if (rs == S_OK)
|
||||||
RPC_STATUS (RPC_ENTRY *pUuidCreate)(UUID *);
|
{
|
||||||
UUID uuid;
|
sprintfW(buf, uuidFmt,
|
||||||
WCHAR buf[37];
|
uuid.Data1, uuid.Data2, uuid.Data3,
|
||||||
RPC_STATUS rs;
|
uuid.Data4[0], uuid.Data4[1],
|
||||||
static const WCHAR uuidFmt[] = {
|
uuid.Data4[2], uuid.Data4[3],
|
||||||
'%','0','8','x','-','%','0','4','x','-',
|
uuid.Data4[4], uuid.Data4[5],
|
||||||
'%','0','4','x','-','%','0','2','x',
|
uuid.Data4[6], uuid.Data4[7] );
|
||||||
'%','0','2','x','-','%','0','2','x',
|
RegSetValueExW(key, machineGuidW, 0, REG_SZ,
|
||||||
'%','0','2','x','%','0','2','x',
|
(const BYTE *)buf,
|
||||||
'%','0','2','x','%','0','2','x',
|
(lstrlenW(buf)+1)*sizeof(WCHAR));
|
||||||
'%','0','2','x',0 };
|
}
|
||||||
|
|
||||||
pUuidCreate = (void *)GetProcAddress(lib, "UuidCreate");
|
|
||||||
rs = pUuidCreate(&uuid);
|
|
||||||
if (rs == S_OK)
|
|
||||||
{
|
|
||||||
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,
|
|
||||||
(const BYTE *)buf,
|
|
||||||
(lstrlenW(buf)+1)*sizeof(WCHAR));
|
|
||||||
}
|
|
||||||
FreeLibrary(lib);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue