wined3d: Report post pixelshader blending on WINED3DFMT_A16B16G16R16F.
[wine/gsoc_dplay.git] / dlls / browseui / browseui_main.c
blob10757c18ffd2db0647ab2c7be020141ccfe26ef4
1 /*
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
22 #include "config.h"
24 #include <stdarg.h>
25 #include <stdio.h>
27 #define COBJMACROS
29 #include "wine/debug.h"
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winreg.h"
33 #include "shlwapi.h"
34 #include "shlguid.h"
36 #include "browseui.h"
38 #include "initguid.h"
39 DEFINE_GUID(CLSID_CompCatCacheDaemon, 0x8C7461EF, 0x2b13, 0x11d2, 0xbe, 0x35, 0x30, 0x78, 0x30, 0x2c, 0x20, 0x30);
41 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
43 LONG BROWSEUI_refCount = 0;
45 HINSTANCE BROWSEUI_hinstance = 0;
47 typedef HRESULT (*LPFNCONSTRUCTOR)(IUnknown *pUnkOuter, IUnknown **ppvOut);
49 static const struct {
50 REFCLSID clsid;
51 LPFNCONSTRUCTOR ctor;
52 } ClassesTable[] = {
53 {&CLSID_ACLMulti, ACLMulti_Constructor},
54 {&CLSID_ProgressDialog, ProgressDialog_Constructor},
55 {&CLSID_CompCatCacheDaemon, CompCatCacheDaemon_Constructor},
56 {NULL, NULL}
59 typedef struct tagClassFactory
61 const IClassFactoryVtbl *vtbl;
62 LONG ref;
63 LPFNCONSTRUCTOR ctor;
64 } ClassFactory;
66 static void ClassFactory_Destructor(ClassFactory *This)
68 TRACE("Destroying class factory %p\n", This);
69 heap_free(This);
70 BROWSEUI_refCount--;
73 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
75 *ppvOut = NULL;
76 if (IsEqualIID(riid, &IID_IClassFactory) || IsEqualIID(riid, &IID_IUnknown)) {
77 IClassFactory_AddRef(iface);
78 *ppvOut = iface;
79 return S_OK;
82 WARN("Unknown interface %s\n", debugstr_guid(riid));
83 return E_NOINTERFACE;
86 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
88 ClassFactory *This = (ClassFactory *)iface;
89 return InterlockedIncrement(&This->ref);
92 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
94 ClassFactory *This = (ClassFactory *)iface;
95 ULONG ret = InterlockedDecrement(&This->ref);
97 if (ret == 0)
98 ClassFactory_Destructor(This);
99 return ret;
102 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
104 ClassFactory *This = (ClassFactory *)iface;
105 HRESULT ret;
106 IUnknown *obj;
108 TRACE("(%p, %p, %s, %p)\n", iface, punkOuter, debugstr_guid(iid), ppvOut);
109 ret = This->ctor(punkOuter, &obj);
110 if (FAILED(ret))
111 return ret;
112 ret = IUnknown_QueryInterface(obj, iid, ppvOut);
113 IUnknown_Release(obj);
114 return ret;
117 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
119 ClassFactory *This = (ClassFactory *)iface;
121 TRACE("(%p)->(%x)\n", This, fLock);
123 if(fLock)
124 InterlockedIncrement(&BROWSEUI_refCount);
125 else
126 InterlockedDecrement(&BROWSEUI_refCount);
128 return S_OK;
131 static const IClassFactoryVtbl ClassFactoryVtbl = {
132 /* IUnknown */
133 ClassFactory_QueryInterface,
134 ClassFactory_AddRef,
135 ClassFactory_Release,
137 /* IClassFactory*/
138 ClassFactory_CreateInstance,
139 ClassFactory_LockServer
142 static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
144 ClassFactory *This = heap_alloc(sizeof(ClassFactory));
145 This->vtbl = &ClassFactoryVtbl;
146 This->ref = 1;
147 This->ctor = ctor;
148 *ppvOut = (LPVOID)This;
149 TRACE("Created class factory %p\n", This);
150 BROWSEUI_refCount++;
151 return S_OK;
154 /*************************************************************************
155 * BROWSEUI DllMain
157 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
159 TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
160 switch (fdwReason)
162 case DLL_WINE_PREATTACH:
163 return FALSE; /* prefer native version */
164 case DLL_PROCESS_ATTACH:
165 DisableThreadLibraryCalls(hinst);
166 BROWSEUI_hinstance = hinst;
167 break;
169 return TRUE;
172 /*************************************************************************
173 * DllCanUnloadNow (BROWSEUI.@)
175 HRESULT WINAPI DllCanUnloadNow(void)
177 return BROWSEUI_refCount ? S_FALSE : S_OK;
180 /***********************************************************************
181 * DllGetVersion (BROWSEUI.@)
183 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
185 if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
187 /* this is what IE6 on Windows 98 reports */
188 info->dwMajorVersion = 6;
189 info->dwMinorVersion = 0;
190 info->dwBuildNumber = 2600;
191 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
193 return NOERROR;
196 /***********************************************************************
197 * DllGetClassObject (BROWSEUI.@)
199 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *ppvOut)
201 int i;
203 *ppvOut = NULL;
204 if (!IsEqualIID(iid, &IID_IUnknown) && !IsEqualIID(iid, &IID_IClassFactory))
205 return E_NOINTERFACE;
207 for (i = 0; ClassesTable[i].clsid != NULL; i++)
208 if (IsEqualCLSID(ClassesTable[i].clsid, clsid)) {
209 return ClassFactory_Constructor(ClassesTable[i].ctor, ppvOut);
211 FIXME("CLSID %s not supported\n", debugstr_guid(clsid));
212 return CLASS_E_CLASSNOTAVAILABLE;