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

Sebastian Lackner sebastian at fds-team.de
Fri Jul 31 01:07:33 CDT 2015


---
 dlls/wintrust/register.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/wintrust/register.c b/dlls/wintrust/register.c
index 9981fbc..48e6b21 100644
--- a/dlls/wintrust/register.c
+++ b/dlls/wintrust/register.c
@@ -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;
-- 
2.5.0



More information about the wine-patches mailing list