INetFwPolicy::CurrentProfile property

[The Windows Firewall API is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. For Windows Vista and later, use of the Windows Firewall with Advanced Security API is recommended.]

Retrieves the current firewall profile.

This property is read-only.

Syntax


HRESULT get_CurrentProfile(
  [out] INetFwProfile **profile
);

Property value

The current firewall profile.

Error codes

If the method succeeds, the return value is S_OK.

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

NameMeaning
E_ACCESSDENIED

The operation was stopped because of permissions issues.

E_OUTOFMEMORY

The method was unable to allocate required memory.

E_POINTER

The method failed because a pointer was not valid.

HRESULT_FROM_WIN32(EPT_S_NOT_REGISTERED)

The method failed because the Windows Firewall, Internet Sharing Service (SharedAccess) was not running.

Remarks

The SharedAccess service must be running.

To get specific profile objects, use INetFwPolicy::GetProfileByType instead of INetFwPolicy::CurrentProfile.

On Windows 7, the netsh context current maps to all currently active profiles for netsh advfirewall and netsh firewall. On earlier versions of Windows, current maps to the most restrictive profile.

Requirements

Minimum supported client

Windows Vista, Windows XP with SP2 [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Header

Netfw.h

DLL

FirewallAPI.dll;
Hnetcfg.dll on Windows XP with SP2

See also

INetFwPolicy
INetFwMgr
INetFwProfile

 

 

Show: