PATCH: some static cleanup in ole32_main
Marcus Meissner
marcus at jet.franken.de
Mon May 16 04:10:19 CDT 2005
Hi,
This gets rid of some global non-static functions by moving some stuff
Also do:
rm dlls/ole32/ole32_main.h
Ciao, Marcus
Changelog:
Move the Dll init function to compobj.c to avoid having
global variables. Remove need of ole32_main.h.
Index: dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.150
diff -u -r1.150 compobj.c
--- dlls/ole32/compobj.c 11 May 2005 12:57:16 -0000 1.150
+++ dlls/ole32/compobj.c 16 May 2005 09:02:13 -0000
@@ -66,7 +66,6 @@
#include "wownt32.h"
#include "wine/unicode.h"
#include "objbase.h"
-#include "ole32_main.h"
#include "compobj_private.h"
#include "wine/debug.h"
@@ -75,6 +74,8 @@
typedef LPCSTR LPCOLESTR16;
+HINSTANCE OLE32_hInstance = 0; /* FIXME: make static ... */
+
/****************************************************************************
* This section defines variables internal to the COM module.
*
@@ -169,7 +170,7 @@
static void COMPOBJ_DLLList_Add(HANDLE hLibrary);
static void COMPOBJ_DllList_FreeUnused(int Timeout);
-void COMPOBJ_InitProcess( void )
+static void COMPOBJ_InitProcess( void )
{
WNDCLASSW wclass;
@@ -189,12 +190,12 @@
RegisterClassW(&wclass);
}
-void COMPOBJ_UninitProcess( void )
+static void COMPOBJ_UninitProcess( void )
{
UnregisterClassW(wszAptWinClass, OLE32_hInstance);
}
-void COM_TlsDestroy()
+static void COM_TlsDestroy()
{
struct oletls *info = NtCurrentTeb()->ReservedForOle;
if (info)
@@ -624,7 +625,7 @@
/* On COM finalization for a STA thread, the message queue is flushed to ensure no
pending RPCs are ignored. Non-COM messages are discarded at this point.
*/
-void COM_FlushMessageQueue(void)
+static void COM_FlushMessageQueue(void)
{
MSG message;
APARTMENT *apt = COM_CurrentApt();
@@ -1531,7 +1532,8 @@
*
* Reads a registry value and expands it when necessary
*/
-HRESULT compobj_RegReadPath(char * keyname, char * valuename, char * dst, DWORD dstlen)
+static HRESULT
+compobj_RegReadPath(char * keyname, char * valuename, char * dst, DWORD dstlen)
{
HRESULT hres;
HKEY key;
@@ -2654,3 +2656,32 @@
TRACE("-- 0x%08lx\n", hr);
return hr;
}
+
+/***********************************************************************
+ * DllMain (OLE32.@)
+ */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
+{
+ TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
+
+ switch(fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ OLE32_hInstance = hinstDLL;
+ COMPOBJ_InitProcess();
+ if (TRACE_ON(ole)) CoRegisterMallocSpy((LPVOID)-1);
+ break;
+
+ case DLL_PROCESS_DETACH:
+ if (TRACE_ON(ole)) CoRevokeMallocSpy();
+ COMPOBJ_UninitProcess();
+ OLE32_hInstance = 0;
+ break;
+
+ case DLL_THREAD_DETACH:
+ COM_TlsDestroy();
+ break;
+ }
+ return TRUE;
+}
+
+/* NOTE: DllRegisterServer and DllUnregisterServer are in regsvr.c */
Index: dlls/ole32/compobj_private.h
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj_private.h,v
retrieving revision 1.50
diff -u -r1.50 compobj_private.h
--- dlls/ole32/compobj_private.h 12 May 2005 09:57:21 -0000 1.50
+++ dlls/ole32/compobj_private.h 16 May 2005 09:02:13 -0000
@@ -254,4 +254,6 @@
# define DEBUG_CLEAR_CRITSEC_NAME(cs)
#endif
+extern HINSTANCE OLE32_hInstance; /* FIXME: make static */
+
#endif /* __WINE_OLE_COMPOBJ_H */
Index: dlls/ole32/ole2.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2.c,v
retrieving revision 1.65
diff -u -r1.65 ole2.c
--- dlls/ole32/ole2.c 20 Apr 2005 16:21:16 -0000 1.65
+++ dlls/ole32/ole2.c 16 May 2005 09:02:18 -0000
@@ -48,7 +48,6 @@
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
#include "wine/winuser16.h"
-#include "ole32_main.h"
#include "compobj_private.h"
#include "wine/debug.h"
Index: dlls/ole32/ole2_16.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole2_16.c,v
retrieving revision 1.4
diff -u -r1.4 ole2_16.c
--- dlls/ole32/ole2_16.c 13 Apr 2005 15:16:40 -0000 1.4
+++ dlls/ole32/ole2_16.c 16 May 2005 09:02:21 -0000
@@ -45,7 +45,6 @@
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
#include "wine/winuser16.h"
-#include "ole32_main.h"
#include "ifs.h"
#include "wine/debug.h"
Index: dlls/ole32/ole32_main.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ole32_main.c,v
retrieving revision 1.19
diff -u -r1.19 ole32_main.c
--- dlls/ole32/ole32_main.c 8 Feb 2005 13:42:15 -0000 1.19
+++ dlls/ole32/ole32_main.c 16 May 2005 09:02:21 -0000
@@ -27,13 +27,11 @@
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
-#include "ole32_main.h"
+#include "objbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
-HINSTANCE OLE32_hInstance = 0;
-
/***********************************************************************
* OleMetafilePictFromIconAndLabel (OLE32.@)
*/
@@ -110,33 +108,3 @@
return hmem;
}
-
-
-/***********************************************************************
- * DllMain (OLE32.@)
- */
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
-{
- TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
-
- switch(fdwReason) {
- case DLL_PROCESS_ATTACH:
- OLE32_hInstance = hinstDLL;
- COMPOBJ_InitProcess();
- if (TRACE_ON(ole)) CoRegisterMallocSpy((LPVOID)-1);
- break;
-
- case DLL_PROCESS_DETACH:
- if (TRACE_ON(ole)) CoRevokeMallocSpy();
- COMPOBJ_UninitProcess();
- OLE32_hInstance = 0;
- break;
-
- case DLL_THREAD_DETACH:
- COM_TlsDestroy();
- break;
- }
- return TRUE;
-}
-
-/* NOTE: DllRegisterServer and DllUnregisterServer are in regsvr.c */
More information about the wine-patches
mailing list