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