Added dxdiagn.dll with a simple implementation of IDxDiagProvider.
[wine/wine64.git] / dlls / dxdiagn / provider.c
blobafc8554a98dcebd83facbe77cfe293539a25bfb3
1 /*
2 * IDxDiagProvider Implementation
3 *
4 * Copyright 2004 Raphael Junqueira
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
23 #include "dxdiag_private.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
28 /* IDxDiagProvider IUnknown parts follow: */
29 HRESULT WINAPI IDxDiagProviderImpl_QueryInterface(PDXDIAGPROVIDER iface, REFIID riid, LPVOID *ppobj)
31 ICOM_THIS(IDxDiagProviderImpl,iface);
33 if (IsEqualGUID(riid, &IID_IUnknown)
34 || IsEqualGUID(riid, &IID_IDxDiagProvider)) {
35 IDxDiagProviderImpl_AddRef(iface);
36 *ppobj = This;
37 return S_OK;
40 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
41 return E_NOINTERFACE;
44 ULONG WINAPI IDxDiagProviderImpl_AddRef(PDXDIAGPROVIDER iface) {
45 ICOM_THIS(IDxDiagProviderImpl,iface);
46 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
47 return ++(This->ref);
50 ULONG WINAPI IDxDiagProviderImpl_Release(PDXDIAGPROVIDER iface) {
51 ICOM_THIS(IDxDiagProviderImpl,iface);
52 ULONG ref = --This->ref;
53 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
54 if (ref == 0) {
55 HeapFree(GetProcessHeap(), 0, This);
57 return ref;
60 /* IDxDiagProvider Interface follow: */
61 HRESULT WINAPI IDxDiagProviderImpl_Initialize(PDXDIAGPROVIDER iface, DXDIAG_INIT_PARAMS* pParams) {
62 return S_OK;
65 HRESULT WINAPI IDxDiagProviderImpl_GetRootContainer(PDXDIAGPROVIDER iface, IDxDiagContainer** ppInstance) {
66 return S_OK;
69 ICOM_VTABLE(IDxDiagProvider) DxDiagProvider_Vtbl =
71 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
72 IDxDiagProviderImpl_QueryInterface,
73 IDxDiagProviderImpl_AddRef,
74 IDxDiagProviderImpl_Release,
75 IDxDiagProviderImpl_Initialize,
76 IDxDiagProviderImpl_GetRootContainer
79 HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
80 IDxDiagProviderImpl* provider;
82 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
84 provider = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDxDiagProviderImpl));
85 if (NULL == provider) {
86 *ppobj = NULL;
87 return E_OUTOFMEMORY;
89 provider->lpVtbl = &DxDiagProvider_Vtbl;
90 provider->ref = 0; /* will be inited with QueryInterface */
91 return IDxDiagProviderImpl_QueryInterface ((PDXDIAGPROVIDER)provider, riid, ppobj);