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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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 {
|
2005-06-01 21:57:42 +02:00
|
|
|
const IClassFactoryVtbl *lpVtbl;
|
2004-04-16 02:26:14 +02:00
|
|
|
REFCLSID rclsid;
|
|
|
|
HRESULT (*pfnCreateInstanceFactory)(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj);
|
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
|
|
|
static HRESULT WINAPI DXDiagCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2005-02-01 15:21:37 +01:00
|
|
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
|
|
|
|
|
|
|
if (ppobj == NULL) return E_POINTER;
|
2004-04-16 02:26:14 +02:00
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DXDiagCF_AddRef(LPCLASSFACTORY 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
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DXDiagCF_Release(LPCLASSFACTORY 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
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DXDiagCF_CreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj) {
|
2004-09-06 22:34:29 +02:00
|
|
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
2004-04-16 02:26:14 +02:00
|
|
|
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
2005-02-01 15:21:37 +01:00
|
|
|
|
2004-04-16 02:26:14 +02:00
|
|
|
return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DXDiagCF_LockServer(LPCLASSFACTORY 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
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactoryImpl DXDiag_CFS[] = {
|
2005-02-01 15:21:37 +01:00
|
|
|
{ &DXDiagCF_Vtbl, &CLSID_DxDiagProvider, DXDiag_CreateDXDiagProvider },
|
|
|
|
{ NULL, NULL, NULL }
|
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)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
2006-07-04 15:59:53 +02:00
|
|
|
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
2004-04-16 02:26:14 +02:00
|
|
|
while (NULL != DXDiag_CFS[i].rclsid) {
|
|
|
|
if (IsEqualGUID(rclsid, DXDiag_CFS[i].rclsid)) {
|
|
|
|
DXDiagCF_AddRef((IClassFactory*) &DXDiag_CFS[i]);
|
|
|
|
*ppv = &DXDiag_CFS[i];
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
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-04-04 03:55:26 +02:00
|
|
|
return __wine_register_resources( dxdiagn_instance, NULL );
|
2010-12-07 13:13:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllUnregisterServer (DXDIAGN.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
|
|
|
{
|
2011-04-04 03:55:26 +02:00
|
|
|
return __wine_unregister_resources( dxdiagn_instance, NULL );
|
2010-12-07 13:13:45 +01:00
|
|
|
}
|