wintrust: Create a dummy context to force creation of MachineGuid registry key.

This commit is contained in:
Sebastian Lackner 2015-07-31 08:07:33 +02:00 committed by Alexandre Julliard
parent f652283368
commit e5e05b971b
1 changed files with 7 additions and 0 deletions

View File

@ -960,6 +960,8 @@ HRESULT WINAPI DllRegisterServer(void)
HRESULT CryptRegisterRes = S_OK;
HRESULT TrustProviderRes = S_OK;
HRESULT SIPAddProviderRes = S_OK;
HCRYPTPROV crypt_provider;
BOOL ret;
TRACE("\n");
@ -1077,6 +1079,11 @@ add_trust_providers:
* a trust provider without a diagnostic policy).
*/
/* Create a dummy context to force creation of the MachineGuid registry key. */
ret = CryptAcquireContextW(&crypt_provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
if (ret) CryptReleaseContext(crypt_provider, 0);
else ERR("Failed to acquire cryptographic context: %u\n", GetLastError());
/* If CryptRegisterRes is not S_OK it will always overrule the return value. */
if (CryptRegisterRes != S_OK)
return CryptRegisterRes;