[atlnew]
[reactos.git] / reactos / dll / win32 / browseui / browseui.cpp
1 /*
2 * ReactOS Explorer
3 *
4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include <windows.h>
22 #include <shlobj.h>
23 #include <shlobj_undoc.h>
24 #include <shlguid.h>
25 #include <shlguid_undoc.h>
26 #include <shlwapi.h>
27 #include <tchar.h>
28 #include <atlbase.h>
29 #include <atlcom.h>
30 #include <atlwin.h>
31 #include <wine/debug.h>
32 #include "resource.h"
33 #include "aclmulti.h"
34 #include "addressband.h"
35 #include "addresseditbox.h"
36 #include "bandproxy.h"
37 #include "bandsite.h"
38 #include "bandsitemenu.h"
39 #include "brandband.h"
40 #include "internettoolbar.h"
41
42 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
43
44 class CBrowseUIModule : public CComModule
45 {
46 public:
47 };
48
49
50 BEGIN_OBJECT_MAP(ObjectMap)
51 OBJECT_ENTRY(CLSID_ACLMulti, CACLMulti)
52 OBJECT_ENTRY(CLSID_SH_AddressBand, CAddressBand)
53 OBJECT_ENTRY(CLSID_AddressEditBox, CAddressEditBox)
54 OBJECT_ENTRY(CLSID_BandProxy, CBandProxy)
55 OBJECT_ENTRY(CLSID_RebarBandSite, CBandSite)
56 OBJECT_ENTRY(CLSID_BandSiteMenu, CBandSiteMenu)
57 OBJECT_ENTRY(CLSID_BrandBand, CBrandBand)
58 OBJECT_ENTRY(CLSID_InternetToolbar, CInternetToolbar)
59 END_OBJECT_MAP()
60
61 CBrowseUIModule gModule;
62 CAtlWinModule gWinModule;
63
64 void *operator new (size_t, void *buf)
65 {
66 return buf;
67 }
68
69 /*************************************************************************
70 * BROWSEUI DllMain
71 */
72 STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
73 {
74 TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad);
75
76 /* HACK - the global constructors don't run, so I placement new them here */
77 new (&gModule) CBrowseUIModule;
78 new (&gWinModule) CAtlWinModule;
79 new (&_AtlBaseModule) CAtlBaseModule;
80
81 if (dwReason == DLL_PROCESS_ATTACH)
82 {
83 gModule.Init(ObjectMap, hInstance, NULL);
84 DisableThreadLibraryCalls (hInstance);
85 }
86 else if (dwReason == DLL_PROCESS_DETACH)
87 {
88 gModule.Term();
89 }
90 return TRUE;
91 }
92
93 /***********************************************************************
94 * DllCanUnloadNow (BROWSEUI.@)
95 */
96 STDAPI DllCanUnloadNow()
97 {
98 return gModule.DllCanUnloadNow();
99 }
100
101 /***********************************************************************
102 * DllGetClassObject (BROWSEUI.@)
103 */
104 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
105 {
106 return gModule.DllGetClassObject(rclsid, riid, ppv);
107 }
108
109 /***********************************************************************
110 * DllRegisterServer (BROWSEUI.@)
111 */
112 STDAPI DllRegisterServer()
113 {
114 return gModule.DllRegisterServer(FALSE);
115 }
116
117 /***********************************************************************
118 * DllUnregisterServer (BROWSEUI.@)
119 */
120 STDAPI DllUnregisterServer()
121 {
122 return gModule.DllUnregisterServer(FALSE);
123 }
124
125 /***********************************************************************
126 * DllGetVersion (BROWSEUI.@)
127 */
128 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
129 {
130 if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
131
132 /* this is what IE6 on Windows 98 reports */
133 info->dwMajorVersion = 6;
134 info->dwMinorVersion = 0;
135 info->dwBuildNumber = 2600;
136 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
137
138 return NOERROR;
139 }