From a99ef3570f49375ad6edf35f9b31ac0cf1de3b6f Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 17 Dec 2008 14:33:29 +0100 Subject: [PATCH] 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 bbdf2c0cf35..b69647d823a 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 e09f5fe280b..af7805178d5 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);