Robert Shearman : include: Fix rpcproxy. h to allow the compilation of dlldata.c files.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 9 16:18:42 CDT 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Wed Aug  9 18:15:51 2006 +0100

include: Fix rpcproxy.h to allow the compilation of dlldata.c files.

Add macros for generating the GetProxyDllInfo, DllGetClassObject and 
DllCanUnloadNow functions.

---

 include/rpcproxy.h |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/include/rpcproxy.h b/include/rpcproxy.h
index 7c40a1d..824462a 100644
--- a/include/rpcproxy.h
+++ b/include/rpcproxy.h
@@ -229,7 +229,7 @@ #define IID_BS_LOOKUP_RETURN_RESULT(name
 
 /* macros used in dlldata.c files */
 #define EXTERN_PROXY_FILE(proxy) \
-    EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo
+    EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo;
 
 #define PROXYFILE_LIST_START \
     const ProxyFileInfo *aProxyFileList[] = \
@@ -241,7 +241,80 @@ #define REFERENCE_PROXY_FILE(proxy) \
 #define PROXYFILE_LIST_END \
         NULL \
     };
-    
+
+
+/* define PROXY_CLSID to use an existing CLSID */
+/* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */
+/* define neither to use the GUID of the first interface */
+#ifdef PROXY_CLSID
+# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
+#else
+# ifdef PROXY_CLSID_IS
+#  define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = \
+    PROXY_CLSID_IS;
+#  define PROXY_CLSID CLSID_PSFactoryBuffer
+# else
+#  define CLSID_PSFACTORYBUFFER
+# endif
+#endif
+
+#ifndef PROXY_CLSID
+# define GET_DLL_CLSID (aProxyFileList[0]->pStubVtblList[0] ? \
+    aProxyFileList[0]->pStubVtblList[0]->header.piid : NULL)
+#else
+# define GET_DLL_CLSID &PROXY_CLSID
+#endif
+
+#ifdef ENTRY_PREFIX
+# define __rpc_macro_expand2(a, b) a##b
+# define __rpc_macro_expand(a, b) __rpc_macro_expand2(a, b)
+# define DLLREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllRegisterServer)
+# define DLLUNREGISTERSERVER_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllUnregisterServer)
+# define DLLMAIN_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllMain)
+# define DLLGETCLASSOBJECT_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllGetClassObject)
+# define DLLCANUNLOADNOW_ENTRY __rpc_macro_expand(ENTRY_PREFIX, DllCanUnloadNow)
+#else
+# define DLLREGISTERSERVER_ENTRY DllRegisterServer
+# define DLLUNREGISTERSERVER_ENTRY DllUnregisterServer
+# define DLLMAIN_ENTRY DllMain
+# define DLLGETCLASSOBJECT_ENTRY DllGetClassObject
+# define DLLCANUNLOADNOW_ENTRY DllCanUnloadNow
+#endif
+
+#define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \
+    void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
+                                   const CLSID **ppClsid) \
+    { \
+        *ppProxyFileInfo = (pfl); \
+        *ppClsid = (rclsid); \
+    }
+
+#define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \
+    HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \
+                                           void **ppv) \
+    { \
+        return NdrDllGetClassObject(rclsid, riid, ppv, (pfl), \
+                                    (factory_clsid), factory); \
+    }
+
+#define DLLCANUNLOADNOW(factory) \
+    HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \
+    { \
+        return NdrDllCanUnloadNow((factory)); \
+    }
+
+#define DLLREGISTRY_ROUTINES(pfl, factory_clsid)
+
+#define DLLDATA_ROUTINES(pfl, factory_clsid) \
+    CLSID_PSFACTORYBUFFER \
+    CStdPSFactoryBuffer gPFactory = { NULL, 0, NULL, 0 }; \
+    DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \
+    DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \
+    DLLCANUNLOADNOW(&gPFactory) \
+    CSTDSTUBBUFFERRELEASE(&gPFactory) \
+    CSTDSTUBBUFFER2RELEASE(&gPFactory) \
+    DLLREGISTRY_ROUTINES(pfl, factory_clsid)
+
 #if 0
 
 /* see http://www.microsoft.com/msj/0199/com/com0199.aspx */




More information about the wine-cvs mailing list