- 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.
This commit is contained in:
Michael Jung 2004-07-22 19:43:03 +00:00 committed by Alexandre Julliard
parent 60b22a4add
commit 7439680542
2 changed files with 10 additions and 11 deletions

View File

@ -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,16 +266,17 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
TRACE("(%p, %s, %s, %ld, %08lx)\n", phProv, pszContainer,
pszProvider, dwProvType, dwFlags);
if (!phProv || !dwProvType)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (dwProvType > MAXPROVTYPES)
if (dwProvType < 1 || dwProvType > MAXPROVTYPES)
{
SetLastError(NTE_BAD_PROV_TYPE);
return FALSE;
}
if (!phProv)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!pszProvider)
{

View File

@ -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());