crypt32: Fix a few tests that fail in win2k.
This commit is contained in:
parent
9dc979604c
commit
9d2cc2171f
|
@ -99,10 +99,12 @@ static void testOIDToAlgID(void)
|
||||||
/* Test with a bogus one */
|
/* Test with a bogus one */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
alg = CertOIDToAlgId("1.2.3");
|
alg = CertOIDToAlgId("1.2.3");
|
||||||
ok(!alg && (GetLastError() == 0xdeadbeef ||
|
ok(!alg, "Expected failure, got %d\n", alg);
|
||||||
GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND),
|
ok(GetLastError() == 0xdeadbeef ||
|
||||||
"Expected ERROR_RESOURCE_NAME_NOT_FOUND or no error set, got %08x\n",
|
GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND ||
|
||||||
GetLastError());
|
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++)
|
for (i = 0; i < sizeof(oidToAlgID) / sizeof(oidToAlgID[0]); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,9 @@ static void test_cryptprotectdata(void)
|
||||||
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
|
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,&cipher);
|
||||||
ok(protected, "Encrypting without entropy.\n");
|
ok(protected, "Encrypting without entropy.\n");
|
||||||
r = GetLastError();
|
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.pbData=NULL;
|
||||||
cipher_entropy.cbData=0;
|
cipher_entropy.cbData=0;
|
||||||
|
@ -81,7 +83,9 @@ static void test_cryptprotectdata(void)
|
||||||
protected = pCryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
|
protected = pCryptProtectData(&plain,desc,&entropy,NULL,NULL,0,&cipher_entropy);
|
||||||
ok(protected, "Encrypting with entropy.\n");
|
ok(protected, "Encrypting with entropy.\n");
|
||||||
r = GetLastError();
|
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.pbData=NULL;
|
||||||
cipher_no_desc.cbData=0;
|
cipher_no_desc.cbData=0;
|
||||||
|
@ -91,9 +95,17 @@ static void test_cryptprotectdata(void)
|
||||||
plain.cbData=strlen(secret2)+1;
|
plain.cbData=strlen(secret2)+1;
|
||||||
SetLastError(0xDEADBEEF);
|
SetLastError(0xDEADBEEF);
|
||||||
protected = pCryptProtectData(&plain,NULL,&entropy,NULL,NULL,0,&cipher_no_desc);
|
protected = pCryptProtectData(&plain,NULL,&entropy,NULL,NULL,0,&cipher_no_desc);
|
||||||
ok(protected, "Encrypting with entropy and no description.\n");
|
|
||||||
r = GetLastError();
|
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)
|
static void test_cryptunprotectdata(void)
|
||||||
|
@ -107,8 +119,12 @@ static void test_cryptunprotectdata(void)
|
||||||
entropy.pbData=(void*)key;
|
entropy.pbData=(void*)key;
|
||||||
entropy.cbData=strlen(key)+1;
|
entropy.cbData=strlen(key)+1;
|
||||||
|
|
||||||
ok(protected, "CryptProtectData failed to run, so I can't test its output\n");
|
/* fails in win2k */
|
||||||
if (!protected) return;
|
if (!protected)
|
||||||
|
{
|
||||||
|
skip("CryptProtectData failed to run\\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plain.pbData=NULL;
|
plain.pbData=NULL;
|
||||||
plain.cbData=0;
|
plain.cbData=0;
|
||||||
|
|
Loading…
Reference in New Issue