James Hawkins : crypt32: Fix a few tests that fail in win2k.

Alexandre Julliard julliard at winehq.org
Fri Apr 11 06:28:18 CDT 2008


Module: wine
Branch: master
Commit: 9d2cc2171f0e99a7801582072cf27ba2ec9145c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9d2cc2171f0e99a7801582072cf27ba2ec9145c1

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Thu Apr 10 18:06:29 2008 -0500

crypt32: Fix a few tests that fail in win2k.

---

 dlls/crypt32/tests/oid.c         |   10 ++++++----
 dlls/crypt32/tests/protectdata.c |   28 ++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/dlls/crypt32/tests/oid.c b/dlls/crypt32/tests/oid.c
index 2477bf5..e2e8bc4 100644
--- a/dlls/crypt32/tests/oid.c
+++ b/dlls/crypt32/tests/oid.c
@@ -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++)
     {
diff --git a/dlls/crypt32/tests/protectdata.c b/dlls/crypt32/tests/protectdata.c
index 0dfad9a..d0c662e 100644
--- a/dlls/crypt32/tests/protectdata.c
+++ b/dlls/crypt32/tests/protectdata.c
@@ -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;




More information about the wine-cvs mailing list