Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 2000
  5. //
  6. // File: H N F W C O N N . C P P
  7. //
  8. // Contents: CHNFWConn implementation
  9. //
  10. // Notes:
  11. //
  12. // Author: jonburs 23 June 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. //
  18. // IHNetFirewalledConnection methods
  19. //
  20. STDMETHODIMP
  21. CHNFWConn::Unfirewall()
  22. {
  23. HRESULT hr = S_OK;
  24. IWbemClassObject *pwcoProperties;
  25. if (ProhibitedByPolicy(NCPERM_PersonalFirewallConfig))
  26. {
  27. hr = HN_E_POLICY;
  28. }
  29. if (S_OK == hr)
  30. {
  31. hr = GetConnectionPropertiesObject(&pwcoProperties);
  32. }
  33. if (WBEM_S_NO_ERROR == hr)
  34. {
  35. //
  36. // Change our IsFirewalled property to false
  37. //
  38. hr = SetBooleanValue(
  39. pwcoProperties,
  40. c_wszIsFirewalled,
  41. FALSE
  42. );
  43. if (WBEM_S_NO_ERROR == hr)
  44. {
  45. //
  46. // Write the instance to the store
  47. //
  48. hr = m_piwsHomenet->PutInstance(
  49. pwcoProperties,
  50. WBEM_FLAG_UPDATE_ONLY,
  51. NULL,
  52. NULL
  53. );
  54. }
  55. if (WBEM_S_NO_ERROR == hr)
  56. {
  57. //
  58. // Inform netman that something changed. Error doesn't matter.
  59. //
  60. UpdateNetman();
  61. }
  62. pwcoProperties->Release();
  63. }
  64. if (WBEM_S_NO_ERROR == hr)
  65. {
  66. HRESULT hr2;
  67. //
  68. // Stop or send an update to the homenet service. We don't
  69. // propagate an error here, as the store correctly reflects
  70. // the unfirewalled state. Success is asserted on debug builds.
  71. //
  72. hr2 = UpdateOrStopService(
  73. m_piwsHomenet,
  74. m_bstrWQL,
  75. IPNATHLP_CONTROL_UPDATE_CONNECTION
  76. );
  77. RefreshNetConnectionsUI();
  78. _ASSERT(SUCCEEDED(hr2));
  79. }
  80. return hr;
  81. }