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

factory.c
Go to the documentation of this file.
00001 /*
00002  *  ClassFactory implementation for DEVENUM.dll
00003  *
00004  * Copyright (C) 2002 John K. Hohm
00005  * Copyright (C) 2002 Robert Shearman
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00020  */
00021 
00022 #include "devenum_private.h"
00023 
00024 #include "wine/debug.h"
00025 
00026 WINE_DEFAULT_DEBUG_CHANNEL(devenum);
00027 
00028 /**********************************************************************
00029  * DEVENUM_IClassFactory_QueryInterface (also IUnknown)
00030  */
00031 static HRESULT WINAPI DEVENUM_IClassFactory_QueryInterface(
00032     LPCLASSFACTORY iface,
00033     REFIID riid,
00034     LPVOID *ppvObj)
00035 {
00036     TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
00037 
00038     if (ppvObj == NULL) return E_POINTER;
00039 
00040     if (IsEqualGUID(riid, &IID_IUnknown) ||
00041     IsEqualGUID(riid, &IID_IClassFactory))
00042     {
00043         *ppvObj = iface;
00044     IClassFactory_AddRef(iface);
00045     return S_OK;
00046     }
00047     else if (IsEqualGUID(riid, &IID_IParseDisplayName))
00048     {
00049         return IClassFactory_CreateInstance(iface, NULL, riid, ppvObj);
00050     }
00051 
00052     FIXME("- no interface IID: %s\n", debugstr_guid(riid));
00053     return E_NOINTERFACE;
00054 }
00055 
00056 /**********************************************************************
00057  * DEVENUM_IClassFactory_AddRef (also IUnknown)
00058  */
00059 static ULONG WINAPI DEVENUM_IClassFactory_AddRef(LPCLASSFACTORY iface)
00060 {
00061     TRACE("\n");
00062 
00063     DEVENUM_LockModule();
00064 
00065     return 2; /* non-heap based object */
00066 }
00067 
00068 /**********************************************************************
00069  * DEVENUM_IClassFactory_Release (also IUnknown)
00070  */
00071 static ULONG WINAPI DEVENUM_IClassFactory_Release(LPCLASSFACTORY iface)
00072 {
00073     TRACE("\n");
00074 
00075     DEVENUM_UnlockModule();
00076 
00077     return 1; /* non-heap based object */
00078 }
00079 
00080 /**********************************************************************
00081  * DEVENUM_IClassFactory_CreateInstance
00082  */
00083 static HRESULT WINAPI DEVENUM_IClassFactory_CreateInstance(
00084     LPCLASSFACTORY iface,
00085     LPUNKNOWN pUnkOuter,
00086     REFIID riid,
00087     LPVOID *ppvObj)
00088 {
00089     TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
00090 
00091     if (ppvObj == NULL) return E_POINTER;
00092 
00093     /* Don't support aggregation (Windows doesn't) */
00094     if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
00095 
00096     if (IsEqualGUID(&IID_ICreateDevEnum, riid))
00097     {
00098         *ppvObj = &DEVENUM_CreateDevEnum;
00099         return S_OK;
00100     }
00101     if (IsEqualGUID(&IID_IParseDisplayName, riid))
00102     {
00103         *ppvObj = &DEVENUM_ParseDisplayName;
00104         return S_OK;
00105     }
00106 
00107     return CLASS_E_CLASSNOTAVAILABLE;
00108 }
00109 
00110 /**********************************************************************
00111  * DEVENUM_IClassFactory_LockServer
00112  */
00113 static HRESULT WINAPI DEVENUM_IClassFactory_LockServer(
00114     LPCLASSFACTORY iface,
00115     BOOL fLock)
00116 {
00117     TRACE("\n");
00118 
00119     if (fLock)
00120         DEVENUM_LockModule();
00121     else
00122         DEVENUM_UnlockModule();
00123     return S_OK;
00124 }
00125 
00126 /**********************************************************************
00127  * IClassFactory_Vtbl
00128  */
00129 static const IClassFactoryVtbl IClassFactory_Vtbl =
00130 {
00131     DEVENUM_IClassFactory_QueryInterface,
00132     DEVENUM_IClassFactory_AddRef,
00133     DEVENUM_IClassFactory_Release,
00134     DEVENUM_IClassFactory_CreateInstance,
00135     DEVENUM_IClassFactory_LockServer
00136 };
00137 
00138 /**********************************************************************
00139  * static ClassFactory instance
00140  */
00141 ClassFactoryImpl DEVENUM_ClassFactory = { &IClassFactory_Vtbl };

Generated on Sat May 26 2012 04:20:01 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.