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

port.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_port
00038 {
00039     INetFwOpenPort INetFwOpenPort_iface;
00040     LONG refs;
00041 } fw_port;
00042 
00043 static inline fw_port *impl_from_INetFwOpenPort( INetFwOpenPort *iface )
00044 {
00045     return CONTAINING_RECORD(iface, fw_port, INetFwOpenPort_iface);
00046 }
00047 
00048 static ULONG WINAPI fw_port_AddRef(
00049     INetFwOpenPort *iface )
00050 {
00051     fw_port *fw_port = impl_from_INetFwOpenPort( iface );
00052     return InterlockedIncrement( &fw_port->refs );
00053 }
00054 
00055 static ULONG WINAPI fw_port_Release(
00056     INetFwOpenPort *iface )
00057 {
00058     fw_port *fw_port = impl_from_INetFwOpenPort( iface );
00059     LONG refs = InterlockedDecrement( &fw_port->refs );
00060     if (!refs)
00061     {
00062         TRACE("destroying %p\n", fw_port);
00063         HeapFree( GetProcessHeap(), 0, fw_port );
00064     }
00065     return refs;
00066 }
00067 
00068 static HRESULT WINAPI fw_port_QueryInterface(
00069     INetFwOpenPort *iface,
00070     REFIID riid,
00071     void **ppvObject )
00072 {
00073     fw_port *This = impl_from_INetFwOpenPort( iface );
00074 
00075     TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
00076 
00077     if ( IsEqualGUID( riid, &IID_INetFwOpenPort ) ||
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     INetFwOpenPort_AddRef( iface );
00089     return S_OK;
00090 }
00091 
00092 static HRESULT WINAPI fw_port_GetTypeInfoCount(
00093     INetFwOpenPort *iface,
00094     UINT *pctinfo )
00095 {
00096     fw_port *This = impl_from_INetFwOpenPort( iface );
00097 
00098     FIXME("%p %p\n", This, pctinfo);
00099     return E_NOTIMPL;
00100 }
00101 
00102 static HRESULT WINAPI fw_port_GetTypeInfo(
00103     INetFwOpenPort *iface,
00104     UINT iTInfo,
00105     LCID lcid,
00106     ITypeInfo **ppTInfo )
00107 {
00108     fw_port *This = impl_from_INetFwOpenPort( iface );
00109 
00110     FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
00111     return E_NOTIMPL;
00112 }
00113 
00114 static HRESULT WINAPI fw_port_GetIDsOfNames(
00115     INetFwOpenPort *iface,
00116     REFIID riid,
00117     LPOLESTR *rgszNames,
00118     UINT cNames,
00119     LCID lcid,
00120     DISPID *rgDispId )
00121 {
00122     fw_port *This = impl_from_INetFwOpenPort( 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_port_Invoke(
00129     INetFwOpenPort *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_port *This = impl_from_INetFwOpenPort( 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_port_get_Name(
00147     INetFwOpenPort *iface,
00148     BSTR *name)
00149 {
00150     fw_port *This = impl_from_INetFwOpenPort( iface );
00151 
00152     FIXME("%p %p\n", This, name);
00153     return E_NOTIMPL;
00154 }
00155 
00156 static HRESULT WINAPI fw_port_put_Name(
00157     INetFwOpenPort *iface,
00158     BSTR name)
00159 {
00160     fw_port *This = impl_from_INetFwOpenPort( iface );
00161 
00162     FIXME("%p %s\n", This, debugstr_w(name));
00163     return E_NOTIMPL;
00164 }
00165 
00166 static HRESULT WINAPI fw_port_get_IpVersion(
00167     INetFwOpenPort *iface,
00168     NET_FW_IP_VERSION *ipVersion)
00169 {
00170     fw_port *This = impl_from_INetFwOpenPort( iface );
00171 
00172     FIXME("%p %p\n", This, ipVersion);
00173     return E_NOTIMPL;
00174 }
00175 
00176 static HRESULT WINAPI fw_port_put_IpVersion(
00177     INetFwOpenPort *iface,
00178     NET_FW_IP_VERSION ipVersion)
00179 {
00180     fw_port *This = impl_from_INetFwOpenPort( iface );
00181 
00182     FIXME("%p %u\n", This, ipVersion);
00183     return E_NOTIMPL;
00184 }
00185 
00186 static HRESULT WINAPI fw_port_get_Protocol(
00187     INetFwOpenPort *iface,
00188     NET_FW_IP_PROTOCOL *ipProtocol)
00189 {
00190     fw_port *This = impl_from_INetFwOpenPort( iface );
00191 
00192     FIXME("%p %p\n", This, ipProtocol);
00193     return E_NOTIMPL;
00194 }
00195 
00196 static HRESULT WINAPI fw_port_put_Protocol(
00197     INetFwOpenPort *iface,
00198     NET_FW_IP_PROTOCOL ipProtocol)
00199 {
00200     fw_port *This = impl_from_INetFwOpenPort( iface );
00201 
00202     FIXME("%p %u\n", This, ipProtocol);
00203     return E_NOTIMPL;
00204 }
00205 
00206 static HRESULT WINAPI fw_port_get_Port(
00207     INetFwOpenPort *iface,
00208     LONG *portNumber)
00209 {
00210     fw_port *This = impl_from_INetFwOpenPort( iface );
00211 
00212     FIXME("%p %p\n", This, portNumber);
00213     return E_NOTIMPL;
00214 }
00215 
00216 static HRESULT WINAPI fw_port_put_Port(
00217     INetFwOpenPort *iface,
00218     LONG portNumber)
00219 {
00220     fw_port *This = impl_from_INetFwOpenPort( iface );
00221 
00222     FIXME("%p %d\n", This, portNumber);
00223     return E_NOTIMPL;
00224 }
00225 
00226 static HRESULT WINAPI fw_port_get_Scope(
00227     INetFwOpenPort *iface,
00228     NET_FW_SCOPE *scope)
00229 {
00230     fw_port *This = impl_from_INetFwOpenPort( iface );
00231 
00232     FIXME("%p %p\n", This, scope);
00233     return E_NOTIMPL;
00234 }
00235 
00236 static HRESULT WINAPI fw_port_put_Scope(
00237     INetFwOpenPort *iface,
00238     NET_FW_SCOPE scope)
00239 {
00240     fw_port *This = impl_from_INetFwOpenPort( iface );
00241 
00242     FIXME("%p %u\n", This, scope);
00243     return E_NOTIMPL;
00244 }
00245 
00246 static HRESULT WINAPI fw_port_get_RemoteAddresses(
00247     INetFwOpenPort *iface,
00248     BSTR *remoteAddrs)
00249 {
00250     fw_port *This = impl_from_INetFwOpenPort( iface );
00251 
00252     FIXME("%p %p\n", This, remoteAddrs);
00253     return E_NOTIMPL;
00254 }
00255 
00256 static HRESULT WINAPI fw_port_put_RemoteAddresses(
00257     INetFwOpenPort *iface,
00258     BSTR remoteAddrs)
00259 {
00260     fw_port *This = impl_from_INetFwOpenPort( iface );
00261 
00262     FIXME("%p %s\n", This, debugstr_w(remoteAddrs));
00263     return E_NOTIMPL;
00264 }
00265 
00266 static HRESULT WINAPI fw_port_get_Enabled(
00267     INetFwOpenPort *iface,
00268     VARIANT_BOOL *enabled)
00269 {
00270     fw_port *This = impl_from_INetFwOpenPort( iface );
00271 
00272     FIXME("%p %p\n", This, enabled);
00273 
00274     *enabled = VARIANT_TRUE;
00275     return S_OK;
00276 }
00277 
00278 static HRESULT WINAPI fw_port_put_Enabled(
00279     INetFwOpenPort *iface,
00280     VARIANT_BOOL enabled)
00281 {
00282     fw_port *This = impl_from_INetFwOpenPort( iface );
00283 
00284     FIXME("%p %d\n", This, enabled);
00285     return E_NOTIMPL;
00286 }
00287 
00288 static HRESULT WINAPI fw_port_get_BuiltIn(
00289     INetFwOpenPort *iface,
00290     VARIANT_BOOL *builtIn)
00291 {
00292     fw_port *This = impl_from_INetFwOpenPort( iface );
00293 
00294     FIXME("%p %p\n", This, builtIn);
00295     return E_NOTIMPL;
00296 }
00297 
00298 static const struct INetFwOpenPortVtbl fw_port_vtbl =
00299 {
00300     fw_port_QueryInterface,
00301     fw_port_AddRef,
00302     fw_port_Release,
00303     fw_port_GetTypeInfoCount,
00304     fw_port_GetTypeInfo,
00305     fw_port_GetIDsOfNames,
00306     fw_port_Invoke,
00307     fw_port_get_Name,
00308     fw_port_put_Name,
00309     fw_port_get_IpVersion,
00310     fw_port_put_IpVersion,
00311     fw_port_get_Protocol,
00312     fw_port_put_Protocol,
00313     fw_port_get_Port,
00314     fw_port_put_Port,
00315     fw_port_get_Scope,
00316     fw_port_put_Scope,
00317     fw_port_get_RemoteAddresses,
00318     fw_port_put_RemoteAddresses,
00319     fw_port_get_Enabled,
00320     fw_port_put_Enabled,
00321     fw_port_get_BuiltIn
00322 };
00323 
00324 static HRESULT NetFwOpenPort_create( IUnknown *pUnkOuter, LPVOID *ppObj )
00325 {
00326     fw_port *fp;
00327 
00328     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
00329 
00330     fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
00331     if (!fp) return E_OUTOFMEMORY;
00332 
00333     fp->INetFwOpenPort_iface.lpVtbl = &fw_port_vtbl;
00334     fp->refs = 1;
00335 
00336     *ppObj = &fp->INetFwOpenPort_iface;
00337 
00338     TRACE("returning iface %p\n", *ppObj);
00339     return S_OK;
00340 }
00341 
00342 typedef struct fw_ports
00343 {
00344     INetFwOpenPorts INetFwOpenPorts_iface;
00345     LONG refs;
00346 } fw_ports;
00347 
00348 static inline fw_ports *impl_from_INetFwOpenPorts( INetFwOpenPorts *iface )
00349 {
00350     return CONTAINING_RECORD(iface, fw_ports, INetFwOpenPorts_iface);
00351 }
00352 
00353 static ULONG WINAPI fw_ports_AddRef(
00354     INetFwOpenPorts *iface )
00355 {
00356     fw_ports *fw_ports = impl_from_INetFwOpenPorts( iface );
00357     return InterlockedIncrement( &fw_ports->refs );
00358 }
00359 
00360 static ULONG WINAPI fw_ports_Release(
00361     INetFwOpenPorts *iface )
00362 {
00363     fw_ports *fw_ports = impl_from_INetFwOpenPorts( iface );
00364     LONG refs = InterlockedDecrement( &fw_ports->refs );
00365     if (!refs)
00366     {
00367         TRACE("destroying %p\n", fw_ports);
00368         HeapFree( GetProcessHeap(), 0, fw_ports );
00369     }
00370     return refs;
00371 }
00372 
00373 static HRESULT WINAPI fw_ports_QueryInterface(
00374     INetFwOpenPorts *iface,
00375     REFIID riid,
00376     void **ppvObject )
00377 {
00378     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00379 
00380     TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
00381 
00382     if ( IsEqualGUID( riid, &IID_INetFwOpenPorts ) ||
00383          IsEqualGUID( riid, &IID_IDispatch ) ||
00384          IsEqualGUID( riid, &IID_IUnknown ) )
00385     {
00386         *ppvObject = iface;
00387     }
00388     else
00389     {
00390         FIXME("interface %s not implemented\n", debugstr_guid(riid));
00391         return E_NOINTERFACE;
00392     }
00393     INetFwOpenPorts_AddRef( iface );
00394     return S_OK;
00395 }
00396 
00397 static HRESULT WINAPI fw_ports_GetTypeInfoCount(
00398     INetFwOpenPorts *iface,
00399     UINT *pctinfo )
00400 {
00401     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00402 
00403     FIXME("%p %p\n", This, pctinfo);
00404     return E_NOTIMPL;
00405 }
00406 
00407 static HRESULT WINAPI fw_ports_GetTypeInfo(
00408     INetFwOpenPorts *iface,
00409     UINT iTInfo,
00410     LCID lcid,
00411     ITypeInfo **ppTInfo )
00412 {
00413     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00414 
00415     FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
00416     return E_NOTIMPL;
00417 }
00418 
00419 static HRESULT WINAPI fw_ports_GetIDsOfNames(
00420     INetFwOpenPorts *iface,
00421     REFIID riid,
00422     LPOLESTR *rgszNames,
00423     UINT cNames,
00424     LCID lcid,
00425     DISPID *rgDispId )
00426 {
00427     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00428 
00429     FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
00430     return E_NOTIMPL;
00431 }
00432 
00433 static HRESULT WINAPI fw_ports_Invoke(
00434     INetFwOpenPorts *iface,
00435     DISPID dispIdMember,
00436     REFIID riid,
00437     LCID lcid,
00438     WORD wFlags,
00439     DISPPARAMS *pDispParams,
00440     VARIANT *pVarResult,
00441     EXCEPINFO *pExcepInfo,
00442     UINT *puArgErr )
00443 {
00444     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00445 
00446     FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
00447           lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
00448     return E_NOTIMPL;
00449 }
00450 
00451 static HRESULT WINAPI fw_ports_get_Count(
00452     INetFwOpenPorts *iface,
00453     LONG *count)
00454 {
00455     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00456 
00457     FIXME("%p, %p\n", This, count);
00458 
00459     *count = 0;
00460     return S_OK;
00461 }
00462 
00463 static HRESULT WINAPI fw_ports_Add(
00464     INetFwOpenPorts *iface,
00465     INetFwOpenPort *port)
00466 {
00467     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00468 
00469     FIXME("%p, %p\n", This, port);
00470     return E_NOTIMPL;
00471 }
00472 
00473 static HRESULT WINAPI fw_ports_Remove(
00474     INetFwOpenPorts *iface,
00475     LONG portNumber,
00476     NET_FW_IP_PROTOCOL ipProtocol)
00477 {
00478     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00479 
00480     FIXME("%p, %d, %u\n", This, portNumber, ipProtocol);
00481     return E_NOTIMPL;
00482 }
00483 
00484 static HRESULT WINAPI fw_ports_Item(
00485     INetFwOpenPorts *iface,
00486     LONG portNumber,
00487     NET_FW_IP_PROTOCOL ipProtocol,
00488     INetFwOpenPort **openPort)
00489 {
00490     HRESULT hr;
00491     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00492 
00493     FIXME("%p, %d, %u, %p\n", This, portNumber, ipProtocol, openPort);
00494 
00495     hr = NetFwOpenPort_create( NULL, (void **)openPort );
00496     if (SUCCEEDED(hr))
00497     {
00498         INetFwOpenPort_put_Protocol( *openPort, ipProtocol );
00499         INetFwOpenPort_put_Port( *openPort, portNumber );
00500     }
00501     return hr;
00502 }
00503 
00504 static HRESULT WINAPI fw_ports_get__NewEnum(
00505     INetFwOpenPorts *iface,
00506     IUnknown **newEnum)
00507 {
00508     fw_ports *This = impl_from_INetFwOpenPorts( iface );
00509 
00510     FIXME("%p, %p\n", This, newEnum);
00511     return E_NOTIMPL;
00512 }
00513 
00514 static const struct INetFwOpenPortsVtbl fw_ports_vtbl =
00515 {
00516     fw_ports_QueryInterface,
00517     fw_ports_AddRef,
00518     fw_ports_Release,
00519     fw_ports_GetTypeInfoCount,
00520     fw_ports_GetTypeInfo,
00521     fw_ports_GetIDsOfNames,
00522     fw_ports_Invoke,
00523     fw_ports_get_Count,
00524     fw_ports_Add,
00525     fw_ports_Remove,
00526     fw_ports_Item,
00527     fw_ports_get__NewEnum
00528 };
00529 
00530 HRESULT NetFwOpenPorts_create( IUnknown *pUnkOuter, LPVOID *ppObj )
00531 {
00532     fw_ports *fp;
00533 
00534     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
00535 
00536     fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
00537     if (!fp) return E_OUTOFMEMORY;
00538 
00539     fp->INetFwOpenPorts_iface.lpVtbl = &fw_ports_vtbl;
00540     fp->refs = 1;
00541 
00542     *ppObj = &fp->INetFwOpenPorts_iface;
00543 
00544     TRACE("returning iface %p\n", *ppObj);
00545     return S_OK;
00546 }

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