2 * Copyright 2009 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
33 #include "hnetcfg_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg
);
37 typedef struct fw_port
39 INetFwOpenPort INetFwOpenPort_iface
;
44 static inline fw_port
*impl_from_INetFwOpenPort( INetFwOpenPort
*iface
)
46 return CONTAINING_RECORD(iface
, fw_port
, INetFwOpenPort_iface
);
49 static ULONG WINAPI
fw_port_AddRef(
50 INetFwOpenPort
*iface
)
52 fw_port
*fw_port
= impl_from_INetFwOpenPort( iface
);
53 return InterlockedIncrement( &fw_port
->refs
);
56 static ULONG WINAPI
fw_port_Release(
57 INetFwOpenPort
*iface
)
59 fw_port
*fw_port
= impl_from_INetFwOpenPort( iface
);
60 LONG refs
= InterlockedDecrement( &fw_port
->refs
);
63 TRACE("destroying %p\n", fw_port
);
64 SysFreeString( fw_port
->name
);
65 HeapFree( GetProcessHeap(), 0, fw_port
);
70 static HRESULT WINAPI
fw_port_QueryInterface(
71 INetFwOpenPort
*iface
,
75 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
77 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
79 if ( IsEqualGUID( riid
, &IID_INetFwOpenPort
) ||
80 IsEqualGUID( riid
, &IID_IDispatch
) ||
81 IsEqualGUID( riid
, &IID_IUnknown
) )
87 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
90 INetFwOpenPort_AddRef( iface
);
94 static HRESULT WINAPI
fw_port_GetTypeInfoCount(
95 INetFwOpenPort
*iface
,
98 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
100 TRACE("%p %p\n", This
, pctinfo
);
105 static HRESULT WINAPI
fw_port_GetTypeInfo(
106 INetFwOpenPort
*iface
,
109 ITypeInfo
**ppTInfo
)
111 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
113 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
114 return get_typeinfo( INetFwOpenPort_tid
, ppTInfo
);
117 static HRESULT WINAPI
fw_port_GetIDsOfNames(
118 INetFwOpenPort
*iface
,
125 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
129 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
131 hr
= get_typeinfo( INetFwOpenPort_tid
, &typeinfo
);
134 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
135 ITypeInfo_Release( typeinfo
);
140 static HRESULT WINAPI
fw_port_Invoke(
141 INetFwOpenPort
*iface
,
146 DISPPARAMS
*pDispParams
,
148 EXCEPINFO
*pExcepInfo
,
151 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
155 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
156 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
158 hr
= get_typeinfo( INetFwOpenPort_tid
, &typeinfo
);
161 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwOpenPort_iface
, dispIdMember
,
162 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
163 ITypeInfo_Release( typeinfo
);
168 static HRESULT WINAPI
fw_port_get_Name(
169 INetFwOpenPort
*iface
,
172 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
174 FIXME("%p %p\n", This
, name
);
178 static HRESULT WINAPI
fw_port_put_Name(
179 INetFwOpenPort
*iface
,
182 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
184 TRACE("%p %s\n", This
, debugstr_w(name
));
186 if (!(name
= SysAllocString( name
)))
187 return E_OUTOFMEMORY
;
189 SysFreeString( This
->name
);
194 static HRESULT WINAPI
fw_port_get_IpVersion(
195 INetFwOpenPort
*iface
,
196 NET_FW_IP_VERSION
*ipVersion
)
198 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
200 FIXME("%p %p\n", This
, ipVersion
);
204 static HRESULT WINAPI
fw_port_put_IpVersion(
205 INetFwOpenPort
*iface
,
206 NET_FW_IP_VERSION ipVersion
)
208 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
210 FIXME("%p %u\n", This
, ipVersion
);
214 static HRESULT WINAPI
fw_port_get_Protocol(
215 INetFwOpenPort
*iface
,
216 NET_FW_IP_PROTOCOL
*ipProtocol
)
218 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
220 FIXME("%p %p\n", This
, ipProtocol
);
224 static HRESULT WINAPI
fw_port_put_Protocol(
225 INetFwOpenPort
*iface
,
226 NET_FW_IP_PROTOCOL ipProtocol
)
228 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
230 FIXME("%p %u\n", This
, ipProtocol
);
234 static HRESULT WINAPI
fw_port_get_Port(
235 INetFwOpenPort
*iface
,
238 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
240 FIXME("%p %p\n", This
, portNumber
);
244 static HRESULT WINAPI
fw_port_put_Port(
245 INetFwOpenPort
*iface
,
248 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
250 FIXME("%p %d\n", This
, portNumber
);
254 static HRESULT WINAPI
fw_port_get_Scope(
255 INetFwOpenPort
*iface
,
258 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
260 FIXME("%p %p\n", This
, scope
);
264 static HRESULT WINAPI
fw_port_put_Scope(
265 INetFwOpenPort
*iface
,
268 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
270 FIXME("%p %u\n", This
, scope
);
274 static HRESULT WINAPI
fw_port_get_RemoteAddresses(
275 INetFwOpenPort
*iface
,
278 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
280 FIXME("%p %p\n", This
, remoteAddrs
);
284 static HRESULT WINAPI
fw_port_put_RemoteAddresses(
285 INetFwOpenPort
*iface
,
288 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
290 FIXME("%p %s\n", This
, debugstr_w(remoteAddrs
));
294 static HRESULT WINAPI
fw_port_get_Enabled(
295 INetFwOpenPort
*iface
,
296 VARIANT_BOOL
*enabled
)
298 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
300 FIXME("%p %p\n", This
, enabled
);
302 *enabled
= VARIANT_TRUE
;
306 static HRESULT WINAPI
fw_port_put_Enabled(
307 INetFwOpenPort
*iface
,
308 VARIANT_BOOL enabled
)
310 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
312 FIXME("%p %d\n", This
, enabled
);
316 static HRESULT WINAPI
fw_port_get_BuiltIn(
317 INetFwOpenPort
*iface
,
318 VARIANT_BOOL
*builtIn
)
320 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
322 FIXME("%p %p\n", This
, builtIn
);
326 static const struct INetFwOpenPortVtbl fw_port_vtbl
=
328 fw_port_QueryInterface
,
331 fw_port_GetTypeInfoCount
,
333 fw_port_GetIDsOfNames
,
337 fw_port_get_IpVersion
,
338 fw_port_put_IpVersion
,
339 fw_port_get_Protocol
,
340 fw_port_put_Protocol
,
345 fw_port_get_RemoteAddresses
,
346 fw_port_put_RemoteAddresses
,
352 HRESULT
NetFwOpenPort_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
356 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
358 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
359 if (!fp
) return E_OUTOFMEMORY
;
361 fp
->INetFwOpenPort_iface
.lpVtbl
= &fw_port_vtbl
;
365 *ppObj
= &fp
->INetFwOpenPort_iface
;
367 TRACE("returning iface %p\n", *ppObj
);
371 typedef struct fw_ports
373 INetFwOpenPorts INetFwOpenPorts_iface
;
377 static inline fw_ports
*impl_from_INetFwOpenPorts( INetFwOpenPorts
*iface
)
379 return CONTAINING_RECORD(iface
, fw_ports
, INetFwOpenPorts_iface
);
382 static ULONG WINAPI
fw_ports_AddRef(
383 INetFwOpenPorts
*iface
)
385 fw_ports
*fw_ports
= impl_from_INetFwOpenPorts( iface
);
386 return InterlockedIncrement( &fw_ports
->refs
);
389 static ULONG WINAPI
fw_ports_Release(
390 INetFwOpenPorts
*iface
)
392 fw_ports
*fw_ports
= impl_from_INetFwOpenPorts( iface
);
393 LONG refs
= InterlockedDecrement( &fw_ports
->refs
);
396 TRACE("destroying %p\n", fw_ports
);
397 HeapFree( GetProcessHeap(), 0, fw_ports
);
402 static HRESULT WINAPI
fw_ports_QueryInterface(
403 INetFwOpenPorts
*iface
,
407 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
409 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
411 if ( IsEqualGUID( riid
, &IID_INetFwOpenPorts
) ||
412 IsEqualGUID( riid
, &IID_IDispatch
) ||
413 IsEqualGUID( riid
, &IID_IUnknown
) )
419 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
420 return E_NOINTERFACE
;
422 INetFwOpenPorts_AddRef( iface
);
426 static HRESULT WINAPI
fw_ports_GetTypeInfoCount(
427 INetFwOpenPorts
*iface
,
430 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
432 FIXME("%p %p\n", This
, pctinfo
);
436 static HRESULT WINAPI
fw_ports_GetTypeInfo(
437 INetFwOpenPorts
*iface
,
440 ITypeInfo
**ppTInfo
)
442 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
444 FIXME("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
448 static HRESULT WINAPI
fw_ports_GetIDsOfNames(
449 INetFwOpenPorts
*iface
,
456 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
458 FIXME("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
462 static HRESULT WINAPI
fw_ports_Invoke(
463 INetFwOpenPorts
*iface
,
468 DISPPARAMS
*pDispParams
,
470 EXCEPINFO
*pExcepInfo
,
473 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
475 FIXME("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
476 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
480 static HRESULT WINAPI
fw_ports_get_Count(
481 INetFwOpenPorts
*iface
,
484 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
486 FIXME("%p, %p\n", This
, count
);
492 static HRESULT WINAPI
fw_ports_Add(
493 INetFwOpenPorts
*iface
,
494 INetFwOpenPort
*port
)
496 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
498 FIXME("%p, %p\n", This
, port
);
502 static HRESULT WINAPI
fw_ports_Remove(
503 INetFwOpenPorts
*iface
,
505 NET_FW_IP_PROTOCOL ipProtocol
)
507 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
509 FIXME("%p, %d, %u\n", This
, portNumber
, ipProtocol
);
513 static HRESULT WINAPI
fw_ports_Item(
514 INetFwOpenPorts
*iface
,
516 NET_FW_IP_PROTOCOL ipProtocol
,
517 INetFwOpenPort
**openPort
)
520 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
522 FIXME("%p, %d, %u, %p\n", This
, portNumber
, ipProtocol
, openPort
);
524 hr
= NetFwOpenPort_create( NULL
, (void **)openPort
);
527 INetFwOpenPort_put_Protocol( *openPort
, ipProtocol
);
528 INetFwOpenPort_put_Port( *openPort
, portNumber
);
533 static HRESULT WINAPI
fw_ports_get__NewEnum(
534 INetFwOpenPorts
*iface
,
537 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
539 FIXME("%p, %p\n", This
, newEnum
);
543 static const struct INetFwOpenPortsVtbl fw_ports_vtbl
=
545 fw_ports_QueryInterface
,
548 fw_ports_GetTypeInfoCount
,
549 fw_ports_GetTypeInfo
,
550 fw_ports_GetIDsOfNames
,
556 fw_ports_get__NewEnum
559 HRESULT
NetFwOpenPorts_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
563 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
565 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
566 if (!fp
) return E_OUTOFMEMORY
;
568 fp
->INetFwOpenPorts_iface
.lpVtbl
= &fw_ports_vtbl
;
571 *ppObj
= &fp
->INetFwOpenPorts_iface
;
573 TRACE("returning iface %p\n", *ppObj
);