windows-nt/Source/XPSP1/NT/net/homenet/config/cfgmgr/hnicspub.cpp
2020-09-26 16:20:57 +08:00

100 lines
2.1 KiB
C++

//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1997 - 2000
//
// File: H N I C S P U B . C P P
//
// Contents: CHNIcsPublicConn implementation
//
// Notes:
//
// Author: jonburs 23 June 2000
//
//----------------------------------------------------------------------------
#include "pch.h"
#pragma hdrstop
//
// IHNetIcsPublicConnection methods
//
STDMETHODIMP
CHNIcsPublicConn::Unshare()
{
HRESULT hr = S_OK;
IWbemClassObject *pwcoProperties;
if (ProhibitedByPolicy(NCPERM_ShowSharedAccessUi))
{
hr = HN_E_POLICY;
}
if (S_OK == hr)
{
hr = GetConnectionPropertiesObject(&pwcoProperties);
}
if (WBEM_S_NO_ERROR == hr)
{
//
// Change our IsIcsPublic property to false
//
hr = SetBooleanValue(
pwcoProperties,
c_wszIsIcsPublic,
FALSE
);
if (WBEM_S_NO_ERROR == hr)
{
//
// Write the instance to the store
//
hr = m_piwsHomenet->PutInstance(
pwcoProperties,
WBEM_FLAG_UPDATE_ONLY,
NULL,
NULL
);
}
if (WBEM_S_NO_ERROR == hr)
{
//
// Inform netman that something changed. Error doesn't matter.
//
UpdateNetman();
}
pwcoProperties->Release();
}
if (WBEM_S_NO_ERROR == hr)
{
HRESULT hr2;
//
// Stop or send an update to the homenet service. We don't
// propagate an error here, as the store correctly reflects
// the unfirewalled state. Success is asserted on debug builds.
//
hr2 = UpdateOrStopService(
m_piwsHomenet,
m_bstrWQL,
IPNATHLP_CONTROL_UPDATE_CONNECTION
);
RefreshNetConnectionsUI();
_ASSERT(SUCCEEDED(hr2));
}
return hr;
}