2004-04-16 02:26:14 +02:00
|
|
|
/*
|
|
|
|
* DXDiag
|
|
|
|
*
|
|
|
|
* Copyright 2004 Raphael Junqueira
|
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-04-16 02:26:14 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2004-04-16 02:26:14 +02:00
|
|
|
#include "config.h"
|
2010-12-07 13:13:45 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "oleauto.h"
|
|
|
|
#include "oleidl.h"
|
|
|
|
#include "rpcproxy.h"
|
|
|
|
#include "initguid.h"
|
2004-04-16 02:26:14 +02:00
|
|
|
#include "dxdiag_private.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
|
|
|
|
|
2011-04-04 03:55:26 +02:00
|
|
|
HINSTANCE dxdiagn_instance = 0;
|
2010-12-07 13:13:45 +01:00
|
|
|
|
2005-02-01 15:21:37 +01:00
|
|
|
LONG DXDIAGN_refCount = 0;
|
|
|
|
|
2004-04-16 02:26:14 +02:00
|
|
|
/* At process attach */
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
2006-10-06 23:01:04 +02:00
|
|
|
TRACE("%p,%x,%p\n", hInstDLL, fdwReason, lpvReserved);
|
2004-04-16 02:26:14 +02:00
|
|
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
2011-04-04 03:55:26 +02:00
|
|
|
dxdiagn_instance = hInstDLL;
|
2010-12-07 13:13:45 +01:00
|
|
|
DisableThreadLibraryCalls(hInstDLL);
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* DXDiag ClassFactory
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2011-08-01 10:39:18 +02:00
|
|
|
IClassFactory IClassFactory_iface;
|
2004-04-16 02:26:14 +02:00
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
static HRESULT WINAPI DXDiagCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2011-08-01 10:41:56 +02:00
|
|
|
if (ppv == NULL)
|
|
|
|
return E_POINTER;
|
2005-02-01 15:21:37 +01:00
|
|
|
|
2011-08-01 10:41:56 +02:00
|
|
|
if (IsEqualGUID(&IID_IUnknown, riid))
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
|
|
|
|
else if (IsEqualGUID(&IID_IClassFactory, riid))
|
|
|
|
TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
|
2015-05-07 10:24:15 +02:00
|
|
|
else if (IsEqualGUID(&IID_IExternalConnection, riid) ||
|
|
|
|
IsEqualGUID(&IID_IMarshal, riid)) {
|
|
|
|
TRACE("(%p)->(%s) ignoring\n", iface, debugstr_guid(riid));
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2011-08-01 10:41:56 +02:00
|
|
|
else {
|
|
|
|
FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = iface;
|
|
|
|
IClassFactory_AddRef(iface);
|
|
|
|
return S_OK;
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
static ULONG WINAPI DXDiagCF_AddRef(IClassFactory *iface)
|
|
|
|
{
|
2005-02-01 15:21:37 +01:00
|
|
|
DXDIAGN_LockModule();
|
|
|
|
|
|
|
|
return 2; /* non-heap based object */
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
static ULONG WINAPI DXDiagCF_Release(IClassFactory * iface)
|
|
|
|
{
|
2005-02-01 15:21:37 +01:00
|
|
|
DXDIAGN_UnlockModule();
|
|
|
|
|
|
|
|
return 1; /* non-heap based object */
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
static HRESULT WINAPI DXDiagCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid,
|
|
|
|
void **ppv)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
return DXDiag_CreateDXDiagProvider(iface, pOuter, riid, ppv);
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
static HRESULT WINAPI DXDiagCF_LockServer(IClassFactory *iface, BOOL dolock)
|
|
|
|
{
|
2005-02-01 15:21:37 +01:00
|
|
|
TRACE("(%d)\n", dolock);
|
|
|
|
|
|
|
|
if (dolock)
|
|
|
|
DXDIAGN_LockModule();
|
|
|
|
else
|
|
|
|
DXDIAGN_UnlockModule();
|
|
|
|
|
2004-04-16 02:26:14 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IClassFactoryVtbl DXDiagCF_Vtbl = {
|
2004-04-16 02:26:14 +02:00
|
|
|
DXDiagCF_QueryInterface,
|
|
|
|
DXDiagCF_AddRef,
|
|
|
|
DXDiagCF_Release,
|
|
|
|
DXDiagCF_CreateInstance,
|
|
|
|
DXDiagCF_LockServer
|
|
|
|
};
|
|
|
|
|
2011-08-01 10:39:18 +02:00
|
|
|
static IClassFactoryImpl DXDiag_CF = { { &DXDiagCF_Vtbl } };
|
2004-04-16 02:26:14 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2004-05-17 23:08:31 +02:00
|
|
|
* DllCanUnloadNow (DXDIAGN.@)
|
2004-04-16 02:26:14 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllCanUnloadNow(void)
|
|
|
|
{
|
2005-02-01 15:21:37 +01:00
|
|
|
return DXDIAGN_refCount != 0 ? S_FALSE : S_OK;
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2004-05-17 23:08:31 +02:00
|
|
|
* DllGetClassObject (DXDIAGN.@)
|
2004-04-16 02:26:14 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2006-07-04 15:59:53 +02:00
|
|
|
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
2011-08-01 10:39:18 +02:00
|
|
|
|
|
|
|
if (IsEqualGUID(rclsid, &CLSID_DxDiagProvider)) {
|
|
|
|
IClassFactory_AddRef(&DXDiag_CF.IClassFactory_iface);
|
|
|
|
*ppv = &DXDiag_CF.IClassFactory_iface;
|
|
|
|
return S_OK;
|
2004-04-16 02:26:14 +02:00
|
|
|
}
|
|
|
|
|
2006-07-04 15:59:53 +02:00
|
|
|
FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
2004-04-16 02:26:14 +02:00
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
2010-12-07 13:13:45 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllRegisterServer (DXDIAGN.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
|
|
|
{
|
2011-08-02 15:51:55 +02:00
|
|
|
return __wine_register_resources( dxdiagn_instance );
|
2010-12-07 13:13:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllUnregisterServer (DXDIAGN.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
|
|
|
{
|
2011-08-02 15:51:55 +02:00
|
|
|
return __wine_unregister_resources( dxdiagn_instance );
|
2010-12-07 13:13:45 +01:00
|
|
|
}
|