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  * Copyright (C) 2008 Google (Roy Shea)
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #include "mstask_private.h"
00020 #include "wine/debug.h"
00021 
00022 WINE_DEFAULT_DEBUG_CHANNEL(mstask);
00023 
00024 struct ClassFactoryImpl
00025 {
00026     IClassFactory IClassFactory_iface;
00027     LONG ref;
00028 };
00029 
00030 static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
00031 {
00032     return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
00033 }
00034 
00035 static HRESULT WINAPI MSTASK_IClassFactory_QueryInterface(
00036         LPCLASSFACTORY iface,
00037         REFIID riid,
00038         LPVOID *ppvObj)
00039 {
00040     ClassFactoryImpl *This = impl_from_IClassFactory(iface);
00041 
00042     TRACE("IID: %s\n",debugstr_guid(riid));
00043     if (ppvObj == NULL)
00044         return E_POINTER;
00045 
00046     if (IsEqualGUID(riid, &IID_IUnknown) ||
00047             IsEqualGUID(riid, &IID_IClassFactory))
00048     {
00049         *ppvObj = &This->IClassFactory_iface;
00050         IClassFactory_AddRef(iface);
00051         return S_OK;
00052     }
00053 
00054     WARN("Unknown interface: %s\n", debugstr_guid(riid));
00055     *ppvObj = NULL;
00056     return E_NOINTERFACE;
00057 }
00058 
00059 static ULONG WINAPI MSTASK_IClassFactory_AddRef(LPCLASSFACTORY iface)
00060 {
00061     TRACE("\n");
00062     InterlockedIncrement(&dll_ref);
00063     return 2;
00064 }
00065 
00066 static ULONG WINAPI MSTASK_IClassFactory_Release(LPCLASSFACTORY iface)
00067 {
00068     TRACE("\n");
00069     InterlockedDecrement(&dll_ref);
00070     return 1;
00071 }
00072 
00073 static HRESULT WINAPI MSTASK_IClassFactory_CreateInstance(
00074         LPCLASSFACTORY iface,
00075         LPUNKNOWN pUnkOuter,
00076         REFIID riid,
00077         LPVOID *ppvObj)
00078 {
00079     HRESULT res;
00080     IUnknown *punk = NULL;
00081     *ppvObj = NULL;
00082 
00083     TRACE("IID: %s\n",debugstr_guid(riid));
00084 
00085     if (pUnkOuter)
00086         return CLASS_E_NOAGGREGATION;
00087 
00088     res = TaskSchedulerConstructor((LPVOID*) &punk);
00089     if (FAILED(res))
00090         return res;
00091 
00092     res = ITaskScheduler_QueryInterface(punk, riid, ppvObj);
00093     ITaskScheduler_Release(punk);
00094     return res;
00095 }
00096 
00097 static HRESULT WINAPI MSTASK_IClassFactory_LockServer(
00098         LPCLASSFACTORY iface,
00099         BOOL fLock)
00100 {
00101     TRACE("\n");
00102 
00103     if (fLock != FALSE)
00104         MSTASK_IClassFactory_AddRef(iface);
00105     else
00106         MSTASK_IClassFactory_Release(iface);
00107     return S_OK;
00108 }
00109 
00110 static const IClassFactoryVtbl IClassFactory_Vtbl =
00111 {
00112     MSTASK_IClassFactory_QueryInterface,
00113     MSTASK_IClassFactory_AddRef,
00114     MSTASK_IClassFactory_Release,
00115     MSTASK_IClassFactory_CreateInstance,
00116     MSTASK_IClassFactory_LockServer
00117 };
00118 
00119 ClassFactoryImpl MSTASK_ClassFactory = { { &IClassFactory_Vtbl } };

Generated on Sun May 27 2012 04:21:28 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.