WslGetDistributionConfiguration function (wslapi.h)

Retrieves the current configuration of a distribution registered with the Windows Subsystem for Linux (WSL).

Syntax

HRESULT WslGetDistributionConfiguration(
  [in]  PCWSTR                 distributionName,
  [out] ULONG                  *distributionVersion,
  [out] ULONG                  *defaultUID,
  [out] WSL_DISTRIBUTION_FLAGS *wslDistributionFlags,
  [out] PSTR                   **defaultEnvironmentVariables,
  [out] ULONG                  *defaultEnvironmentVariableCount
);

Parameters

[in] distributionName

Unique name representing a distribution (for example, "Fabrikam.Distro.10.01").

[out] distributionVersion

The version of WSL for which this distribution is configured.

[out] defaultUID

The default user ID used when launching new WSL sessions for this distribution.

[out] wslDistributionFlags

The flags governing the behavior of this distribution.

[out] defaultEnvironmentVariables

The address of a pointer to an array of default environment variable strings used when launching new WSL sessions for this distribution.

[out] defaultEnvironmentVariableCount

The number of elements in pDefaultEnvironmentVariablesArray.

Return value

Returns S_OK on success, or a failing HRESULT otherwise.

Remarks

The caller is responsible for freeing each string in pDefaultEnvironmentVariablesArray (and the array itself) via CoTaskMemFree.

Requirements

Requirement Value
Target Platform Windows
Header wslapi.h
Library Wslapi.lib
DLL Api-ms-win-wsl-api-l1-1-0.dll