Use alternative approach to create MachineGuid registry key during wineprefix startup.

This commit is contained in:
Sebastian Lackner
2015-07-31 05:59:32 +02:00
parent 14975afd63
commit 113a63d374
6 changed files with 78 additions and 100 deletions

View File

@@ -0,0 +1,39 @@
From 8c028847d81f5dbd4ffc7f56e21b9a4141eef89e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 31 Jul 2015 05:43:45 +0200
Subject: wintrust: Create a dummy context to force creation of MachineGuid
registry key.
---
dlls/wintrust/register.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dlls/wintrust/register.c b/dlls/wintrust/register.c
index 9981fbc..0dbb99c 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,12 @@ add_trust_providers:
* a trust provider without a diagnostic policy).
*/
+ /* Acquire a dummy context to ensure that the MachineGuid registry key
+ * is created immediately after the creation of a new Wineprefix. */
+ 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

View File

@@ -0,0 +1 @@
Fixes: [38508] Create HKLM\Software\Microsoft\Cryptography\MachineGuid registry key