2014-07-23 18:00:36 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS system libraries
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2014-07-28 13:18:57 +00:00
|
|
|
* FILE: dll\win32\stobject\stobject.cpp
|
2014-07-30 22:08:05 +00:00
|
|
|
* PURPOSE: COM registration services for STobject.dll
|
2014-07-28 13:18:57 +00:00
|
|
|
* PROGRAMMERS: Robert Naumann
|
|
|
|
David Quintana <gigaherz@gmail.com>
|
2014-07-23 18:00:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
|
|
|
#include <olectl.h>
|
2014-07-28 13:18:57 +00:00
|
|
|
#include <atlwin.h>
|
2014-07-23 18:00:36 +00:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(stobject);
|
|
|
|
|
2014-07-30 22:08:05 +00:00
|
|
|
BEGIN_OBJECT_MAP(ObjectMap)
|
|
|
|
OBJECT_ENTRY(CLSID_SysTray, CSysTray)
|
|
|
|
END_OBJECT_MAP()
|
2014-07-28 13:18:57 +00:00
|
|
|
|
2014-07-31 12:36:40 +00:00
|
|
|
HINSTANCE g_hInstance;
|
|
|
|
CComModule g_Module;
|
2014-07-23 18:00:36 +00:00
|
|
|
|
2014-07-30 22:08:05 +00:00
|
|
|
void *operator new (size_t, void *buf)
|
2014-07-23 18:00:36 +00:00
|
|
|
{
|
2014-07-30 22:08:05 +00:00
|
|
|
return buf;
|
2014-07-28 13:18:57 +00:00
|
|
|
}
|
2014-07-23 18:00:36 +00:00
|
|
|
|
2014-07-31 12:36:40 +00:00
|
|
|
STDAPI_(BOOL)
|
2014-07-30 22:08:05 +00:00
|
|
|
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
2014-07-28 13:18:57 +00:00
|
|
|
{
|
2014-07-30 22:08:05 +00:00
|
|
|
if (fdwReason == DLL_PROCESS_ATTACH)
|
2014-07-23 18:00:36 +00:00
|
|
|
{
|
2014-07-30 22:08:05 +00:00
|
|
|
g_hInstance = hinstDLL;
|
|
|
|
DisableThreadLibraryCalls(g_hInstance);
|
2014-07-23 18:00:36 +00:00
|
|
|
|
2014-07-30 22:08:05 +00:00
|
|
|
/* HACK - the global constructors don't run, so I placement new them here */
|
2014-07-31 12:36:40 +00:00
|
|
|
new (&g_Module) CComModule;
|
2014-07-30 22:08:05 +00:00
|
|
|
new (&_AtlWinModule) CAtlWinModule;
|
|
|
|
new (&_AtlBaseModule) CAtlBaseModule;
|
|
|
|
new (&_AtlComModule) CAtlComModule;
|
2014-07-28 13:18:57 +00:00
|
|
|
|
2014-07-30 22:08:05 +00:00
|
|
|
g_Module.Init(ObjectMap, g_hInstance, NULL);
|
2014-07-28 13:18:57 +00:00
|
|
|
}
|
2014-07-30 22:08:05 +00:00
|
|
|
else if (fdwReason == DLL_PROCESS_DETACH)
|
2014-07-28 13:18:57 +00:00
|
|
|
{
|
2014-07-30 22:08:05 +00:00
|
|
|
g_hInstance = NULL;
|
|
|
|
g_Module.Term();
|
2014-07-28 13:18:57 +00:00
|
|
|
}
|
2014-07-30 22:08:05 +00:00
|
|
|
return TRUE;
|
2014-07-28 13:18:57 +00:00
|
|
|
}
|
|
|
|
|
2014-07-30 22:08:05 +00:00
|
|
|
STDAPI
|
|
|
|
DllRegisterServer(void)
|
2014-07-23 18:00:36 +00:00
|
|
|
{
|
2014-07-31 12:36:40 +00:00
|
|
|
return g_Module.DllRegisterServer(FALSE);
|
2014-07-23 18:00:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
STDAPI
|
2014-07-30 22:08:05 +00:00
|
|
|
DllUnregisterServer(void)
|
2014-07-23 18:00:36 +00:00
|
|
|
{
|
2014-07-31 12:36:40 +00:00
|
|
|
return g_Module.DllUnregisterServer(FALSE);
|
2014-07-23 18:00:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
STDAPI
|
2014-07-30 22:08:05 +00:00
|
|
|
DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
2014-07-23 18:00:36 +00:00
|
|
|
{
|
2014-07-31 12:36:40 +00:00
|
|
|
return g_Module.DllGetClassObject(rclsid, riid, ppv);
|
2014-07-23 18:00:36 +00:00
|
|
|
}
|
|
|
|
|
2014-07-31 12:36:40 +00:00
|
|
|
STDAPI
|
2014-07-30 22:08:05 +00:00
|
|
|
DllCanUnloadNow(void)
|
2014-07-23 18:00:36 +00:00
|
|
|
{
|
2014-07-30 22:08:05 +00:00
|
|
|
return g_Module.DllCanUnloadNow();
|
2014-07-23 18:00:36 +00:00
|
|
|
}
|