[PATCH] wintrust/tests: Accept the CryptCATAdminAcquireContext win8 results

Detlef Riekenberg wine.dev at web.de
Sun Nov 17 08:18:26 CST 2013


This fixes the common win8 test failures.

--
By by ... Detlef
---
 dlls/wintrust/crypt.c       |    2 +-
 dlls/wintrust/tests/crypt.c |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c
index 0ed45d3..84188f8 100644
--- a/dlls/wintrust/crypt.c
+++ b/dlls/wintrust/crypt.c
@@ -113,7 +113,7 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin,
 
     TRACE("%p %s %x\n", catAdmin, debugstr_guid(sys), dwFlags);
 
-    if (!catAdmin)
+    if (!catAdmin || dwFlags)
     {
         SetLastError(ERROR_INVALID_PARAMETER);
         return FALSE;
diff --git a/dlls/wintrust/tests/crypt.c b/dlls/wintrust/tests/crypt.c
index cb5818e..7f2fe76 100644
--- a/dlls/wintrust/tests/crypt.c
+++ b/dlls/wintrust/tests/crypt.c
@@ -284,13 +284,21 @@ static void test_context(void)
     ret = pCryptCATAdminReleaseContext(hca, 0);
     ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
 
-    /* Flags not equal to 0 */
+    hca = (void *) 0xdeadbeef;
+    SetLastError(0xdeadbeef);
+    /* Flags is documented as unused, but the parameter is checked since win8 */
     ret = pCryptCATAdminAcquireContext(&hca, &unknown, 1);
-    ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
-    ok(hca != NULL, "Expected a context handle, got NULL\n");
+    ok((!ret && (GetLastError() == ERROR_INVALID_PARAMETER) && (hca == (void *) 0xdeadbeef)) ||
+        broken(ret && hca != NULL && hca != (void *) 0xdeadbeef),
+        "Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %u with %p\n",
+        ret, GetLastError(), hca);
 
-    ret = pCryptCATAdminReleaseContext(hca, 0);
-    ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
+    if (ret && hca)
+    {
+        SetLastError(0xdeadbeef);
+        ret = pCryptCATAdminReleaseContext(hca, 0);
+        ok(ret, "Expected success, got FALSE with %d\n", GetLastError());
+    }
 }
 
 /* TODO: Check whether SHA-1 is the algorithm that's always used */
-- 
1.7.5.4




More information about the wine-patches mailing list