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_service
39 const INetFwServiceVtbl
*vtbl
;
43 static inline fw_service
*impl_from_INetFwService( INetFwService
*iface
)
45 return (fw_service
*)((char *)iface
- FIELD_OFFSET( fw_service
, vtbl
));
48 static ULONG WINAPI
fw_service_AddRef(
49 INetFwService
*iface
)
51 fw_service
*fw_service
= impl_from_INetFwService( iface
);
52 return InterlockedIncrement( &fw_service
->refs
);
55 static ULONG WINAPI
fw_service_Release(
56 INetFwService
*iface
)
58 fw_service
*fw_service
= impl_from_INetFwService( iface
);
59 LONG refs
= InterlockedDecrement( &fw_service
->refs
);
62 TRACE("destroying %p\n", fw_service
);
63 HeapFree( GetProcessHeap(), 0, fw_service
);
68 static HRESULT WINAPI
fw_service_QueryInterface(
73 fw_service
*This
= impl_from_INetFwService( iface
);
75 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
77 if ( IsEqualGUID( riid
, &IID_INetFwService
) ||
78 IsEqualGUID( riid
, &IID_IDispatch
) ||
79 IsEqualGUID( riid
, &IID_IUnknown
) )
85 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
88 INetFwService_AddRef( iface
);
92 static HRESULT WINAPI
fw_service_GetTypeInfoCount(
96 fw_service
*This
= impl_from_INetFwService( iface
);
98 FIXME("%p %p\n", This
, pctinfo
);
102 static HRESULT WINAPI
fw_service_GetTypeInfo(
103 INetFwService
*iface
,
106 ITypeInfo
**ppTInfo
)
108 fw_service
*This
= impl_from_INetFwService( iface
);
110 FIXME("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
114 static HRESULT WINAPI
fw_service_GetIDsOfNames(
115 INetFwService
*iface
,
122 fw_service
*This
= impl_from_INetFwService( iface
);
124 FIXME("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
128 static HRESULT WINAPI
fw_service_Invoke(
129 INetFwService
*iface
,
134 DISPPARAMS
*pDispParams
,
136 EXCEPINFO
*pExcepInfo
,
139 fw_service
*This
= impl_from_INetFwService( iface
);
141 FIXME("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
142 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
146 static HRESULT WINAPI
fw_service_get_Name(
147 INetFwService
*iface
,
150 fw_service
*This
= impl_from_INetFwService( iface
);
152 FIXME("%p %p\n", This
, name
);
156 static HRESULT WINAPI
fw_service_get_Type(
157 INetFwService
*iface
,
158 NET_FW_SERVICE_TYPE
*type
)
160 fw_service
*This
= impl_from_INetFwService( iface
);
162 FIXME("%p %p\n", This
, type
);
166 static HRESULT WINAPI
fw_service_get_Customized(
167 INetFwService
*iface
,
168 VARIANT_BOOL
*customized
)
170 fw_service
*This
= impl_from_INetFwService( iface
);
172 FIXME("%p %p\n", This
, customized
);
176 static HRESULT WINAPI
fw_service_get_IpVersion(
177 INetFwService
*iface
,
178 NET_FW_IP_VERSION
*ipVersion
)
180 fw_service
*This
= impl_from_INetFwService( iface
);
182 FIXME("%p %p\n", This
, ipVersion
);
186 static HRESULT WINAPI
fw_service_put_IpVersion(
187 INetFwService
*iface
,
188 NET_FW_IP_VERSION ipVersion
)
190 fw_service
*This
= impl_from_INetFwService( iface
);
192 FIXME("%p %u\n", This
, ipVersion
);
196 static HRESULT WINAPI
fw_service_get_Scope(
197 INetFwService
*iface
,
198 NET_FW_SCOPE
*scope
)
200 fw_service
*This
= impl_from_INetFwService( iface
);
202 FIXME("%p %p\n", This
, scope
);
206 static HRESULT WINAPI
fw_service_put_Scope(
207 INetFwService
*iface
,
210 fw_service
*This
= impl_from_INetFwService( iface
);
212 FIXME("%p %u\n", This
, scope
);
216 static HRESULT WINAPI
fw_service_get_RemoteAddresses(
217 INetFwService
*iface
,
220 fw_service
*This
= impl_from_INetFwService( iface
);
222 FIXME("%p %p\n", This
, remoteAddrs
);
226 static HRESULT WINAPI
fw_service_put_RemoteAddresses(
227 INetFwService
*iface
,
230 fw_service
*This
= impl_from_INetFwService( iface
);
232 FIXME("%p %s\n", This
, debugstr_w(remoteAddrs
));
236 static HRESULT WINAPI
fw_service_get_Enabled(
237 INetFwService
*iface
,
238 VARIANT_BOOL
*enabled
)
240 fw_service
*This
= impl_from_INetFwService( iface
);
242 FIXME("%p %p\n", This
, enabled
);
246 static HRESULT WINAPI
fw_service_put_Enabled(
247 INetFwService
*iface
,
248 VARIANT_BOOL enabled
)
250 fw_service
*This
= impl_from_INetFwService( iface
);
252 FIXME("%p %d\n", This
, enabled
);
256 static HRESULT WINAPI
fw_service_get_GloballyOpenPorts(
257 INetFwService
*iface
,
258 INetFwOpenPorts
**openPorts
)
260 fw_service
*This
= impl_from_INetFwService( iface
);
262 TRACE("%p %p\n", This
, openPorts
);
263 return NetFwOpenPorts_create( NULL
, (void **)openPorts
);
266 static const struct INetFwServiceVtbl fw_service_vtbl
=
268 fw_service_QueryInterface
,
271 fw_service_GetTypeInfoCount
,
272 fw_service_GetTypeInfo
,
273 fw_service_GetIDsOfNames
,
277 fw_service_get_Customized
,
278 fw_service_get_IpVersion
,
279 fw_service_put_IpVersion
,
280 fw_service_get_Scope
,
281 fw_service_put_Scope
,
282 fw_service_get_RemoteAddresses
,
283 fw_service_put_RemoteAddresses
,
284 fw_service_get_Enabled
,
285 fw_service_put_Enabled
,
286 fw_service_get_GloballyOpenPorts
289 static HRESULT
NetFwService_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
293 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
295 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
296 if (!fp
) return E_OUTOFMEMORY
;
298 fp
->vtbl
= &fw_service_vtbl
;
303 TRACE("returning iface %p\n", *ppObj
);
307 typedef struct fw_services
309 const INetFwServicesVtbl
*vtbl
;
313 static inline fw_services
*impl_from_INetFwServices( INetFwServices
*iface
)
315 return (fw_services
*)((char *)iface
- FIELD_OFFSET( fw_services
, vtbl
));
318 static ULONG WINAPI
fw_services_AddRef(
319 INetFwServices
*iface
)
321 fw_services
*fw_services
= impl_from_INetFwServices( iface
);
322 return InterlockedIncrement( &fw_services
->refs
);
325 static ULONG WINAPI
fw_services_Release(
326 INetFwServices
*iface
)
328 fw_services
*fw_services
= impl_from_INetFwServices( iface
);
329 LONG refs
= InterlockedDecrement( &fw_services
->refs
);
332 TRACE("destroying %p\n", fw_services
);
333 HeapFree( GetProcessHeap(), 0, fw_services
);
338 static HRESULT WINAPI
fw_services_QueryInterface(
339 INetFwServices
*iface
,
343 fw_services
*This
= impl_from_INetFwServices( iface
);
345 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
347 if ( IsEqualGUID( riid
, &IID_INetFwServices
) ||
348 IsEqualGUID( riid
, &IID_IDispatch
) ||
349 IsEqualGUID( riid
, &IID_IUnknown
) )
355 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
356 return E_NOINTERFACE
;
358 INetFwServices_AddRef( iface
);
362 static HRESULT WINAPI
fw_services_GetTypeInfoCount(
363 INetFwServices
*iface
,
366 fw_services
*This
= impl_from_INetFwServices( iface
);
368 FIXME("%p %p\n", This
, pctinfo
);
372 static HRESULT WINAPI
fw_services_GetTypeInfo(
373 INetFwServices
*iface
,
376 ITypeInfo
**ppTInfo
)
378 fw_services
*This
= impl_from_INetFwServices( iface
);
380 FIXME("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
384 static HRESULT WINAPI
fw_services_GetIDsOfNames(
385 INetFwServices
*iface
,
392 fw_services
*This
= impl_from_INetFwServices( iface
);
394 FIXME("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
398 static HRESULT WINAPI
fw_services_Invoke(
399 INetFwServices
*iface
,
404 DISPPARAMS
*pDispParams
,
406 EXCEPINFO
*pExcepInfo
,
409 fw_services
*This
= impl_from_INetFwServices( iface
);
411 FIXME("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
412 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
416 static HRESULT WINAPI
fw_services_get_Count(
417 INetFwServices
*iface
,
420 fw_services
*This
= impl_from_INetFwServices( iface
);
422 FIXME("%p, %p\n", This
, count
);
428 static HRESULT WINAPI
fw_services_Item(
429 INetFwServices
*iface
,
430 NET_FW_SERVICE_TYPE svcType
,
431 INetFwService
**service
)
433 fw_services
*This
= impl_from_INetFwServices( iface
);
435 FIXME("%p, %u, %p\n", This
, svcType
, service
);
436 return NetFwService_create( NULL
, (void **)service
);
439 static HRESULT WINAPI
fw_services_get__NewEnum(
440 INetFwServices
*iface
,
443 fw_services
*This
= impl_from_INetFwServices( iface
);
445 FIXME("%p, %p\n", This
, newEnum
);
449 static const struct INetFwServicesVtbl fw_services_vtbl
=
451 fw_services_QueryInterface
,
454 fw_services_GetTypeInfoCount
,
455 fw_services_GetTypeInfo
,
456 fw_services_GetIDsOfNames
,
458 fw_services_get_Count
,
460 fw_services_get__NewEnum
463 HRESULT
NetFwServices_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
467 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
469 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
470 if (!fp
) return E_OUTOFMEMORY
;
472 fp
->vtbl
= &fw_services_vtbl
;
477 TRACE("returning iface %p\n", *ppObj
);