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

service.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009 Hans Leidekker for CodeWeavers
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 "config.h"
00020 #include <stdarg.h>
00021 #include <stdio.h>
00022 
00023 #define COBJMACROS
00024 
00025 #include "windef.h"
00026 #include "winbase.h"
00027 #include "winuser.h"
00028 #include "ole2.h"
00029 #include "netfw.h"
00030 
00031 #include "wine/debug.h"
00032 #include "wine/unicode.h"
00033 #include "hnetcfg_private.h"
00034 
00035 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
00036 
00037 typedef struct fw_service
00038 {
00039     INetFwService INetFwService_iface;
00040     LONG refs;
00041 } fw_service;
00042 
00043 static inline fw_service *impl_from_INetFwService( INetFwService *iface )
00044 {
00045     return CONTAINING_RECORD(iface, fw_service, INetFwService_iface);
00046 }
00047 
00048 static ULONG WINAPI fw_service_AddRef(
00049     INetFwService *iface )
00050 {
00051     fw_service *fw_service = impl_from_INetFwService( iface );
00052     return InterlockedIncrement( &fw_service->refs );
00053 }
00054 
00055 static ULONG WINAPI fw_service_Release(
00056     INetFwService *iface )
00057 {
00058     fw_service *fw_service = impl_from_INetFwService( iface );
00059     LONG refs = InterlockedDecrement( &fw_service->refs );
00060     if (!refs)
00061     {
00062         TRACE("destroying %p\n", fw_service);
00063         HeapFree( GetProcessHeap(), 0, fw_service );
00064     }
00065     return refs;
00066 }
00067 
00068 static HRESULT WINAPI fw_service_QueryInterface(
00069     INetFwService *iface,
00070     REFIID riid,
00071     void **ppvObject )
00072 {
00073     fw_service *This = impl_from_INetFwService( iface );
00074 
00075     TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
00076 
00077     if ( IsEqualGUID( riid, &IID_INetFwService ) ||
00078          IsEqualGUID( riid, &IID_IDispatch ) ||
00079          IsEqualGUID( riid, &IID_IUnknown ) )
00080     {
00081         *ppvObject = iface;
00082     }
00083     else
00084     {
00085         FIXME("interface %s not implemented\n", debugstr_guid(riid));
00086         return E_NOINTERFACE;
00087     }
00088     INetFwService_AddRef( iface );
00089     return S_OK;
00090 }
00091 
00092 static HRESULT WINAPI fw_service_GetTypeInfoCount(
00093     INetFwService *iface,
00094     UINT *pctinfo )
00095 {
00096     fw_service *This = impl_from_INetFwService( iface );
00097 
00098     FIXME("%p %p\n", This, pctinfo);
00099     return E_NOTIMPL;
00100 }
00101 
00102 static HRESULT WINAPI fw_service_GetTypeInfo(
00103     INetFwService *iface,
00104     UINT iTInfo,
00105     LCID lcid,
00106     ITypeInfo **ppTInfo )
00107 {
00108     fw_service *This = impl_from_INetFwService( iface );
00109 
00110     FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
00111     return E_NOTIMPL;
00112 }
00113 
00114 static HRESULT WINAPI fw_service_GetIDsOfNames(
00115     INetFwService *iface,
00116     REFIID riid,
00117     LPOLESTR *rgszNames,
00118     UINT cNames,
00119     LCID lcid,
00120     DISPID *rgDispId )
00121 {
00122     fw_service *This = impl_from_INetFwService( iface );
00123 
00124     FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
00125     return E_NOTIMPL;
00126 }
00127 
00128 static HRESULT WINAPI fw_service_Invoke(
00129     INetFwService *iface,
00130     DISPID dispIdMember,
00131     REFIID riid,
00132     LCID lcid,
00133     WORD wFlags,
00134     DISPPARAMS *pDispParams,
00135     VARIANT *pVarResult,
00136     EXCEPINFO *pExcepInfo,
00137     UINT *puArgErr )
00138 {
00139     fw_service *This = impl_from_INetFwService( iface );
00140 
00141     FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
00142           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
00143     return E_NOTIMPL;
00144 }
00145 
00146 static HRESULT WINAPI fw_service_get_Name(
00147     INetFwService *iface,
00148     BSTR *name )
00149 {
00150     fw_service *This = impl_from_INetFwService( iface );
00151 
00152     FIXME("%p %p\n", This, name);
00153     return E_NOTIMPL;
00154 }
00155 
00156 static HRESULT WINAPI fw_service_get_Type(
00157     INetFwService *iface,
00158     NET_FW_SERVICE_TYPE *type )
00159 {
00160     fw_service *This = impl_from_INetFwService( iface );
00161 
00162     FIXME("%p %p\n", This, type);
00163     return E_NOTIMPL;
00164 }
00165 
00166 static HRESULT WINAPI fw_service_get_Customized(
00167         INetFwService *iface,
00168         VARIANT_BOOL *customized )
00169 {
00170     fw_service *This = impl_from_INetFwService( iface );
00171 
00172     FIXME("%p %p\n", This, customized);
00173     return E_NOTIMPL;
00174 }
00175 
00176 static HRESULT WINAPI fw_service_get_IpVersion(
00177     INetFwService *iface,
00178     NET_FW_IP_VERSION *ipVersion )
00179 {
00180     fw_service *This = impl_from_INetFwService( iface );
00181 
00182     FIXME("%p %p\n", This, ipVersion);
00183     return E_NOTIMPL;
00184 }
00185 
00186 static HRESULT WINAPI fw_service_put_IpVersion(
00187     INetFwService *iface,
00188     NET_FW_IP_VERSION ipVersion )
00189 {
00190     fw_service *This = impl_from_INetFwService( iface );
00191 
00192     FIXME("%p %u\n", This, ipVersion);
00193     return E_NOTIMPL;
00194 }
00195 
00196 static HRESULT WINAPI fw_service_get_Scope(
00197     INetFwService *iface,
00198     NET_FW_SCOPE *scope )
00199 {
00200     fw_service *This = impl_from_INetFwService( iface );
00201 
00202     FIXME("%p %p\n", This, scope);
00203     return E_NOTIMPL;
00204 }
00205 
00206 static HRESULT WINAPI fw_service_put_Scope(
00207     INetFwService *iface,
00208     NET_FW_SCOPE scope )
00209 {
00210     fw_service *This = impl_from_INetFwService( iface );
00211 
00212     FIXME("%p %u\n", This, scope);
00213     return E_NOTIMPL;
00214 }
00215 
00216 static HRESULT WINAPI fw_service_get_RemoteAddresses(
00217     INetFwService *iface,
00218     BSTR *remoteAddrs )
00219 {
00220     fw_service *This = impl_from_INetFwService( iface );
00221 
00222     FIXME("%p %p\n", This, remoteAddrs);
00223     return E_NOTIMPL;
00224 }
00225 
00226 static HRESULT WINAPI fw_service_put_RemoteAddresses(
00227     INetFwService *iface,
00228     BSTR remoteAddrs )
00229 {
00230     fw_service *This = impl_from_INetFwService( iface );
00231 
00232     FIXME("%p %s\n", This, debugstr_w(remoteAddrs));
00233     return E_NOTIMPL;
00234 }
00235 
00236 static HRESULT WINAPI fw_service_get_Enabled(
00237     INetFwService *iface,
00238     VARIANT_BOOL *enabled )
00239 {
00240     fw_service *This = impl_from_INetFwService( iface );
00241 
00242     FIXME("%p %p\n", This, enabled);
00243     return E_NOTIMPL;
00244 }
00245 
00246 static HRESULT WINAPI fw_service_put_Enabled(
00247     INetFwService *iface,
00248     VARIANT_BOOL enabled )
00249 {
00250     fw_service *This = impl_from_INetFwService( iface );
00251 
00252     FIXME("%p %d\n", This, enabled);
00253     return E_NOTIMPL;
00254 }
00255 
00256 static HRESULT WINAPI fw_service_get_GloballyOpenPorts(
00257     INetFwService *iface,
00258     INetFwOpenPorts **openPorts )
00259 {
00260     fw_service *This = impl_from_INetFwService( iface );
00261 
00262     TRACE("%p %p\n", This, openPorts);
00263     return NetFwOpenPorts_create( NULL, (void **)openPorts );
00264 }
00265 
00266 static const struct INetFwServiceVtbl fw_service_vtbl =
00267 {
00268     fw_service_QueryInterface,
00269     fw_service_AddRef,
00270     fw_service_Release,
00271     fw_service_GetTypeInfoCount,
00272     fw_service_GetTypeInfo,
00273     fw_service_GetIDsOfNames,
00274     fw_service_Invoke,
00275     fw_service_get_Name,
00276     fw_service_get_Type,
00277     fw_service_get_Customized,
00278     fw_service_get_IpVersion,
00279     fw_service_put_IpVersion,
00280     fw_service_get_Scope,
00281     fw_service_put_Scope,
00282     fw_service_get_RemoteAddresses,
00283     fw_service_put_RemoteAddresses,
00284     fw_service_get_Enabled,
00285     fw_service_put_Enabled,
00286     fw_service_get_GloballyOpenPorts
00287 };
00288 
00289 static HRESULT NetFwService_create( IUnknown *pUnkOuter, LPVOID *ppObj )
00290 {
00291     fw_service *fp;
00292 
00293     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
00294 
00295     fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
00296     if (!fp) return E_OUTOFMEMORY;
00297 
00298     fp->INetFwService_iface.lpVtbl = &fw_service_vtbl;
00299     fp->refs = 1;
00300 
00301     *ppObj = &fp->INetFwService_iface;
00302 
00303     TRACE("returning iface %p\n", *ppObj);
00304     return S_OK;
00305 }
00306 
00307 typedef struct fw_services
00308 {
00309     INetFwServices INetFwServices_iface;
00310     LONG refs;
00311 } fw_services;
00312 
00313 static inline fw_services *impl_from_INetFwServices( INetFwServices *iface )
00314 {
00315     return CONTAINING_RECORD(iface, fw_services, INetFwServices_iface);
00316 }
00317 
00318 static ULONG WINAPI fw_services_AddRef(
00319     INetFwServices *iface )
00320 {
00321     fw_services *fw_services = impl_from_INetFwServices( iface );
00322     return InterlockedIncrement( &fw_services->refs );
00323 }
00324 
00325 static ULONG WINAPI fw_services_Release(
00326     INetFwServices *iface )
00327 {
00328     fw_services *fw_services = impl_from_INetFwServices( iface );
00329     LONG refs = InterlockedDecrement( &fw_services->refs );
00330     if (!refs)
00331     {
00332         TRACE("destroying %p\n", fw_services);
00333         HeapFree( GetProcessHeap(), 0, fw_services );
00334     }
00335     return refs;
00336 }
00337 
00338 static HRESULT WINAPI fw_services_QueryInterface(
00339     INetFwServices *iface,
00340     REFIID riid,
00341     void **ppvObject )
00342 {
00343     fw_services *This = impl_from_INetFwServices( iface );
00344 
00345     TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
00346 
00347     if ( IsEqualGUID( riid, &IID_INetFwServices ) ||
00348          IsEqualGUID( riid, &IID_IDispatch ) ||
00349          IsEqualGUID( riid, &IID_IUnknown ) )
00350     {
00351         *ppvObject = iface;
00352     }
00353     else
00354     {
00355         FIXME("interface %s not implemented\n", debugstr_guid(riid));
00356         return E_NOINTERFACE;
00357     }
00358     INetFwServices_AddRef( iface );
00359     return S_OK;
00360 }
00361 
00362 static HRESULT WINAPI fw_services_GetTypeInfoCount(
00363     INetFwServices *iface,
00364     UINT *pctinfo )
00365 {
00366     fw_services *This = impl_from_INetFwServices( iface );
00367 
00368     FIXME("%p %p\n", This, pctinfo);
00369     return E_NOTIMPL;
00370 }
00371 
00372 static HRESULT WINAPI fw_services_GetTypeInfo(
00373     INetFwServices *iface,
00374     UINT iTInfo,
00375     LCID lcid,
00376     ITypeInfo **ppTInfo )
00377 {
00378     fw_services *This = impl_from_INetFwServices( iface );
00379 
00380     FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
00381     return E_NOTIMPL;
00382 }
00383 
00384 static HRESULT WINAPI fw_services_GetIDsOfNames(
00385     INetFwServices *iface,
00386     REFIID riid,
00387     LPOLESTR *rgszNames,
00388     UINT cNames,
00389     LCID lcid,
00390     DISPID *rgDispId )
00391 {
00392     fw_services *This = impl_from_INetFwServices( iface );
00393 
00394     FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
00395     return E_NOTIMPL;
00396 }
00397 
00398 static HRESULT WINAPI fw_services_Invoke(
00399     INetFwServices *iface,
00400     DISPID dispIdMember,
00401     REFIID riid,
00402     LCID lcid,
00403     WORD wFlags,
00404     DISPPARAMS *pDispParams,
00405     VARIANT *pVarResult,
00406     EXCEPINFO *pExcepInfo,
00407     UINT *puArgErr )
00408 {
00409     fw_services *This = impl_from_INetFwServices( iface );
00410 
00411     FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
00412           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
00413     return E_NOTIMPL;
00414 }
00415 
00416 static HRESULT WINAPI fw_services_get_Count(
00417     INetFwServices *iface,
00418     LONG *count )
00419 {
00420     fw_services *This = impl_from_INetFwServices( iface );
00421 
00422     FIXME("%p, %p\n", This, count);
00423 
00424     *count = 0;
00425     return S_OK;
00426 }
00427 
00428 static HRESULT WINAPI fw_services_Item(
00429     INetFwServices *iface,
00430     NET_FW_SERVICE_TYPE svcType,
00431     INetFwService **service )
00432 {
00433     fw_services *This = impl_from_INetFwServices( iface );
00434 
00435     FIXME("%p, %u, %p\n", This, svcType, service);
00436     return NetFwService_create( NULL, (void **)service );
00437 }
00438 
00439 static HRESULT WINAPI fw_services_get__NewEnum(
00440     INetFwServices *iface,
00441     IUnknown **newEnum )
00442 {
00443     fw_services *This = impl_from_INetFwServices( iface );
00444 
00445     FIXME("%p, %p\n", This, newEnum);
00446     return E_NOTIMPL;
00447 }
00448 
00449 static const struct INetFwServicesVtbl fw_services_vtbl =
00450 {
00451     fw_services_QueryInterface,
00452     fw_services_AddRef,
00453     fw_services_Release,
00454     fw_services_GetTypeInfoCount,
00455     fw_services_GetTypeInfo,
00456     fw_services_GetIDsOfNames,
00457     fw_services_Invoke,
00458     fw_services_get_Count,
00459     fw_services_Item,
00460     fw_services_get__NewEnum
00461 };
00462 
00463 HRESULT NetFwServices_create( IUnknown *pUnkOuter, LPVOID *ppObj )
00464 {
00465     fw_services *fp;
00466 
00467     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
00468 
00469     fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
00470     if (!fp) return E_OUTOFMEMORY;
00471 
00472     fp->INetFwServices_iface.lpVtbl = &fw_services_vtbl;
00473     fp->refs = 1;
00474 
00475     *ppObj = &fp->INetFwServices_iface;
00476 
00477     TRACE("returning iface %p\n", *ppObj);
00478     return S_OK;
00479 }

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