Function require_version

Source
pub const unsafe fn require_version(
    required_major: u32,
    required_minor: u32,
    required_revision: u32,
    api: *const WSLPluginAPIV1,
) -> HRESULT
Expand description

Ensures the WSL Plugin API version meets the minimum required version.

This function compares the version of the API passed as a parameter against the required version numbers specified (required_major, required_minor, required_revision). If the API version is lower than required, it returns WSL_E_PLUGIN_REQUIRES_UPDATE. Otherwise, it returns S_OK.

§Parameters

  • required_major: The major version number required by the plugin.
  • required_minor: The minor version number required by the plugin.
  • required_revision: The revision number required by the plugin.
  • api: A pointer to the WSLPluginAPIV1 structure, containing the current API version.

§Returns

  • S_OK: If the API version meets or exceeds the required version.
  • WSL_E_PLUGIN_REQUIRES_UPDATE: If the API version is below the required minimum.

§Safety

This function is unsafe because it dereferences a raw pointer (api). The caller must ensure that the pointer is valid and points to a properly initialized WSLPluginAPIV1 structure.