Leaked source code of windows server 2003
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.

111 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 2000
  5. //
  6. // File: H N I C S P R V . C P P
  7. //
  8. // Contents: CHNIcsPrivateConn implementation
  9. //
  10. // Notes:
  11. //
  12. // Author: jonburs 23 June 2000
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. //
  18. // IHNetIcsPrivateConnection methods
  19. //
  20. STDMETHODIMP
  21. CHNIcsPrivateConn::RemoveFromIcs()
  22. {
  23. HRESULT hr = S_OK;
  24. IWbemClassObject *pwcoProperties;
  25. if (ProhibitedByPolicy(NCPERM_ShowSharedAccessUi))
  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 IsIcsPrivate property to false
  37. //
  38. hr = SetBooleanValue(
  39. pwcoProperties,
  40. c_wszIsIcsPrivate,
  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.
  71. //
  72. hr2 = UpdateOrStopService(
  73. m_piwsHomenet,
  74. m_bstrWQL,
  75. IPNATHLP_CONTROL_UPDATE_CONNECTION
  76. );
  77. RefreshNetConnectionsUI();
  78. _ASSERT(SUCCEEDED(hr2));
  79. }
  80. if (WBEM_S_NO_ERROR == hr)
  81. {
  82. //
  83. // Reconfig interface from backup settings
  84. //
  85. RestoreIpConfiguration();
  86. }
  87. return hr;
  88. }