mshtml: Implement MediaQueryList's addListener method.
[wine.git] / dlls / hnetcfg / policy.c
blob5031fdcdd927d67f38d01d09d2110486fd2e4131
1 /*
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
19 #include <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28 #include "netfw.h"
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;
38 LONG refs;
39 } fw_policy;
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;
50 LONG refs;
51 } fw_policy2;
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;
61 LONG refs;
62 } fw_rule;
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(
70 INetFwRule *iface,
71 REFIID riid,
72 void **object)
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 ) )
82 *object = iface;
84 else
86 FIXME("interface %s not implemented\n", debugstr_guid(riid));
87 return E_NOINTERFACE;
89 INetFwRule_AddRef( iface );
90 return S_OK;
93 static ULONG WINAPI netfw_rule_AddRef(
94 INetFwRule *iface )
96 fw_rule *This = impl_from_INetFwRule( iface );
97 return InterlockedIncrement( &This->refs );
100 static ULONG WINAPI netfw_rule_Release(
101 INetFwRule *iface )
103 fw_rule *This = impl_from_INetFwRule( iface );
104 LONG refs = InterlockedDecrement( &This->refs );
105 if (!refs)
107 TRACE("destroying %p\n", This);
108 free( This );
110 return refs;
113 static HRESULT WINAPI netfw_rule_GetTypeInfoCount(
114 INetFwRule *iface,
115 UINT *pctinfo )
117 fw_rule *This = impl_from_INetFwRule( iface );
119 TRACE("%p %p\n", This, pctinfo);
120 *pctinfo = 1;
121 return S_OK;
124 static HRESULT WINAPI netfw_rule_GetTypeInfo(
125 INetFwRule *iface,
126 UINT iTInfo,
127 LCID lcid,
128 ITypeInfo **ppTInfo)
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(
137 INetFwRule *iface,
138 REFIID riid,
139 LPOLESTR *rgszNames,
140 UINT cNames,
141 LCID lcid,
142 DISPID *rgDispId)
144 fw_rule *This = impl_from_INetFwRule( iface );
145 ITypeInfo *typeinfo;
146 HRESULT hr;
148 TRACE("%p %s %p %u %lu %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
150 hr = get_typeinfo( INetFwRule_tid, &typeinfo );
151 if (SUCCEEDED(hr))
153 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
154 ITypeInfo_Release( typeinfo );
156 return hr;
159 static HRESULT WINAPI netfw_rule_Invoke(
160 INetFwRule *iface,
161 DISPID dispIdMember,
162 REFIID riid,
163 LCID lcid,
164 WORD wFlags,
165 DISPPARAMS *pDispParams,
166 VARIANT *pVarResult,
167 EXCEPINFO *pExcepInfo,
168 UINT *puArgErr)
170 fw_rule *This = impl_from_INetFwRule( iface );
171 ITypeInfo *typeinfo;
172 HRESULT hr;
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 );
178 if (SUCCEEDED(hr))
180 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwRule_iface, dispIdMember,
181 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
182 ITypeInfo_Release( typeinfo );
184 return hr;
187 static HRESULT WINAPI netfw_rule_get_Name(
188 INetFwRule *iface,
189 BSTR *name)
191 fw_rule *This = impl_from_INetFwRule( iface );
193 FIXME("%p, %p\n", This, name);
194 return E_NOTIMPL;
197 static HRESULT WINAPI netfw_rule_put_Name(
198 INetFwRule *iface,
199 BSTR name)
201 fw_rule *This = impl_from_INetFwRule( iface );
203 FIXME("%p, %s\n", This, debugstr_w(name));
204 return S_OK;
207 static HRESULT WINAPI netfw_rule_get_Description(
208 INetFwRule *iface,
209 BSTR *desc)
211 fw_rule *This = impl_from_INetFwRule( iface );
213 FIXME("%p, %p\n", This, desc);
214 return E_NOTIMPL;
217 static HRESULT WINAPI netfw_rule_put_Description(
218 INetFwRule *iface,
219 BSTR desc)
221 fw_rule *This = impl_from_INetFwRule( iface );
223 FIXME("%p, %s\n", This, debugstr_w(desc));
224 return S_OK;
227 static HRESULT WINAPI netfw_rule_get_ApplicationName(
228 INetFwRule *iface,
229 BSTR *app)
231 fw_rule *This = impl_from_INetFwRule( iface );
233 FIXME("%p, %p\n", This, app);
234 return E_NOTIMPL;
237 static HRESULT WINAPI netfw_rule_put_ApplicationName(
238 INetFwRule *iface,
239 BSTR app)
241 fw_rule *This = impl_from_INetFwRule( iface );
243 FIXME("%p, %s\n", This, debugstr_w(app));
244 return S_OK;
247 static HRESULT WINAPI netfw_rule_get_ServiceName(
248 INetFwRule *iface,
249 BSTR *service)
251 fw_rule *This = impl_from_INetFwRule( iface );
253 FIXME("%p, %p\n", This, service);
254 return E_NOTIMPL;
257 static HRESULT WINAPI netfw_rule_put_ServiceName(
258 INetFwRule *iface,
259 BSTR service)
261 fw_rule *This = impl_from_INetFwRule( iface );
263 FIXME("%p, %s\n", This, debugstr_w(service));
264 return S_OK;
267 static HRESULT WINAPI netfw_rule_get_Protocol(
268 INetFwRule *iface,
269 LONG *protocol)
271 fw_rule *This = impl_from_INetFwRule( iface );
273 FIXME("%p, %p\n", This, protocol);
274 return E_NOTIMPL;
277 static HRESULT WINAPI netfw_rule_put_Protocol(
278 INetFwRule *iface,
279 LONG protocol)
281 fw_rule *This = impl_from_INetFwRule( iface );
283 FIXME("%p, %ld\n", This, protocol);
284 return S_OK;
287 static HRESULT WINAPI netfw_rule_get_LocalPorts(
288 INetFwRule *iface,
289 BSTR *ports)
291 fw_rule *This = impl_from_INetFwRule( iface );
293 FIXME("%p, %p\n", This, ports);
294 return E_NOTIMPL;
297 static HRESULT WINAPI netfw_rule_put_LocalPorts(
298 INetFwRule *iface,
299 BSTR ports)
301 fw_rule *This = impl_from_INetFwRule( iface );
303 FIXME("%p, %s\n", This, debugstr_w(ports));
304 return S_OK;
307 static HRESULT WINAPI netfw_rule_get_RemotePorts(
308 INetFwRule *iface,
309 BSTR *ports)
311 fw_rule *This = impl_from_INetFwRule( iface );
313 FIXME("%p, %p\n", This, ports);
314 return E_NOTIMPL;
317 static HRESULT WINAPI netfw_rule_put_RemotePorts(
318 INetFwRule *iface,
319 BSTR ports)
321 fw_rule *This = impl_from_INetFwRule( iface );
323 FIXME("%p, %s\n", This, debugstr_w(ports));
324 return S_OK;
327 static HRESULT WINAPI netfw_rule_get_LocalAddresses(
328 INetFwRule *iface,
329 BSTR *addresses)
331 fw_rule *This = impl_from_INetFwRule( iface );
333 FIXME("%p, %p\n", This, addresses);
334 return E_NOTIMPL;
337 static HRESULT WINAPI netfw_rule_put_LocalAddresses(
338 INetFwRule *iface,
339 BSTR addresses)
341 fw_rule *This = impl_from_INetFwRule( iface );
343 FIXME("%p, %s\n", This, debugstr_w(addresses));
344 return S_OK;
347 static HRESULT WINAPI netfw_rule_get_RemoteAddresses(
348 INetFwRule *iface,
349 BSTR *addresses)
351 fw_rule *This = impl_from_INetFwRule( iface );
353 FIXME("%p, %p\n", This, addresses);
354 return E_NOTIMPL;
357 static HRESULT WINAPI netfw_rule_put_RemoteAddresses(
358 INetFwRule *iface,
359 BSTR addresses)
361 fw_rule *This = impl_from_INetFwRule( iface );
363 FIXME("%p, %s\n", This, debugstr_w(addresses));
364 return S_OK;
367 static HRESULT WINAPI netfw_rule_get_IcmpTypesAndCodes(
368 INetFwRule *iface,
369 BSTR *codes)
371 fw_rule *This = impl_from_INetFwRule( iface );
373 FIXME("%p, %p\n", This, codes);
374 return E_NOTIMPL;
377 static HRESULT WINAPI netfw_rule_put_IcmpTypesAndCodes(
378 INetFwRule *iface,
379 BSTR codes)
381 fw_rule *This = impl_from_INetFwRule( iface );
383 FIXME("%p, %s\n", This, debugstr_w(codes));
384 return S_OK;
387 static HRESULT WINAPI netfw_rule_get_Direction(
388 INetFwRule *iface,
389 NET_FW_RULE_DIRECTION *dir)
391 fw_rule *This = impl_from_INetFwRule( iface );
393 FIXME("%p, %p\n", This, dir);
394 return E_NOTIMPL;
397 static HRESULT WINAPI netfw_rule_put_Direction(
398 INetFwRule *iface,
399 NET_FW_RULE_DIRECTION dir)
401 fw_rule *This = impl_from_INetFwRule( iface );
403 FIXME("%p, %u\n", This, dir);
404 return S_OK;
407 static HRESULT WINAPI netfw_rule_get_Interfaces(
408 INetFwRule *iface,
409 VARIANT *interfaces)
411 fw_rule *This = impl_from_INetFwRule( iface );
413 FIXME("%p, %p\n", This, interfaces);
414 return E_NOTIMPL;
417 static HRESULT WINAPI netfw_rule_put_Interfaces(
418 INetFwRule *iface,
419 VARIANT interfaces)
421 fw_rule *This = impl_from_INetFwRule( iface );
423 FIXME("%p, %s\n", This, debugstr_variant(&interfaces));
424 return S_OK;
427 static HRESULT WINAPI netfw_rule_get_InterfaceTypes(
428 INetFwRule *iface,
429 BSTR *types)
431 fw_rule *This = impl_from_INetFwRule( iface );
433 FIXME("%p, %p\n", This, types);
434 return E_NOTIMPL;
437 static HRESULT WINAPI netfw_rule_put_InterfaceTypes(
438 INetFwRule *iface,
439 BSTR types)
441 fw_rule *This = impl_from_INetFwRule( iface );
443 FIXME("%p, %s\n", This, debugstr_w(types));
444 return S_OK;
447 static HRESULT WINAPI netfw_rule_get_Enabled(
448 INetFwRule *iface,
449 VARIANT_BOOL *enabled)
451 fw_rule *This = impl_from_INetFwRule( iface );
453 FIXME("%p, %p\n", This, enabled);
454 return E_NOTIMPL;
457 static HRESULT WINAPI netfw_rule_put_Enabled(
458 INetFwRule *iface,
459 VARIANT_BOOL enabled)
461 fw_rule *This = impl_from_INetFwRule( iface );
463 FIXME("%p, %#x\n", This, enabled);
464 return S_OK;
467 static HRESULT WINAPI netfw_rule_get_Grouping(
468 INetFwRule *iface,
469 BSTR *grouping)
471 fw_rule *This = impl_from_INetFwRule( iface );
473 FIXME("%p, %p\n", This, grouping);
474 return E_NOTIMPL;
477 static HRESULT WINAPI netfw_rule_put_Grouping(
478 INetFwRule *iface,
479 BSTR grouping)
481 fw_rule *This = impl_from_INetFwRule( iface );
483 FIXME("%p, %s\n", This, debugstr_w(grouping));
484 return S_OK;
487 static HRESULT WINAPI netfw_rule_get_Profiles(
488 INetFwRule *iface,
489 LONG *profiles)
491 fw_rule *This = impl_from_INetFwRule( iface );
493 FIXME("%p, %p\n", This, profiles);
494 return E_NOTIMPL;
497 static HRESULT WINAPI netfw_rule_put_Profiles(
498 INetFwRule *iface,
499 LONG profiles)
501 fw_rule *This = impl_from_INetFwRule( iface );
503 FIXME("%p, %#lx\n", This, profiles);
504 return S_OK;
507 static HRESULT WINAPI netfw_rule_get_EdgeTraversal(
508 INetFwRule *iface,
509 VARIANT_BOOL *enabled)
511 fw_rule *This = impl_from_INetFwRule( iface );
513 FIXME("%p, %p\n", This, enabled);
514 return E_NOTIMPL;
517 static HRESULT WINAPI netfw_rule_put_EdgeTraversal(
518 INetFwRule *iface,
519 VARIANT_BOOL enabled)
521 fw_rule *This = impl_from_INetFwRule( iface );
523 FIXME("%p, %#x\n", This, enabled);
524 return S_OK;
527 static HRESULT WINAPI netfw_rule_get_Action(
528 INetFwRule *iface,
529 NET_FW_ACTION *action)
531 fw_rule *This = impl_from_INetFwRule( iface );
533 FIXME("%p, %p\n", This, action);
534 return E_NOTIMPL;
537 static HRESULT WINAPI netfw_rule_put_Action(
538 INetFwRule *iface,
539 NET_FW_ACTION action)
541 fw_rule *This = impl_from_INetFwRule( iface );
543 FIXME("%p, %u\n", This, action);
544 return S_OK;
547 static const struct INetFwRuleVtbl fw_rule_vtbl =
549 netfw_rule_QueryInterface,
550 netfw_rule_AddRef,
551 netfw_rule_Release,
552 netfw_rule_GetTypeInfoCount,
553 netfw_rule_GetTypeInfo,
554 netfw_rule_GetIDsOfNames,
555 netfw_rule_Invoke,
556 netfw_rule_get_Name,
557 netfw_rule_put_Name,
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 )
596 fw_rule *rule;
598 TRACE("(%p)\n", obj);
600 rule = malloc( sizeof(*rule) );
601 if (!rule) return E_OUTOFMEMORY;
603 rule->INetFwRule_iface.lpVtbl = &fw_rule_vtbl;
604 rule->refs = 1;
606 *obj = &rule->INetFwRule_iface;
608 TRACE("returning iface %p\n", *obj);
609 return S_OK;
612 typedef struct fw_rules
614 INetFwRules INetFwRules_iface;
615 LONG refs;
616 } fw_rules;
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(
624 INetFwRules *iface,
625 REFIID riid,
626 void **object)
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 ) )
636 *object = iface;
638 else
640 FIXME("interface %s not implemented\n", debugstr_guid(riid));
641 return E_NOINTERFACE;
643 INetFwRules_AddRef( iface );
644 return S_OK;
647 static ULONG WINAPI netfw_rules_AddRef(
648 INetFwRules *iface )
650 fw_rules *This = impl_from_INetFwRules( iface );
651 return InterlockedIncrement( &This->refs );
654 static ULONG WINAPI netfw_rules_Release(
655 INetFwRules *iface )
657 fw_rules *This = impl_from_INetFwRules( iface );
658 LONG refs = InterlockedDecrement( &This->refs );
659 if (!refs)
661 TRACE("destroying %p\n", This);
662 free( This );
664 return refs;
667 static HRESULT WINAPI netfw_rules_GetTypeInfoCount(
668 INetFwRules *iface,
669 UINT *pctinfo )
671 fw_rules *This = impl_from_INetFwRules( iface );
673 TRACE("%p %p\n", This, pctinfo);
674 *pctinfo = 1;
675 return S_OK;
678 static HRESULT WINAPI netfw_rules_GetTypeInfo(
679 INetFwRules *iface,
680 UINT iTInfo,
681 LCID lcid,
682 ITypeInfo **ppTInfo)
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(
691 INetFwRules *iface,
692 REFIID riid,
693 LPOLESTR *rgszNames,
694 UINT cNames,
695 LCID lcid,
696 DISPID *rgDispId)
698 fw_rules *This = impl_from_INetFwRules( iface );
699 ITypeInfo *typeinfo;
700 HRESULT hr;
702 TRACE("%p %s %p %u %lu %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
704 hr = get_typeinfo( INetFwRules_tid, &typeinfo );
705 if (SUCCEEDED(hr))
707 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
708 ITypeInfo_Release( typeinfo );
710 return hr;
713 static HRESULT WINAPI netfw_rules_Invoke(
714 INetFwRules *iface,
715 DISPID dispIdMember,
716 REFIID riid,
717 LCID lcid,
718 WORD wFlags,
719 DISPPARAMS *pDispParams,
720 VARIANT *pVarResult,
721 EXCEPINFO *pExcepInfo,
722 UINT *puArgErr)
724 fw_rules *This = impl_from_INetFwRules( iface );
725 ITypeInfo *typeinfo;
726 HRESULT hr;
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 );
732 if (SUCCEEDED(hr))
734 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwRules_iface, dispIdMember,
735 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
736 ITypeInfo_Release( typeinfo );
738 return hr;
741 static HRESULT WINAPI netfw_rules_get_Count(
742 INetFwRules *iface,
743 LONG *count)
745 fw_rules *This = impl_from_INetFwRules( iface );
747 FIXME("%p, %p\n", This, count);
749 if (count)
750 *count = 0;
752 return S_OK;
755 static HRESULT WINAPI netfw_rules_Add(
756 INetFwRules *iface,
757 INetFwRule *rule)
759 fw_rules *This = impl_from_INetFwRules( iface );
761 FIXME("%p, %p\n", This, rule);
762 return S_OK;
765 static HRESULT WINAPI netfw_rules_Remove(
766 INetFwRules *iface,
767 BSTR name)
769 fw_rules *This = impl_from_INetFwRules( iface );
771 FIXME("%p, %s\n", This, debugstr_w(name));
772 return S_OK;
775 static HRESULT WINAPI netfw_rules_Item(
776 INetFwRules *iface,
777 BSTR name,
778 INetFwRule **rule)
780 fw_rules *This = impl_from_INetFwRules( iface );
782 FIXME("%p, %s, %p\n", This, debugstr_w(name), rule);
783 return E_NOTIMPL;
786 static HRESULT WINAPI netfw_rules_get__NewEnum(
787 INetFwRules *iface,
788 IUnknown **newEnum)
790 fw_rules *This = impl_from_INetFwRules( iface );
792 FIXME("%p, %p\n", This, newEnum);
794 if (!newEnum) return E_POINTER;
795 *newEnum = NULL;
797 return E_NOTIMPL;
800 static const struct INetFwRulesVtbl fw_rules_vtbl =
802 netfw_rules_QueryInterface,
803 netfw_rules_AddRef,
804 netfw_rules_Release,
805 netfw_rules_GetTypeInfoCount,
806 netfw_rules_GetTypeInfo,
807 netfw_rules_GetIDsOfNames,
808 netfw_rules_Invoke,
809 netfw_rules_get_Count,
810 netfw_rules_Add,
811 netfw_rules_Remove,
812 netfw_rules_Item,
813 netfw_rules_get__NewEnum
816 static HRESULT create_INetFwRules(INetFwRules **object)
818 fw_rules *rules;
820 TRACE("(%p)\n", object);
822 rules = malloc( sizeof(*rules) );
823 if (!rules) return E_OUTOFMEMORY;
825 rules->INetFwRules_iface.lpVtbl = &fw_rules_vtbl;
826 rules->refs = 1;
828 *object = &rules->INetFwRules_iface;
830 TRACE("returning iface %p\n", *object);
831 return S_OK;
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 );
846 if (!refs)
848 TRACE("destroying %p\n", fw_policy);
849 free( fw_policy );
851 return refs;
854 static HRESULT WINAPI fw_policy_QueryInterface(
855 INetFwPolicy *iface,
856 REFIID riid,
857 void **ppvObject )
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 ) )
867 *ppvObject = iface;
869 else
871 FIXME("interface %s not implemented\n", debugstr_guid(riid));
872 return E_NOINTERFACE;
874 INetFwPolicy_AddRef( iface );
875 return S_OK;
878 static HRESULT WINAPI fw_policy_GetTypeInfoCount(
879 INetFwPolicy *iface,
880 UINT *pctinfo )
882 fw_policy *This = impl_from_INetFwPolicy( iface );
884 TRACE("%p %p\n", This, pctinfo);
885 *pctinfo = 1;
886 return S_OK;
889 static HRESULT WINAPI fw_policy_GetTypeInfo(
890 INetFwPolicy *iface,
891 UINT iTInfo,
892 LCID lcid,
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(
902 INetFwPolicy *iface,
903 REFIID riid,
904 LPOLESTR *rgszNames,
905 UINT cNames,
906 LCID lcid,
907 DISPID *rgDispId )
909 fw_policy *This = impl_from_INetFwPolicy( iface );
910 ITypeInfo *typeinfo;
911 HRESULT hr;
913 TRACE("%p %s %p %u %lu %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
915 hr = get_typeinfo( INetFwPolicy_tid, &typeinfo );
916 if (SUCCEEDED(hr))
918 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
919 ITypeInfo_Release( typeinfo );
921 return hr;
924 static HRESULT WINAPI fw_policy_Invoke(
925 INetFwPolicy *iface,
926 DISPID dispIdMember,
927 REFIID riid,
928 LCID lcid,
929 WORD wFlags,
930 DISPPARAMS *pDispParams,
931 VARIANT *pVarResult,
932 EXCEPINFO *pExcepInfo,
933 UINT *puArgErr )
935 fw_policy *This = impl_from_INetFwPolicy( iface );
936 ITypeInfo *typeinfo;
937 HRESULT hr;
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 );
943 if (SUCCEEDED(hr))
945 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwPolicy_iface, dispIdMember,
946 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
947 ITypeInfo_Release( typeinfo );
949 return hr;
952 static HRESULT WINAPI fw_policy_get_CurrentProfile(
953 INetFwPolicy *iface,
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(
963 INetFwPolicy *iface,
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);
970 return E_NOTIMPL;
973 static const struct INetFwPolicyVtbl fw_policy_vtbl =
975 fw_policy_QueryInterface,
976 fw_policy_AddRef,
977 fw_policy_Release,
978 fw_policy_GetTypeInfoCount,
979 fw_policy_GetTypeInfo,
980 fw_policy_GetIDsOfNames,
981 fw_policy_Invoke,
982 fw_policy_get_CurrentProfile,
983 fw_policy_GetProfileByType
986 HRESULT NetFwPolicy_create( IUnknown *pUnkOuter, LPVOID *ppObj )
988 fw_policy *fp;
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;
996 fp->refs = 1;
998 *ppObj = &fp->INetFwPolicy_iface;
1000 TRACE("returning iface %p\n", *ppObj);
1001 return S_OK;
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 ) )
1014 *out = iface;
1016 else if( IsEqualGUID( riid, &IID_INetFwRules ) )
1018 TRACE("INetFwRules not supported\n");
1019 return E_NOINTERFACE;
1021 else
1023 FIXME("interface %s not implemented\n", debugstr_guid(riid));
1024 return E_NOINTERFACE;
1026 INetFwPolicy2_AddRef( iface );
1027 return S_OK;
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 );
1040 if (!refs)
1042 INetFwRules_Release(fw_policy->fw_policy2_rules);
1043 TRACE("destroying %p\n", fw_policy);
1044 free( fw_policy );
1046 return refs;
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);
1054 *pctinfo = 1;
1055 return S_OK;
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;
1071 HRESULT hr;
1073 TRACE("%p %s %p %u %lu %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
1075 hr = get_typeinfo( INetFwPolicy2_tid, &typeinfo );
1076 if (SUCCEEDED(hr))
1078 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
1079 ITypeInfo_Release( typeinfo );
1081 return hr;
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;
1089 HRESULT hr;
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 );
1095 if (SUCCEEDED(hr))
1097 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwPolicy2_iface, dispIdMember,
1098 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
1099 ITypeInfo_Release( typeinfo );
1101 return hr;
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);
1109 return E_NOTIMPL;
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);
1117 return E_NOTIMPL;
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);
1125 return E_NOTIMPL;
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);
1133 return E_NOTIMPL;
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);
1140 return E_NOTIMPL;
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);
1148 return E_NOTIMPL;
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);
1156 return E_NOTIMPL;
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);
1164 return E_NOTIMPL;
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);
1172 return E_NOTIMPL;
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);
1180 return E_NOTIMPL;
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);
1188 return E_NOTIMPL;
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);
1197 if(!rules)
1198 return E_POINTER;
1200 *rules = This->fw_policy2_rules;
1201 INetFwRules_AddRef(This->fw_policy2_rules);
1203 return S_OK;
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);
1211 return E_NOTIMPL;
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);
1219 return E_NOTIMPL;
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);
1227 return E_NOTIMPL;
1230 static HRESULT WINAPI fwpolicy2_RestoreLocalFirewallDefaults(INetFwPolicy2 *iface)
1232 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
1234 FIXME("%p\n", This);
1235 return E_NOTIMPL;
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);
1243 return E_NOTIMPL;
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);
1251 return E_NOTIMPL;
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);
1259 return E_NOTIMPL;
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);
1267 return E_NOTIMPL;
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);
1275 return E_NOTIMPL;
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);
1283 return E_NOTIMPL;
1286 static const struct INetFwPolicy2Vtbl fw_policy2_vtbl =
1288 fwpolicy2_QueryInterface,
1289 fwpolicy2_AddRef,
1290 fwpolicy2_Release,
1291 fwpolicy2_GetTypeInfoCount,
1292 fwpolicy2_GetTypeInfo,
1293 fwpolicy2_GetIDsOfNames,
1294 fwpolicy2_Invoke,
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 )
1321 fw_policy2 *fp;
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;
1329 fp->refs = 1;
1331 *obj = &fp->INetFwPolicy2_iface;
1333 if (FAILED(create_INetFwRules(&fp->fw_policy2_rules)))
1335 free( fp );
1336 return E_OUTOFMEMORY;
1339 TRACE("returning iface %p\n", *obj);
1340 return S_OK;