Export (0) Print
Expand All

INetFwServiceRestriction::RestrictService method

The RestrictService method turns service restriction on or off for a given service.

Syntax


HRESULT RestrictService(
  [in]  BSTR serviceName,
  [in]  BSTR appName,
  [in]  VARIANT_BOOL restrictService,
  [in]  VARIANT_BOOL serviceSidRestricted
);

Parameters

serviceName [in]

Name of the service for which service restriction is being turned on or off.

appName [in]

Name of the application for which service restriction is being turned on or off.

restrictService [in]

Indicates whether service restriction is being turned on or off. If this value is true (VARIANT_TRUE), the service will be restricted when sending or receiving network traffic. The Windows Service Hardening rules collection can contain rules which can allow this service specific inbound or outbound network access per specific requirements. If false (VARIANT_FALSE), the service is not restricted by Windows Service Hardening.

serviceSidRestricted [in]

Indicates the type of service SID for the specified service. If this value is true (VARIANT_TRUE), the service SID will be restricted. Otherwise, it will be unrestricted.

Return value

C++

If the method succeeds the return value is S_OK.

If the method fails, the return value is one of the following error codes.

Return codeDescription
E_ACCESSDENIED

The operation was aborted due to permissions issues.

E_INVALIDARG

The method failed due to an invalid parameter.

 

VB

If the method succeeds the return value is S_OK.

If the method fails, the return value is one of the following error codes.

Return codeDescription
E_ACCESSDENIED

The operation was aborted due to permissions issues.

E_INVALIDARG

The method failed due to an invalid parameter.

 

Remarks

When adding rules, note that there may be a small time lag before the newly-added rule is applied.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Netfw.h

DLL

FirewallAPI.dll

See also

INetFwServiceRestriction

 

 

Build date: 11/16/2013

Community Additions

ADD
Show:
© 2014 Microsoft