ReactOS 0.4.16-dev-329-g9223134
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 <stdarg.h>
25
26#include "windef.h"
27#include "winbase.h"
28#include "objbase.h"
29#include "oleauto.h"
30#include "oleidl.h"
31#include "rpcproxy.h"
32#include "initguid.h"
33#include "dxdiag_private.h"
34#include "wine/debug.h"
35
37
39
41
42/* At process attach */
44{
45 TRACE("%p,%x,%p\n", hInstDLL, fdwReason, lpvReserved);
46 if (fdwReason == DLL_PROCESS_ATTACH) {
47 dxdiagn_instance = hInstDLL;
49 }
50 return TRUE;
51}
52
53/*******************************************************************************
54 * DXDiag ClassFactory
55 */
56typedef struct {
57 IClassFactory IClassFactory_iface;
59
61{
62 if (ppv == NULL)
63 return E_POINTER;
64
66 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
68 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
69 else if (IsEqualGUID(&IID_IExternalConnection, riid) ||
70 IsEqualGUID(&IID_IMarshal, riid)) {
71 TRACE("(%p)->(%s) ignoring\n", iface, debugstr_guid(riid));
72 *ppv = NULL;
73 return E_NOINTERFACE;
74 }
75 else {
76 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
77 *ppv = NULL;
78 return E_NOINTERFACE;
79 }
80
81 *ppv = iface;
82 IClassFactory_AddRef(iface);
83 return S_OK;
84}
85
87{
89
90 return 2; /* non-heap based object */
91}
92
94{
96
97 return 1; /* non-heap based object */
98}
99
101 void **ppv)
102{
103 TRACE("(%p)->(%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid), ppv);
104
105 return DXDiag_CreateDXDiagProvider(iface, pOuter, riid, ppv);
106}
107
109{
110 TRACE("(%d)\n", dolock);
111
112 if (dolock)
114 else
116
117 return S_OK;
118}
119
120static const IClassFactoryVtbl DXDiagCF_Vtbl = {
126};
127
129
130/***********************************************************************
131 * DllCanUnloadNow (DXDIAGN.@)
132 */
134{
135 return DXDIAGN_refCount != 0 ? S_FALSE : S_OK;
136}
137
138/***********************************************************************
139 * DllGetClassObject (DXDIAGN.@)
140 */
142{
143 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
144
145 if (IsEqualGUID(rclsid, &CLSID_DxDiagProvider)) {
146 IClassFactory_AddRef(&DXDiag_CF.IClassFactory_iface);
148 return S_OK;
149 }
150
151 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
153}
154
155/***********************************************************************
156 * DllRegisterServer (DXDIAGN.@)
157 */
159{
161}
162
163/***********************************************************************
164 * DllUnregisterServer (DXDIAGN.@)
165 */
167{
169}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HINSTANCE dxdiagn_instance
Definition: dxdiag_main.c:38
HRESULT WINAPI DllRegisterServer(void)
Definition: dxdiag_main.c:158
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: dxdiag_main.c:43
static const IClassFactoryVtbl DXDiagCF_Vtbl
Definition: dxdiag_main.c:120
HRESULT WINAPI DllUnregisterServer(void)
Definition: dxdiag_main.c:166
LONG DXDIAGN_refCount
Definition: dxdiag_main.c:40
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: dxdiag_main.c:141
static HRESULT WINAPI DXDiagCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: dxdiag_main.c:108
static IClassFactoryImpl DXDiag_CF
Definition: dxdiag_main.c:128
static HRESULT WINAPI DXDiagCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: dxdiag_main.c:100
HRESULT WINAPI DllCanUnloadNow(void)
Definition: dxdiag_main.c:133
static ULONG WINAPI DXDiagCF_Release(IClassFactory *iface)
Definition: dxdiag_main.c:93
static HRESULT WINAPI DXDiagCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: dxdiag_main.c:60
static ULONG WINAPI DXDiagCF_AddRef(IClassFactory *iface)
Definition: dxdiag_main.c:86
static void DXDIAGN_UnlockModule(void)
static void DXDIAGN_LockModule(void)
HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN
Definition: provider.c:219
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
static IN DWORD IN LPVOID lpvReserved
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define TRACE(s)
Definition: solgame.cpp:4
IClassFactory IClassFactory_iface
Definition: main.c:58
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663