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
,
115 HRESULT
get_typeinfo( enum type_id tid
, ITypeInfo
**ret
)
123 hr
= LoadRegTypeLib( &LIBID_NetFwPublicTypeLib
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &lib
);
126 ERR("LoadRegTypeLib failed: %08x\n", hr
);
129 if (InterlockedCompareExchangePointer( (void **)&typelib
, lib
, NULL
))
130 ITypeLib_Release( lib
);
136 hr
= ITypeLib_GetTypeInfoOfGuid( typelib
, tid_id
[tid
], &info
);
139 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id
[tid
]), hr
);
142 if (InterlockedCompareExchangePointer( (void **)(typeinfo
+ tid
), info
, NULL
))
143 ITypeInfo_Release( info
);
145 *ret
= typeinfo
[tid
];
149 static HRESULT WINAPI
fw_app_GetTypeInfo(
150 INetFwAuthorizedApplication
*iface
,
153 ITypeInfo
**ppTInfo
)
155 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
157 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
158 return get_typeinfo( INetFwAuthorizedApplication_tid
, ppTInfo
);
161 static HRESULT WINAPI
fw_app_GetIDsOfNames(
162 INetFwAuthorizedApplication
*iface
,
169 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
173 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
175 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
178 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
179 ITypeInfo_Release( typeinfo
);
184 static HRESULT WINAPI
fw_app_Invoke(
185 INetFwAuthorizedApplication
*iface
,
190 DISPPARAMS
*pDispParams
,
192 EXCEPINFO
*pExcepInfo
,
195 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
199 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
200 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
202 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
205 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplication_iface
, dispIdMember
,
206 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
207 ITypeInfo_Release( typeinfo
);
212 static HRESULT WINAPI
fw_app_get_Name(
213 INetFwAuthorizedApplication
*iface
,
216 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
218 FIXME("%p, %p\n", This
, name
);
222 static HRESULT WINAPI
fw_app_put_Name(
223 INetFwAuthorizedApplication
*iface
,
226 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
228 FIXME("%p, %s\n", This
, debugstr_w(name
));
232 static HRESULT WINAPI
fw_app_get_ProcessImageFileName(
233 INetFwAuthorizedApplication
*iface
,
234 BSTR
*imageFileName
)
236 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
238 FIXME("%p, %p\n", This
, imageFileName
);
242 static HRESULT WINAPI
fw_app_put_ProcessImageFileName(
243 INetFwAuthorizedApplication
*iface
,
246 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
248 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
252 static HRESULT WINAPI
fw_app_get_IpVersion(
253 INetFwAuthorizedApplication
*iface
,
254 NET_FW_IP_VERSION
*ipVersion
)
256 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
258 FIXME("%p, %p\n", This
, ipVersion
);
262 static HRESULT WINAPI
fw_app_put_IpVersion(
263 INetFwAuthorizedApplication
*iface
,
264 NET_FW_IP_VERSION ipVersion
)
266 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
268 FIXME("%p, %u\n", This
, ipVersion
);
272 static HRESULT WINAPI
fw_app_get_Scope(
273 INetFwAuthorizedApplication
*iface
,
274 NET_FW_SCOPE
*scope
)
276 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
278 FIXME("%p, %p\n", This
, scope
);
282 static HRESULT WINAPI
fw_app_put_Scope(
283 INetFwAuthorizedApplication
*iface
,
286 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
288 FIXME("%p, %u\n", This
, scope
);
292 static HRESULT WINAPI
fw_app_get_RemoteAddresses(
293 INetFwAuthorizedApplication
*iface
,
296 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
298 FIXME("%p, %p\n", This
, remoteAddrs
);
302 static HRESULT WINAPI
fw_app_put_RemoteAddresses(
303 INetFwAuthorizedApplication
*iface
,
306 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
308 FIXME("%p, %s\n", This
, debugstr_w(remoteAddrs
));
312 static HRESULT WINAPI
fw_app_get_Enabled(
313 INetFwAuthorizedApplication
*iface
,
314 VARIANT_BOOL
*enabled
)
316 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
318 FIXME("%p, %p\n", This
, enabled
);
320 *enabled
= VARIANT_FALSE
;
324 static HRESULT WINAPI
fw_app_put_Enabled(
325 INetFwAuthorizedApplication
*iface
,
326 VARIANT_BOOL enabled
)
328 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
330 FIXME("%p, %d\n", This
, enabled
);
334 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl
=
336 fw_app_QueryInterface
,
339 fw_app_GetTypeInfoCount
,
341 fw_app_GetIDsOfNames
,
345 fw_app_get_ProcessImageFileName
,
346 fw_app_put_ProcessImageFileName
,
347 fw_app_get_IpVersion
,
348 fw_app_put_IpVersion
,
351 fw_app_get_RemoteAddresses
,
352 fw_app_put_RemoteAddresses
,
357 HRESULT
NetFwAuthorizedApplication_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
361 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
363 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
364 if (!fa
) return E_OUTOFMEMORY
;
366 fa
->INetFwAuthorizedApplication_iface
.lpVtbl
= &fw_app_vtbl
;
369 *ppObj
= &fa
->INetFwAuthorizedApplication_iface
;
371 TRACE("returning iface %p\n", *ppObj
);
374 typedef struct fw_apps
376 INetFwAuthorizedApplications INetFwAuthorizedApplications_iface
;
380 static inline fw_apps
*impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications
*iface
)
382 return CONTAINING_RECORD(iface
, fw_apps
, INetFwAuthorizedApplications_iface
);
385 static ULONG WINAPI
fw_apps_AddRef(
386 INetFwAuthorizedApplications
*iface
)
388 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
389 return InterlockedIncrement( &fw_apps
->refs
);
392 static ULONG WINAPI
fw_apps_Release(
393 INetFwAuthorizedApplications
*iface
)
395 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
396 LONG refs
= InterlockedDecrement( &fw_apps
->refs
);
399 TRACE("destroying %p\n", fw_apps
);
400 HeapFree( GetProcessHeap(), 0, fw_apps
);
405 static HRESULT WINAPI
fw_apps_QueryInterface(
406 INetFwAuthorizedApplications
*iface
,
410 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
412 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
414 if ( IsEqualGUID( riid
, &IID_INetFwAuthorizedApplications
) ||
415 IsEqualGUID( riid
, &IID_IDispatch
) ||
416 IsEqualGUID( riid
, &IID_IUnknown
) )
422 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
423 return E_NOINTERFACE
;
425 INetFwAuthorizedApplications_AddRef( iface
);
429 static HRESULT WINAPI
fw_apps_GetTypeInfoCount(
430 INetFwAuthorizedApplications
*iface
,
433 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
435 FIXME("%p %p\n", This
, pctinfo
);
439 static HRESULT WINAPI
fw_apps_GetTypeInfo(
440 INetFwAuthorizedApplications
*iface
,
443 ITypeInfo
**ppTInfo
)
445 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
447 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
448 return get_typeinfo( INetFwAuthorizedApplications_tid
, ppTInfo
);
451 static HRESULT WINAPI
fw_apps_GetIDsOfNames(
452 INetFwAuthorizedApplications
*iface
,
459 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
463 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
465 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
468 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
469 ITypeInfo_Release( typeinfo
);
474 static HRESULT WINAPI
fw_apps_Invoke(
475 INetFwAuthorizedApplications
*iface
,
480 DISPPARAMS
*pDispParams
,
482 EXCEPINFO
*pExcepInfo
,
485 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
489 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
490 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
492 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
495 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplications_iface
, dispIdMember
,
496 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
497 ITypeInfo_Release( typeinfo
);
502 static HRESULT WINAPI
fw_apps_get_Count(
503 INetFwAuthorizedApplications
*iface
,
506 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
508 FIXME("%p, %p\n", This
, count
);
512 static HRESULT WINAPI
fw_apps_Add(
513 INetFwAuthorizedApplications
*iface
,
514 INetFwAuthorizedApplication
*app
)
516 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
518 FIXME("%p, %p\n", This
, app
);
522 static HRESULT WINAPI
fw_apps_Remove(
523 INetFwAuthorizedApplications
*iface
,
526 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
528 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
532 static HRESULT WINAPI
fw_apps_Item(
533 INetFwAuthorizedApplications
*iface
,
535 INetFwAuthorizedApplication
**app
)
537 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
539 TRACE("%p, %s, %p\n", This
, debugstr_w(imageFileName
), app
);
540 return NetFwAuthorizedApplication_create( NULL
, (void **)app
);
543 static HRESULT WINAPI
fw_apps_get__NewEnum(
544 INetFwAuthorizedApplications
*iface
,
547 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
549 FIXME("%p, %p\n", This
, newEnum
);
553 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl
=
555 fw_apps_QueryInterface
,
558 fw_apps_GetTypeInfoCount
,
560 fw_apps_GetIDsOfNames
,
569 HRESULT
NetFwAuthorizedApplications_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
573 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
575 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
576 if (!fa
) return E_OUTOFMEMORY
;
578 fa
->INetFwAuthorizedApplications_iface
.lpVtbl
= &fw_apps_vtbl
;
581 *ppObj
= &fa
->INetFwAuthorizedApplications_iface
;
583 TRACE("returning iface %p\n", *ppObj
);