1 /*
2  * PROJECT:     NT Object Namespace shell extension
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Shell extension entry point and exports
5  * COPYRIGHT:   Copyright 2015-2017 David Quintana <gigaherz@gmail.com>
6  */
7 
8 #include "precomp.h"
9 
10 #include <atlwin.h>
11 
12 BEGIN_OBJECT_MAP(ObjectMap)
13     OBJECT_ENTRY(CLSID_NtObjectFolder, CNtObjectFolder)
14     OBJECT_ENTRY(CLSID_RegistryFolder, CRegistryFolder)
15 END_OBJECT_MAP()
16 
17 HINSTANCE  g_hInstance;
18 CComModule g_Module;
19 
20 STDAPI_(BOOL)
21 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
22 {
23     if (fdwReason == DLL_PROCESS_ATTACH)
24     {
25         g_hInstance = hinstDLL;
26         DisableThreadLibraryCalls(g_hInstance);
27 
28         g_Module.Init(ObjectMap, g_hInstance, NULL);
29     }
30     else if (fdwReason == DLL_PROCESS_DETACH)
31     {
32         g_hInstance = NULL;
33         g_Module.Term();
34     }
35     return TRUE;
36 }
37 
38 STDAPI
39 DllRegisterServer(void)
40 {
41     return g_Module.DllRegisterServer(FALSE);
42 }
43 
44 STDAPI
45 DllUnregisterServer(void)
46 {
47     return g_Module.DllUnregisterServer(FALSE);
48 }
49 
50 STDAPI
51 DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
52 {
53     return g_Module.DllGetClassObject(rclsid, riid, ppv);
54 }
55 
56 STDAPI
57 DllCanUnloadNow(void)
58 {
59     return g_Module.DllCanUnloadNow();
60 }
61