[4/4] wintrust: Implement CryptCATAdminReleaseContext.
Hans Leidekker
hans at codeweavers.com
Wed Dec 17 07:33:29 CST 2008
Based on work done by Maarten Lankhorst.
-Hans
diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c
index 1230ad4..37f5bac 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-patches
mailing list