ole32/tests: Dynamically load WdtpInterfacePointer_UserFree (win8)

André Hentschel nerv at dawncrow.de
Tue Sep 25 16:10:23 CDT 2012


---
 dlls/ole32/tests/usrmarshal.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/tests/usrmarshal.c b/dlls/ole32/tests/usrmarshal.c
index ed09558..ba9142c 100644
--- a/dlls/ole32/tests/usrmarshal.c
+++ b/dlls/ole32/tests/usrmarshal.c
@@ -29,6 +29,8 @@
 
 #include "wine/test.h"
 
+static void (__RPC_USER *pWdtpInterfacePointer_UserFree)(IUnknown*);
+
 ULONG __RPC_USER HMETAFILE_UserSize(ULONG *, ULONG, HMETAFILE *);
 unsigned char * __RPC_USER HMETAFILE_UserMarshal(ULONG *, unsigned char *, HMETAFILE *);
 unsigned char * __RPC_USER HMETAFILE_UserUnmarshal(ULONG *, unsigned char *, HMETAFILE *);
@@ -44,6 +46,13 @@ unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal  (ULONG *, unsigned char *,
 unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *, unsigned char *, HMETAFILEPICT *);
 void __RPC_USER HMETAFILEPICT_UserFree(ULONG *, HMETAFILEPICT *);
 
+static void init_function_pointers(void)
+{
+    HMODULE hole32 = GetModuleHandleA("ole32.dll");
+
+    pWdtpInterfacePointer_UserFree = (void*)GetProcAddress(hole32, "WdtpInterfacePointer_UserFree");
+}
+
 static void * WINAPI user_allocate(SIZE_T size)
 {
     return CoTaskMemAlloc(size);
@@ -551,7 +560,6 @@ static IStream Test_Stream = { &TestStream_Vtbl };
 ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *, ULONG, ULONG, IUnknown *, REFIID);
 unsigned char * __RPC_USER WdtpInterfacePointer_UserMarshal(ULONG *, ULONG, unsigned char *, IUnknown *, REFIID);
 unsigned char * __RPC_USER WdtpInterfacePointer_UserUnmarshal(ULONG *, unsigned char *, IUnknown **, REFIID);
-void __RPC_USER WdtpInterfacePointer_UserFree(IUnknown *);
 
 static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx)
 {
@@ -624,11 +632,17 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx)
     ok(unk2 != NULL, "IUnknown object didn't unmarshal properly\n");
     HeapFree(GetProcessHeap(), 0, buffer);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
-    WdtpInterfacePointer_UserFree(unk2);
+    pWdtpInterfacePointer_UserFree(unk2);
 }
 
 static void test_marshal_WdtpInterfacePointer(void)
 {
+    if (!pWdtpInterfacePointer_UserFree)
+    {
+        win_skip("WdtpInterfacePointer_UserFree is not available\n");
+        return;
+    }
+
     /*
      * There are two places where we can pass the marshalling ctx: as
      * part of the umcb and as a separate flag.  The loword of that
@@ -756,6 +770,8 @@ START_TEST(usrmarshal)
 {
     CoInitialize(NULL);
 
+    init_function_pointers();
+
     test_marshal_CLIPFORMAT();
     test_marshal_HWND();
     test_marshal_HGLOBAL();
-- 
1.7.4.1


-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list