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
27 #include "wine/debug.h"
38 DEFINE_GUID(CLSID_CompCatCacheDaemon
, 0x8C7461EF, 0x2b13, 0x11d2, 0xbe, 0x35, 0x30, 0x78, 0x30, 0x2c, 0x20, 0x30);
40 WINE_DEFAULT_DEBUG_CHANNEL(browseui
);
42 LONG BROWSEUI_refCount
= 0;
44 HINSTANCE BROWSEUI_hinstance
= 0;
46 typedef HRESULT (*LPFNCONSTRUCTOR
)(IUnknown
*pUnkOuter
, IUnknown
**ppvOut
);
52 {&CLSID_ACLMulti
, ACLMulti_Constructor
},
53 {&CLSID_ProgressDialog
, ProgressDialog_Constructor
},
54 {&CLSID_CompCatCacheDaemon
, CompCatCacheDaemon_Constructor
},
55 {&CLSID_ACListISF
, ACLShellSource_Constructor
},
59 typedef struct tagClassFactory
61 IClassFactory IClassFactory_iface
;
66 static inline ClassFactory
*impl_from_IClassFactory(IClassFactory
*iface
)
68 return CONTAINING_RECORD(iface
, ClassFactory
, IClassFactory_iface
);
71 static void ClassFactory_Destructor(ClassFactory
*This
)
73 TRACE("Destroying class factory %p\n", This
);
75 InterlockedDecrement(&BROWSEUI_refCount
);
78 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, LPVOID
*ppvOut
)
81 if (IsEqualIID(riid
, &IID_IClassFactory
) || IsEqualIID(riid
, &IID_IUnknown
)) {
82 IClassFactory_AddRef(iface
);
87 WARN("Unknown interface %s\n", debugstr_guid(riid
));
91 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
93 ClassFactory
*This
= impl_from_IClassFactory(iface
);
94 return InterlockedIncrement(&This
->ref
);
97 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
99 ClassFactory
*This
= impl_from_IClassFactory(iface
);
100 ULONG ret
= InterlockedDecrement(&This
->ref
);
103 ClassFactory_Destructor(This
);
107 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*punkOuter
, REFIID iid
, LPVOID
*ppvOut
)
109 ClassFactory
*This
= impl_from_IClassFactory(iface
);
113 TRACE("(%p, %p, %s, %p)\n", iface
, punkOuter
, debugstr_guid(iid
), ppvOut
);
114 ret
= This
->ctor(punkOuter
, &obj
);
117 ret
= IUnknown_QueryInterface(obj
, iid
, ppvOut
);
118 IUnknown_Release(obj
);
122 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
124 ClassFactory
*This
= impl_from_IClassFactory(iface
);
126 TRACE("(%p)->(%x)\n", This
, fLock
);
129 InterlockedIncrement(&BROWSEUI_refCount
);
131 InterlockedDecrement(&BROWSEUI_refCount
);
136 static const IClassFactoryVtbl ClassFactoryVtbl
= {
138 ClassFactory_QueryInterface
,
140 ClassFactory_Release
,
143 ClassFactory_CreateInstance
,
144 ClassFactory_LockServer
147 static HRESULT
ClassFactory_Constructor(LPFNCONSTRUCTOR ctor
, LPVOID
*ppvOut
)
149 ClassFactory
*This
= malloc(sizeof(*This
));
150 This
->IClassFactory_iface
.lpVtbl
= &ClassFactoryVtbl
;
153 *ppvOut
= &This
->IClassFactory_iface
;
154 TRACE("Created class factory %p\n", This
);
155 InterlockedIncrement(&BROWSEUI_refCount
);
159 /*************************************************************************
162 BOOL WINAPI
DllMain(HINSTANCE hinst
, DWORD fdwReason
, LPVOID fImpLoad
)
164 TRACE("%p 0x%lx %p\n", hinst
, fdwReason
, fImpLoad
);
167 case DLL_PROCESS_ATTACH
:
168 DisableThreadLibraryCalls(hinst
);
169 BROWSEUI_hinstance
= hinst
;
175 /*************************************************************************
176 * DllCanUnloadNow (BROWSEUI.@)
178 HRESULT WINAPI
DllCanUnloadNow(void)
180 return BROWSEUI_refCount
? S_FALSE
: S_OK
;
183 /***********************************************************************
184 * DllGetVersion (BROWSEUI.@)
186 HRESULT WINAPI
DllGetVersion(DLLVERSIONINFO
*info
)
188 if(info
->cbSize
== sizeof(DLLVERSIONINFO
) ||
189 info
->cbSize
== sizeof(DLLVERSIONINFO2
))
191 /* this is what IE6 on Windows 98 reports */
192 info
->dwMajorVersion
= 6;
193 info
->dwMinorVersion
= 0;
194 info
->dwBuildNumber
= 2600;
195 info
->dwPlatformID
= DLLVER_PLATFORM_WINDOWS
;
196 if(info
->cbSize
== sizeof(DLLVERSIONINFO2
))
198 DLLVERSIONINFO2
*info2
= (DLLVERSIONINFO2
*) info
;
200 info2
->ullVersion
= MAKEDLLVERULL(info
->dwMajorVersion
,
201 info
->dwMinorVersion
,
203 0); /* FIXME: correct hotfix number */
208 WARN("wrong DLLVERSIONINFO size from app.\n");
212 /***********************************************************************
213 * DllGetClassObject (BROWSEUI.@)
215 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID iid
, LPVOID
*ppvOut
)
220 if (!IsEqualIID(iid
, &IID_IUnknown
) && !IsEqualIID(iid
, &IID_IClassFactory
))
221 return E_NOINTERFACE
;
223 for (i
= 0; ClassesTable
[i
].clsid
!= NULL
; i
++)
224 if (IsEqualCLSID(ClassesTable
[i
].clsid
, clsid
)) {
225 return ClassFactory_Constructor(ClassesTable
[i
].ctor
, ppvOut
);
227 FIXME("CLSID %s not supported\n", debugstr_guid(clsid
));
228 return CLASS_E_CLASSNOTAVAILABLE
;
231 /***********************************************************************
232 * DllInstall (BROWSEUI.@)
234 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
236 FIXME("(%s, %s): stub\n", bInstall
? "TRUE" : "FALSE", debugstr_w(cmdline
));