2007-02-05 17:51:05 +01:00
|
|
|
/*
|
|
|
|
* browseui - Internet Explorer / Windows Explorer standard UI
|
|
|
|
*
|
|
|
|
* Copyright 2001 John R. Sheets (for CodeWeavers)
|
|
|
|
* Copyright 2004 Mike McCormack (for CodeWeavers)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2007-02-05 17:52:17 +01:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2007-02-05 17:51:05 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "shlwapi.h"
|
2007-02-05 17:53:42 +01:00
|
|
|
#include "shlguid.h"
|
2010-12-08 12:01:31 +01:00
|
|
|
#include "rpcproxy.h"
|
2007-02-05 17:51:05 +01:00
|
|
|
|
2018-01-29 22:50:42 +01:00
|
|
|
#include "wine/heap.h"
|
2007-02-05 17:53:42 +01:00
|
|
|
#include "browseui.h"
|
|
|
|
|
2008-02-11 19:18:07 +01:00
|
|
|
#include "initguid.h"
|
|
|
|
DEFINE_GUID(CLSID_CompCatCacheDaemon, 0x8C7461EF, 0x2b13, 0x11d2, 0xbe, 0x35, 0x30, 0x78, 0x30, 0x2c, 0x20, 0x30);
|
|
|
|
|
2007-02-05 17:51:05 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
|
|
|
|
|
|
|
|
LONG BROWSEUI_refCount = 0;
|
|
|
|
|
2007-10-04 00:13:26 +02:00
|
|
|
HINSTANCE BROWSEUI_hinstance = 0;
|
2007-02-05 17:51:05 +01:00
|
|
|
|
2008-02-16 14:05:32 +01:00
|
|
|
typedef HRESULT (*LPFNCONSTRUCTOR)(IUnknown *pUnkOuter, IUnknown **ppvOut);
|
2007-02-05 17:52:17 +01:00
|
|
|
|
|
|
|
static const struct {
|
|
|
|
REFCLSID clsid;
|
|
|
|
LPFNCONSTRUCTOR ctor;
|
|
|
|
} ClassesTable[] = {
|
2007-02-05 17:53:42 +01:00
|
|
|
{&CLSID_ACLMulti, ACLMulti_Constructor},
|
2007-10-04 00:13:26 +02:00
|
|
|
{&CLSID_ProgressDialog, ProgressDialog_Constructor},
|
2008-02-11 19:18:07 +01:00
|
|
|
{&CLSID_CompCatCacheDaemon, CompCatCacheDaemon_Constructor},
|
2008-10-07 20:58:47 +02:00
|
|
|
{&CLSID_ACListISF, ACLShellSource_Constructor},
|
2007-02-05 17:52:17 +01:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct tagClassFactory
|
|
|
|
{
|
2010-12-08 22:59:27 +01:00
|
|
|
IClassFactory IClassFactory_iface;
|
2007-02-05 17:52:17 +01:00
|
|
|
LONG ref;
|
|
|
|
LPFNCONSTRUCTOR ctor;
|
|
|
|
} ClassFactory;
|
|
|
|
|
2010-12-08 22:59:27 +01:00
|
|
|
static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
2007-02-05 17:52:17 +01:00
|
|
|
static void ClassFactory_Destructor(ClassFactory *This)
|
|
|
|
{
|
|
|
|
TRACE("Destroying class factory %p\n", This);
|
2008-02-22 02:22:59 +01:00
|
|
|
heap_free(This);
|
2015-03-01 03:46:06 +01:00
|
|
|
InterlockedDecrement(&BROWSEUI_refCount);
|
2007-02-05 17:52:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
|
|
|
*ppvOut = NULL;
|
|
|
|
if (IsEqualIID(riid, &IID_IClassFactory) || IsEqualIID(riid, &IID_IUnknown)) {
|
|
|
|
IClassFactory_AddRef(iface);
|
|
|
|
*ppvOut = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("Unknown interface %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
|
|
|
|
{
|
2010-12-08 22:59:27 +01:00
|
|
|
ClassFactory *This = impl_from_IClassFactory(iface);
|
2007-02-05 17:52:17 +01:00
|
|
|
return InterlockedIncrement(&This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
|
|
|
|
{
|
2010-12-08 22:59:27 +01:00
|
|
|
ClassFactory *This = impl_from_IClassFactory(iface);
|
2007-02-05 17:52:17 +01:00
|
|
|
ULONG ret = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
ClassFactory_Destructor(This);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2010-12-08 22:59:27 +01:00
|
|
|
ClassFactory *This = impl_from_IClassFactory(iface);
|
2007-02-05 17:52:17 +01:00
|
|
|
HRESULT ret;
|
|
|
|
IUnknown *obj;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %s, %p)\n", iface, punkOuter, debugstr_guid(iid), ppvOut);
|
|
|
|
ret = This->ctor(punkOuter, &obj);
|
|
|
|
if (FAILED(ret))
|
|
|
|
return ret;
|
|
|
|
ret = IUnknown_QueryInterface(obj, iid, ppvOut);
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
|
|
|
|
{
|
2010-12-08 22:59:27 +01:00
|
|
|
ClassFactory *This = impl_from_IClassFactory(iface);
|
2007-05-06 19:31:07 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%x)\n", This, fLock);
|
|
|
|
|
|
|
|
if(fLock)
|
2007-05-07 18:13:35 +02:00
|
|
|
InterlockedIncrement(&BROWSEUI_refCount);
|
2007-05-06 19:31:07 +02:00
|
|
|
else
|
2007-05-07 18:13:35 +02:00
|
|
|
InterlockedDecrement(&BROWSEUI_refCount);
|
2007-05-06 19:31:07 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2007-02-05 17:52:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IClassFactoryVtbl ClassFactoryVtbl = {
|
|
|
|
/* IUnknown */
|
|
|
|
ClassFactory_QueryInterface,
|
|
|
|
ClassFactory_AddRef,
|
|
|
|
ClassFactory_Release,
|
|
|
|
|
|
|
|
/* IClassFactory*/
|
|
|
|
ClassFactory_CreateInstance,
|
|
|
|
ClassFactory_LockServer
|
|
|
|
};
|
|
|
|
|
2008-02-22 02:22:59 +01:00
|
|
|
static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
|
|
|
|
{
|
|
|
|
ClassFactory *This = heap_alloc(sizeof(ClassFactory));
|
2010-12-08 22:59:27 +01:00
|
|
|
This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl;
|
2008-02-22 02:22:59 +01:00
|
|
|
This->ref = 1;
|
|
|
|
This->ctor = ctor;
|
2015-03-20 09:19:22 +01:00
|
|
|
*ppvOut = &This->IClassFactory_iface;
|
2008-02-22 02:22:59 +01:00
|
|
|
TRACE("Created class factory %p\n", This);
|
2015-03-01 03:46:06 +01:00
|
|
|
InterlockedIncrement(&BROWSEUI_refCount);
|
2008-02-22 02:22:59 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-02-05 17:51:05 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* BROWSEUI DllMain
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
|
|
|
|
{
|
2022-02-09 09:25:01 +01:00
|
|
|
TRACE("%p 0x%lx %p\n", hinst, fdwReason, fImpLoad);
|
2007-02-05 17:51:05 +01:00
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(hinst);
|
2007-10-04 00:13:26 +02:00
|
|
|
BROWSEUI_hinstance = hinst;
|
2007-02-05 17:51:05 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* DllCanUnloadNow (BROWSEUI.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllCanUnloadNow(void)
|
|
|
|
{
|
|
|
|
return BROWSEUI_refCount ? S_FALSE : S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllGetVersion (BROWSEUI.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
|
|
|
|
{
|
2010-08-13 16:30:58 +02:00
|
|
|
if(info->cbSize == sizeof(DLLVERSIONINFO) ||
|
|
|
|
info->cbSize == sizeof(DLLVERSIONINFO2))
|
|
|
|
{
|
|
|
|
/* this is what IE6 on Windows 98 reports */
|
|
|
|
info->dwMajorVersion = 6;
|
|
|
|
info->dwMinorVersion = 0;
|
|
|
|
info->dwBuildNumber = 2600;
|
|
|
|
info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
|
|
|
|
if(info->cbSize == sizeof(DLLVERSIONINFO2))
|
|
|
|
{
|
|
|
|
DLLVERSIONINFO2 *info2 = (DLLVERSIONINFO2*) info;
|
|
|
|
info2->dwFlags = 0;
|
|
|
|
info2->ullVersion = MAKEDLLVERULL(info->dwMajorVersion,
|
|
|
|
info->dwMinorVersion,
|
|
|
|
info->dwBuildNumber,
|
|
|
|
0); /* FIXME: correct hotfix number */
|
|
|
|
}
|
|
|
|
return S_OK;
|
|
|
|
}
|
2007-02-05 17:51:05 +01:00
|
|
|
|
2010-08-13 16:30:58 +02:00
|
|
|
WARN("wrong DLLVERSIONINFO size from app.\n");
|
|
|
|
return E_INVALIDARG;
|
2007-02-05 17:51:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllGetClassObject (BROWSEUI.@)
|
|
|
|
*/
|
2007-02-05 17:52:17 +01:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *ppvOut)
|
2007-02-05 17:51:05 +01:00
|
|
|
{
|
2007-02-05 17:52:17 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
if (!IsEqualIID(iid, &IID_IUnknown) && !IsEqualIID(iid, &IID_IClassFactory))
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
for (i = 0; ClassesTable[i].clsid != NULL; i++)
|
|
|
|
if (IsEqualCLSID(ClassesTable[i].clsid, clsid)) {
|
|
|
|
return ClassFactory_Constructor(ClassesTable[i].ctor, ppvOut);
|
|
|
|
}
|
2007-02-05 17:53:42 +01:00
|
|
|
FIXME("CLSID %s not supported\n", debugstr_guid(clsid));
|
2007-02-05 17:51:05 +01:00
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
2009-06-25 00:26:32 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllInstall (BROWSEUI.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
|
|
|
|
return S_OK;
|
|
|
|
}
|