3.2.4.7.12 SetCurrentPolicy (Opnum 18)

The SetCurrentPolicy method sets the current resource policy to a specified resource policy by name.

 [id(12), helpstring("method SetCurrentPolicy")] HRESULT SetCurrentPolicy(
   [in] BSTR bstrPolicyName,
   [in] MANAGEMENT_TYPE enumManage
 );

bstrPolicyName: The name of the policy to become the current resource policy. If enumManage is PROFILING, the specified policy is used to gather PMC details required for accounting. The WSRM service categorizes every process based on the PMCs of the policy and collects data to serve accounting-related queries.

enumManage: The MANAGEMENT_TYPE enumeration (section 2.2.3.5) value that specifies the current mode in which the management service is operating. This function does not support calendar mode, so the value CALENDAR_POLICY is not valid for this parameter.

Return Values: This method returns 0x00000000 for success or a negative HRESULT value (in the following table or in [MS-ERREF] section 2.1.1) if an error occurs.

Return value/code

Description

0x00000000

S_OK

Operation successful.

0xC1FF006F

WRM_ERR_ID_VALUE

The specified name contains characters that are not valid. The name cannot start with a hyphen ("-"), cannot contain spaces, and cannot contain any of the following characters:

 \   / ? * | : < > " , ;

0x80070057

E_INVALIDARG

One or more arguments are invalid.

0xC1FF00C9

WRM_ERR_POLICYID_INVALID

The specified RAP does not exist.

Additional IWRMPolicy interface methods are specified in section 3.2.4.7.