Paul Vriens : wintrust/tests: Add a basic CryptCATOpen test.

Alexandre Julliard julliard at winehq.org
Tue May 19 09:23:07 CDT 2009


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

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Tue May 19 11:54:10 2009 +0200

wintrust/tests: Add a basic CryptCATOpen test.

---

 dlls/wintrust/tests/crypt.c |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/dlls/wintrust/tests/crypt.c b/dlls/wintrust/tests/crypt.c
index acadead..3e77814 100644
--- a/dlls/wintrust/tests/crypt.c
+++ b/dlls/wintrust/tests/crypt.c
@@ -373,6 +373,37 @@ static void test_calchash(void)
     DeleteFileA(temp);
 }
 
+static void test_CryptCATOpen(void)
+{
+    HANDLE hcat;
+    char empty[MAX_PATH];
+    WCHAR emptyW[MAX_PATH];
+    HANDLE file;
+    BOOL ret;
+
+    SetLastError(0xdeadbeef);
+    hcat = pCryptCATOpen(NULL, 0, 0, 0, 0);
+    ok(hcat == INVALID_HANDLE_VALUE, "CryptCATOpen succeeded\n");
+    ok(GetLastError() == ERROR_INVALID_PARAMETER,
+       "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
+
+    if (!GetTempFileNameA(CURR_DIR, "cat", 0, empty)) return;
+
+    file = CreateFileA(empty, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError());
+    CloseHandle(file);
+    MultiByteToWideChar(CP_ACP, 0, empty, -1, emptyW, MAX_PATH);
+
+    hcat = pCryptCATOpen(emptyW, 0, 0, 0, 0);
+    todo_wine
+    ok(hcat != INVALID_HANDLE_VALUE, "Expected a correct handle\n");
+
+    ret = pCryptCATClose(hcat);
+    todo_wine
+    ok(ret, "CryptCATClose failed\n");
+    DeleteFileA(empty);
+}
+
 static DWORD error_area;
 static DWORD local_error;
 
@@ -615,9 +646,6 @@ static void test_catalog_properties(CHAR *catfile, int attributes, int members)
         catalog[0] = 0;
     }
 
-    hcat = pCryptCATOpen(NULL, 0, 0, 0, 0);
-    ok(hcat == INVALID_HANDLE_VALUE, "CryptCATOpen succeeded\n");
-
     hcat = pCryptCATOpen(catalogW, 0, 0, 0, 0);
     if (hcat == INVALID_HANDLE_VALUE && members == 0)
     {
@@ -1106,6 +1134,7 @@ START_TEST(crypt)
    
     test_context();
     test_calchash();
+    test_CryptCATOpen();
     /* Parameter checking only */
     test_CryptCATCDF_params();
     /* Test the parsing of a cdf file */




More information about the wine-cvs mailing list