xref: /reactos/dll/shellext/stobject/stobject.cpp (revision c2c66aff)
1 /*
2  * PROJECT:     ReactOS system libraries
3  * LICENSE:     GPL - See COPYING in the top level directory
4  * FILE:        dll/shellext/stobject/stobject.cpp
5  * PURPOSE:     COM registration services for STobject.dll
6  * PROGRAMMERS: Robert Naumann
7  *              David Quintana <gigaherz@gmail.com>
8  */
9 
10 #include "precomp.h"
11 
12 #include <olectl.h>
13 #include <atlwin.h>
14 
15 WINE_DEFAULT_DEBUG_CHANNEL(stobject);
16 
17 BEGIN_OBJECT_MAP(ObjectMap)
18     OBJECT_ENTRY(CLSID_SysTray, CSysTray)
19 END_OBJECT_MAP()
20 
21 HINSTANCE  g_hInstance;
22 CComModule g_Module;
23 
24 STDAPI_(BOOL)
25 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
26 {
27     if (fdwReason == DLL_PROCESS_ATTACH)
28     {
29         g_hInstance = hinstDLL;
30         DisableThreadLibraryCalls(g_hInstance);
31 
32         g_Module.Init(ObjectMap, g_hInstance, NULL);
33     }
34     else if (fdwReason == DLL_PROCESS_DETACH)
35     {
36         g_hInstance = NULL;
37         g_Module.Term();
38     }
39     return TRUE;
40 }
41 
42 STDAPI
43 DllRegisterServer(void)
44 {
45     return g_Module.DllRegisterServer(FALSE);
46 }
47 
48 STDAPI
49 DllUnregisterServer(void)
50 {
51     return g_Module.DllUnregisterServer(FALSE);
52 }
53 
54 STDAPI
55 DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
56 {
57     return g_Module.DllGetClassObject(rclsid, riid, ppv);
58 }
59 
60 STDAPI
61 DllCanUnloadNow(void)
62 {
63     return g_Module.DllCanUnloadNow();
64 }
65