rsaenh: Use the correct registry key in RSAENH_CPAcquireContext.
This commit is contained in:
parent
526d2b4c33
commit
56a1326a8b
@ -1476,7 +1476,12 @@ BOOL WINAPI RSAENH_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer,
|
|||||||
SetLastError(NTE_BAD_KEYSET_PARAM);
|
SetLastError(NTE_BAD_KEYSET_PARAM);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} 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);
|
SetLastError(ERROR_SUCCESS);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1623,6 +1623,26 @@ static void test_null_provider(void)
|
|||||||
CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
|
CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL,
|
||||||
CRYPT_DELETEKEYSET);
|
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)
|
START_TEST(rsaenh)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user