Juan Lang : crypt32: Don' t claim to have queried an object as a serialized context when reading it has failed .

Alexandre Julliard julliard at winehq.org
Fri Dec 12 07:04:10 CST 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Dec 11 15:23:31 2008 -0800

crypt32: Don't claim to have queried an object as a serialized context when reading it has failed.

---

 dlls/crypt32/object.c       |    3 +++
 dlls/crypt32/tests/object.c |    6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/object.c b/dlls/crypt32/object.c
index f6e0c84..0674c79 100644
--- a/dlls/crypt32/object.c
+++ b/dlls/crypt32/object.c
@@ -163,6 +163,7 @@ static BOOL CRYPT_QuerySerializedContextObject(DWORD dwObjectType,
     if (!ret)
         return FALSE;
 
+    ret = FALSE;
     context = CRYPT_ReadSerializedElement(blob->pbData, blob->cbData,
      CERT_STORE_ALL_CONTEXT_FLAG, &contextType);
     if (context)
@@ -563,6 +564,8 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
          dwExpectedContentTypeFlags, pdwMsgAndCertEncodingType, pdwContentType,
          phCertStore, phMsg);
     }
+    if (!ret)
+        SetLastError(CRYPT_E_NO_MATCH);
     TRACE("returning %d\n", ret);
     return ret;
 }
diff --git a/dlls/crypt32/tests/object.c b/dlls/crypt32/tests/object.c
index 23f3597..6e440c6 100644
--- a/dlls/crypt32/tests/object.c
+++ b/dlls/crypt32/tests/object.c
@@ -152,13 +152,13 @@ static void test_query_object(void)
     ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
      CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
      NULL, NULL, NULL, NULL);
+    todo_wine
     ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
     /* The same base64-encoded cert, restricting the format types */
     SetLastError(0xdeadbeef);
     ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
      CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
      NULL, NULL, NULL, NULL);
-    todo_wine
     ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
      "expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
     SetLastError(0xdeadbeef);
@@ -174,7 +174,6 @@ static void test_query_object(void)
     ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
      CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
      NULL, NULL, NULL, NULL);
-    todo_wine
     ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
      "expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
     /* For brevity, not tested here, but tested on Windows:  same failure
@@ -195,6 +194,7 @@ static void test_query_object(void)
     ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
      CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
      NULL, NULL, NULL, NULL);
+    todo_wine
     ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
     /* A valid signed message, encoded as a wide character base64 string, can
      * be queried successfully.
@@ -205,12 +205,12 @@ static void test_query_object(void)
     ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
      CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
      NULL, NULL, NULL, NULL);
+    todo_wine
     ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
      CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
      NULL, NULL, NULL, NULL);
-    todo_wine
     ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
      "expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
     SetLastError(0xdeadbeef);




More information about the wine-cvs mailing list