[HNETCFG] Sync with Wine 3.0. CORE-14225
[reactos.git] / dll / win32 / hnetcfg / policy.c
1 /*
2 * Copyright 2009 Hans Leidekker for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19 #include "hnetcfg_private.h"
20
21 typedef struct fw_policy
22 {
23 INetFwPolicy INetFwPolicy_iface;
24 LONG refs;
25 } fw_policy;
26
27 static inline fw_policy *impl_from_INetFwPolicy( INetFwPolicy *iface )
28 {
29 return CONTAINING_RECORD(iface, fw_policy, INetFwPolicy_iface);
30 }
31
32 typedef struct fw_policy2
33 {
34 INetFwPolicy2 INetFwPolicy2_iface;
35 INetFwRules *fw_policy2_rules;
36 LONG refs;
37 } fw_policy2;
38
39 static inline fw_policy2 *impl_from_INetFwPolicy2( INetFwPolicy2 *iface )
40 {
41 return CONTAINING_RECORD(iface, fw_policy2, INetFwPolicy2_iface);
42 }
43
44 typedef struct fw_rules
45 {
46 INetFwRules INetFwRules_iface;
47 LONG refs;
48 } fw_rules;
49
50 static inline fw_rules *impl_from_INetFwRules( INetFwRules *iface )
51 {
52 return CONTAINING_RECORD(iface, fw_rules, INetFwRules_iface);
53 }
54
55 static HRESULT WINAPI netfw_rules_QueryInterface(
56 INetFwRules *iface,
57 REFIID riid,
58 void **object)
59 {
60 fw_rules *This = impl_from_INetFwRules( iface );
61
62 TRACE("%p %s %p\n", This, debugstr_guid( riid ), object );
63
64 if ( IsEqualGUID( riid, &IID_INetFwRules ) ||
65 IsEqualGUID( riid, &IID_IDispatch ) ||
66 IsEqualGUID( riid, &IID_IUnknown ) )
67 {
68 *object = iface;
69 }
70 else
71 {
72 FIXME("interface %s not implemented\n", debugstr_guid(riid));
73 return E_NOINTERFACE;
74 }
75 INetFwRules_AddRef( iface );
76 return S_OK;
77 }
78
79 static ULONG WINAPI netfw_rules_AddRef(
80 INetFwRules *iface )
81 {
82 fw_rules *This = impl_from_INetFwRules( iface );
83 return InterlockedIncrement( &This->refs );
84 }
85
86 static ULONG WINAPI netfw_rules_Release(
87 INetFwRules *iface )
88 {
89 fw_rules *This = impl_from_INetFwRules( iface );
90 LONG refs = InterlockedDecrement( &This->refs );
91 if (!refs)
92 {
93 TRACE("destroying %p\n", This);
94 HeapFree( GetProcessHeap(), 0, This );
95 }
96 return refs;
97 }
98
99 static HRESULT WINAPI netfw_rules_GetTypeInfoCount(
100 INetFwRules *iface,
101 UINT *pctinfo )
102 {
103 fw_rules *This = impl_from_INetFwRules( iface );
104
105 TRACE("%p %p\n", This, pctinfo);
106 *pctinfo = 1;
107 return S_OK;
108 }
109
110 static HRESULT WINAPI netfw_rules_GetTypeInfo(
111 INetFwRules *iface,
112 UINT iTInfo,
113 LCID lcid,
114 ITypeInfo **ppTInfo)
115 {
116 fw_rules *This = impl_from_INetFwRules( iface );
117
118 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
119 return get_typeinfo( INetFwRules_tid, ppTInfo );
120 }
121
122 static HRESULT WINAPI netfw_rules_GetIDsOfNames(
123 INetFwRules *iface,
124 REFIID riid,
125 LPOLESTR *rgszNames,
126 UINT cNames,
127 LCID lcid,
128 DISPID *rgDispId)
129 {
130 fw_rules *This = impl_from_INetFwRules( iface );
131 ITypeInfo *typeinfo;
132 HRESULT hr;
133
134 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
135
136 hr = get_typeinfo( INetFwRules_tid, &typeinfo );
137 if (SUCCEEDED(hr))
138 {
139 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
140 ITypeInfo_Release( typeinfo );
141 }
142 return hr;
143 }
144
145 static HRESULT WINAPI netfw_rules_Invoke(
146 INetFwRules *iface,
147 DISPID dispIdMember,
148 REFIID riid,
149 LCID lcid,
150 WORD wFlags,
151 DISPPARAMS *pDispParams,
152 VARIANT *pVarResult,
153 EXCEPINFO *pExcepInfo,
154 UINT *puArgErr)
155 {
156 fw_rules *This = impl_from_INetFwRules( iface );
157 ITypeInfo *typeinfo;
158 HRESULT hr;
159
160 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
161 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
162
163 hr = get_typeinfo( INetFwRules_tid, &typeinfo );
164 if (SUCCEEDED(hr))
165 {
166 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwRules_iface, dispIdMember,
167 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
168 ITypeInfo_Release( typeinfo );
169 }
170 return hr;
171 }
172
173 static HRESULT WINAPI netfw_rules_get_Count(
174 INetFwRules *iface,
175 LONG *count)
176 {
177 fw_rules *This = impl_from_INetFwRules( iface );
178
179 FIXME("%p, %p\n", This, count);
180
181 if (count)
182 *count = 0;
183
184 return S_OK;
185 }
186
187 static HRESULT WINAPI netfw_rules_Add(
188 INetFwRules *iface,
189 INetFwRule *rule)
190 {
191 fw_rules *This = impl_from_INetFwRules( iface );
192
193 FIXME("%p, %p\n", This, rule);
194 return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI netfw_rules_Remove(
198 INetFwRules *iface,
199 BSTR name)
200 {
201 fw_rules *This = impl_from_INetFwRules( iface );
202
203 FIXME("%p, %s\n", This, debugstr_w(name));
204 return E_NOTIMPL;
205 }
206
207 static HRESULT WINAPI netfw_rules_Item(
208 INetFwRules *iface,
209 BSTR name,
210 INetFwRule **rule)
211 {
212 fw_rules *This = impl_from_INetFwRules( iface );
213
214 FIXME("%p, %s, %p\n", This, debugstr_w(name), rule);
215 return E_NOTIMPL;
216 }
217
218 static HRESULT WINAPI netfw_rules_get__NewEnum(
219 INetFwRules *iface,
220 IUnknown **newEnum)
221 {
222 fw_rules *This = impl_from_INetFwRules( iface );
223
224 FIXME("%p, %p\n", This, newEnum);
225 return E_NOTIMPL;
226 }
227
228 static const struct INetFwRulesVtbl fw_rules_vtbl =
229 {
230 netfw_rules_QueryInterface,
231 netfw_rules_AddRef,
232 netfw_rules_Release,
233 netfw_rules_GetTypeInfoCount,
234 netfw_rules_GetTypeInfo,
235 netfw_rules_GetIDsOfNames,
236 netfw_rules_Invoke,
237 netfw_rules_get_Count,
238 netfw_rules_Add,
239 netfw_rules_Remove,
240 netfw_rules_Item,
241 netfw_rules_get__NewEnum
242 };
243
244 static HRESULT create_INetFwRules(INetFwRules **object)
245 {
246 fw_rules *rules;
247
248 TRACE("(%p)\n", object);
249
250 rules = HeapAlloc( GetProcessHeap(), 0, sizeof(*rules) );
251 if (!rules) return E_OUTOFMEMORY;
252
253 rules->INetFwRules_iface.lpVtbl = &fw_rules_vtbl;
254 rules->refs = 1;
255
256 *object = &rules->INetFwRules_iface;
257
258 TRACE("returning iface %p\n", *object);
259 return S_OK;
260 }
261
262 static ULONG WINAPI fw_policy_AddRef(
263 INetFwPolicy *iface )
264 {
265 fw_policy *fw_policy = impl_from_INetFwPolicy( iface );
266 return InterlockedIncrement( &fw_policy->refs );
267 }
268
269 static ULONG WINAPI fw_policy_Release(
270 INetFwPolicy *iface )
271 {
272 fw_policy *fw_policy = impl_from_INetFwPolicy( iface );
273 LONG refs = InterlockedDecrement( &fw_policy->refs );
274 if (!refs)
275 {
276 TRACE("destroying %p\n", fw_policy);
277 HeapFree( GetProcessHeap(), 0, fw_policy );
278 }
279 return refs;
280 }
281
282 static HRESULT WINAPI fw_policy_QueryInterface(
283 INetFwPolicy *iface,
284 REFIID riid,
285 void **ppvObject )
286 {
287 fw_policy *This = impl_from_INetFwPolicy( iface );
288
289 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
290
291 if ( IsEqualGUID( riid, &IID_INetFwPolicy ) ||
292 IsEqualGUID( riid, &IID_IDispatch ) ||
293 IsEqualGUID( riid, &IID_IUnknown ) )
294 {
295 *ppvObject = iface;
296 }
297 else
298 {
299 FIXME("interface %s not implemented\n", debugstr_guid(riid));
300 return E_NOINTERFACE;
301 }
302 INetFwPolicy_AddRef( iface );
303 return S_OK;
304 }
305
306 static HRESULT WINAPI fw_policy_GetTypeInfoCount(
307 INetFwPolicy *iface,
308 UINT *pctinfo )
309 {
310 fw_policy *This = impl_from_INetFwPolicy( iface );
311
312 TRACE("%p %p\n", This, pctinfo);
313 *pctinfo = 1;
314 return S_OK;
315 }
316
317 static HRESULT WINAPI fw_policy_GetTypeInfo(
318 INetFwPolicy *iface,
319 UINT iTInfo,
320 LCID lcid,
321 ITypeInfo **ppTInfo )
322 {
323 fw_policy *This = impl_from_INetFwPolicy( iface );
324
325 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
326 return get_typeinfo( INetFwPolicy_tid, ppTInfo );
327 }
328
329 static HRESULT WINAPI fw_policy_GetIDsOfNames(
330 INetFwPolicy *iface,
331 REFIID riid,
332 LPOLESTR *rgszNames,
333 UINT cNames,
334 LCID lcid,
335 DISPID *rgDispId )
336 {
337 fw_policy *This = impl_from_INetFwPolicy( iface );
338 ITypeInfo *typeinfo;
339 HRESULT hr;
340
341 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
342
343 hr = get_typeinfo( INetFwPolicy_tid, &typeinfo );
344 if (SUCCEEDED(hr))
345 {
346 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
347 ITypeInfo_Release( typeinfo );
348 }
349 return hr;
350 }
351
352 static HRESULT WINAPI fw_policy_Invoke(
353 INetFwPolicy *iface,
354 DISPID dispIdMember,
355 REFIID riid,
356 LCID lcid,
357 WORD wFlags,
358 DISPPARAMS *pDispParams,
359 VARIANT *pVarResult,
360 EXCEPINFO *pExcepInfo,
361 UINT *puArgErr )
362 {
363 fw_policy *This = impl_from_INetFwPolicy( iface );
364 ITypeInfo *typeinfo;
365 HRESULT hr;
366
367 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
368 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
369
370 hr = get_typeinfo( INetFwPolicy_tid, &typeinfo );
371 if (SUCCEEDED(hr))
372 {
373 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwPolicy_iface, dispIdMember,
374 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
375 ITypeInfo_Release( typeinfo );
376 }
377 return hr;
378 }
379
380 static HRESULT WINAPI fw_policy_get_CurrentProfile(
381 INetFwPolicy *iface,
382 INetFwProfile **profile )
383 {
384 fw_policy *This = impl_from_INetFwPolicy( iface );
385
386 TRACE("%p, %p\n", This, profile);
387 return NetFwProfile_create( NULL, (void **)profile );
388 }
389
390 static HRESULT WINAPI fw_policy_GetProfileByType(
391 INetFwPolicy *iface,
392 NET_FW_PROFILE_TYPE profileType,
393 INetFwProfile **profile )
394 {
395 fw_policy *This = impl_from_INetFwPolicy( iface );
396
397 FIXME("%p, %u, %p\n", This, profileType, profile);
398 return E_NOTIMPL;
399 }
400
401 static const struct INetFwPolicyVtbl fw_policy_vtbl =
402 {
403 fw_policy_QueryInterface,
404 fw_policy_AddRef,
405 fw_policy_Release,
406 fw_policy_GetTypeInfoCount,
407 fw_policy_GetTypeInfo,
408 fw_policy_GetIDsOfNames,
409 fw_policy_Invoke,
410 fw_policy_get_CurrentProfile,
411 fw_policy_GetProfileByType
412 };
413
414 HRESULT NetFwPolicy_create( IUnknown *pUnkOuter, LPVOID *ppObj )
415 {
416 fw_policy *fp;
417
418 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
419
420 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
421 if (!fp) return E_OUTOFMEMORY;
422
423 fp->INetFwPolicy_iface.lpVtbl = &fw_policy_vtbl;
424 fp->refs = 1;
425
426 *ppObj = &fp->INetFwPolicy_iface;
427
428 TRACE("returning iface %p\n", *ppObj);
429 return S_OK;
430 }
431
432 static HRESULT WINAPI fwpolicy2_QueryInterface(INetFwPolicy2 *iface, REFIID riid, void **out)
433 {
434 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
435
436 TRACE("%p %s %p\n", This, debugstr_guid( riid ), out );
437
438 if ( IsEqualGUID( riid, &IID_INetFwPolicy2 ) ||
439 IsEqualGUID( riid, &IID_IDispatch ) ||
440 IsEqualGUID( riid, &IID_IUnknown ) )
441 {
442 *out = iface;
443 }
444 else if( IsEqualGUID( riid, &IID_INetFwRules ) )
445 {
446 TRACE("INetFwRules not supported\n");
447 return E_NOINTERFACE;
448 }
449 else
450 {
451 FIXME("interface %s not implemented\n", debugstr_guid(riid));
452 return E_NOINTERFACE;
453 }
454 INetFwPolicy2_AddRef( iface );
455 return S_OK;
456 }
457
458 static ULONG WINAPI fwpolicy2_AddRef(INetFwPolicy2 *iface)
459 {
460 fw_policy2 *fw_policy = impl_from_INetFwPolicy2( iface );
461 return InterlockedIncrement( &fw_policy->refs );
462 }
463
464 static ULONG WINAPI fwpolicy2_Release(INetFwPolicy2 *iface)
465 {
466 fw_policy2 *fw_policy = impl_from_INetFwPolicy2( iface );
467 LONG refs = InterlockedDecrement( &fw_policy->refs );
468 if (!refs)
469 {
470 INetFwRules_Release(fw_policy->fw_policy2_rules);
471 TRACE("destroying %p\n", fw_policy);
472 HeapFree( GetProcessHeap(), 0, fw_policy );
473 }
474 return refs;
475 }
476
477 static HRESULT WINAPI fwpolicy2_GetTypeInfoCount(INetFwPolicy2 *iface, UINT *pctinfo)
478 {
479 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
480
481 TRACE("%p %p\n", This, pctinfo);
482 *pctinfo = 1;
483 return S_OK;
484 }
485
486 static HRESULT WINAPI fwpolicy2_GetTypeInfo(INetFwPolicy2 *iface, UINT iTInfo, LCID lcid, ITypeInfo **info)
487 {
488 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
489
490 TRACE("%p %u %u %p\n", This, iTInfo, lcid, info);
491 return get_typeinfo( INetFwPolicy2_tid, info );
492 }
493
494 static HRESULT WINAPI fwpolicy2_GetIDsOfNames(INetFwPolicy2 *iface, REFIID riid, LPOLESTR *rgszNames,
495 UINT cNames, LCID lcid, DISPID *rgDispId)
496 {
497 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
498 ITypeInfo *typeinfo;
499 HRESULT hr;
500
501 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
502
503 hr = get_typeinfo( INetFwPolicy2_tid, &typeinfo );
504 if (SUCCEEDED(hr))
505 {
506 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
507 ITypeInfo_Release( typeinfo );
508 }
509 return hr;
510 }
511
512 static HRESULT WINAPI fwpolicy2_Invoke(INetFwPolicy2 *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
513 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
514 {
515 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
516 ITypeInfo *typeinfo;
517 HRESULT hr;
518
519 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
520 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
521
522 hr = get_typeinfo( INetFwPolicy2_tid, &typeinfo );
523 if (SUCCEEDED(hr))
524 {
525 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwPolicy2_iface, dispIdMember,
526 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
527 ITypeInfo_Release( typeinfo );
528 }
529 return hr;
530 }
531
532 static HRESULT WINAPI fwpolicy2_get_CurrentProfileTypes(INetFwPolicy2 *iface, LONG *profile)
533 {
534 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
535
536 FIXME("%p %p\n", This, profile);
537 return E_NOTIMPL;
538 }
539
540 static HRESULT WINAPI fwpolicy2_get_FirewallEnabled(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL *enabled)
541 {
542 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
543
544 FIXME("%p %d %p\n", This, profileType, enabled);
545 return E_NOTIMPL;
546 }
547
548 static HRESULT WINAPI fwpolicy2_put_FirewallEnabled(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL enabled)
549 {
550 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
551
552 FIXME("%p %d %d\n", This, profileType, enabled);
553 return E_NOTIMPL;
554 }
555
556 static HRESULT WINAPI fwpolicy2_get_ExcludedInterfaces(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT *interfaces)
557 {
558 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
559
560 FIXME("%p %d %p\n", This, profileType, interfaces);
561 return E_NOTIMPL;
562 }
563
564 static HRESULT WINAPI fwpolicy2_put_ExcludedInterfaces(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT interfaces)
565 {
566 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
567 FIXME("%p %d\n", This, profileType);
568 return E_NOTIMPL;
569 }
570
571 static HRESULT WINAPI fwpolicy2_get_BlockAllInboundTraffic(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL *block)
572 {
573 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
574
575 FIXME("%p %d %p\n", This, profileType, block);
576 return E_NOTIMPL;
577 }
578
579 static HRESULT WINAPI fwpolicy2_put_BlockAllInboundTraffic(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL block)
580 {
581 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
582
583 FIXME("%p %d %d\n", This, profileType, block);
584 return E_NOTIMPL;
585 }
586
587 static HRESULT WINAPI fwpolicy2_get_NotificationsDisabled(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL *disabled)
588 {
589 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
590
591 FIXME("%p %d %p\n", This, profileType, disabled);
592 return E_NOTIMPL;
593 }
594
595 static HRESULT WINAPI fwpolicy2_put_NotificationsDisabled(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL disabled)
596 {
597 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
598
599 FIXME("%p %d %d\n", This, profileType, disabled);
600 return E_NOTIMPL;
601 }
602
603 static HRESULT WINAPI fwpolicy2_get_UnicastResponsesToMulticastBroadcastDisabled(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL *disabled)
604 {
605 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
606
607 FIXME("%p %d %p\n", This, profileType, disabled);
608 return E_NOTIMPL;
609 }
610
611 static HRESULT WINAPI fwpolicy2_put_UnicastResponsesToMulticastBroadcastDisabled(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, VARIANT_BOOL disabled)
612 {
613 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
614
615 FIXME("%p %d %d\n", This, profileType, disabled);
616 return E_NOTIMPL;
617 }
618
619 static HRESULT WINAPI fwpolicy2_get_Rules(INetFwPolicy2 *iface, INetFwRules **rules)
620 {
621 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
622
623 TRACE("%p %p\n", This, rules);
624
625 if(!rules)
626 return E_POINTER;
627
628 if(rules)
629 {
630 *rules = This->fw_policy2_rules;
631 INetFwRules_AddRef(This->fw_policy2_rules);
632 }
633
634 return S_OK;
635 }
636
637 static HRESULT WINAPI fwpolicy2_get_ServiceRestriction(INetFwPolicy2 *iface, INetFwServiceRestriction **ServiceRestriction)
638 {
639 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
640
641 FIXME("%p %p\n", This, ServiceRestriction);
642 return E_NOTIMPL;
643 }
644
645 static HRESULT WINAPI fwpolicy2_EnableRuleGroup(INetFwPolicy2 *iface, LONG bitmask, BSTR group, VARIANT_BOOL enable)
646 {
647 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
648
649 FIXME("%p %d %s %d\n", This, bitmask, debugstr_w(group), enable);
650 return E_NOTIMPL;
651 }
652
653 static HRESULT WINAPI fwpolicy2_IsRuleGroupEnabled(INetFwPolicy2 *iface, LONG bitmask, BSTR group, VARIANT_BOOL *enabled)
654 {
655 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
656
657 FIXME("%p %d %s %p\n", This, bitmask, debugstr_w(group), enabled);
658 return E_NOTIMPL;
659 }
660
661 static HRESULT WINAPI fwpolicy2_RestoreLocalFirewallDefaults(INetFwPolicy2 *iface)
662 {
663 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
664
665 FIXME("%p\n", This);
666 return E_NOTIMPL;
667 }
668
669 static HRESULT WINAPI fwpolicy2_get_DefaultInboundAction(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, NET_FW_ACTION *action)
670 {
671 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
672
673 FIXME("%p %d %p\n", This, profileType, action);
674 return E_NOTIMPL;
675 }
676
677 static HRESULT WINAPI fwpolicy2_put_DefaultInboundAction(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, NET_FW_ACTION action)
678 {
679 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
680
681 FIXME("%p %d %d\n", This, profileType, action);
682 return E_NOTIMPL;
683 }
684
685 static HRESULT WINAPI fwpolicy2_get_DefaultOutboundAction(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, NET_FW_ACTION *action)
686 {
687 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
688
689 FIXME("%p %d %p\n", This, profileType, action);
690 return E_NOTIMPL;
691 }
692
693 static HRESULT WINAPI fwpolicy2_put_DefaultOutboundAction(INetFwPolicy2 *iface, NET_FW_PROFILE_TYPE2 profileType, NET_FW_ACTION action)
694 {
695 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
696
697 FIXME("%p %d %d\n", This, profileType, action);
698 return E_NOTIMPL;
699 }
700
701 static HRESULT WINAPI fwpolicy2_get_IsRuleGroupCurrentlyEnabled(INetFwPolicy2 *iface, BSTR group, VARIANT_BOOL *enabled)
702 {
703 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
704
705 FIXME("%p %s %p\n", This, debugstr_w(group), enabled);
706 return E_NOTIMPL;
707 }
708
709 static HRESULT WINAPI fwpolicy2_get_LocalPolicyModifyState(INetFwPolicy2 *iface, NET_FW_MODIFY_STATE *modifyState)
710 {
711 fw_policy2 *This = impl_from_INetFwPolicy2( iface );
712
713 FIXME("%p %p\n", This, modifyState);
714 return E_NOTIMPL;
715 }
716
717 static const struct INetFwPolicy2Vtbl fw_policy2_vtbl =
718 {
719 fwpolicy2_QueryInterface,
720 fwpolicy2_AddRef,
721 fwpolicy2_Release,
722 fwpolicy2_GetTypeInfoCount,
723 fwpolicy2_GetTypeInfo,
724 fwpolicy2_GetIDsOfNames,
725 fwpolicy2_Invoke,
726 fwpolicy2_get_CurrentProfileTypes,
727 fwpolicy2_get_FirewallEnabled,
728 fwpolicy2_put_FirewallEnabled,
729 fwpolicy2_get_ExcludedInterfaces,
730 fwpolicy2_put_ExcludedInterfaces,
731 fwpolicy2_get_BlockAllInboundTraffic,
732 fwpolicy2_put_BlockAllInboundTraffic,
733 fwpolicy2_get_NotificationsDisabled,
734 fwpolicy2_put_NotificationsDisabled,
735 fwpolicy2_get_UnicastResponsesToMulticastBroadcastDisabled,
736 fwpolicy2_put_UnicastResponsesToMulticastBroadcastDisabled,
737 fwpolicy2_get_Rules,
738 fwpolicy2_get_ServiceRestriction,
739 fwpolicy2_EnableRuleGroup,
740 fwpolicy2_IsRuleGroupEnabled,
741 fwpolicy2_RestoreLocalFirewallDefaults,
742 fwpolicy2_get_DefaultInboundAction,
743 fwpolicy2_put_DefaultInboundAction,
744 fwpolicy2_get_DefaultOutboundAction,
745 fwpolicy2_put_DefaultOutboundAction,
746 fwpolicy2_get_IsRuleGroupCurrentlyEnabled,
747 fwpolicy2_get_LocalPolicyModifyState
748 };
749
750 HRESULT NetFwPolicy2_create( IUnknown *outer, void **obj )
751 {
752 fw_policy2 *fp;
753
754 TRACE("(%p,%p)\n", outer, obj);
755
756 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
757 if (!fp) return E_OUTOFMEMORY;
758
759 fp->INetFwPolicy2_iface.lpVtbl = &fw_policy2_vtbl;
760 fp->refs = 1;
761
762 *obj = &fp->INetFwPolicy2_iface;
763
764 if (FAILED(create_INetFwRules(&fp->fw_policy2_rules)))
765 {
766 HeapFree( GetProcessHeap(), 0, fp );
767 return E_OUTOFMEMORY;
768 }
769
770 TRACE("returning iface %p\n", *obj);
771 return S_OK;
772 }