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
30 #include "wine/debug.h"
31 #include "hnetcfg_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg
);
35 typedef struct fw_policy
37 INetFwPolicy INetFwPolicy_iface
;
41 static inline fw_policy
*impl_from_INetFwPolicy( INetFwPolicy
*iface
)
43 return CONTAINING_RECORD(iface
, fw_policy
, INetFwPolicy_iface
);
46 typedef struct fw_policy2
48 INetFwPolicy2 INetFwPolicy2_iface
;
49 INetFwRules
*fw_policy2_rules
;
53 static inline fw_policy2
*impl_from_INetFwPolicy2( INetFwPolicy2
*iface
)
55 return CONTAINING_RECORD(iface
, fw_policy2
, INetFwPolicy2_iface
);
58 typedef struct fw_rule
60 INetFwRule INetFwRule_iface
;
64 static inline fw_rule
*impl_from_INetFwRule( INetFwRule
*iface
)
66 return CONTAINING_RECORD(iface
, fw_rule
, INetFwRule_iface
);
69 static HRESULT WINAPI
netfw_rule_QueryInterface(
74 fw_rule
*This
= impl_from_INetFwRule( iface
);
76 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), object
);
78 if ( IsEqualGUID( riid
, &IID_INetFwRule
) ||
79 IsEqualGUID( riid
, &IID_IDispatch
) ||
80 IsEqualGUID( riid
, &IID_IUnknown
) )
86 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
89 INetFwRule_AddRef( iface
);
93 static ULONG WINAPI
netfw_rule_AddRef(
96 fw_rule
*This
= impl_from_INetFwRule( iface
);
97 return InterlockedIncrement( &This
->refs
);
100 static ULONG WINAPI
netfw_rule_Release(
103 fw_rule
*This
= impl_from_INetFwRule( iface
);
104 LONG refs
= InterlockedDecrement( &This
->refs
);
107 TRACE("destroying %p\n", This
);
113 static HRESULT WINAPI
netfw_rule_GetTypeInfoCount(
117 fw_rule
*This
= impl_from_INetFwRule( iface
);
119 TRACE("%p %p\n", This
, pctinfo
);
124 static HRESULT WINAPI
netfw_rule_GetTypeInfo(
130 fw_rule
*This
= impl_from_INetFwRule( iface
);
132 TRACE("%p %u %lu %p\n", This
, iTInfo
, lcid
, ppTInfo
);
133 return get_typeinfo( INetFwRule_tid
, ppTInfo
);
136 static HRESULT WINAPI
netfw_rule_GetIDsOfNames(
144 fw_rule
*This
= impl_from_INetFwRule( iface
);
148 TRACE("%p %s %p %u %lu %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
150 hr
= get_typeinfo( INetFwRule_tid
, &typeinfo
);
153 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
154 ITypeInfo_Release( typeinfo
);
159 static HRESULT WINAPI
netfw_rule_Invoke(
165 DISPPARAMS
*pDispParams
,
167 EXCEPINFO
*pExcepInfo
,
170 fw_rule
*This
= impl_from_INetFwRule( iface
);
174 TRACE("%p %ld %s %ld %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
175 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
177 hr
= get_typeinfo( INetFwRule_tid
, &typeinfo
);
180 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwRule_iface
, dispIdMember
,
181 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
182 ITypeInfo_Release( typeinfo
);
187 static HRESULT WINAPI
netfw_rule_get_Name(
191 fw_rule
*This
= impl_from_INetFwRule( iface
);
193 FIXME("%p, %p\n", This
, name
);
197 static HRESULT WINAPI
netfw_rule_put_Name(
201 fw_rule
*This
= impl_from_INetFwRule( iface
);
203 FIXME("%p, %s\n", This
, debugstr_w(name
));
207 static HRESULT WINAPI
netfw_rule_get_Description(
211 fw_rule
*This
= impl_from_INetFwRule( iface
);
213 FIXME("%p, %p\n", This
, desc
);
217 static HRESULT WINAPI
netfw_rule_put_Description(
221 fw_rule
*This
= impl_from_INetFwRule( iface
);
223 FIXME("%p, %s\n", This
, debugstr_w(desc
));
227 static HRESULT WINAPI
netfw_rule_get_ApplicationName(
231 fw_rule
*This
= impl_from_INetFwRule( iface
);
233 FIXME("%p, %p\n", This
, app
);
237 static HRESULT WINAPI
netfw_rule_put_ApplicationName(
241 fw_rule
*This
= impl_from_INetFwRule( iface
);
243 FIXME("%p, %s\n", This
, debugstr_w(app
));
247 static HRESULT WINAPI
netfw_rule_get_ServiceName(
251 fw_rule
*This
= impl_from_INetFwRule( iface
);
253 FIXME("%p, %p\n", This
, service
);
257 static HRESULT WINAPI
netfw_rule_put_ServiceName(
261 fw_rule
*This
= impl_from_INetFwRule( iface
);
263 FIXME("%p, %s\n", This
, debugstr_w(service
));
267 static HRESULT WINAPI
netfw_rule_get_Protocol(
271 fw_rule
*This
= impl_from_INetFwRule( iface
);
273 FIXME("%p, %p\n", This
, protocol
);
277 static HRESULT WINAPI
netfw_rule_put_Protocol(
281 fw_rule
*This
= impl_from_INetFwRule( iface
);
283 FIXME("%p, %ld\n", This
, protocol
);
287 static HRESULT WINAPI
netfw_rule_get_LocalPorts(
291 fw_rule
*This
= impl_from_INetFwRule( iface
);
293 FIXME("%p, %p\n", This
, ports
);
297 static HRESULT WINAPI
netfw_rule_put_LocalPorts(
301 fw_rule
*This
= impl_from_INetFwRule( iface
);
303 FIXME("%p, %s\n", This
, debugstr_w(ports
));
307 static HRESULT WINAPI
netfw_rule_get_RemotePorts(
311 fw_rule
*This
= impl_from_INetFwRule( iface
);
313 FIXME("%p, %p\n", This
, ports
);
317 static HRESULT WINAPI
netfw_rule_put_RemotePorts(
321 fw_rule
*This
= impl_from_INetFwRule( iface
);
323 FIXME("%p, %s\n", This
, debugstr_w(ports
));
327 static HRESULT WINAPI
netfw_rule_get_LocalAddresses(
331 fw_rule
*This
= impl_from_INetFwRule( iface
);
333 FIXME("%p, %p\n", This
, addresses
);
337 static HRESULT WINAPI
netfw_rule_put_LocalAddresses(
341 fw_rule
*This
= impl_from_INetFwRule( iface
);
343 FIXME("%p, %s\n", This
, debugstr_w(addresses
));
347 static HRESULT WINAPI
netfw_rule_get_RemoteAddresses(
351 fw_rule
*This
= impl_from_INetFwRule( iface
);
353 FIXME("%p, %p\n", This
, addresses
);
357 static HRESULT WINAPI
netfw_rule_put_RemoteAddresses(
361 fw_rule
*This
= impl_from_INetFwRule( iface
);
363 FIXME("%p, %s\n", This
, debugstr_w(addresses
));
367 static HRESULT WINAPI
netfw_rule_get_IcmpTypesAndCodes(
371 fw_rule
*This
= impl_from_INetFwRule( iface
);
373 FIXME("%p, %p\n", This
, codes
);
377 static HRESULT WINAPI
netfw_rule_put_IcmpTypesAndCodes(
381 fw_rule
*This
= impl_from_INetFwRule( iface
);
383 FIXME("%p, %s\n", This
, debugstr_w(codes
));
387 static HRESULT WINAPI
netfw_rule_get_Direction(
389 NET_FW_RULE_DIRECTION
*dir
)
391 fw_rule
*This
= impl_from_INetFwRule( iface
);
393 FIXME("%p, %p\n", This
, dir
);
397 static HRESULT WINAPI
netfw_rule_put_Direction(
399 NET_FW_RULE_DIRECTION dir
)
401 fw_rule
*This
= impl_from_INetFwRule( iface
);
403 FIXME("%p, %u\n", This
, dir
);
407 static HRESULT WINAPI
netfw_rule_get_Interfaces(
411 fw_rule
*This
= impl_from_INetFwRule( iface
);
413 FIXME("%p, %p\n", This
, interfaces
);
417 static HRESULT WINAPI
netfw_rule_put_Interfaces(
421 fw_rule
*This
= impl_from_INetFwRule( iface
);
423 FIXME("%p, %s\n", This
, debugstr_variant(&interfaces
));
427 static HRESULT WINAPI
netfw_rule_get_InterfaceTypes(
431 fw_rule
*This
= impl_from_INetFwRule( iface
);
433 FIXME("%p, %p\n", This
, types
);
437 static HRESULT WINAPI
netfw_rule_put_InterfaceTypes(
441 fw_rule
*This
= impl_from_INetFwRule( iface
);
443 FIXME("%p, %s\n", This
, debugstr_w(types
));
447 static HRESULT WINAPI
netfw_rule_get_Enabled(
449 VARIANT_BOOL
*enabled
)
451 fw_rule
*This
= impl_from_INetFwRule( iface
);
453 FIXME("%p, %p\n", This
, enabled
);
457 static HRESULT WINAPI
netfw_rule_put_Enabled(
459 VARIANT_BOOL enabled
)
461 fw_rule
*This
= impl_from_INetFwRule( iface
);
463 FIXME("%p, %#x\n", This
, enabled
);
467 static HRESULT WINAPI
netfw_rule_get_Grouping(
471 fw_rule
*This
= impl_from_INetFwRule( iface
);
473 FIXME("%p, %p\n", This
, grouping
);
477 static HRESULT WINAPI
netfw_rule_put_Grouping(
481 fw_rule
*This
= impl_from_INetFwRule( iface
);
483 FIXME("%p, %s\n", This
, debugstr_w(grouping
));
487 static HRESULT WINAPI
netfw_rule_get_Profiles(
491 fw_rule
*This
= impl_from_INetFwRule( iface
);
493 FIXME("%p, %p\n", This
, profiles
);
497 static HRESULT WINAPI
netfw_rule_put_Profiles(
501 fw_rule
*This
= impl_from_INetFwRule( iface
);
503 FIXME("%p, %#lx\n", This
, profiles
);
507 static HRESULT WINAPI
netfw_rule_get_EdgeTraversal(
509 VARIANT_BOOL
*enabled
)
511 fw_rule
*This
= impl_from_INetFwRule( iface
);
513 FIXME("%p, %p\n", This
, enabled
);
517 static HRESULT WINAPI
netfw_rule_put_EdgeTraversal(
519 VARIANT_BOOL enabled
)
521 fw_rule
*This
= impl_from_INetFwRule( iface
);
523 FIXME("%p, %#x\n", This
, enabled
);
527 static HRESULT WINAPI
netfw_rule_get_Action(
529 NET_FW_ACTION
*action
)
531 fw_rule
*This
= impl_from_INetFwRule( iface
);
533 FIXME("%p, %p\n", This
, action
);
537 static HRESULT WINAPI
netfw_rule_put_Action(
539 NET_FW_ACTION action
)
541 fw_rule
*This
= impl_from_INetFwRule( iface
);
543 FIXME("%p, %u\n", This
, action
);
547 static const struct INetFwRuleVtbl fw_rule_vtbl
=
549 netfw_rule_QueryInterface
,
552 netfw_rule_GetTypeInfoCount
,
553 netfw_rule_GetTypeInfo
,
554 netfw_rule_GetIDsOfNames
,
558 netfw_rule_get_Description
,
559 netfw_rule_put_Description
,
560 netfw_rule_get_ApplicationName
,
561 netfw_rule_put_ApplicationName
,
562 netfw_rule_get_ServiceName
,
563 netfw_rule_put_ServiceName
,
564 netfw_rule_get_Protocol
,
565 netfw_rule_put_Protocol
,
566 netfw_rule_get_LocalPorts
,
567 netfw_rule_put_LocalPorts
,
568 netfw_rule_get_RemotePorts
,
569 netfw_rule_put_RemotePorts
,
570 netfw_rule_get_LocalAddresses
,
571 netfw_rule_put_LocalAddresses
,
572 netfw_rule_get_RemoteAddresses
,
573 netfw_rule_put_RemoteAddresses
,
574 netfw_rule_get_IcmpTypesAndCodes
,
575 netfw_rule_put_IcmpTypesAndCodes
,
576 netfw_rule_get_Direction
,
577 netfw_rule_put_Direction
,
578 netfw_rule_get_Interfaces
,
579 netfw_rule_put_Interfaces
,
580 netfw_rule_get_InterfaceTypes
,
581 netfw_rule_put_InterfaceTypes
,
582 netfw_rule_get_Enabled
,
583 netfw_rule_put_Enabled
,
584 netfw_rule_get_Grouping
,
585 netfw_rule_put_Grouping
,
586 netfw_rule_get_Profiles
,
587 netfw_rule_put_Profiles
,
588 netfw_rule_get_EdgeTraversal
,
589 netfw_rule_put_EdgeTraversal
,
590 netfw_rule_get_Action
,
591 netfw_rule_put_Action
,
594 HRESULT
NetFwRule_create( IUnknown
*outer
, void **obj
)
598 TRACE("(%p)\n", obj
);
600 rule
= malloc( sizeof(*rule
) );
601 if (!rule
) return E_OUTOFMEMORY
;
603 rule
->INetFwRule_iface
.lpVtbl
= &fw_rule_vtbl
;
606 *obj
= &rule
->INetFwRule_iface
;
608 TRACE("returning iface %p\n", *obj
);
612 typedef struct fw_rules
614 INetFwRules INetFwRules_iface
;
618 static inline fw_rules
*impl_from_INetFwRules( INetFwRules
*iface
)
620 return CONTAINING_RECORD(iface
, fw_rules
, INetFwRules_iface
);
623 static HRESULT WINAPI
netfw_rules_QueryInterface(
628 fw_rules
*This
= impl_from_INetFwRules( iface
);
630 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), object
);
632 if ( IsEqualGUID( riid
, &IID_INetFwRules
) ||
633 IsEqualGUID( riid
, &IID_IDispatch
) ||
634 IsEqualGUID( riid
, &IID_IUnknown
) )
640 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
641 return E_NOINTERFACE
;
643 INetFwRules_AddRef( iface
);
647 static ULONG WINAPI
netfw_rules_AddRef(
650 fw_rules
*This
= impl_from_INetFwRules( iface
);
651 return InterlockedIncrement( &This
->refs
);
654 static ULONG WINAPI
netfw_rules_Release(
657 fw_rules
*This
= impl_from_INetFwRules( iface
);
658 LONG refs
= InterlockedDecrement( &This
->refs
);
661 TRACE("destroying %p\n", This
);
667 static HRESULT WINAPI
netfw_rules_GetTypeInfoCount(
671 fw_rules
*This
= impl_from_INetFwRules( iface
);
673 TRACE("%p %p\n", This
, pctinfo
);
678 static HRESULT WINAPI
netfw_rules_GetTypeInfo(
684 fw_rules
*This
= impl_from_INetFwRules( iface
);
686 TRACE("%p %u %lu %p\n", This
, iTInfo
, lcid
, ppTInfo
);
687 return get_typeinfo( INetFwRules_tid
, ppTInfo
);
690 static HRESULT WINAPI
netfw_rules_GetIDsOfNames(
698 fw_rules
*This
= impl_from_INetFwRules( iface
);
702 TRACE("%p %s %p %u %lu %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
704 hr
= get_typeinfo( INetFwRules_tid
, &typeinfo
);
707 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
708 ITypeInfo_Release( typeinfo
);
713 static HRESULT WINAPI
netfw_rules_Invoke(
719 DISPPARAMS
*pDispParams
,
721 EXCEPINFO
*pExcepInfo
,
724 fw_rules
*This
= impl_from_INetFwRules( iface
);
728 TRACE("%p %ld %s %ld %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
729 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
731 hr
= get_typeinfo( INetFwRules_tid
, &typeinfo
);
734 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwRules_iface
, dispIdMember
,
735 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
736 ITypeInfo_Release( typeinfo
);
741 static HRESULT WINAPI
netfw_rules_get_Count(
745 fw_rules
*This
= impl_from_INetFwRules( iface
);
747 FIXME("%p, %p\n", This
, count
);
755 static HRESULT WINAPI
netfw_rules_Add(
759 fw_rules
*This
= impl_from_INetFwRules( iface
);
761 FIXME("%p, %p\n", This
, rule
);
765 static HRESULT WINAPI
netfw_rules_Remove(
769 fw_rules
*This
= impl_from_INetFwRules( iface
);
771 FIXME("%p, %s\n", This
, debugstr_w(name
));
775 static HRESULT WINAPI
netfw_rules_Item(
780 fw_rules
*This
= impl_from_INetFwRules( iface
);
782 FIXME("%p, %s, %p\n", This
, debugstr_w(name
), rule
);
786 static HRESULT WINAPI
netfw_rules_get__NewEnum(
790 fw_rules
*This
= impl_from_INetFwRules( iface
);
792 FIXME("%p, %p\n", This
, newEnum
);
794 if (!newEnum
) return E_POINTER
;
800 static const struct INetFwRulesVtbl fw_rules_vtbl
=
802 netfw_rules_QueryInterface
,
805 netfw_rules_GetTypeInfoCount
,
806 netfw_rules_GetTypeInfo
,
807 netfw_rules_GetIDsOfNames
,
809 netfw_rules_get_Count
,
813 netfw_rules_get__NewEnum
816 static HRESULT
create_INetFwRules(INetFwRules
**object
)
820 TRACE("(%p)\n", object
);
822 rules
= malloc( sizeof(*rules
) );
823 if (!rules
) return E_OUTOFMEMORY
;
825 rules
->INetFwRules_iface
.lpVtbl
= &fw_rules_vtbl
;
828 *object
= &rules
->INetFwRules_iface
;
830 TRACE("returning iface %p\n", *object
);
834 static ULONG WINAPI
fw_policy_AddRef(
835 INetFwPolicy
*iface
)
837 fw_policy
*fw_policy
= impl_from_INetFwPolicy( iface
);
838 return InterlockedIncrement( &fw_policy
->refs
);
841 static ULONG WINAPI
fw_policy_Release(
842 INetFwPolicy
*iface
)
844 fw_policy
*fw_policy
= impl_from_INetFwPolicy( iface
);
845 LONG refs
= InterlockedDecrement( &fw_policy
->refs
);
848 TRACE("destroying %p\n", fw_policy
);
854 static HRESULT WINAPI
fw_policy_QueryInterface(
859 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
861 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
863 if ( IsEqualGUID( riid
, &IID_INetFwPolicy
) ||
864 IsEqualGUID( riid
, &IID_IDispatch
) ||
865 IsEqualGUID( riid
, &IID_IUnknown
) )
871 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
872 return E_NOINTERFACE
;
874 INetFwPolicy_AddRef( iface
);
878 static HRESULT WINAPI
fw_policy_GetTypeInfoCount(
882 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
884 TRACE("%p %p\n", This
, pctinfo
);
889 static HRESULT WINAPI
fw_policy_GetTypeInfo(
893 ITypeInfo
**ppTInfo
)
895 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
897 TRACE("%p %u %lu %p\n", This
, iTInfo
, lcid
, ppTInfo
);
898 return get_typeinfo( INetFwPolicy_tid
, ppTInfo
);
901 static HRESULT WINAPI
fw_policy_GetIDsOfNames(
909 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
913 TRACE("%p %s %p %u %lu %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
915 hr
= get_typeinfo( INetFwPolicy_tid
, &typeinfo
);
918 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
919 ITypeInfo_Release( typeinfo
);
924 static HRESULT WINAPI
fw_policy_Invoke(
930 DISPPARAMS
*pDispParams
,
932 EXCEPINFO
*pExcepInfo
,
935 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
939 TRACE("%p %ld %s %ld %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
940 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
942 hr
= get_typeinfo( INetFwPolicy_tid
, &typeinfo
);
945 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwPolicy_iface
, dispIdMember
,
946 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
947 ITypeInfo_Release( typeinfo
);
952 static HRESULT WINAPI
fw_policy_get_CurrentProfile(
954 INetFwProfile
**profile
)
956 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
958 TRACE("%p, %p\n", This
, profile
);
959 return NetFwProfile_create( NULL
, (void **)profile
);
962 static HRESULT WINAPI
fw_policy_GetProfileByType(
964 NET_FW_PROFILE_TYPE profileType
,
965 INetFwProfile
**profile
)
967 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
969 FIXME("%p, %u, %p\n", This
, profileType
, profile
);
973 static const struct INetFwPolicyVtbl fw_policy_vtbl
=
975 fw_policy_QueryInterface
,
978 fw_policy_GetTypeInfoCount
,
979 fw_policy_GetTypeInfo
,
980 fw_policy_GetIDsOfNames
,
982 fw_policy_get_CurrentProfile
,
983 fw_policy_GetProfileByType
986 HRESULT
NetFwPolicy_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
990 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
992 fp
= malloc( sizeof(*fp
) );
993 if (!fp
) return E_OUTOFMEMORY
;
995 fp
->INetFwPolicy_iface
.lpVtbl
= &fw_policy_vtbl
;
998 *ppObj
= &fp
->INetFwPolicy_iface
;
1000 TRACE("returning iface %p\n", *ppObj
);
1004 static HRESULT WINAPI
fwpolicy2_QueryInterface(INetFwPolicy2
*iface
, REFIID riid
, void **out
)
1006 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1008 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), out
);
1010 if ( IsEqualGUID( riid
, &IID_INetFwPolicy2
) ||
1011 IsEqualGUID( riid
, &IID_IDispatch
) ||
1012 IsEqualGUID( riid
, &IID_IUnknown
) )
1016 else if( IsEqualGUID( riid
, &IID_INetFwRules
) )
1018 TRACE("INetFwRules not supported\n");
1019 return E_NOINTERFACE
;
1023 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
1024 return E_NOINTERFACE
;
1026 INetFwPolicy2_AddRef( iface
);
1030 static ULONG WINAPI
fwpolicy2_AddRef(INetFwPolicy2
*iface
)
1032 fw_policy2
*fw_policy
= impl_from_INetFwPolicy2( iface
);
1033 return InterlockedIncrement( &fw_policy
->refs
);
1036 static ULONG WINAPI
fwpolicy2_Release(INetFwPolicy2
*iface
)
1038 fw_policy2
*fw_policy
= impl_from_INetFwPolicy2( iface
);
1039 LONG refs
= InterlockedDecrement( &fw_policy
->refs
);
1042 INetFwRules_Release(fw_policy
->fw_policy2_rules
);
1043 TRACE("destroying %p\n", fw_policy
);
1049 static HRESULT WINAPI
fwpolicy2_GetTypeInfoCount(INetFwPolicy2
*iface
, UINT
*pctinfo
)
1051 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1053 TRACE("%p %p\n", This
, pctinfo
);
1058 static HRESULT WINAPI
fwpolicy2_GetTypeInfo(INetFwPolicy2
*iface
, UINT iTInfo
, LCID lcid
, ITypeInfo
**info
)
1060 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1062 TRACE("%p %u %lu %p\n", This
, iTInfo
, lcid
, info
);
1063 return get_typeinfo( INetFwPolicy2_tid
, info
);
1066 static HRESULT WINAPI
fwpolicy2_GetIDsOfNames(INetFwPolicy2
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
1067 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1069 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1070 ITypeInfo
*typeinfo
;
1073 TRACE("%p %s %p %u %lu %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
1075 hr
= get_typeinfo( INetFwPolicy2_tid
, &typeinfo
);
1078 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
1079 ITypeInfo_Release( typeinfo
);
1084 static HRESULT WINAPI
fwpolicy2_Invoke(INetFwPolicy2
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
1085 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1087 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1088 ITypeInfo
*typeinfo
;
1091 TRACE("%p %ld %s %ld %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
1092 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1094 hr
= get_typeinfo( INetFwPolicy2_tid
, &typeinfo
);
1097 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwPolicy2_iface
, dispIdMember
,
1098 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1099 ITypeInfo_Release( typeinfo
);
1104 static HRESULT WINAPI
fwpolicy2_get_CurrentProfileTypes(INetFwPolicy2
*iface
, LONG
*profile
)
1106 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1108 FIXME("%p %p\n", This
, profile
);
1112 static HRESULT WINAPI
fwpolicy2_get_FirewallEnabled(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL
*enabled
)
1114 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1116 FIXME("%p %d %p\n", This
, profileType
, enabled
);
1120 static HRESULT WINAPI
fwpolicy2_put_FirewallEnabled(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL enabled
)
1122 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1124 FIXME("%p %d %d\n", This
, profileType
, enabled
);
1128 static HRESULT WINAPI
fwpolicy2_get_ExcludedInterfaces(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT
*interfaces
)
1130 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1132 FIXME("%p %d %p\n", This
, profileType
, interfaces
);
1136 static HRESULT WINAPI
fwpolicy2_put_ExcludedInterfaces(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT interfaces
)
1138 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1139 FIXME("%p %d\n", This
, profileType
);
1143 static HRESULT WINAPI
fwpolicy2_get_BlockAllInboundTraffic(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL
*block
)
1145 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1147 FIXME("%p %d %p\n", This
, profileType
, block
);
1151 static HRESULT WINAPI
fwpolicy2_put_BlockAllInboundTraffic(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL block
)
1153 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1155 FIXME("%p %d %d\n", This
, profileType
, block
);
1159 static HRESULT WINAPI
fwpolicy2_get_NotificationsDisabled(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL
*disabled
)
1161 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1163 FIXME("%p %d %p\n", This
, profileType
, disabled
);
1167 static HRESULT WINAPI
fwpolicy2_put_NotificationsDisabled(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL disabled
)
1169 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1171 FIXME("%p %d %d\n", This
, profileType
, disabled
);
1175 static HRESULT WINAPI
fwpolicy2_get_UnicastResponsesToMulticastBroadcastDisabled(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL
*disabled
)
1177 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1179 FIXME("%p %d %p\n", This
, profileType
, disabled
);
1183 static HRESULT WINAPI
fwpolicy2_put_UnicastResponsesToMulticastBroadcastDisabled(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, VARIANT_BOOL disabled
)
1185 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1187 FIXME("%p %d %d\n", This
, profileType
, disabled
);
1191 static HRESULT WINAPI
fwpolicy2_get_Rules(INetFwPolicy2
*iface
, INetFwRules
**rules
)
1193 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1195 TRACE("%p %p\n", This
, rules
);
1200 *rules
= This
->fw_policy2_rules
;
1201 INetFwRules_AddRef(This
->fw_policy2_rules
);
1206 static HRESULT WINAPI
fwpolicy2_get_ServiceRestriction(INetFwPolicy2
*iface
, INetFwServiceRestriction
**ServiceRestriction
)
1208 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1210 FIXME("%p %p\n", This
, ServiceRestriction
);
1214 static HRESULT WINAPI
fwpolicy2_EnableRuleGroup(INetFwPolicy2
*iface
, LONG bitmask
, BSTR group
, VARIANT_BOOL enable
)
1216 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1218 FIXME("%p %ld %s %d\n", This
, bitmask
, debugstr_w(group
), enable
);
1222 static HRESULT WINAPI
fwpolicy2_IsRuleGroupEnabled(INetFwPolicy2
*iface
, LONG bitmask
, BSTR group
, VARIANT_BOOL
*enabled
)
1224 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1226 FIXME("%p %ld %s %p\n", This
, bitmask
, debugstr_w(group
), enabled
);
1230 static HRESULT WINAPI
fwpolicy2_RestoreLocalFirewallDefaults(INetFwPolicy2
*iface
)
1232 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1234 FIXME("%p\n", This
);
1238 static HRESULT WINAPI
fwpolicy2_get_DefaultInboundAction(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, NET_FW_ACTION
*action
)
1240 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1242 FIXME("%p %d %p\n", This
, profileType
, action
);
1246 static HRESULT WINAPI
fwpolicy2_put_DefaultInboundAction(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, NET_FW_ACTION action
)
1248 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1250 FIXME("%p %d %d\n", This
, profileType
, action
);
1254 static HRESULT WINAPI
fwpolicy2_get_DefaultOutboundAction(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, NET_FW_ACTION
*action
)
1256 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1258 FIXME("%p %d %p\n", This
, profileType
, action
);
1262 static HRESULT WINAPI
fwpolicy2_put_DefaultOutboundAction(INetFwPolicy2
*iface
, NET_FW_PROFILE_TYPE2 profileType
, NET_FW_ACTION action
)
1264 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1266 FIXME("%p %d %d\n", This
, profileType
, action
);
1270 static HRESULT WINAPI
fwpolicy2_get_IsRuleGroupCurrentlyEnabled(INetFwPolicy2
*iface
, BSTR group
, VARIANT_BOOL
*enabled
)
1272 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1274 FIXME("%p %s %p\n", This
, debugstr_w(group
), enabled
);
1278 static HRESULT WINAPI
fwpolicy2_get_LocalPolicyModifyState(INetFwPolicy2
*iface
, NET_FW_MODIFY_STATE
*modifyState
)
1280 fw_policy2
*This
= impl_from_INetFwPolicy2( iface
);
1282 FIXME("%p %p\n", This
, modifyState
);
1286 static const struct INetFwPolicy2Vtbl fw_policy2_vtbl
=
1288 fwpolicy2_QueryInterface
,
1291 fwpolicy2_GetTypeInfoCount
,
1292 fwpolicy2_GetTypeInfo
,
1293 fwpolicy2_GetIDsOfNames
,
1295 fwpolicy2_get_CurrentProfileTypes
,
1296 fwpolicy2_get_FirewallEnabled
,
1297 fwpolicy2_put_FirewallEnabled
,
1298 fwpolicy2_get_ExcludedInterfaces
,
1299 fwpolicy2_put_ExcludedInterfaces
,
1300 fwpolicy2_get_BlockAllInboundTraffic
,
1301 fwpolicy2_put_BlockAllInboundTraffic
,
1302 fwpolicy2_get_NotificationsDisabled
,
1303 fwpolicy2_put_NotificationsDisabled
,
1304 fwpolicy2_get_UnicastResponsesToMulticastBroadcastDisabled
,
1305 fwpolicy2_put_UnicastResponsesToMulticastBroadcastDisabled
,
1306 fwpolicy2_get_Rules
,
1307 fwpolicy2_get_ServiceRestriction
,
1308 fwpolicy2_EnableRuleGroup
,
1309 fwpolicy2_IsRuleGroupEnabled
,
1310 fwpolicy2_RestoreLocalFirewallDefaults
,
1311 fwpolicy2_get_DefaultInboundAction
,
1312 fwpolicy2_put_DefaultInboundAction
,
1313 fwpolicy2_get_DefaultOutboundAction
,
1314 fwpolicy2_put_DefaultOutboundAction
,
1315 fwpolicy2_get_IsRuleGroupCurrentlyEnabled
,
1316 fwpolicy2_get_LocalPolicyModifyState
1319 HRESULT
NetFwPolicy2_create( IUnknown
*outer
, void **obj
)
1323 TRACE("(%p,%p)\n", outer
, obj
);
1325 fp
= malloc( sizeof(*fp
) );
1326 if (!fp
) return E_OUTOFMEMORY
;
1328 fp
->INetFwPolicy2_iface
.lpVtbl
= &fw_policy2_vtbl
;
1331 *obj
= &fp
->INetFwPolicy2_iface
;
1333 if (FAILED(create_INetFwRules(&fp
->fw_policy2_rules
)))
1336 return E_OUTOFMEMORY
;
1339 TRACE("returning iface %p\n", *obj
);