Juan Lang : crypt32: Fix a test failure on Vista, and make Wine match the newer (and saner) behavior.

Alexandre Julliard julliard at winehq.org
Sat Feb 16 09:57:21 CST 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Feb 14 10:33:09 2008 -0800

crypt32: Fix a test failure on Vista, and make Wine match the newer (and saner) behavior.

---

 dlls/crypt32/store.c      |    7 +------
 dlls/crypt32/tests/cert.c |   12 ++++++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 37247a5..20d71b7 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -782,12 +782,6 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
     TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCertContext,
      dwAddDisposition, ppStoreContext);
 
-    /* Weird case to pass a test */
-    if (dwAddDisposition == 0)
-    {
-        SetLastError(STATUS_ACCESS_VIOLATION);
-        return FALSE;
-    }
     if (dwAddDisposition != CERT_STORE_ADD_ALWAYS)
     {
         BYTE hashToAdd[20];
@@ -855,6 +849,7 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
         break;
     default:
         FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
+        SetLastError(E_INVALIDARG);
         ret = FALSE;
     }
 
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index a31632b..5aa20ae 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -160,12 +160,16 @@ static void testAddCert(void)
      */
     ret = CertAddEncodedCertificateToStore(0, X509_ASN_ENCODING, bigCert,
      sizeof(bigCert), 0, NULL);
-    ok(!ret && GetLastError() == STATUS_ACCESS_VIOLATION,
-     "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
+    ok(!ret && (GetLastError() == STATUS_ACCESS_VIOLATION ||
+     GetLastError() == E_INVALIDARG),
+     "Expected STATUS_ACCESS_VIOLATION or E_INVALIDARG, got %08x\n",
+     GetLastError());
     ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
      bigCert, sizeof(bigCert), 0, NULL);
-    ok(!ret && GetLastError() == STATUS_ACCESS_VIOLATION,
-     "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
+    ok(!ret && (GetLastError() == STATUS_ACCESS_VIOLATION ||
+     GetLastError() == E_INVALIDARG),
+     "Expected STATUS_ACCESS_VIOLATION or E_INVALIDARG, got %08x\n",
+     GetLastError());
 
     /* Weird--can add a cert to the NULL store (does this have special
      * meaning?)




More information about the wine-cvs mailing list