- Changed some FIXMEs to TRACEs, since they report on a problem in the

way the client uses the dll rather than in the dll itself.
- Cover the case, when the pszProvider parameter points to an empty
  string.
- Fixed some imprecisions in error reporting.
- Removed the "wine_todo's" arround the corresponding unit-tests.
This commit is contained in:
Michael Jung 2004-07-24 02:27:15 +00:00 committed by Alexandre Julliard
parent fd43a4688b
commit 74ed099347
2 changed files with 26 additions and 21 deletions

View File

@ -278,13 +278,13 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
return FALSE;
}
if (!pszProvider)
if (!pszProvider || !*pszProvider)
{
/* No CSP name specified so try the user default CSP first
* then try the machine default CSP
*/
if ( !(keyname = CRYPT_GetTypeKeyName(dwProvType, TRUE)) ) {
FIXME("No provider registered for crypto provider type %ld.\n", dwProvType);
TRACE("No provider registered for crypto provider type %ld.\n", dwProvType);
SetLastError(NTE_PROV_TYPE_NOT_DEF);
return FALSE;
}
@ -292,13 +292,13 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
{
CRYPT_Free(keyname);
if ( !(keyname = CRYPT_GetTypeKeyName(dwProvType, FALSE)) ) {
FIXME("No type registered for crypto provider type %ld.\n", dwProvType);
TRACE("No type registered for crypto provider type %ld.\n", dwProvType);
RegCloseKey(key);
SetLastError(NTE_PROV_TYPE_NOT_DEF);
goto error;
}
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, keyname, &key)) {
FIXME("Did not find registry entry of crypto provider for %s.\n", debugstr_a(keyname));
TRACE("Did not find registry entry of crypto provider for %s.\n", debugstr_a(keyname));
CRYPT_Free(keyname);
RegCloseKey(key);
SetLastError(NTE_PROV_TYPE_NOT_DEF);
@ -341,13 +341,22 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
keyname = CRYPT_GetProvKeyName(provname);
r = RegOpenKeyA(HKEY_LOCAL_MACHINE, keyname, &key);
CRYPT_Free(keyname);
if (r) goto error;
if (r != ERROR_SUCCESS)
{
SetLastError(NTE_KEYSET_NOT_DEF);
goto error;
}
len = sizeof(DWORD);
r = RegQueryValueExA(key, "Type", NULL, NULL, (BYTE*)&type, &len);
if (r != ERROR_SUCCESS || type != dwProvType)
if (r != ERROR_SUCCESS)
{
FIXME("Crypto provider has wrong type (%ld vs expected %ld).\n", type, dwProvType);
SetLastError(NTE_BAD_PROV_TYPE);
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
goto error;
}
if (type != dwProvType)
{
TRACE("Crypto provider has wrong type (%ld vs expected %ld).\n", type, dwProvType);
SetLastError(NTE_PROV_TYPE_NO_MATCH);
goto error;
}

View File

@ -95,13 +95,11 @@ static void test_acquire_context(void)
result = CryptAcquireContext(&hProv, NULL, NULL, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NOT_DEF, "%08x\n", (unsigned int)GetLastError());
todo_wine {
result = CryptAcquireContext(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0);
ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%08x\n", (unsigned int)GetLastError());
result = CryptAcquireContext(&hProv, szKeySet, szNonExistentProv, PROV_RSA_FULL, 0);
ok(!result && GetLastError()==NTE_KEYSET_NOT_DEF, "%08x\n", (unsigned int)GetLastError());
result = CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%08x\n", (unsigned int)GetLastError());
}
result = CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, NON_DEF_PROV_TYPE, 0);
ok(!result && GetLastError()==NTE_PROV_TYPE_NO_MATCH, "%08x\n", (unsigned int)GetLastError());
result = CryptAcquireContext(NULL, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0);
ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%08x\n", (unsigned int)GetLastError());
@ -113,14 +111,12 @@ static void test_acquire_context(void)
if (GetLastError() == ERROR_SUCCESS)
CryptReleaseContext(hProv, 0);
todo_wine {
/* Try again, witch an empty ("\0") szProvider parameter */
result = CryptAcquireContext(&hProv, szKeySet, "", PROV_RSA_FULL, 0);
ok(result, "%08x\n", (unsigned int)GetLastError());
/* Try again, witch an empty ("\0") szProvider parameter */
result = CryptAcquireContext(&hProv, szKeySet, "", PROV_RSA_FULL, 0);
ok(result, "%08x\n", (unsigned int)GetLastError());
if (GetLastError() == ERROR_SUCCESS)
CryptReleaseContext(hProv, 0);
}
if (GetLastError() == ERROR_SUCCESS)
CryptReleaseContext(hProv, 0);
}
START_TEST(crypt)