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
,
116 HRESULT
get_typeinfo( enum type_id tid
, ITypeInfo
**ret
)
124 hr
= LoadRegTypeLib( &LIBID_NetFwPublicTypeLib
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &lib
);
127 ERR("LoadRegTypeLib failed: %08x\n", hr
);
130 if (InterlockedCompareExchangePointer( (void **)&typelib
, lib
, NULL
))
131 ITypeLib_Release( lib
);
137 hr
= ITypeLib_GetTypeInfoOfGuid( typelib
, tid_id
[tid
], &info
);
140 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id
[tid
]), hr
);
143 if (InterlockedCompareExchangePointer( (void **)(typeinfo
+ tid
), info
, NULL
))
144 ITypeInfo_Release( info
);
146 *ret
= typeinfo
[tid
];
147 ITypeInfo_AddRef(typeinfo
[tid
]);
151 void release_typelib(void)
155 for (i
= 0; i
< sizeof(typeinfo
)/sizeof(*typeinfo
); i
++)
157 ITypeInfo_Release(typeinfo
[i
]);
160 ITypeLib_Release(typelib
);
163 static HRESULT WINAPI
fw_app_GetTypeInfo(
164 INetFwAuthorizedApplication
*iface
,
167 ITypeInfo
**ppTInfo
)
169 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
171 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
172 return get_typeinfo( INetFwAuthorizedApplication_tid
, ppTInfo
);
175 static HRESULT WINAPI
fw_app_GetIDsOfNames(
176 INetFwAuthorizedApplication
*iface
,
183 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
187 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
189 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
192 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
193 ITypeInfo_Release( typeinfo
);
198 static HRESULT WINAPI
fw_app_Invoke(
199 INetFwAuthorizedApplication
*iface
,
204 DISPPARAMS
*pDispParams
,
206 EXCEPINFO
*pExcepInfo
,
209 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
213 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
214 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
216 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
219 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplication_iface
, dispIdMember
,
220 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
221 ITypeInfo_Release( typeinfo
);
226 static HRESULT WINAPI
fw_app_get_Name(
227 INetFwAuthorizedApplication
*iface
,
230 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
232 FIXME("%p, %p\n", This
, name
);
236 static HRESULT WINAPI
fw_app_put_Name(
237 INetFwAuthorizedApplication
*iface
,
240 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
242 FIXME("%p, %s\n", This
, debugstr_w(name
));
246 static HRESULT WINAPI
fw_app_get_ProcessImageFileName(
247 INetFwAuthorizedApplication
*iface
,
248 BSTR
*imageFileName
)
250 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
252 FIXME("%p, %p\n", This
, imageFileName
);
256 static HRESULT WINAPI
fw_app_put_ProcessImageFileName(
257 INetFwAuthorizedApplication
*iface
,
260 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
262 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
266 static HRESULT WINAPI
fw_app_get_IpVersion(
267 INetFwAuthorizedApplication
*iface
,
268 NET_FW_IP_VERSION
*ipVersion
)
270 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
272 TRACE("%p, %p\n", This
, ipVersion
);
276 *ipVersion
= NET_FW_IP_VERSION_ANY
;
280 static HRESULT WINAPI
fw_app_put_IpVersion(
281 INetFwAuthorizedApplication
*iface
,
282 NET_FW_IP_VERSION ipVersion
)
284 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
286 TRACE("%p, %u\n", This
, ipVersion
);
290 static HRESULT WINAPI
fw_app_get_Scope(
291 INetFwAuthorizedApplication
*iface
,
292 NET_FW_SCOPE
*scope
)
294 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
296 FIXME("%p, %p\n", This
, scope
);
300 static HRESULT WINAPI
fw_app_put_Scope(
301 INetFwAuthorizedApplication
*iface
,
304 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
306 FIXME("%p, %u\n", This
, scope
);
310 static HRESULT WINAPI
fw_app_get_RemoteAddresses(
311 INetFwAuthorizedApplication
*iface
,
314 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
316 FIXME("%p, %p\n", This
, remoteAddrs
);
320 static HRESULT WINAPI
fw_app_put_RemoteAddresses(
321 INetFwAuthorizedApplication
*iface
,
324 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
326 FIXME("%p, %s\n", This
, debugstr_w(remoteAddrs
));
330 static HRESULT WINAPI
fw_app_get_Enabled(
331 INetFwAuthorizedApplication
*iface
,
332 VARIANT_BOOL
*enabled
)
334 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
336 FIXME("%p, %p\n", This
, enabled
);
338 *enabled
= VARIANT_FALSE
;
342 static HRESULT WINAPI
fw_app_put_Enabled(
343 INetFwAuthorizedApplication
*iface
,
344 VARIANT_BOOL enabled
)
346 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
348 FIXME("%p, %d\n", This
, enabled
);
352 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl
=
354 fw_app_QueryInterface
,
357 fw_app_GetTypeInfoCount
,
359 fw_app_GetIDsOfNames
,
363 fw_app_get_ProcessImageFileName
,
364 fw_app_put_ProcessImageFileName
,
365 fw_app_get_IpVersion
,
366 fw_app_put_IpVersion
,
369 fw_app_get_RemoteAddresses
,
370 fw_app_put_RemoteAddresses
,
375 HRESULT
NetFwAuthorizedApplication_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
379 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
381 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
382 if (!fa
) return E_OUTOFMEMORY
;
384 fa
->INetFwAuthorizedApplication_iface
.lpVtbl
= &fw_app_vtbl
;
387 *ppObj
= &fa
->INetFwAuthorizedApplication_iface
;
389 TRACE("returning iface %p\n", *ppObj
);
392 typedef struct fw_apps
394 INetFwAuthorizedApplications INetFwAuthorizedApplications_iface
;
398 static inline fw_apps
*impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications
*iface
)
400 return CONTAINING_RECORD(iface
, fw_apps
, INetFwAuthorizedApplications_iface
);
403 static ULONG WINAPI
fw_apps_AddRef(
404 INetFwAuthorizedApplications
*iface
)
406 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
407 return InterlockedIncrement( &fw_apps
->refs
);
410 static ULONG WINAPI
fw_apps_Release(
411 INetFwAuthorizedApplications
*iface
)
413 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
414 LONG refs
= InterlockedDecrement( &fw_apps
->refs
);
417 TRACE("destroying %p\n", fw_apps
);
418 HeapFree( GetProcessHeap(), 0, fw_apps
);
423 static HRESULT WINAPI
fw_apps_QueryInterface(
424 INetFwAuthorizedApplications
*iface
,
428 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
430 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
432 if ( IsEqualGUID( riid
, &IID_INetFwAuthorizedApplications
) ||
433 IsEqualGUID( riid
, &IID_IDispatch
) ||
434 IsEqualGUID( riid
, &IID_IUnknown
) )
440 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
441 return E_NOINTERFACE
;
443 INetFwAuthorizedApplications_AddRef( iface
);
447 static HRESULT WINAPI
fw_apps_GetTypeInfoCount(
448 INetFwAuthorizedApplications
*iface
,
451 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
453 FIXME("%p %p\n", This
, pctinfo
);
457 static HRESULT WINAPI
fw_apps_GetTypeInfo(
458 INetFwAuthorizedApplications
*iface
,
461 ITypeInfo
**ppTInfo
)
463 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
465 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
466 return get_typeinfo( INetFwAuthorizedApplications_tid
, ppTInfo
);
469 static HRESULT WINAPI
fw_apps_GetIDsOfNames(
470 INetFwAuthorizedApplications
*iface
,
477 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
481 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
483 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
486 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
487 ITypeInfo_Release( typeinfo
);
492 static HRESULT WINAPI
fw_apps_Invoke(
493 INetFwAuthorizedApplications
*iface
,
498 DISPPARAMS
*pDispParams
,
500 EXCEPINFO
*pExcepInfo
,
503 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
507 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
508 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
510 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
513 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplications_iface
, dispIdMember
,
514 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
515 ITypeInfo_Release( typeinfo
);
520 static HRESULT WINAPI
fw_apps_get_Count(
521 INetFwAuthorizedApplications
*iface
,
524 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
526 FIXME("%p, %p\n", This
, count
);
530 static HRESULT WINAPI
fw_apps_Add(
531 INetFwAuthorizedApplications
*iface
,
532 INetFwAuthorizedApplication
*app
)
534 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
536 FIXME("%p, %p\n", This
, app
);
540 static HRESULT WINAPI
fw_apps_Remove(
541 INetFwAuthorizedApplications
*iface
,
544 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
546 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
550 static HRESULT WINAPI
fw_apps_Item(
551 INetFwAuthorizedApplications
*iface
,
553 INetFwAuthorizedApplication
**app
)
555 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
557 TRACE("%p, %s, %p\n", This
, debugstr_w(imageFileName
), app
);
558 return NetFwAuthorizedApplication_create( NULL
, (void **)app
);
561 static HRESULT WINAPI
fw_apps_get__NewEnum(
562 INetFwAuthorizedApplications
*iface
,
565 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
567 FIXME("%p, %p\n", This
, newEnum
);
571 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl
=
573 fw_apps_QueryInterface
,
576 fw_apps_GetTypeInfoCount
,
578 fw_apps_GetIDsOfNames
,
587 HRESULT
NetFwAuthorizedApplications_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
591 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
593 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
594 if (!fa
) return E_OUTOFMEMORY
;
596 fa
->INetFwAuthorizedApplications_iface
.lpVtbl
= &fw_apps_vtbl
;
599 *ppObj
= &fa
->INetFwAuthorizedApplications_iface
;
601 TRACE("returning iface %p\n", *ppObj
);