3.2.4.7.2 CreatePolicy (Opnum 8)

The CreatePolicy method creates a new resource allocation policy (RAP).

 [id(2), helpstring("method CreatePolicy")] HRESULT CreatePolicy(
   [in] BSTR bstrPolicyInfo
 );

bstrPolicyInfo: A string that specifies the new policy to be created in the form of a Policy element (section 2.2.5.21). For an example, see Policy Example (section 4.2.19).

If this parameter is NULL, E_INVALIDARG MUST be returned.

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.

0x80070057

E_INVALIDARG

One or more arguments are invalid.

0xC1FF006F

WRM_ERR_ID_VALUE

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

 \   / ? * | : < > " , ;

0xC1FF0070

WRM_ERR_TAGS_NOT_IN_ORDER

The XML data that is maintained by the management service is invalid or cannot be processed.<105>

0xC1FF00CA

WRM_ERR_POLICYID_ALREADY_EXISTS

The request has been aborted because a RAP with the specified name already exists.

0xC1FF00DF

WRM_ERR_POLICY_LIMIT_EXCEEDED

The request has been aborted because the total number of RAPs has exceeded an implementation-defined limit.<106>

0xC1FF00E3

WRM_ERR_CANNOT_CREATE_RESERVED_POLICY

A user created policy cannot have the same name as that of a built-in policy.

0xC1FF012E

WRM_ERR_RESOURCEGROUPID_INVALID

The request has been aborted because the process matching criteria (PMC) name could not be found.

Additional IWRMPolicy interface methods are specified in section 3.2.4.7.