Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenprovider.c
Go to the documentation of this file.
00001 /* 00002 * IDxDiagProvider Implementation 00003 * 00004 * Copyright 2004 Raphael Junqueira 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #include "config.h" 00023 #include "dxdiag_private.h" 00024 #include "wine/debug.h" 00025 00026 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag); 00027 00028 /* IDxDiagProvider IUnknown parts follow: */ 00029 HRESULT WINAPI IDxDiagProviderImpl_QueryInterface(PDXDIAGPROVIDER iface, REFIID riid, LPVOID *ppobj) 00030 { 00031 IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface; 00032 00033 if (IsEqualGUID(riid, &IID_IUnknown) 00034 || IsEqualGUID(riid, &IID_IDxDiagProvider)) { 00035 IDxDiagProviderImpl_AddRef(iface); 00036 *ppobj = This; 00037 return S_OK; 00038 } 00039 00040 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); 00041 return E_NOINTERFACE; 00042 } 00043 00044 ULONG WINAPI IDxDiagProviderImpl_AddRef(PDXDIAGPROVIDER iface) { 00045 IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface; 00046 TRACE("(%p) : AddRef from %ld\n", This, This->ref); 00047 return ++(This->ref); 00048 } 00049 00050 ULONG WINAPI IDxDiagProviderImpl_Release(PDXDIAGPROVIDER iface) { 00051 IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface; 00052 ULONG ref = --This->ref; 00053 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); 00054 if (ref == 0) { 00055 HeapFree(GetProcessHeap(), 0, This); 00056 } 00057 return ref; 00058 } 00059 00060 /* IDxDiagProvider Interface follow: */ 00061 HRESULT WINAPI IDxDiagProviderImpl_Initialize(PDXDIAGPROVIDER iface, DXDIAG_INIT_PARAMS* pParams) { 00062 IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface; 00063 TRACE("(%p,%p)\n", iface, pParams); 00064 00065 if (NULL == pParams) { 00066 return E_POINTER; 00067 } 00068 if (pParams->dwSize != sizeof(DXDIAG_INIT_PARAMS)) { 00069 return E_INVALIDARG; 00070 } 00071 00072 This->init = TRUE; 00073 memcpy(&This->params, pParams, pParams->dwSize); 00074 return S_OK; 00075 } 00076 00077 HRESULT WINAPI IDxDiagProviderImpl_GetRootContainer(PDXDIAGPROVIDER iface, IDxDiagContainer** ppInstance) { 00078 HRESULT hr = S_OK; 00079 IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface; 00080 TRACE("(%p,%p)\n", iface, ppInstance); 00081 00082 if (NULL == ppInstance) { 00083 return E_INVALIDARG; 00084 } 00085 if (FALSE == This->init) { 00086 return E_INVALIDARG; /* should be E_CO_UNINITIALIZED */ 00087 } 00088 if (NULL == This->pRootContainer) { 00089 hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &This->pRootContainer); 00090 if (FAILED(hr)) { 00091 return hr; 00092 } 00093 } 00094 return IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER)This->pRootContainer, &IID_IDxDiagContainer, (void**) ppInstance); 00095 } 00096 00097 IDxDiagProviderVtbl DxDiagProvider_Vtbl = 00098 { 00099 IDxDiagProviderImpl_QueryInterface, 00100 IDxDiagProviderImpl_AddRef, 00101 IDxDiagProviderImpl_Release, 00102 IDxDiagProviderImpl_Initialize, 00103 IDxDiagProviderImpl_GetRootContainer 00104 }; 00105 00106 HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) { 00107 IDxDiagProviderImpl* provider; 00108 00109 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj); 00110 00111 provider = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDxDiagProviderImpl)); 00112 if (NULL == provider) { 00113 *ppobj = NULL; 00114 return E_OUTOFMEMORY; 00115 } 00116 provider->lpVtbl = &DxDiagProvider_Vtbl; 00117 provider->ref = 0; /* will be inited with QueryInterface */ 00118 return IDxDiagProviderImpl_QueryInterface ((PDXDIAGPROVIDER)provider, riid, ppobj); 00119 } Generated on Sun May 27 2012 04:21:47 for ReactOS by
1.7.6.1
|