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
);
39 INetFwAuthorizedApplication INetFwAuthorizedApplication_iface
;
43 static inline fw_app
*impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication
*iface
)
45 return CONTAINING_RECORD(iface
, fw_app
, INetFwAuthorizedApplication_iface
);
48 static ULONG WINAPI
fw_app_AddRef(
49 INetFwAuthorizedApplication
*iface
)
51 fw_app
*fw_app
= impl_from_INetFwAuthorizedApplication( iface
);
52 return InterlockedIncrement( &fw_app
->refs
);
55 static ULONG WINAPI
fw_app_Release(
56 INetFwAuthorizedApplication
*iface
)
58 fw_app
*fw_app
= impl_from_INetFwAuthorizedApplication( iface
);
59 LONG refs
= InterlockedDecrement( &fw_app
->refs
);
62 TRACE("destroying %p\n", fw_app
);
63 HeapFree( GetProcessHeap(), 0, fw_app
);
68 static HRESULT WINAPI
fw_app_QueryInterface(
69 INetFwAuthorizedApplication
*iface
,
73 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
75 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
77 if ( IsEqualGUID( riid
, &IID_INetFwAuthorizedApplication
) ||
78 IsEqualGUID( riid
, &IID_IDispatch
) ||
79 IsEqualGUID( riid
, &IID_IUnknown
) )
85 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
88 INetFwAuthorizedApplication_AddRef( iface
);
92 static HRESULT WINAPI
fw_app_GetTypeInfoCount(
93 INetFwAuthorizedApplication
*iface
,
96 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
98 TRACE("%p %p\n", This
, pctinfo
);
103 static ITypeLib
*typelib
;
104 static ITypeInfo
*typeinfo
[last_tid
];
106 static REFIID tid_id
[] =
108 &IID_INetFwAuthorizedApplication
,
109 &IID_INetFwAuthorizedApplications
,
112 &IID_INetFwOpenPorts
,
117 HRESULT
get_typeinfo( enum type_id tid
, ITypeInfo
**ret
)
125 hr
= LoadRegTypeLib( &LIBID_NetFwPublicTypeLib
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &lib
);
128 ERR("LoadRegTypeLib failed: %08x\n", hr
);
131 if (InterlockedCompareExchangePointer( (void **)&typelib
, lib
, NULL
))
132 ITypeLib_Release( lib
);
138 hr
= ITypeLib_GetTypeInfoOfGuid( typelib
, tid_id
[tid
], &info
);
141 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id
[tid
]), hr
);
144 if (InterlockedCompareExchangePointer( (void **)(typeinfo
+ tid
), info
, NULL
))
145 ITypeInfo_Release( info
);
147 *ret
= typeinfo
[tid
];
148 ITypeInfo_AddRef(typeinfo
[tid
]);
152 void release_typelib(void)
156 for (i
= 0; i
< sizeof(typeinfo
)/sizeof(*typeinfo
); i
++)
158 ITypeInfo_Release(typeinfo
[i
]);
161 ITypeLib_Release(typelib
);
164 static HRESULT WINAPI
fw_app_GetTypeInfo(
165 INetFwAuthorizedApplication
*iface
,
168 ITypeInfo
**ppTInfo
)
170 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
172 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
173 return get_typeinfo( INetFwAuthorizedApplication_tid
, ppTInfo
);
176 static HRESULT WINAPI
fw_app_GetIDsOfNames(
177 INetFwAuthorizedApplication
*iface
,
184 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
188 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
190 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
193 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
194 ITypeInfo_Release( typeinfo
);
199 static HRESULT WINAPI
fw_app_Invoke(
200 INetFwAuthorizedApplication
*iface
,
205 DISPPARAMS
*pDispParams
,
207 EXCEPINFO
*pExcepInfo
,
210 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
214 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
215 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
217 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
220 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplication_iface
, dispIdMember
,
221 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
222 ITypeInfo_Release( typeinfo
);
227 static HRESULT WINAPI
fw_app_get_Name(
228 INetFwAuthorizedApplication
*iface
,
231 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
233 FIXME("%p, %p\n", This
, name
);
237 static HRESULT WINAPI
fw_app_put_Name(
238 INetFwAuthorizedApplication
*iface
,
241 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
243 FIXME("%p, %s\n", This
, debugstr_w(name
));
247 static HRESULT WINAPI
fw_app_get_ProcessImageFileName(
248 INetFwAuthorizedApplication
*iface
,
249 BSTR
*imageFileName
)
251 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
253 FIXME("%p, %p\n", This
, imageFileName
);
257 static HRESULT WINAPI
fw_app_put_ProcessImageFileName(
258 INetFwAuthorizedApplication
*iface
,
261 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
263 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
267 static HRESULT WINAPI
fw_app_get_IpVersion(
268 INetFwAuthorizedApplication
*iface
,
269 NET_FW_IP_VERSION
*ipVersion
)
271 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
273 TRACE("%p, %p\n", This
, ipVersion
);
277 *ipVersion
= NET_FW_IP_VERSION_ANY
;
281 static HRESULT WINAPI
fw_app_put_IpVersion(
282 INetFwAuthorizedApplication
*iface
,
283 NET_FW_IP_VERSION ipVersion
)
285 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
287 TRACE("%p, %u\n", This
, ipVersion
);
291 static HRESULT WINAPI
fw_app_get_Scope(
292 INetFwAuthorizedApplication
*iface
,
293 NET_FW_SCOPE
*scope
)
295 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
297 FIXME("%p, %p\n", This
, scope
);
301 static HRESULT WINAPI
fw_app_put_Scope(
302 INetFwAuthorizedApplication
*iface
,
305 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
307 FIXME("%p, %u\n", This
, scope
);
311 static HRESULT WINAPI
fw_app_get_RemoteAddresses(
312 INetFwAuthorizedApplication
*iface
,
315 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
317 FIXME("%p, %p\n", This
, remoteAddrs
);
321 static HRESULT WINAPI
fw_app_put_RemoteAddresses(
322 INetFwAuthorizedApplication
*iface
,
325 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
327 FIXME("%p, %s\n", This
, debugstr_w(remoteAddrs
));
331 static HRESULT WINAPI
fw_app_get_Enabled(
332 INetFwAuthorizedApplication
*iface
,
333 VARIANT_BOOL
*enabled
)
335 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
337 FIXME("%p, %p\n", This
, enabled
);
339 *enabled
= VARIANT_FALSE
;
343 static HRESULT WINAPI
fw_app_put_Enabled(
344 INetFwAuthorizedApplication
*iface
,
345 VARIANT_BOOL enabled
)
347 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
349 FIXME("%p, %d\n", This
, enabled
);
353 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl
=
355 fw_app_QueryInterface
,
358 fw_app_GetTypeInfoCount
,
360 fw_app_GetIDsOfNames
,
364 fw_app_get_ProcessImageFileName
,
365 fw_app_put_ProcessImageFileName
,
366 fw_app_get_IpVersion
,
367 fw_app_put_IpVersion
,
370 fw_app_get_RemoteAddresses
,
371 fw_app_put_RemoteAddresses
,
376 HRESULT
NetFwAuthorizedApplication_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
380 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
382 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
383 if (!fa
) return E_OUTOFMEMORY
;
385 fa
->INetFwAuthorizedApplication_iface
.lpVtbl
= &fw_app_vtbl
;
388 *ppObj
= &fa
->INetFwAuthorizedApplication_iface
;
390 TRACE("returning iface %p\n", *ppObj
);
393 typedef struct fw_apps
395 INetFwAuthorizedApplications INetFwAuthorizedApplications_iface
;
399 static inline fw_apps
*impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications
*iface
)
401 return CONTAINING_RECORD(iface
, fw_apps
, INetFwAuthorizedApplications_iface
);
404 static ULONG WINAPI
fw_apps_AddRef(
405 INetFwAuthorizedApplications
*iface
)
407 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
408 return InterlockedIncrement( &fw_apps
->refs
);
411 static ULONG WINAPI
fw_apps_Release(
412 INetFwAuthorizedApplications
*iface
)
414 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
415 LONG refs
= InterlockedDecrement( &fw_apps
->refs
);
418 TRACE("destroying %p\n", fw_apps
);
419 HeapFree( GetProcessHeap(), 0, fw_apps
);
424 static HRESULT WINAPI
fw_apps_QueryInterface(
425 INetFwAuthorizedApplications
*iface
,
429 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
431 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
433 if ( IsEqualGUID( riid
, &IID_INetFwAuthorizedApplications
) ||
434 IsEqualGUID( riid
, &IID_IDispatch
) ||
435 IsEqualGUID( riid
, &IID_IUnknown
) )
441 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
442 return E_NOINTERFACE
;
444 INetFwAuthorizedApplications_AddRef( iface
);
448 static HRESULT WINAPI
fw_apps_GetTypeInfoCount(
449 INetFwAuthorizedApplications
*iface
,
452 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
454 FIXME("%p %p\n", This
, pctinfo
);
458 static HRESULT WINAPI
fw_apps_GetTypeInfo(
459 INetFwAuthorizedApplications
*iface
,
462 ITypeInfo
**ppTInfo
)
464 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
466 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
467 return get_typeinfo( INetFwAuthorizedApplications_tid
, ppTInfo
);
470 static HRESULT WINAPI
fw_apps_GetIDsOfNames(
471 INetFwAuthorizedApplications
*iface
,
478 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
482 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
484 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
487 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
488 ITypeInfo_Release( typeinfo
);
493 static HRESULT WINAPI
fw_apps_Invoke(
494 INetFwAuthorizedApplications
*iface
,
499 DISPPARAMS
*pDispParams
,
501 EXCEPINFO
*pExcepInfo
,
504 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
508 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
509 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
511 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
514 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplications_iface
, dispIdMember
,
515 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
516 ITypeInfo_Release( typeinfo
);
521 static HRESULT WINAPI
fw_apps_get_Count(
522 INetFwAuthorizedApplications
*iface
,
525 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
527 FIXME("%p, %p\n", This
, count
);
531 static HRESULT WINAPI
fw_apps_Add(
532 INetFwAuthorizedApplications
*iface
,
533 INetFwAuthorizedApplication
*app
)
535 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
537 FIXME("%p, %p\n", This
, app
);
541 static HRESULT WINAPI
fw_apps_Remove(
542 INetFwAuthorizedApplications
*iface
,
545 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
547 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
551 static HRESULT WINAPI
fw_apps_Item(
552 INetFwAuthorizedApplications
*iface
,
554 INetFwAuthorizedApplication
**app
)
556 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
558 TRACE("%p, %s, %p\n", This
, debugstr_w(imageFileName
), app
);
559 return NetFwAuthorizedApplication_create( NULL
, (void **)app
);
562 static HRESULT WINAPI
fw_apps_get__NewEnum(
563 INetFwAuthorizedApplications
*iface
,
566 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
568 FIXME("%p, %p\n", This
, newEnum
);
572 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl
=
574 fw_apps_QueryInterface
,
577 fw_apps_GetTypeInfoCount
,
579 fw_apps_GetIDsOfNames
,
588 HRESULT
NetFwAuthorizedApplications_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
592 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
594 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
595 if (!fa
) return E_OUTOFMEMORY
;
597 fa
->INetFwAuthorizedApplications_iface
.lpVtbl
= &fw_apps_vtbl
;
600 *ppObj
= &fa
->INetFwAuthorizedApplications_iface
;
602 TRACE("returning iface %p\n", *ppObj
);