Commit 56a1326a authored by Mounir IDRASSI's avatar Mounir IDRASSI Committed by Alexandre Julliard

rsaenh: Use the correct registry key in RSAENH_CPAcquireContext.

parent 526d2b4c
......@@ -1476,7 +1476,12 @@ BOOL WINAPI RSAENH_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer,
SetLastError(NTE_BAD_KEYSET_PARAM);
return FALSE;
} else {
if (!RegDeleteKeyA(HKEY_CURRENT_USER, szRegKey)) {
HKEY hRootKey;
if (dwFlags & CRYPT_MACHINE_KEYSET)
hRootKey = HKEY_LOCAL_MACHINE;
else
hRootKey = HKEY_CURRENT_USER;
if (!RegDeleteKeyA(hRootKey, szRegKey)) {
SetLastError(ERROR_SUCCESS);
return TRUE;
} else {
......
......@@ -1623,6 +1623,26 @@ static void test_null_provider(void)
CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
CRYPT_DELETEKEYSET);
/* test the machine key set */
CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
CRYPT_DELETEKEYSET|CRYPT_MACHINE_KEYSET);
result = CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
CRYPT_NEWKEYSET|CRYPT_MACHINE_KEYSET);
ok(result, "CryptAcquireContext with CRYPT_MACHINE_KEYSET failed: %08x\n", GetLastError());
CryptReleaseContext(prov, 0);
result = CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
CRYPT_MACHINE_KEYSET);
ok(result, "CryptAcquireContext with CRYPT_MACHINE_KEYSET failed: %08x\n", GetLastError());
CryptReleaseContext(prov,0);
result = CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
CRYPT_DELETEKEYSET|CRYPT_MACHINE_KEYSET);
ok(result, "CryptAcquireContext with CRYPT_DELETEKEYSET|CRYPT_MACHINE_KEYSET failed: %08x\n",
GetLastError());
result = CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
CRYPT_MACHINE_KEYSET);
ok(!result && GetLastError() == NTE_BAD_KEYSET ,
"Expected NTE_BAD_KEYSET, got %08x\n", GetLastError());
}
START_TEST(rsaenh)
......
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