Commit 5c8aa891 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Fix race condition in loading default provider.

parent 027236b0
...@@ -59,8 +59,16 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) ...@@ -59,8 +59,16 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
HCRYPTPROV CRYPT_GetDefaultProvider(void) HCRYPTPROV CRYPT_GetDefaultProvider(void)
{ {
if (!hDefProv) if (!hDefProv)
CryptAcquireContextW(&hDefProv, NULL, MS_ENHANCED_PROV_W, {
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); HCRYPTPROV prov;
CryptAcquireContextW(&prov, NULL, MS_ENHANCED_PROV_W, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
InterlockedCompareExchangePointer((PVOID *)&hDefProv, (PVOID)prov,
NULL);
if (hDefProv != prov)
CryptReleaseContext(prov, 0);
}
return hDefProv; return hDefProv;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment