Commit 74396805 authored by Michael Jung's avatar Michael Jung Committed by Alexandre Julliard

- Fixed a problem with dwProvType values greater than 99 in

CRYPT_GetTypeKeyName. - Fixed error reporting in the case of dwProvType == 0. - Removed "todo_wine" from the corresponding unit test.
parent 60b22a4a
......@@ -79,7 +79,7 @@ static inline PSTR CRYPT_GetTypeKeyName(DWORD dwType, BOOL user)
user ? strcpy(keyname, USERSTR) : strcpy(keyname, MACHINESTR);
ptr = keyname + strlen(keyname);
*(--ptr) = (dwType % 10) + '0';
*(--ptr) = (dwType / 10) + '0';
*(--ptr) = ((dwType / 10) % 10) + '0';
*(--ptr) = (dwType / 100) + '0';
} else
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
......@@ -266,14 +266,15 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
TRACE("(%p, %s, %s, %ld, %08lx)\n", phProv, pszContainer,
pszProvider, dwProvType, dwFlags);
if (!phProv || !dwProvType)
if (dwProvType < 1 || dwProvType > MAXPROVTYPES)
{
SetLastError(ERROR_INVALID_PARAMETER);
SetLastError(NTE_BAD_PROV_TYPE);
return FALSE;
}
if (dwProvType > MAXPROVTYPES)
if (!phProv)
{
SetLastError(NTE_BAD_PROV_TYPE);
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
......
......@@ -86,10 +86,8 @@ static void test_acquire_context(void)
* The order of the error tests seems to match Windows XP's rsaenh.dll CSP,
* but since this is likely to change between CSP versions, we don't check
* this. Please don't change the order of tests. */
todo_wine {
result = CryptAcquireContext(&hProv, NULL, NULL, 0, 0);
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%08x\n", (unsigned int)GetLastError());
}
result = CryptAcquireContext(&hProv, NULL, NULL, 0, 0);
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%08x\n", (unsigned int)GetLastError());
result = CryptAcquireContext(&hProv, NULL, NULL, 1000, 0);
ok(!result && GetLastError()==NTE_BAD_PROV_TYPE, "%08x\n", (unsigned int)GetLastError());
......
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