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
,
118 HRESULT
get_typeinfo( enum type_id tid
, ITypeInfo
**ret
)
126 hr
= LoadRegTypeLib( &LIBID_NetFwPublicTypeLib
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &lib
);
129 ERR("LoadRegTypeLib failed: %08x\n", hr
);
132 if (InterlockedCompareExchangePointer( (void **)&typelib
, lib
, NULL
))
133 ITypeLib_Release( lib
);
139 hr
= ITypeLib_GetTypeInfoOfGuid( typelib
, tid_id
[tid
], &info
);
142 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id
[tid
]), hr
);
145 if (InterlockedCompareExchangePointer( (void **)(typeinfo
+ tid
), info
, NULL
))
146 ITypeInfo_Release( info
);
148 *ret
= typeinfo
[tid
];
149 ITypeInfo_AddRef(typeinfo
[tid
]);
153 void release_typelib(void)
157 for (i
= 0; i
< sizeof(typeinfo
)/sizeof(*typeinfo
); i
++)
159 ITypeInfo_Release(typeinfo
[i
]);
162 ITypeLib_Release(typelib
);
165 static HRESULT WINAPI
fw_app_GetTypeInfo(
166 INetFwAuthorizedApplication
*iface
,
169 ITypeInfo
**ppTInfo
)
171 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
173 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
174 return get_typeinfo( INetFwAuthorizedApplication_tid
, ppTInfo
);
177 static HRESULT WINAPI
fw_app_GetIDsOfNames(
178 INetFwAuthorizedApplication
*iface
,
185 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
189 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
191 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
194 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
195 ITypeInfo_Release( typeinfo
);
200 static HRESULT WINAPI
fw_app_Invoke(
201 INetFwAuthorizedApplication
*iface
,
206 DISPPARAMS
*pDispParams
,
208 EXCEPINFO
*pExcepInfo
,
211 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
215 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
216 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
218 hr
= get_typeinfo( INetFwAuthorizedApplication_tid
, &typeinfo
);
221 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplication_iface
, dispIdMember
,
222 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
223 ITypeInfo_Release( typeinfo
);
228 static HRESULT WINAPI
fw_app_get_Name(
229 INetFwAuthorizedApplication
*iface
,
232 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
234 FIXME("%p, %p\n", This
, name
);
238 static HRESULT WINAPI
fw_app_put_Name(
239 INetFwAuthorizedApplication
*iface
,
242 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
244 FIXME("%p, %s\n", This
, debugstr_w(name
));
248 static HRESULT WINAPI
fw_app_get_ProcessImageFileName(
249 INetFwAuthorizedApplication
*iface
,
250 BSTR
*imageFileName
)
252 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
254 FIXME("%p, %p\n", This
, imageFileName
);
258 static HRESULT WINAPI
fw_app_put_ProcessImageFileName(
259 INetFwAuthorizedApplication
*iface
,
262 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
264 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
268 static HRESULT WINAPI
fw_app_get_IpVersion(
269 INetFwAuthorizedApplication
*iface
,
270 NET_FW_IP_VERSION
*ipVersion
)
272 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
274 TRACE("%p, %p\n", This
, ipVersion
);
278 *ipVersion
= NET_FW_IP_VERSION_ANY
;
282 static HRESULT WINAPI
fw_app_put_IpVersion(
283 INetFwAuthorizedApplication
*iface
,
284 NET_FW_IP_VERSION ipVersion
)
286 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
288 TRACE("%p, %u\n", This
, ipVersion
);
292 static HRESULT WINAPI
fw_app_get_Scope(
293 INetFwAuthorizedApplication
*iface
,
294 NET_FW_SCOPE
*scope
)
296 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
298 FIXME("%p, %p\n", This
, scope
);
302 static HRESULT WINAPI
fw_app_put_Scope(
303 INetFwAuthorizedApplication
*iface
,
306 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
308 FIXME("%p, %u\n", This
, scope
);
312 static HRESULT WINAPI
fw_app_get_RemoteAddresses(
313 INetFwAuthorizedApplication
*iface
,
316 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
318 FIXME("%p, %p\n", This
, remoteAddrs
);
322 static HRESULT WINAPI
fw_app_put_RemoteAddresses(
323 INetFwAuthorizedApplication
*iface
,
326 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
328 FIXME("%p, %s\n", This
, debugstr_w(remoteAddrs
));
332 static HRESULT WINAPI
fw_app_get_Enabled(
333 INetFwAuthorizedApplication
*iface
,
334 VARIANT_BOOL
*enabled
)
336 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
338 FIXME("%p, %p\n", This
, enabled
);
340 *enabled
= VARIANT_FALSE
;
344 static HRESULT WINAPI
fw_app_put_Enabled(
345 INetFwAuthorizedApplication
*iface
,
346 VARIANT_BOOL enabled
)
348 fw_app
*This
= impl_from_INetFwAuthorizedApplication( iface
);
350 FIXME("%p, %d\n", This
, enabled
);
354 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl
=
356 fw_app_QueryInterface
,
359 fw_app_GetTypeInfoCount
,
361 fw_app_GetIDsOfNames
,
365 fw_app_get_ProcessImageFileName
,
366 fw_app_put_ProcessImageFileName
,
367 fw_app_get_IpVersion
,
368 fw_app_put_IpVersion
,
371 fw_app_get_RemoteAddresses
,
372 fw_app_put_RemoteAddresses
,
377 HRESULT
NetFwAuthorizedApplication_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
381 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
383 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
384 if (!fa
) return E_OUTOFMEMORY
;
386 fa
->INetFwAuthorizedApplication_iface
.lpVtbl
= &fw_app_vtbl
;
389 *ppObj
= &fa
->INetFwAuthorizedApplication_iface
;
391 TRACE("returning iface %p\n", *ppObj
);
394 typedef struct fw_apps
396 INetFwAuthorizedApplications INetFwAuthorizedApplications_iface
;
400 static inline fw_apps
*impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications
*iface
)
402 return CONTAINING_RECORD(iface
, fw_apps
, INetFwAuthorizedApplications_iface
);
405 static ULONG WINAPI
fw_apps_AddRef(
406 INetFwAuthorizedApplications
*iface
)
408 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
409 return InterlockedIncrement( &fw_apps
->refs
);
412 static ULONG WINAPI
fw_apps_Release(
413 INetFwAuthorizedApplications
*iface
)
415 fw_apps
*fw_apps
= impl_from_INetFwAuthorizedApplications( iface
);
416 LONG refs
= InterlockedDecrement( &fw_apps
->refs
);
419 TRACE("destroying %p\n", fw_apps
);
420 HeapFree( GetProcessHeap(), 0, fw_apps
);
425 static HRESULT WINAPI
fw_apps_QueryInterface(
426 INetFwAuthorizedApplications
*iface
,
430 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
432 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
434 if ( IsEqualGUID( riid
, &IID_INetFwAuthorizedApplications
) ||
435 IsEqualGUID( riid
, &IID_IDispatch
) ||
436 IsEqualGUID( riid
, &IID_IUnknown
) )
442 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
443 return E_NOINTERFACE
;
445 INetFwAuthorizedApplications_AddRef( iface
);
449 static HRESULT WINAPI
fw_apps_GetTypeInfoCount(
450 INetFwAuthorizedApplications
*iface
,
453 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
455 FIXME("%p %p\n", This
, pctinfo
);
459 static HRESULT WINAPI
fw_apps_GetTypeInfo(
460 INetFwAuthorizedApplications
*iface
,
463 ITypeInfo
**ppTInfo
)
465 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
467 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
468 return get_typeinfo( INetFwAuthorizedApplications_tid
, ppTInfo
);
471 static HRESULT WINAPI
fw_apps_GetIDsOfNames(
472 INetFwAuthorizedApplications
*iface
,
479 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
483 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
485 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
488 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
489 ITypeInfo_Release( typeinfo
);
494 static HRESULT WINAPI
fw_apps_Invoke(
495 INetFwAuthorizedApplications
*iface
,
500 DISPPARAMS
*pDispParams
,
502 EXCEPINFO
*pExcepInfo
,
505 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
509 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
510 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
512 hr
= get_typeinfo( INetFwAuthorizedApplications_tid
, &typeinfo
);
515 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwAuthorizedApplications_iface
, dispIdMember
,
516 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
517 ITypeInfo_Release( typeinfo
);
522 static HRESULT WINAPI
fw_apps_get_Count(
523 INetFwAuthorizedApplications
*iface
,
526 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
528 FIXME("%p, %p\n", This
, count
);
532 static HRESULT WINAPI
fw_apps_Add(
533 INetFwAuthorizedApplications
*iface
,
534 INetFwAuthorizedApplication
*app
)
536 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
538 FIXME("%p, %p\n", This
, app
);
542 static HRESULT WINAPI
fw_apps_Remove(
543 INetFwAuthorizedApplications
*iface
,
546 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
548 FIXME("%p, %s\n", This
, debugstr_w(imageFileName
));
552 static HRESULT WINAPI
fw_apps_Item(
553 INetFwAuthorizedApplications
*iface
,
555 INetFwAuthorizedApplication
**app
)
557 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
559 TRACE("%p, %s, %p\n", This
, debugstr_w(imageFileName
), app
);
560 return NetFwAuthorizedApplication_create( NULL
, (void **)app
);
563 static HRESULT WINAPI
fw_apps_get__NewEnum(
564 INetFwAuthorizedApplications
*iface
,
567 fw_apps
*This
= impl_from_INetFwAuthorizedApplications( iface
);
569 FIXME("%p, %p\n", This
, newEnum
);
573 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl
=
575 fw_apps_QueryInterface
,
578 fw_apps_GetTypeInfoCount
,
580 fw_apps_GetIDsOfNames
,
589 HRESULT
NetFwAuthorizedApplications_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
593 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
595 fa
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fa
) );
596 if (!fa
) return E_OUTOFMEMORY
;
598 fa
->INetFwAuthorizedApplications_iface
.lpVtbl
= &fw_apps_vtbl
;
601 *ppObj
= &fa
->INetFwAuthorizedApplications_iface
;
603 TRACE("returning iface %p\n", *ppObj
);