2 * ExplorerFrame main functions
4 * Copyright 2010 David Hedberg
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
36 #include "wine/debug.h"
38 #include "explorerframe_main.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
42 HINSTANCE explorerframe_hinstance;
43 LONG EFRAME_refCount = 0;
45 /*************************************************************************
46 * DllMain (ExplorerFrame.@)
48 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
50 TRACE("%p, 0x%x, %p\n", hinst, fdwReason, fImpLoad);
53 case DLL_PROCESS_ATTACH:
54 DisableThreadLibraryCalls(hinst);
55 explorerframe_hinstance = hinst;
57 case DLL_PROCESS_DETACH:
63 /*************************************************************************
64 * DllCanUnloadNow (ExplorerFrame.@)
66 HRESULT WINAPI DllCanUnloadNow(void)
68 TRACE("refCount is %d\n", EFRAME_refCount);
69 return EFRAME_refCount ? S_FALSE : S_OK;
72 /*************************************************************************
73 * DllGetVersion (ExplorerFrame.@)
75 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
78 if(info->cbSize == sizeof(DLLVERSIONINFO) ||
79 info->cbSize == sizeof(DLLVERSIONINFO2))
82 info->dwMajorVersion = 6;
83 info->dwMinorVersion = 1;
84 info->dwBuildNumber = 7600;
85 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
86 if(info->cbSize == sizeof(DLLVERSIONINFO2))
88 DLLVERSIONINFO2 *info2 = (DLLVERSIONINFO2*)info;
90 info2->ullVersion = MAKEDLLVERULL(info->dwMajorVersion,
93 16385); /* "hotfix number" */
98 WARN("wrong DLLVERSIONINFO size from app.\n");
102 /*************************************************************************
103 * Implement the ExplorerFrame class factory
108 IClassFactory IClassFactory_iface;
109 HRESULT (*cf)(IUnknown*, REFIID, void**);
113 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
115 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
118 /*************************************************************************
119 * EFCF_QueryInterface
121 static HRESULT WINAPI EFCF_QueryInterface(IClassFactory* iface,
122 REFIID riid, void **ppobj)
124 TRACE("%p (%s %p)\n", iface, debugstr_guid(riid), ppobj);
129 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid))
132 IClassFactory_AddRef(iface);
136 WARN("Interface not supported.\n");
139 return E_NOINTERFACE;
142 /*************************************************************************
145 static ULONG WINAPI EFCF_AddRef(IClassFactory *iface)
149 return 2; /* non-heap based object */
152 /*************************************************************************
155 static ULONG WINAPI EFCF_Release(IClassFactory *iface)
157 EFRAME_UnlockModule();
159 return 1; /* non-heap based object */
162 /*************************************************************************
163 * EFCF_CreateInstance (IClassFactory)
165 static HRESULT WINAPI EFCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
166 REFIID riid, void **ppobj)
168 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
169 return This->cf(pOuter, riid, ppobj);
172 /*************************************************************************
173 * EFCF_LockServer (IClassFactory)
175 static HRESULT WINAPI EFCF_LockServer(IClassFactory *iface, BOOL dolock)
177 TRACE("%p (%d)\n", iface, dolock);
182 EFRAME_UnlockModule();
187 static const IClassFactoryVtbl EFCF_Vtbl =
196 /*************************************************************************
197 * DllGetClassObject (ExplorerFrame.@)
199 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
201 static IClassFactoryImpl NSTCClassFactory = {{&EFCF_Vtbl}, NamespaceTreeControl_Constructor};
203 TRACE("%s, %s, %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
205 if(IsEqualGUID(&CLSID_NamespaceTreeControl, rclsid))
206 return IClassFactory_QueryInterface(&NSTCClassFactory.IClassFactory_iface, riid, ppv);
208 return CLASS_E_CLASSNOTAVAILABLE;
211 /*************************************************************************
212 * DllRegisterServer (ExplorerFrame.@)
214 HRESULT WINAPI DllRegisterServer(void)
216 return __wine_register_resources( explorerframe_hinstance );
219 /*************************************************************************
220 * DllUnregisterServer (ExplorerFrame.@)
222 HRESULT WINAPI DllUnregisterServer(void)
224 return __wine_unregister_resources( explorerframe_hinstance );