Author: dquintana
Date: Thu Jul 31 12:36:40 2014
New Revision: 63791

URL: http://svn.reactos.org/svn/reactos?rev=63791&view=rev
Log:
[STOBJECT]
* Fix DllMain not being called when building with gcc. Apparently msvc makes 
DllMain extern "C" even if you didn't ask for it, unlike gcc.
* Simplify some code.

Modified:
    branches/shell-experiments/dll/shellext/stobject/csystray.cpp
    branches/shell-experiments/dll/shellext/stobject/stobject.cpp

Modified: branches/shell-experiments/dll/shellext/stobject/csystray.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/shellext/stobject/csystray.cpp?rev=63791&r1=63790&r2=63791&view=diff
==============================================================================
--- branches/shell-experiments/dll/shellext/stobject/csystray.cpp       
[iso-8859-1] (original)
+++ branches/shell-experiments/dll/shellext/stobject/csystray.cpp       
[iso-8859-1] Thu Jul 31 12:36:40 2014
@@ -9,6 +9,11 @@
 #include "precomp.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(stobject);
+
+SysTrayIconHandlers_t g_IconHandlers [] = {
+        { Volume_Init, Volume_Shutdown, Volume_Update, Volume_Message }
+};
+const int             g_NumIcons = _countof(g_IconHandlers);
 
 const GUID CLSID_SysTray = { 0x35CEC8A3, 0x2BE6, 0x11D2, { 0x87, 0x73, 0x92, 
0xE2, 0x20, 0x52, 0x41, 0x53 } };
 

Modified: branches/shell-experiments/dll/shellext/stobject/stobject.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/shellext/stobject/stobject.cpp?rev=63791&r1=63790&r2=63791&view=diff
==============================================================================
--- branches/shell-experiments/dll/shellext/stobject/stobject.cpp       
[iso-8859-1] (original)
+++ branches/shell-experiments/dll/shellext/stobject/stobject.cpp       
[iso-8859-1] Thu Jul 31 12:36:40 2014
@@ -18,27 +18,15 @@
     OBJECT_ENTRY(CLSID_SysTray, CSysTray)
 END_OBJECT_MAP()
 
-const int ObjectMapCount = _countof(ObjectMap);
-
-class CShellTrayModule : public CComModule
-{
-public:
-};
-
-HINSTANCE             g_hInstance;
-CShellTrayModule      g_Module;
-SysTrayIconHandlers_t g_IconHandlers [] = {
-        { Volume_Init, Volume_Shutdown, Volume_Update, Volume_Message }
-};
-const int             g_NumIcons = _countof(g_IconHandlers);
+HINSTANCE  g_hInstance;
+CComModule g_Module;
 
 void *operator new (size_t, void *buf)
 {
     return buf;
 }
 
-BOOL
-WINAPI
+STDAPI_(BOOL)
 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
 {
     if (fdwReason == DLL_PROCESS_ATTACH)
@@ -47,7 +35,7 @@
         DisableThreadLibraryCalls(g_hInstance);
 
         /* HACK - the global constructors don't run, so I placement new them 
here */
-        new (&g_Module) CShellTrayModule;
+        new (&g_Module) CComModule;
         new (&_AtlWinModule) CAtlWinModule;
         new (&_AtlBaseModule) CAtlBaseModule;
         new (&_AtlComModule) CAtlComModule;
@@ -65,47 +53,22 @@
 STDAPI
 DllRegisterServer(void)
 {
-    HRESULT hr;
-
-    DbgPrint("DllRegisterServer should process %d classes...\n", 
ObjectMapCount);
-
-    hr = g_Module.DllRegisterServer(FALSE);
-    if (FAILED_UNEXPECTEDLY(hr))
-        return hr;
-
-    return S_OK;
+    return g_Module.DllRegisterServer(FALSE);
 }
 
 STDAPI
 DllUnregisterServer(void)
 {
-    HRESULT hr;
-
-    DbgPrint("DllUnregisterServer should process %d classes...\n", 
ObjectMapCount);
-
-    hr = g_Module.DllUnregisterServer(FALSE);
-    if (FAILED_UNEXPECTEDLY(hr))
-        return hr;
-
-    return S_OK;
+    return g_Module.DllUnregisterServer(FALSE);
 }
 
 STDAPI
 DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
-    HRESULT hr;
-
-    DbgPrint("DllGetClassObject should process %d classes...\n", 
ObjectMapCount);
-
-    hr = g_Module.DllGetClassObject(rclsid, riid, ppv);
-    if (FAILED_UNEXPECTEDLY(hr))
-        return hr;
-
-    return S_OK;
+    return g_Module.DllGetClassObject(rclsid, riid, ppv);
 }
 
-HRESULT
-WINAPI
+STDAPI
 DllCanUnloadNow(void)
 {
     return g_Module.DllCanUnloadNow();


Reply via email to