bcrypt: Implement BCryptGenerateSymmetricKey and BCryptDestroyKey.
[wine.git] / dlls / explorerframe / explorerframe_main.c
blob8f32c2c2d62d6572bae9d197f462ab8974df89e9
1 /*
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
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winreg.h"
30 #include "shlwapi.h"
31 #include "shobjidl.h"
32 #include "rpcproxy.h"
34 #include "wine/debug.h"
36 #include "explorerframe_main.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
40 HINSTANCE explorerframe_hinstance;
41 LONG EFRAME_refCount = 0;
43 /*************************************************************************
44 * DllMain (ExplorerFrame.@)
46 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
48 TRACE("%p, 0x%x, %p\n", hinst, fdwReason, fImpLoad);
49 switch (fdwReason)
51 case DLL_PROCESS_ATTACH:
52 DisableThreadLibraryCalls(hinst);
53 explorerframe_hinstance = hinst;
54 break;
56 return TRUE;
59 /*************************************************************************
60 * DllCanUnloadNow (ExplorerFrame.@)
62 HRESULT WINAPI DllCanUnloadNow(void)
64 TRACE("refCount is %d\n", EFRAME_refCount);
65 return EFRAME_refCount ? S_FALSE : S_OK;
68 /*************************************************************************
69 * DllGetVersion (ExplorerFrame.@)
71 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
73 TRACE("%p\n", info);
74 if(info->cbSize == sizeof(DLLVERSIONINFO) ||
75 info->cbSize == sizeof(DLLVERSIONINFO2))
77 /* Windows 7 */
78 info->dwMajorVersion = 6;
79 info->dwMinorVersion = 1;
80 info->dwBuildNumber = 7600;
81 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
82 if(info->cbSize == sizeof(DLLVERSIONINFO2))
84 DLLVERSIONINFO2 *info2 = (DLLVERSIONINFO2*)info;
85 info2->dwFlags = 0;
86 info2->ullVersion = MAKEDLLVERULL(info->dwMajorVersion,
87 info->dwMinorVersion,
88 info->dwBuildNumber,
89 16385); /* "hotfix number" */
91 return S_OK;
94 WARN("wrong DLLVERSIONINFO size from app.\n");
95 return E_INVALIDARG;
98 /*************************************************************************
99 * Implement the ExplorerFrame class factory
102 typedef struct
104 IClassFactory IClassFactory_iface;
105 HRESULT (*cf)(IUnknown*, REFIID, void**);
106 LONG ref;
107 } IClassFactoryImpl;
109 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
111 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
114 /*************************************************************************
115 * EFCF_QueryInterface
117 static HRESULT WINAPI EFCF_QueryInterface(IClassFactory* iface,
118 REFIID riid, void **ppobj)
120 TRACE("%p (%s %p)\n", iface, debugstr_guid(riid), ppobj);
122 if(!ppobj)
123 return E_POINTER;
125 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid))
127 *ppobj = iface;
128 IClassFactory_AddRef(iface);
129 return S_OK;
132 WARN("Interface not supported.\n");
134 *ppobj = NULL;
135 return E_NOINTERFACE;
138 /*************************************************************************
139 * EFCF_AddRef
141 static ULONG WINAPI EFCF_AddRef(IClassFactory *iface)
143 EFRAME_LockModule();
145 return 2; /* non-heap based object */
148 /*************************************************************************
149 * EFCF_Release
151 static ULONG WINAPI EFCF_Release(IClassFactory *iface)
153 EFRAME_UnlockModule();
155 return 1; /* non-heap based object */
158 /*************************************************************************
159 * EFCF_CreateInstance (IClassFactory)
161 static HRESULT WINAPI EFCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
162 REFIID riid, void **ppobj)
164 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
165 return This->cf(pOuter, riid, ppobj);
168 /*************************************************************************
169 * EFCF_LockServer (IClassFactory)
171 static HRESULT WINAPI EFCF_LockServer(IClassFactory *iface, BOOL dolock)
173 TRACE("%p (%d)\n", iface, dolock);
175 if (dolock)
176 EFRAME_LockModule();
177 else
178 EFRAME_UnlockModule();
180 return S_OK;
183 static const IClassFactoryVtbl EFCF_Vtbl =
185 EFCF_QueryInterface,
186 EFCF_AddRef,
187 EFCF_Release,
188 EFCF_CreateInstance,
189 EFCF_LockServer
192 /*************************************************************************
193 * DllGetClassObject (ExplorerFrame.@)
195 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
197 static IClassFactoryImpl NSTCClassFactory = {{&EFCF_Vtbl}, NamespaceTreeControl_Constructor};
198 static IClassFactoryImpl TaskbarListFactory = {{&EFCF_Vtbl}, TaskbarList_Constructor};
200 TRACE("%s, %s, %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
202 if(IsEqualGUID(&CLSID_NamespaceTreeControl, rclsid))
203 return IClassFactory_QueryInterface(&NSTCClassFactory.IClassFactory_iface, riid, ppv);
205 if(IsEqualGUID(&CLSID_TaskbarList, rclsid))
206 return IClassFactory_QueryInterface(&TaskbarListFactory.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 );