[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.

svn path=/branches/shell-experiments/; revision=63791
This commit is contained in:
David Quintana 2014-07-31 12:36:40 +00:00
parent 56aab7f365
commit 7292674928
2 changed files with 13 additions and 45 deletions

View file

@ -10,6 +10,11 @@
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 } };
CSysTray::CSysTray() {}

View file

@ -18,27 +18,15 @@ BEGIN_OBJECT_MAP(ObjectMap)
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 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
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 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
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();