IsApiSetImplemented function

The IsApiSetImplemented function tests if a specified API set is present on the computer.

Syntax

APICONTRACT BOOL IsApiSetImplemented(
  PCSTR Contract
);

Parameters

Contract

Specifies the name of the API set to query. For more info, see the Remarks section.

Return Value

IsApiSetImplemented returns TRUE if the specified API set is present. In this case, APIs in the target API set have valid implementations on the current platform.

Otherwise, this function returns FALSE.

Remarks

On OneCore, APIs are organized into functional groups called API sets. Depending on applicability, a given API set may be unavailable on the target platform.

When writing code that targets OneCore and Desktop platforms, you may see ApiValidator errors during compilation if your code calls APIs from API sets not present on the computer.

To fix this problem, wrap the API call in IsApiSetImplemented. This function tests at runtime if the specified API set is present on the target platform.

To determine the API set for a given API, find the API name on the OneCoreUap umbrella library page and remove the .dll suffix from the requirements entry.

By making use of IsApiSetImplemented, you can target OneCore and Desktop systems with a single binary.

You don't need to call IsApiSetImplemented for universal APIs because they are by definition present on both OneCore and Desktop versions of Windows.

See the corresponding API reference documentation pages to determine if a given API is universally available. Look for the Target Platform line in the requirements block of the documentation page.

For more information and examples of usage, see Building for OneCore.

Requirements

   
Target Platform Windows
Header apiquery2.h

See Also

Building for OneCore

Validating Universal Windows drivers