Juan Lang : wintrust: Test and correct alloc and free functions in WintrustLoadFunctionPointers.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 27 06:07:39 CDT 2007


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Aug 24 15:07:41 2007 -0700

wintrust: Test and correct alloc and free functions in WintrustLoadFunctionPointers.

---

 dlls/wintrust/register.c       |   14 ++++++++++++--
 dlls/wintrust/tests/register.c |    2 ++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/wintrust/register.c b/dlls/wintrust/register.c
index d16b186..517359f 100644
--- a/dlls/wintrust/register.c
+++ b/dlls/wintrust/register.c
@@ -812,6 +812,16 @@ error_close_key:
     return Func;
 }
 
+static void * WINAPI WINTRUST_Alloc(DWORD cb)
+{
+    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
+}
+
+static void WINAPI WINTRUST_Free(void *p)
+{
+    HeapFree(GetProcessHeap(), 0, p);
+}
+
 /***********************************************************************
  *              WintrustLoadFunctionPointers (WINTRUST.@)
  */
@@ -834,8 +844,8 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
     WINTRUST_Guid2Wstr( pgActionID, GuidString);
 
     /* Get the function pointers from the registry, where applicable */
-    pPfns->pfnAlloc = NULL;
-    pPfns->pfnFree = NULL;
+    pPfns->pfnAlloc = WINTRUST_Alloc;
+    pPfns->pfnFree = WINTRUST_Free;
     pPfns->pfnAddStore2Chain = NULL;
     pPfns->pfnAddSgnr2Chain = NULL;
     pPfns->pfnAddCert2Chain = NULL;
diff --git a/dlls/wintrust/tests/register.c b/dlls/wintrust/tests/register.c
index 6e6ed20..f4aef92 100644
--- a/dlls/wintrust/tests/register.c
+++ b/dlls/wintrust/tests/register.c
@@ -284,6 +284,8 @@ static void test_LoadFunctionPointers(void)
     funcs.cbStruct = sizeof(funcs);
     ret = pWintrustLoadFunctionPointers(&action, &funcs);
     ok(ret, "WintrustLoadFunctionPointers failed: %d\n", GetLastError());
+    ok(funcs.pfnAlloc != NULL, "Expected a pointer\n");
+    ok(funcs.pfnFree != NULL, "Expected a pointer\n");
 }
 
 static void test_RegPolicyFlags(void)




More information about the wine-cvs mailing list