1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #ifndef _WSLAPI_H_
7 #define _WSLAPI_H_
8 
9 #include <apiset.h>
10 #include <apisetcconv.h>
11 #include <wtypes.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
18 
19 BOOL WslIsDistributionRegistered(PCWSTR distributionName);
20 HRESULT WslRegisterDistribution(PCWSTR distributionName, PCWSTR tarGzFilename);
21 HRESULT WslUnregisterDistribution(PCWSTR distributionName);
22 
23 typedef enum {
24     WSL_DISTRIBUTION_FLAGS_NONE = 0x0,
25     WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP = 0x1,
26     WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH = 0x2,
27     WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING = 0x4
28 } WSL_DISTRIBUTION_FLAGS;
29 
30 #define WSL_DISTRIBUTION_FLAGS_VALID (WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP | WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH | WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING)
31 #define WSL_DISTRIBUTION_FLAGS_DEFAULT (WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP | WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH | WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING)
32 
33 HRESULT WslConfigureDistribution(PCWSTR distributionName, ULONG defaultUID, WSL_DISTRIBUTION_FLAGS wslDistributionFlags);
34 HRESULT WslGetDistributionConfiguration(PCWSTR distributionName, ULONG* distributionVersion, ULONG* defaultUID, WSL_DISTRIBUTION_FLAGS* wslDistributionFlags, PSTR** defaultEnvironmentVariables, ULONG* defaultEnvironmentVariableCount);
35 HRESULT WslLaunchInteractive(PCWSTR distributionName, PCWSTR command, BOOL useCurrentWorkingDirectory, DWORD* exitCode);
36 HRESULT WslLaunch(PCWSTR distributionName, PCWSTR command, BOOL useCurrentWorkingDirectory, HANDLE stdIn, HANDLE stdOut, HANDLE stdErr, HANDLE* process);
37 
38 #endif
39 #ifdef __cplusplus
40 }
41 #endif
42 #endif
43