ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dxdiag_main.c
Go to the documentation of this file.
00001 /*
00002  * DXDiag
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 LONG DXDIAGN_refCount = 0;
00029 
00030 /* At process attach */
00031 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
00032 {
00033   TRACE("%p,%lx,%p\n", hInstDLL, fdwReason, lpvReserved);
00034   if (fdwReason == DLL_PROCESS_ATTACH) {
00035     DisableThreadLibraryCalls(hInstDLL);
00036   }
00037   return TRUE;
00038 }
00039 
00040 /*******************************************************************************
00041  * DXDiag ClassFactory
00042  */
00043 typedef struct {
00044   const IClassFactoryVtbl *lpVtbl;
00045   REFCLSID   rclsid;
00046   HRESULT   (*pfnCreateInstanceFactory)(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj);
00047 } IClassFactoryImpl;
00048 
00049 static HRESULT WINAPI DXDiagCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
00050   FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
00051 
00052   if (ppobj == NULL) return E_POINTER;
00053 
00054   return E_NOINTERFACE;
00055 }
00056 
00057 static ULONG WINAPI DXDiagCF_AddRef(LPCLASSFACTORY iface) {
00058   DXDIAGN_LockModule();
00059 
00060   return 2; /* non-heap based object */
00061 }
00062 
00063 static ULONG WINAPI DXDiagCF_Release(LPCLASSFACTORY iface) {
00064   DXDIAGN_UnlockModule();
00065 
00066   return 1; /* non-heap based object */
00067 }
00068 
00069 static HRESULT WINAPI DXDiagCF_CreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj) {
00070   IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
00071   TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
00072 
00073   return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
00074 }
00075 
00076 static HRESULT WINAPI DXDiagCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
00077   TRACE("(%d)\n", dolock);
00078 
00079   if (dolock)
00080     DXDIAGN_LockModule();
00081   else
00082     DXDIAGN_UnlockModule();
00083 
00084   return S_OK;
00085 }
00086 
00087 static const IClassFactoryVtbl DXDiagCF_Vtbl = {
00088   DXDiagCF_QueryInterface,
00089   DXDiagCF_AddRef,
00090   DXDiagCF_Release,
00091   DXDiagCF_CreateInstance,
00092   DXDiagCF_LockServer
00093 };
00094 
00095 static IClassFactoryImpl DXDiag_CFS[] = {
00096   { &DXDiagCF_Vtbl, &CLSID_DxDiagProvider, DXDiag_CreateDXDiagProvider },
00097   { NULL, NULL, NULL }
00098 };
00099 
00100 /***********************************************************************
00101  *             DllCanUnloadNow (DXDIAGN.@)
00102  */
00103 HRESULT WINAPI DllCanUnloadNow(void)
00104 {
00105   return DXDIAGN_refCount != 0 ? S_FALSE : S_OK;
00106 }
00107 
00108 /***********************************************************************
00109  *      DllGetClassObject (DXDIAGN.@)
00110  */
00111 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
00112 {
00113     int i = 0;
00114 
00115     TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
00116     while (NULL != DXDiag_CFS[i].rclsid) {
00117       if (IsEqualGUID(rclsid, DXDiag_CFS[i].rclsid)) {
00118           DXDiagCF_AddRef((IClassFactory*) &DXDiag_CFS[i]);
00119           *ppv = &DXDiag_CFS[i];
00120           return S_OK;
00121       }
00122       ++i;
00123     }
00124 
00125     FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
00126     return CLASS_E_CLASSNOTAVAILABLE;
00127 }

Generated on Mon May 28 2012 04:21:19 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.