Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WsMatchPolicyAlternative function

Verifies that a Policy Alternative is compatible with the specified Policy Constraint. If the alternative is compatible the constraint structures are populated with Policy information.

Note  See Remarks on this page for information on the constraint structures.


HRESULT WINAPI  WsMatchPolicyAlternative(
  _In_     WS_POLICY*             policy,
  _In_     ULONG                  alternativeIndex,
  _In_     WS_POLICY_CONSTRAINTS* policyConstraints,
  _In_     BOOL                   matchRequired,
  _In_     WS_HEAP*               heap,
  _In_opt_ WS_ERROR*              error


policy [in]

A pointer to a WS_POLICY object containing the alternative.

Note  Each WS_METADATA_ENDPOINT that is returned from WsGetMetadataEndpoints contains a policy object.
alternativeIndex [in]

Specifies the zero-based index that identifies the alternative to use within the policy object. The number of alternatives present in the policy object can be obtained using WsGetPolicyAlternativeCount.

policyConstraints [in]

A pointer to the constraints that specify policies to match along with the fields to populate if the function returns NOERROR.

Note  If a property constraint is not specified the default constraint value for that particular property is used. See WS_POLICY_CONSTRAINTS for more information.
matchRequired [in]

Indicates whether a match is required or not.

Note  If the value is FALSE a match is not required, and in conjunction with a non-matching policy alternative, the function returns S_FALSE. If the value of this parameter is TRUE a match is required, and if the policy does not match, the function returns an error.
heap [in]

A pointer to a Heap object used to store any data requiring allocation beyond the specified constraint.

Note  For example pointer types within the constraint "out" fields is allocated using this Heap.
error [in, optional]

A pointer to a WS_ERROR object where additional information about the error should be stored if the function fails.

Return value

This function can return one of these values.

Return codeDescription

One or more arguments are invalid.


The policy alternative does not meet the specified constraints. and matchRequired was set to TRUE.

The policy or other metadata was in an invalid format.


The policy alternative does not meet the specified constraints. and matchRequired was set to FALSE.


The policy alternative meets the specific constraints. The out fields of the constraints structures have been filled with values from the policy.



Each of these data types contain a struct field called "out".

The content of the out field of these structures is populated by this function if the call returns NOERROR.

Note  If the function call fails the content out may have been partially set and only some allocations may have been made from the specified heap object. The content of the out field must not be examined unless the function returns NOERROR.

The policy object may delay some processing until this function is called. If the processing fails the policy object is set to WS_POLICY_STATE_FAULTED.



Minimum supported client

Windows 7 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | UWP apps]









© 2018 Microsoft