Hans Leidekker : wintrust: Implement CryptCATAdminReleaseContext.

Alexandre Julliard julliard at winehq.org
Thu Dec 18 08:08:35 CST 2008


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Dec 17 14:33:29 2008 +0100

wintrust: Implement CryptCATAdminReleaseContext.

Based on work done by Maarten Lankhorst.

---

 dlls/wintrust/crypt.c       |   13 +++++++++++--
 dlls/wintrust/tests/crypt.c |    6 ------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c
index bbdf2c0..b69647d 100644
--- a/dlls/wintrust/crypt.c
+++ b/dlls/wintrust/crypt.c
@@ -183,8 +183,17 @@ BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin,
  */
 BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags )
 {
-    FIXME("%p %x\n", hCatAdmin, dwFlags);
-    return TRUE;
+    struct catadmin *ca = hCatAdmin;
+
+    TRACE("%p %x\n", hCatAdmin, dwFlags);
+
+    if (!ca || ca->magic != CATADMIN_MAGIC)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+    ca->magic = 0;
+    return HeapFree(GetProcessHeap(), 0, ca);
 }
 
 /***********************************************************************
diff --git a/dlls/wintrust/tests/crypt.c b/dlls/wintrust/tests/crypt.c
index e09f5fe..af78051 100644
--- a/dlls/wintrust/tests/crypt.c
+++ b/dlls/wintrust/tests/crypt.c
@@ -109,12 +109,9 @@ static void test_context(void)
     /* All NULL */
     SetLastError(0xdeadbeef);
     ret = pCryptCATAdminReleaseContext(NULL, 0);
-    todo_wine
-    {
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
-    }
 
     /* Proper release */
     SetLastError(0xdeadbeef);
@@ -126,12 +123,9 @@ static void test_context(void)
     /* Try to release a second time */
     SetLastError(0xdeadbeef);
     ret = pCryptCATAdminReleaseContext(hca, 0);
-    todo_wine
-    {
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
-    }
 
     /* NULL context handle and dummy GUID */
     SetLastError(0xdeadbeef);




More information about the wine-cvs mailing list