crypt32: Fix a few tests that fail in win2k.

This commit is contained in:
James Hawkins 2008-04-10 18:06:29 -05:00 committed by Alexandre Julliard
parent 9dc979604c
commit 9d2cc2171f
2 changed files with 28 additions and 10 deletions

View File

@ -99,10 +99,12 @@ static void testOIDToAlgID(void)
/* Test with a bogus one */
SetLastError(0xdeadbeef);
alg = CertOIDToAlgId("1.2.3");
ok(!alg && (GetLastError() == 0xdeadbeef ||
GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND),
"Expected ERROR_RESOURCE_NAME_NOT_FOUND or no error set, got %08x\n",
GetLastError());
ok(!alg, "Expected failure, got %d\n", alg);
ok(GetLastError() == 0xdeadbeef ||
GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND ||
GetLastError() == ERROR_SUCCESS, /* win2k */
"Expected ERROR_RESOURCE_NAME_NOT_FOUND, ERROR_SUCCESS "
"or no error set, got %08x\n", GetLastError());
for (i = 0; i < sizeof(oidToAlgID) / sizeof(oidToAlgID[0]); i++)
{

View File

@ -71,7 +71,9 @@ static void test_cryptprotectdata(void)
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
ok(protected, "Encrypting without entropy.\n");
r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_SUCCESS ||
r == ERROR_IO_PENDING, /* win2k */
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
cipher_entropy.pbData=NULL;
cipher_entropy.cbData=0;
@ -81,7 +83,9 @@ static void test_cryptprotectdata(void)
protected = pCryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
ok(protected, "Encrypting with entropy.\n");
r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_SUCCESS ||
r == ERROR_IO_PENDING, /* win2k */
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
cipher_no_desc.pbData=NULL;
cipher_no_desc.cbData=0;
@ -91,9 +95,17 @@ static void test_cryptprotectdata(void)
plain.cbData=strlen(secret2)+1;
SetLastError(0xDEADBEEF);
protected = pCryptProtectData(&plain,NULL,&entropy,NULL,NULL,0,&cipher_no_desc);
ok(protected, "Encrypting with entropy and no description.\n");
r = GetLastError();
ok(r == ERROR_SUCCESS, "Wrong (%u) GetLastError seen\n",r);
if (protected)
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
}
else
{
/* fails in win2k */
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
}
static void test_cryptunprotectdata(void)
@ -107,8 +119,12 @@ static void test_cryptunprotectdata(void)
entropy.pbData=(void*)key;
entropy.cbData=strlen(key)+1;
ok(protected, "CryptProtectData failed to run, so I can't test its output\n");
if (!protected) return;
/* fails in win2k */
if (!protected)
{
skip("CryptProtectData failed to run\\n");
return;
}
plain.pbData=NULL;
plain.cbData=0;