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
;
43 static inline fw_port
*impl_from_INetFwOpenPort( INetFwOpenPort
*iface
)
45 return CONTAINING_RECORD(iface
, fw_port
, INetFwOpenPort_iface
);
48 static ULONG WINAPI
fw_port_AddRef(
49 INetFwOpenPort
*iface
)
51 fw_port
*fw_port
= impl_from_INetFwOpenPort( iface
);
52 return InterlockedIncrement( &fw_port
->refs
);
55 static ULONG WINAPI
fw_port_Release(
56 INetFwOpenPort
*iface
)
58 fw_port
*fw_port
= impl_from_INetFwOpenPort( iface
);
59 LONG refs
= InterlockedDecrement( &fw_port
->refs
);
62 TRACE("destroying %p\n", fw_port
);
63 HeapFree( GetProcessHeap(), 0, fw_port
);
68 static HRESULT WINAPI
fw_port_QueryInterface(
69 INetFwOpenPort
*iface
,
73 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
75 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
77 if ( IsEqualGUID( riid
, &IID_INetFwOpenPort
) ||
78 IsEqualGUID( riid
, &IID_IDispatch
) ||
79 IsEqualGUID( riid
, &IID_IUnknown
) )
85 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
88 INetFwOpenPort_AddRef( iface
);
92 static HRESULT WINAPI
fw_port_GetTypeInfoCount(
93 INetFwOpenPort
*iface
,
96 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
98 TRACE("%p %p\n", This
, pctinfo
);
103 static HRESULT WINAPI
fw_port_GetTypeInfo(
104 INetFwOpenPort
*iface
,
107 ITypeInfo
**ppTInfo
)
109 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
111 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
112 return get_typeinfo( INetFwOpenPort_tid
, ppTInfo
);
115 static HRESULT WINAPI
fw_port_GetIDsOfNames(
116 INetFwOpenPort
*iface
,
123 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
127 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
129 hr
= get_typeinfo( INetFwOpenPort_tid
, &typeinfo
);
132 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
133 ITypeInfo_Release( typeinfo
);
138 static HRESULT WINAPI
fw_port_Invoke(
139 INetFwOpenPort
*iface
,
144 DISPPARAMS
*pDispParams
,
146 EXCEPINFO
*pExcepInfo
,
149 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
153 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
154 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
156 hr
= get_typeinfo( INetFwOpenPort_tid
, &typeinfo
);
159 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwOpenPort_iface
, dispIdMember
,
160 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
161 ITypeInfo_Release( typeinfo
);
166 static HRESULT WINAPI
fw_port_get_Name(
167 INetFwOpenPort
*iface
,
170 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
172 FIXME("%p %p\n", This
, name
);
176 static HRESULT WINAPI
fw_port_put_Name(
177 INetFwOpenPort
*iface
,
180 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
182 FIXME("%p %s\n", This
, debugstr_w(name
));
186 static HRESULT WINAPI
fw_port_get_IpVersion(
187 INetFwOpenPort
*iface
,
188 NET_FW_IP_VERSION
*ipVersion
)
190 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
192 FIXME("%p %p\n", This
, ipVersion
);
196 static HRESULT WINAPI
fw_port_put_IpVersion(
197 INetFwOpenPort
*iface
,
198 NET_FW_IP_VERSION ipVersion
)
200 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
202 FIXME("%p %u\n", This
, ipVersion
);
206 static HRESULT WINAPI
fw_port_get_Protocol(
207 INetFwOpenPort
*iface
,
208 NET_FW_IP_PROTOCOL
*ipProtocol
)
210 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
212 FIXME("%p %p\n", This
, ipProtocol
);
216 static HRESULT WINAPI
fw_port_put_Protocol(
217 INetFwOpenPort
*iface
,
218 NET_FW_IP_PROTOCOL ipProtocol
)
220 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
222 FIXME("%p %u\n", This
, ipProtocol
);
226 static HRESULT WINAPI
fw_port_get_Port(
227 INetFwOpenPort
*iface
,
230 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
232 FIXME("%p %p\n", This
, portNumber
);
236 static HRESULT WINAPI
fw_port_put_Port(
237 INetFwOpenPort
*iface
,
240 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
242 FIXME("%p %d\n", This
, portNumber
);
246 static HRESULT WINAPI
fw_port_get_Scope(
247 INetFwOpenPort
*iface
,
250 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
252 FIXME("%p %p\n", This
, scope
);
256 static HRESULT WINAPI
fw_port_put_Scope(
257 INetFwOpenPort
*iface
,
260 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
262 FIXME("%p %u\n", This
, scope
);
266 static HRESULT WINAPI
fw_port_get_RemoteAddresses(
267 INetFwOpenPort
*iface
,
270 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
272 FIXME("%p %p\n", This
, remoteAddrs
);
276 static HRESULT WINAPI
fw_port_put_RemoteAddresses(
277 INetFwOpenPort
*iface
,
280 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
282 FIXME("%p %s\n", This
, debugstr_w(remoteAddrs
));
286 static HRESULT WINAPI
fw_port_get_Enabled(
287 INetFwOpenPort
*iface
,
288 VARIANT_BOOL
*enabled
)
290 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
292 FIXME("%p %p\n", This
, enabled
);
294 *enabled
= VARIANT_TRUE
;
298 static HRESULT WINAPI
fw_port_put_Enabled(
299 INetFwOpenPort
*iface
,
300 VARIANT_BOOL enabled
)
302 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
304 FIXME("%p %d\n", This
, enabled
);
308 static HRESULT WINAPI
fw_port_get_BuiltIn(
309 INetFwOpenPort
*iface
,
310 VARIANT_BOOL
*builtIn
)
312 fw_port
*This
= impl_from_INetFwOpenPort( iface
);
314 FIXME("%p %p\n", This
, builtIn
);
318 static const struct INetFwOpenPortVtbl fw_port_vtbl
=
320 fw_port_QueryInterface
,
323 fw_port_GetTypeInfoCount
,
325 fw_port_GetIDsOfNames
,
329 fw_port_get_IpVersion
,
330 fw_port_put_IpVersion
,
331 fw_port_get_Protocol
,
332 fw_port_put_Protocol
,
337 fw_port_get_RemoteAddresses
,
338 fw_port_put_RemoteAddresses
,
344 HRESULT
NetFwOpenPort_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
348 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
350 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
351 if (!fp
) return E_OUTOFMEMORY
;
353 fp
->INetFwOpenPort_iface
.lpVtbl
= &fw_port_vtbl
;
356 *ppObj
= &fp
->INetFwOpenPort_iface
;
358 TRACE("returning iface %p\n", *ppObj
);
362 typedef struct fw_ports
364 INetFwOpenPorts INetFwOpenPorts_iface
;
368 static inline fw_ports
*impl_from_INetFwOpenPorts( INetFwOpenPorts
*iface
)
370 return CONTAINING_RECORD(iface
, fw_ports
, INetFwOpenPorts_iface
);
373 static ULONG WINAPI
fw_ports_AddRef(
374 INetFwOpenPorts
*iface
)
376 fw_ports
*fw_ports
= impl_from_INetFwOpenPorts( iface
);
377 return InterlockedIncrement( &fw_ports
->refs
);
380 static ULONG WINAPI
fw_ports_Release(
381 INetFwOpenPorts
*iface
)
383 fw_ports
*fw_ports
= impl_from_INetFwOpenPorts( iface
);
384 LONG refs
= InterlockedDecrement( &fw_ports
->refs
);
387 TRACE("destroying %p\n", fw_ports
);
388 HeapFree( GetProcessHeap(), 0, fw_ports
);
393 static HRESULT WINAPI
fw_ports_QueryInterface(
394 INetFwOpenPorts
*iface
,
398 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
400 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
402 if ( IsEqualGUID( riid
, &IID_INetFwOpenPorts
) ||
403 IsEqualGUID( riid
, &IID_IDispatch
) ||
404 IsEqualGUID( riid
, &IID_IUnknown
) )
410 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
411 return E_NOINTERFACE
;
413 INetFwOpenPorts_AddRef( iface
);
417 static HRESULT WINAPI
fw_ports_GetTypeInfoCount(
418 INetFwOpenPorts
*iface
,
421 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
423 FIXME("%p %p\n", This
, pctinfo
);
427 static HRESULT WINAPI
fw_ports_GetTypeInfo(
428 INetFwOpenPorts
*iface
,
431 ITypeInfo
**ppTInfo
)
433 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
435 FIXME("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
439 static HRESULT WINAPI
fw_ports_GetIDsOfNames(
440 INetFwOpenPorts
*iface
,
447 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
449 FIXME("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
453 static HRESULT WINAPI
fw_ports_Invoke(
454 INetFwOpenPorts
*iface
,
459 DISPPARAMS
*pDispParams
,
461 EXCEPINFO
*pExcepInfo
,
464 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
466 FIXME("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
467 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
471 static HRESULT WINAPI
fw_ports_get_Count(
472 INetFwOpenPorts
*iface
,
475 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
477 FIXME("%p, %p\n", This
, count
);
483 static HRESULT WINAPI
fw_ports_Add(
484 INetFwOpenPorts
*iface
,
485 INetFwOpenPort
*port
)
487 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
489 FIXME("%p, %p\n", This
, port
);
493 static HRESULT WINAPI
fw_ports_Remove(
494 INetFwOpenPorts
*iface
,
496 NET_FW_IP_PROTOCOL ipProtocol
)
498 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
500 FIXME("%p, %d, %u\n", This
, portNumber
, ipProtocol
);
504 static HRESULT WINAPI
fw_ports_Item(
505 INetFwOpenPorts
*iface
,
507 NET_FW_IP_PROTOCOL ipProtocol
,
508 INetFwOpenPort
**openPort
)
511 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
513 FIXME("%p, %d, %u, %p\n", This
, portNumber
, ipProtocol
, openPort
);
515 hr
= NetFwOpenPort_create( NULL
, (void **)openPort
);
518 INetFwOpenPort_put_Protocol( *openPort
, ipProtocol
);
519 INetFwOpenPort_put_Port( *openPort
, portNumber
);
524 static HRESULT WINAPI
fw_ports_get__NewEnum(
525 INetFwOpenPorts
*iface
,
528 fw_ports
*This
= impl_from_INetFwOpenPorts( iface
);
530 FIXME("%p, %p\n", This
, newEnum
);
534 static const struct INetFwOpenPortsVtbl fw_ports_vtbl
=
536 fw_ports_QueryInterface
,
539 fw_ports_GetTypeInfoCount
,
540 fw_ports_GetTypeInfo
,
541 fw_ports_GetIDsOfNames
,
547 fw_ports_get__NewEnum
550 HRESULT
NetFwOpenPorts_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
554 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
556 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
557 if (!fp
) return E_OUTOFMEMORY
;
559 fp
->INetFwOpenPorts_iface
.lpVtbl
= &fw_ports_vtbl
;
562 *ppObj
= &fp
->INetFwOpenPorts_iface
;
564 TRACE("returning iface %p\n", *ppObj
);