From 74396805424491cd15c5826a230382b2138551ae Mon Sep 17 00:00:00 2001 From: Michael Jung Date: Thu, 22 Jul 2004 19:43:03 +0000 Subject: [PATCH] - 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. --- dlls/advapi32/crypt.c | 11 ++++++----- dlls/advapi32/tests/crypt.c | 6 ++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c index 571efcafa14..2e4936d15e1 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -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; } diff --git a/dlls/advapi32/tests/crypt.c b/dlls/advapi32/tests/crypt.c index 99c727df5df..a3ac44a6152 100644 --- a/dlls/advapi32/tests/crypt.c +++ b/dlls/advapi32/tests/crypt.c @@ -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()); -- 2.11.4.GIT