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

hnetcfg.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Jeff Latimer
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 <stdarg.h>
00020 
00021 #define COBJMACROS
00022 
00023 #include "windef.h"
00024 #include "winbase.h"
00025 #include "objbase.h"
00026 #include "rpcproxy.h"
00027 #include "netfw.h"
00028 
00029 #include "wine/debug.h"
00030 #include "hnetcfg_private.h"
00031 
00032 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
00033 
00034 static HINSTANCE instance;
00035 
00036 typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj );
00037 
00038 typedef struct
00039 {
00040     IClassFactory IClassFactory_iface;
00041     fnCreateInstance pfnCreateInstance;
00042 } hnetcfg_cf;
00043 
00044 static inline hnetcfg_cf *impl_from_IClassFactory( IClassFactory *iface )
00045 {
00046     return CONTAINING_RECORD(iface, hnetcfg_cf, IClassFactory_iface);
00047 }
00048 
00049 static HRESULT WINAPI hnetcfg_cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj )
00050 {
00051     if (IsEqualGUID(riid, &IID_IUnknown) ||
00052         IsEqualGUID(riid, &IID_IClassFactory))
00053     {
00054         IClassFactory_AddRef( iface );
00055         *ppobj = iface;
00056         return S_OK;
00057     }
00058     FIXME("interface %s not implemented\n", debugstr_guid(riid));
00059     return E_NOINTERFACE;
00060 }
00061 
00062 static ULONG WINAPI hnetcfg_cf_AddRef( IClassFactory *iface )
00063 {
00064     return 2;
00065 }
00066 
00067 static ULONG WINAPI hnetcfg_cf_Release( IClassFactory *iface )
00068 {
00069     return 1;
00070 }
00071 
00072 static HRESULT WINAPI hnetcfg_cf_CreateInstance( IClassFactory *iface, LPUNKNOWN pOuter,
00073                                                   REFIID riid, LPVOID *ppobj )
00074 {
00075     hnetcfg_cf *This = impl_from_IClassFactory( iface );
00076     HRESULT r;
00077     IUnknown *punk;
00078 
00079     TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj);
00080 
00081     *ppobj = NULL;
00082 
00083     if (pOuter)
00084         return CLASS_E_NOAGGREGATION;
00085 
00086     r = This->pfnCreateInstance( pOuter, (LPVOID *)&punk );
00087     if (FAILED(r))
00088         return r;
00089 
00090     r = IUnknown_QueryInterface( punk, riid, ppobj );
00091     if (FAILED(r))
00092         return r;
00093 
00094     IUnknown_Release( punk );
00095     return r;
00096 }
00097 
00098 static HRESULT WINAPI hnetcfg_cf_LockServer( IClassFactory *iface, BOOL dolock )
00099 {
00100     FIXME("(%p)->(%d)\n", iface, dolock);
00101     return S_OK;
00102 }
00103 
00104 static const struct IClassFactoryVtbl hnetcfg_cf_vtbl =
00105 {
00106     hnetcfg_cf_QueryInterface,
00107     hnetcfg_cf_AddRef,
00108     hnetcfg_cf_Release,
00109     hnetcfg_cf_CreateInstance,
00110     hnetcfg_cf_LockServer
00111 };
00112 
00113 static hnetcfg_cf fw_manager_cf = { { &hnetcfg_cf_vtbl }, NetFwMgr_create };
00114 static hnetcfg_cf fw_app_cf = { { &hnetcfg_cf_vtbl }, NetFwAuthorizedApplication_create };
00115 
00116 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
00117 {
00118     TRACE("(0x%p, %d, %p)\n",hInstDLL,fdwReason,lpvReserved);
00119 
00120     switch(fdwReason) {
00121         case DLL_WINE_PREATTACH:
00122             return FALSE;
00123         case DLL_PROCESS_ATTACH:
00124             instance = hInstDLL;
00125             DisableThreadLibraryCalls(hInstDLL);
00126             break;
00127         case DLL_PROCESS_DETACH:
00128             break;
00129     }
00130     return TRUE;
00131 }
00132 
00133 HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
00134 {
00135     IClassFactory *cf = NULL;
00136 
00137     TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
00138 
00139     if (IsEqualGUID( rclsid, &CLSID_NetFwMgr ))
00140     {
00141        cf = &fw_manager_cf.IClassFactory_iface;
00142     }
00143     else if (IsEqualGUID( rclsid, &CLSID_NetFwAuthorizedApplication ))
00144     {
00145        cf = &fw_app_cf.IClassFactory_iface;
00146     }
00147 
00148     if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
00149     return IClassFactory_QueryInterface( cf, iid, ppv );
00150 }
00151 
00152 HRESULT WINAPI DllCanUnloadNow( void )
00153 {
00154     return S_FALSE;
00155 }
00156 
00157 /***********************************************************************
00158  *      DllRegisterServer (HNETCFG.@)
00159  */
00160 HRESULT WINAPI DllRegisterServer(void)
00161 {
00162     return __wine_register_resources( instance );
00163 }
00164 
00165 /***********************************************************************
00166  *      DllUnregisterServer (HNETCFG.@)
00167  */
00168 HRESULT WINAPI DllUnregisterServer(void)
00169 {
00170     return __wine_unregister_resources( instance );
00171 }

Generated on Fri May 25 2012 04:22:04 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.