2 * browseui - Internet Explorer / Windows Explorer standard UI
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2004 Mike McCormack (for CodeWeavers)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
42 LONG BROWSEUI_refCount = 0;
44 HINSTANCE browseui_hinstance = 0;
46 typedef HRESULT (WINAPI *LPFNCONSTRUCTOR)(IUnknown *pUnkOuter, IUnknown **ppvOut);
52 {&CLSID_ACLMulti, ACLMulti_Constructor},
56 typedef struct tagClassFactory
58 const IClassFactoryVtbl *vtbl;
62 static const IClassFactoryVtbl ClassFactoryVtbl;
64 static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
66 ClassFactory *This = CoTaskMemAlloc(sizeof(ClassFactory));
67 This->vtbl = &ClassFactoryVtbl;
70 *ppvOut = (LPVOID)This;
71 TRACE("Created class factory %p\n", This);
76 static void ClassFactory_Destructor(ClassFactory *This)
78 TRACE("Destroying class factory %p\n", This);
83 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
86 if (IsEqualIID(riid, &IID_IClassFactory) || IsEqualIID(riid, &IID_IUnknown)) {
87 IClassFactory_AddRef(iface);
92 WARN("Unknown interface %s\n", debugstr_guid(riid));
96 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
98 ClassFactory *This = (ClassFactory *)iface;
99 return InterlockedIncrement(&This->ref);
102 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
104 ClassFactory *This = (ClassFactory *)iface;
105 ULONG ret = InterlockedDecrement(&This->ref);
108 ClassFactory_Destructor(This);
112 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
114 ClassFactory *This = (ClassFactory *)iface;
118 TRACE("(%p, %p, %s, %p)\n", iface, punkOuter, debugstr_guid(iid), ppvOut);
119 ret = This->ctor(punkOuter, &obj);
122 ret = IUnknown_QueryInterface(obj, iid, ppvOut);
123 IUnknown_Release(obj);
127 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
129 FIXME("(%p, %s) - not implemented\n", iface, (fLock ? "TRUE" : "FALSE"));
133 static const IClassFactoryVtbl ClassFactoryVtbl = {
135 ClassFactory_QueryInterface,
137 ClassFactory_Release,
140 ClassFactory_CreateInstance,
141 ClassFactory_LockServer
144 /*************************************************************************
147 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
149 TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
152 case DLL_WINE_PREATTACH:
153 return FALSE; /* prefer native version */
154 case DLL_PROCESS_ATTACH:
155 DisableThreadLibraryCalls(hinst);
156 browseui_hinstance = hinst;
162 /*************************************************************************
163 * DllCanUnloadNow (BROWSEUI.@)
165 HRESULT WINAPI DllCanUnloadNow(void)
167 return BROWSEUI_refCount ? S_FALSE : S_OK;
170 /***********************************************************************
171 * DllGetVersion (BROWSEUI.@)
173 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
175 if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
177 /* this is what IE6 on Windows 98 reports */
178 info->dwMajorVersion = 6;
179 info->dwMinorVersion = 0;
180 info->dwBuildNumber = 2600;
181 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
186 /***********************************************************************
187 * DllGetClassObject (BROWSEUI.@)
189 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *ppvOut)
194 if (!IsEqualIID(iid, &IID_IUnknown) && !IsEqualIID(iid, &IID_IClassFactory))
195 return E_NOINTERFACE;
197 for (i = 0; ClassesTable[i].clsid != NULL; i++)
198 if (IsEqualCLSID(ClassesTable[i].clsid, clsid)) {
199 return ClassFactory_Constructor(ClassesTable[i].ctor, ppvOut);
201 FIXME("CLSID %s not supported\n", debugstr_guid(clsid));
202 return CLASS_E_CLASSNOTAVAILABLE;