ReactOS  0.4.13-dev-551-gf37fb1f
dxdiag_main.c
Go to the documentation of this file.
1 /*
2  * DXDiag
3  *
4  * Copyright 2004 Raphael Junqueira
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  */
21 
22 #define COBJMACROS
23 
24 #include "config.h"
25 #include <stdarg.h>
26 
27 #include "windef.h"
28 #include "winbase.h"
29 #include "objbase.h"
30 #include "oleauto.h"
31 #include "oleidl.h"
32 #include "rpcproxy.h"
33 #include "initguid.h"
34 #include "dxdiag_private.h"
35 #include "wine/debug.h"
36 
38 
40 
42 
43 /* At process attach */
45 {
46  TRACE("%p,%x,%p\n", hInstDLL, fdwReason, lpvReserved);
47  if (fdwReason == DLL_PROCESS_ATTACH) {
48  dxdiagn_instance = hInstDLL;
49  DisableThreadLibraryCalls(hInstDLL);
50  }
51  return TRUE;
52 }
53 
54 /*******************************************************************************
55  * DXDiag ClassFactory
56  */
57 typedef struct {
58  IClassFactory IClassFactory_iface;
60 
62 {
63  if (ppv == NULL)
64  return E_POINTER;
65 
67  TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
69  TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
70  else if (IsEqualGUID(&IID_IExternalConnection, riid) ||
71  IsEqualGUID(&IID_IMarshal, riid)) {
72  TRACE("(%p)->(%s) ignoring\n", iface, debugstr_guid(riid));
73  *ppv = NULL;
74  return E_NOINTERFACE;
75  }
76  else {
77  FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
78  *ppv = NULL;
79  return E_NOINTERFACE;
80  }
81 
82  *ppv = iface;
83  IClassFactory_AddRef(iface);
84  return S_OK;
85 }
86 
88 {
90 
91  return 2; /* non-heap based object */
92 }
93 
95 {
97 
98  return 1; /* non-heap based object */
99 }
100 
102  void **ppv)
103 {
104  TRACE("(%p)->(%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid), ppv);
105 
106  return DXDiag_CreateDXDiagProvider(iface, pOuter, riid, ppv);
107 }
108 
110 {
111  TRACE("(%d)\n", dolock);
112 
113  if (dolock)
115  else
117 
118  return S_OK;
119 }
120 
121 static const IClassFactoryVtbl DXDiagCF_Vtbl = {
127 };
128 
130 
131 /***********************************************************************
132  * DllCanUnloadNow (DXDIAGN.@)
133  */
135 {
136  return DXDIAGN_refCount != 0 ? S_FALSE : S_OK;
137 }
138 
139 /***********************************************************************
140  * DllGetClassObject (DXDIAGN.@)
141  */
143 {
144  TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
145 
146  if (IsEqualGUID(rclsid, &CLSID_DxDiagProvider)) {
147  IClassFactory_AddRef(&DXDiag_CF.IClassFactory_iface);
149  return S_OK;
150  }
151 
152  FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
154 }
155 
156 /***********************************************************************
157  * DllRegisterServer (DXDIAGN.@)
158  */
160 {
162 }
163 
164 /***********************************************************************
165  * DllUnregisterServer (DXDIAGN.@)
166  */
168 {
170 }
HRESULT WINAPI DllCanUnloadNow(void)
Definition: dxdiag_main.c:134
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: dxdiag_main.c:44
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: provider.c:216
REFIID riid
Definition: precomp.h:44
static ULONG WINAPI DXDiagCF_Release(IClassFactory *iface)
Definition: dxdiag_main.c:94
#define REFCLSID
Definition: guiddef.h:112
REFIID LPVOID * ppv
Definition: atlbase.h:39
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static const IClassFactoryVtbl DXDiagCF_Vtbl
Definition: dxdiag_main.c:121
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
LONG DXDIAGN_refCount
Definition: dxdiag_main.c:41
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
static IN DWORD IN LPVOID lpvReserved
static void DXDIAGN_UnlockModule(void)
HRESULT WINAPI DllUnregisterServer(void)
Definition: dxdiag_main.c:167
static void DXDIAGN_LockModule(void)
struct tagIClassFactoryImpl IClassFactoryImpl
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: dxdiag_main.c:142
HRESULT WINAPI DllRegisterServer(void)
Definition: dxdiag_main.c:159
static HRESULT WINAPI DXDiagCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: dxdiag_main.c:101
static IClassFactoryImpl DXDiag_CF
Definition: dxdiag_main.c:129
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static HRESULT WINAPI DXDiagCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: dxdiag_main.c:109
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
static HRESULT WINAPI DXDiagCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: dxdiag_main.c:61
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
WINE_DEFAULT_DEBUG_CHANNEL(dxdiag)
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
static ULONG WINAPI DXDiagCF_AddRef(IClassFactory *iface)
Definition: dxdiag_main.c:87
#define S_OK
Definition: intsafe.h:59
IClassFactory IClassFactory_iface
Definition: main.c:58
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
HINSTANCE dxdiagn_instance
Definition: dxdiag_main.c:39
unsigned int ULONG
Definition: retypes.h:1
#define E_POINTER
Definition: winerror.h:2365
const GUID IID_IClassFactory