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