├── x64 └── install.tar.gz here ├── DistroLauncher ├── images │ ├── icon.ico │ ├── icon.png │ └── logo.png ├── targetver.h ├── Helpers.h ├── stdafx.cpp ├── resource.h ├── stdafx.h ├── DistributionInfo.h ├── DistroLauncher.rc ├── WslApiLoader.h ├── DistroLauncher.vcxproj.filters ├── WslApiLoader.cpp ├── Helpers.cpp ├── messages.mc ├── DistributionInfo.cpp ├── DistroLauncher.cpp └── DistroLauncher.vcxproj ├── DistroLauncher-Appx ├── GentooWSL.pfx.enc ├── Assets │ ├── BadgeLogo.scale-100.png │ ├── BadgeLogo.scale-125.png │ ├── BadgeLogo.scale-150.png │ ├── BadgeLogo.scale-200.png │ ├── BadgeLogo.scale-400.png │ ├── LargeTile.scale-100.png │ ├── LargeTile.scale-125.png │ ├── LargeTile.scale-150.png │ ├── LargeTile.scale-200.png │ ├── LargeTile.scale-400.png │ ├── SmallTile.scale-100.png │ ├── SmallTile.scale-125.png │ ├── SmallTile.scale-150.png │ ├── SmallTile.scale-200.png │ ├── SmallTile.scale-400.png │ ├── StoreLogo.scale-100.png │ ├── StoreLogo.scale-125.png │ ├── StoreLogo.scale-150.png │ ├── StoreLogo.scale-200.png │ ├── StoreLogo.scale-400.png │ ├── SplashScreen.scale-100.png │ ├── SplashScreen.scale-125.png │ ├── SplashScreen.scale-150.png │ ├── SplashScreen.scale-200.png │ ├── SplashScreen.scale-400.png │ ├── Square44x44Logo.scale-100.png │ ├── Square44x44Logo.scale-125.png │ ├── Square44x44Logo.scale-150.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.scale-400.png │ ├── Wide310x150Logo.scale-100.png │ ├── Wide310x150Logo.scale-125.png │ ├── Wide310x150Logo.scale-150.png │ ├── Wide310x150Logo.scale-200.png │ ├── Wide310x150Logo.scale-400.png │ ├── Square150x150Logo.scale-100.png │ ├── Square150x150Logo.scale-125.png │ ├── Square150x150Logo.scale-150.png │ ├── Square150x150Logo.scale-200.png │ ├── Square150x150Logo.scale-400.png │ ├── Square44x44Logo.targetsize-16.png │ ├── Square44x44Logo.targetsize-24.png │ ├── Square44x44Logo.targetsize-256.png │ ├── Square44x44Logo.targetsize-32.png │ ├── Square44x44Logo.targetsize-48.png │ ├── Square44x44Logo.altform-unplated_targetsize-16.png │ ├── Square44x44Logo.altform-unplated_targetsize-256.png │ ├── Square44x44Logo.altform-unplated_targetsize-32.png │ ├── Square44x44Logo.altform-unplated_targetsize-48.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-16.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-256.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-32.png │ ├── Square44x44Logo.altform-lightunplated_targetsize-48.png │ └── Square44x44Logo.targetsize-24_altform-lightunplated.png ├── DistroLauncher-Appx_TemporaryKey.pfx.enc ├── MyDistro.appxmanifest ├── DistroLauncher-Appx.vcxproj.filters └── DistroLauncher-Appx.vcxproj ├── README.md ├── LICENSE ├── DistroLauncher.sln └── .gitignore /x64/install.tar.gz here: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DistroLauncher/images/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher/images/icon.ico -------------------------------------------------------------------------------- /DistroLauncher/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher/images/icon.png -------------------------------------------------------------------------------- /DistroLauncher/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher/images/logo.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/GentooWSL.pfx.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/GentooWSL.pfx.enc -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/BadgeLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/BadgeLogo.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/BadgeLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/BadgeLogo.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/BadgeLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/BadgeLogo.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/BadgeLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/BadgeLogo.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/BadgeLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/BadgeLogo.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/LargeTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/LargeTile.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/LargeTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/LargeTile.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/LargeTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/LargeTile.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/LargeTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/LargeTile.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/LargeTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/LargeTile.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SmallTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SmallTile.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SmallTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SmallTile.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SmallTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SmallTile.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SmallTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SmallTile.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SmallTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SmallTile.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/StoreLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/StoreLogo.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/StoreLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/StoreLogo.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/StoreLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/StoreLogo.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-256.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-32.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/DistroLauncher-Appx_TemporaryKey.pfx.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/DistroLauncher-Appx_TemporaryKey.pfx.enc -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-16.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-256.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-32.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-48.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png -------------------------------------------------------------------------------- /DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24_altform-lightunplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imaandrew/GentooWSL/HEAD/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24_altform-lightunplated.png -------------------------------------------------------------------------------- /DistroLauncher/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /DistroLauncher/Helpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #pragma once 7 | 8 | #define UID_INVALID ((ULONG)-1) 9 | 10 | namespace Helpers 11 | { 12 | std::wstring GetUserInput(DWORD promptMsg, DWORD maxCharacters); 13 | void PrintErrorMessage(HRESULT hr); 14 | HRESULT PrintMessage(DWORD messageId, ...); 15 | void PromptForInput(); 16 | } -------------------------------------------------------------------------------- /DistroLauncher/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | // stdafx.cpp : source file that includes just the standard includes 6 | // DistroInstaller.pch will be the pre-compiled header 7 | // stdafx.obj will contain the pre-compiled type information 8 | // 9 | 10 | #include "stdafx.h" 11 | 12 | // Reference any additional headers you need in stdafx.h and not in this file. 13 | 14 | -------------------------------------------------------------------------------- /DistroLauncher/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by DistroInstaller.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 103 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GentooWSL [![Build status](https://ci.appveyor.com/api/projects/status/pd0494r5y22q0yim)](https://ci.appveyor.com/project/imaandrew/gentoowsl) 2 | 3 | ## This project is no longer being maintained. Check out [GentooWSL2](https://github.com/VPraharsha03/GentooWSL2) and the [wiki page](https://wiki.gentoo.org/wiki/Gentoo_in_WSL) 4 | 5 | Have you ever wanted to easily run Gentoo on Windows? No? Me neither. Introducing GentooWSL! 6 | 7 | ## Features 8 | - Finally works 9 | - Gentoo 10 | 11 | ## Reasons why you should use it 12 | - 13 | -------------------------------------------------------------------------------- /DistroLauncher/stdafx.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | // stdafx.h : include file for standard system include files, 6 | // or project specific include files that are used frequently, but 7 | // are changed infrequently 8 | // 9 | 10 | #pragma once 11 | 12 | #include "targetver.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "WslApiLoader.h" 29 | #include "Helpers.h" 30 | #include "DistributionInfo.h" 31 | 32 | // Message strings compiled from .MC file. 33 | #include "messages.h" 34 | -------------------------------------------------------------------------------- /DistroLauncher/DistributionInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #pragma once 7 | 8 | namespace DistributionInfo 9 | { 10 | // The name of the distribution. This will be displayed to the user via 11 | // wslconfig.exe and in other places. It must conform to the following 12 | // regular expression: ^[a-zA-Z0-9._-]+$ 13 | // 14 | // WARNING: This value must not change between versions of your app, 15 | // otherwise users upgrading from older versions will see launch failures. 16 | const std::wstring Name = L"GentooWSL"; 17 | 18 | // The title bar for the console window while the distribution is installing. 19 | const std::wstring WindowTitle = L"GentooWSL"; 20 | // Set root user password 21 | bool SetRootPassword(); 22 | 23 | // Create and configure a user account. 24 | bool CreateUser(std::wstring_view userName); 25 | 26 | // Query the UID of the user account. 27 | ULONG QueryUid(std::wstring_view userName); 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | Copyright (c) 2020-2021 imaandrew 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /DistroLauncher/DistroLauncher.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | 21 | #ifdef APSTUDIO_INVOKED 22 | ///////////////////////////////////////////////////////////////////////////// 23 | // 24 | // TEXTINCLUDE 25 | // 26 | 27 | 1 TEXTINCLUDE 28 | BEGIN 29 | "resource.h\0" 30 | END 31 | 32 | 2 TEXTINCLUDE 33 | BEGIN 34 | "#include ""winres.h""\r\n" 35 | "\0" 36 | END 37 | 38 | 3 TEXTINCLUDE 39 | BEGIN 40 | "\r\n" 41 | "\0" 42 | END 43 | 44 | #endif // APSTUDIO_INVOKED 45 | 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // 49 | // Icon 50 | // 51 | 52 | // Icon with lowest ID value placed first to ensure application icon 53 | // remains consistent on all systems. 54 | IDI_ICON1 ICON ".\images\icon.ico" 55 | 56 | #endif // English (United States) resources 57 | ///////////////////////////////////////////////////////////////////////////// 58 | 59 | 60 | 61 | #ifndef APSTUDIO_INVOKED 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Generated from the TEXTINCLUDE 3 resource. 65 | // 66 | 67 | 68 | ///////////////////////////////////////////////////////////////////////////// 69 | #endif // not APSTUDIO_INVOKED 70 | 71 | #include "messages.rc" 72 | 73 | -------------------------------------------------------------------------------- /DistroLauncher/WslApiLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #pragma once 7 | #include 8 | 9 | // This error definition is present in the Spring Creators Update SDK. 10 | #ifndef ERROR_LINUX_SUBSYSTEM_NOT_PRESENT 11 | #define ERROR_LINUX_SUBSYSTEM_NOT_PRESENT 414L 12 | #endif // !ERROR_LINUX_SUBSYSTEM_NOT_PRESENT 13 | 14 | typedef BOOL (STDAPICALLTYPE* WSL_IS_DISTRIBUTION_REGISTERED)(PCWSTR); 15 | typedef HRESULT (STDAPICALLTYPE* WSL_REGISTER_DISTRIBUTION)(PCWSTR, PCWSTR); 16 | typedef HRESULT (STDAPICALLTYPE* WSL_CONFIGURE_DISTRIBUTION)(PCWSTR, ULONG, WSL_DISTRIBUTION_FLAGS); 17 | typedef HRESULT (STDAPICALLTYPE* WSL_GET_DISTRIBUTION_CONFIGURATION)(PCWSTR, ULONG *, ULONG *, WSL_DISTRIBUTION_FLAGS *, PSTR **, ULONG *); 18 | typedef HRESULT (STDAPICALLTYPE* WSL_LAUNCH_INTERACTIVE)(PCWSTR, PCWSTR, BOOL, DWORD *); 19 | typedef HRESULT (STDAPICALLTYPE* WSL_LAUNCH)(PCWSTR, PCWSTR, BOOL, HANDLE, HANDLE, HANDLE, HANDLE *); 20 | 21 | class WslApiLoader 22 | { 23 | public: 24 | WslApiLoader(const std::wstring& distributionName); 25 | ~WslApiLoader(); 26 | 27 | BOOL WslIsOptionalComponentInstalled(); 28 | 29 | BOOL WslIsDistributionRegistered(); 30 | 31 | HRESULT WslRegisterDistribution(); 32 | 33 | HRESULT WslConfigureDistribution(ULONG defaultUID, 34 | WSL_DISTRIBUTION_FLAGS wslDistributionFlags); 35 | 36 | HRESULT WslLaunchInteractive(PCWSTR command, 37 | BOOL useCurrentWorkingDirectory, 38 | DWORD *exitCode); 39 | 40 | HRESULT WslLaunch(PCWSTR command, 41 | BOOL useCurrentWorkingDirectory, 42 | HANDLE stdIn, 43 | HANDLE stdOut, 44 | HANDLE stdErr, 45 | HANDLE *process); 46 | 47 | private: 48 | std::wstring _distributionName; 49 | HMODULE _wslApiDll; 50 | WSL_IS_DISTRIBUTION_REGISTERED _isDistributionRegistered; 51 | WSL_REGISTER_DISTRIBUTION _registerDistribution; 52 | WSL_CONFIGURE_DISTRIBUTION _configureDistribution; 53 | WSL_LAUNCH_INTERACTIVE _launchInteractive; 54 | WSL_LAUNCH _launch; 55 | }; 56 | 57 | extern WslApiLoader g_wslApi; 58 | -------------------------------------------------------------------------------- /DistroLauncher/DistroLauncher.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | 55 | 56 | Resource Files 57 | 58 | 59 | 60 | 61 | Resource Files 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /DistroLauncher-Appx/MyDistro.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GentooWSL 7 | imaandrew 8 | Assets\StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /DistroLauncher.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2036 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "launcher", "DistroLauncher\DistroLauncher.vcxproj", "{BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DistroLauncher-Appx", "DistroLauncher-Appx\DistroLauncher-Appx.vcxproj", "{F63472F9-D0A0-412E-AA3D-A4E822970486}" 9 | ProjectSection(ProjectDependencies) = postProject 10 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2} = {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2} 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|ARM64 = Debug|ARM64 16 | Debug|x64 = Debug|x64 17 | Release|ARM64 = Release|ARM64 18 | Release|x64 = Release|x64 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|ARM64.ActiveCfg = Debug|ARM64 22 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|ARM64.Build.0 = Debug|ARM64 23 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|x64.ActiveCfg = Debug|x64 24 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|x64.Build.0 = Debug|x64 25 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|ARM64.ActiveCfg = Release|ARM64 26 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|ARM64.Build.0 = Release|ARM64 27 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|x64.ActiveCfg = Release|x64 28 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|x64.Build.0 = Release|x64 29 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|ARM64.ActiveCfg = Debug|ARM64 30 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|ARM64.Build.0 = Debug|ARM64 31 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|ARM64.Deploy.0 = Debug|ARM64 32 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|x64.ActiveCfg = Debug|x64 33 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|x64.Build.0 = Debug|x64 34 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|x64.Deploy.0 = Debug|x64 35 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|ARM64.ActiveCfg = Release|ARM64 36 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|ARM64.Build.0 = Release|ARM64 37 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|ARM64.Deploy.0 = Release|ARM64 38 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|x64.ActiveCfg = Release|x64 39 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|x64.Build.0 = Release|x64 40 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|x64.Deploy.0 = Release|x64 41 | EndGlobalSection 42 | GlobalSection(SolutionProperties) = preSolution 43 | HideSolutionNode = FALSE 44 | EndGlobalSection 45 | GlobalSection(ExtensibilityGlobals) = postSolution 46 | SolutionGuid = {1CBEEAE2-D963-465A-A538-A30F8D615037} 47 | EndGlobalSection 48 | EndGlobal 49 | -------------------------------------------------------------------------------- /DistroLauncher/WslApiLoader.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #include "stdafx.h" 7 | #include "WslApiLoader.h" 8 | 9 | WslApiLoader::WslApiLoader(const std::wstring& distributionName) : 10 | _distributionName(distributionName) 11 | { 12 | _wslApiDll = LoadLibraryEx(L"wslapi.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); 13 | if (_wslApiDll != nullptr) { 14 | _isDistributionRegistered = (WSL_IS_DISTRIBUTION_REGISTERED)GetProcAddress(_wslApiDll, "WslIsDistributionRegistered"); 15 | _registerDistribution = (WSL_REGISTER_DISTRIBUTION)GetProcAddress(_wslApiDll, "WslRegisterDistribution"); 16 | _configureDistribution = (WSL_CONFIGURE_DISTRIBUTION)GetProcAddress(_wslApiDll, "WslConfigureDistribution"); 17 | _launchInteractive = (WSL_LAUNCH_INTERACTIVE)GetProcAddress(_wslApiDll, "WslLaunchInteractive"); 18 | _launch = (WSL_LAUNCH)GetProcAddress(_wslApiDll, "WslLaunch"); 19 | } 20 | } 21 | 22 | WslApiLoader::~WslApiLoader() 23 | { 24 | if (_wslApiDll != nullptr) { 25 | FreeLibrary(_wslApiDll); 26 | } 27 | } 28 | 29 | BOOL WslApiLoader::WslIsOptionalComponentInstalled() 30 | { 31 | return ((_wslApiDll != nullptr) && 32 | (_isDistributionRegistered != nullptr) && 33 | (_registerDistribution != nullptr) && 34 | (_configureDistribution != nullptr) && 35 | (_launchInteractive != nullptr) && 36 | (_launch != nullptr)); 37 | } 38 | 39 | BOOL WslApiLoader::WslIsDistributionRegistered() 40 | { 41 | return _isDistributionRegistered(_distributionName.c_str()); 42 | } 43 | 44 | HRESULT WslApiLoader::WslRegisterDistribution() 45 | { 46 | HRESULT hr = _registerDistribution(_distributionName.c_str(), L"install.tar.gz"); 47 | if (FAILED(hr)) { 48 | Helpers::PrintMessage(MSG_WSL_REGISTER_DISTRIBUTION_FAILED, hr); 49 | } 50 | 51 | return hr; 52 | } 53 | 54 | HRESULT WslApiLoader::WslConfigureDistribution(ULONG defaultUID, WSL_DISTRIBUTION_FLAGS wslDistributionFlags) 55 | { 56 | HRESULT hr = _configureDistribution(_distributionName.c_str(), defaultUID, wslDistributionFlags); 57 | if (FAILED(hr)) { 58 | Helpers::PrintMessage(MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED, hr); 59 | } 60 | 61 | return hr; 62 | } 63 | 64 | HRESULT WslApiLoader::WslLaunchInteractive(PCWSTR command, BOOL useCurrentWorkingDirectory, DWORD *exitCode) 65 | { 66 | HRESULT hr = _launchInteractive(_distributionName.c_str(), command, useCurrentWorkingDirectory, exitCode); 67 | if (FAILED(hr)) { 68 | Helpers::PrintMessage(MSG_WSL_LAUNCH_INTERACTIVE_FAILED, command, hr); 69 | } 70 | 71 | return hr; 72 | } 73 | 74 | HRESULT WslApiLoader::WslLaunch(PCWSTR command, BOOL useCurrentWorkingDirectory, HANDLE stdIn, HANDLE stdOut, HANDLE stdErr, HANDLE *process) 75 | { 76 | HRESULT hr = _launch(_distributionName.c_str(), command, useCurrentWorkingDirectory, stdIn, stdOut, stdErr, process); 77 | if (FAILED(hr)) { 78 | Helpers::PrintMessage(MSG_WSL_LAUNCH_FAILED, command, hr); 79 | } 80 | 81 | return hr; 82 | } 83 | -------------------------------------------------------------------------------- /DistroLauncher/Helpers.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #include "stdafx.h" 7 | 8 | namespace { 9 | HRESULT FormatMessageHelperVa(DWORD messageId, va_list vaList, std::wstring* message); 10 | HRESULT PrintMessageVa(DWORD messageId, va_list vaList); 11 | } 12 | 13 | std::wstring Helpers::GetUserInput(DWORD promptMsg, DWORD maxCharacters) 14 | { 15 | Helpers::PrintMessage(promptMsg); 16 | size_t bufferSize = maxCharacters + 1; 17 | std::unique_ptr inputBuffer(new wchar_t[bufferSize]); 18 | std::wstring input; 19 | if (wscanf_s(L"%s", inputBuffer.get(), (unsigned int)bufferSize) == 1) { 20 | input = inputBuffer.get(); 21 | } 22 | 23 | // Throw away any additional chracters that did not fit in the buffer. 24 | wchar_t wch; 25 | do { 26 | wch = getwchar(); 27 | 28 | } while ((wch != L'\n') && (wch != WEOF)); 29 | 30 | return input; 31 | } 32 | 33 | void Helpers::PrintErrorMessage(HRESULT error) 34 | { 35 | PWSTR buffer = nullptr; 36 | ::FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, 37 | nullptr, 38 | error, 39 | 0, 40 | (PWSTR)&buffer, 41 | 0, 42 | nullptr); 43 | 44 | Helpers::PrintMessage(MSG_ERROR_CODE, error, buffer); 45 | if (buffer != nullptr) { 46 | HeapFree(GetProcessHeap(), 0, buffer); 47 | } 48 | 49 | return; 50 | } 51 | 52 | HRESULT Helpers::PrintMessage(DWORD messageId, ...) 53 | { 54 | va_list argList; 55 | va_start(argList, messageId); 56 | HRESULT hr = PrintMessageVa(messageId, argList); 57 | va_end(argList); 58 | return hr; 59 | } 60 | 61 | void Helpers::PromptForInput() 62 | { 63 | Helpers::PrintMessage(MSG_PRESS_A_KEY); 64 | _getwch(); 65 | return; 66 | } 67 | 68 | namespace { 69 | HRESULT FormatMessageHelperVa(DWORD messageId, va_list vaList, std::wstring* message) 70 | { 71 | PWSTR buffer = nullptr; 72 | DWORD written = ::FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER, 73 | nullptr, 74 | messageId, 75 | 0, 76 | (PWSTR)&buffer, 77 | 10, 78 | &vaList); 79 | *message = buffer; 80 | if (buffer != nullptr) { 81 | HeapFree(GetProcessHeap(), 0, buffer); 82 | } 83 | 84 | return (written > 0) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); 85 | } 86 | 87 | HRESULT PrintMessageVa(DWORD messageId, va_list vaList) 88 | { 89 | std::wstring message; 90 | HRESULT hr = FormatMessageHelperVa(messageId, vaList, &message); 91 | if (SUCCEEDED(hr)) { 92 | wprintf(L"%ls", message.c_str()); 93 | } 94 | 95 | return hr; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /DistroLauncher/messages.mc: -------------------------------------------------------------------------------- 1 | LanguageNames = (English=0x409:MSG00409) 2 | 3 | MessageId=1001 SymbolicName=MSG_WSL_REGISTER_DISTRIBUTION_FAILED 4 | Language=English 5 | WslRegisterDistribution failed with error: 0x%1!x! 6 | . 7 | 8 | MessageId=1002 SymbolicName=MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED 9 | Language=English 10 | WslGetDistributionConfiguration failed with error: 0x%1!x! 11 | . 12 | 13 | MessageId=1003 SymbolicName=MSG_WSL_LAUNCH_INTERACTIVE_FAILED 14 | Language=English 15 | WslLaunchInteractive %1 failed with error: 0x%2!x! 16 | . 17 | 18 | MessageId=1004 SymbolicName=MSG_WSL_LAUNCH_FAILED 19 | Language=English 20 | WslLaunch %1 failed with error: 0x%2!x! 21 | . 22 | 23 | MessageId=1005 SymbolicName=MSG_USAGE 24 | Language=English 25 | Launches or configures a Linux distribution. 26 | 27 | Usage: 28 | 29 | Launches the user's default shell in the user's home directory. 30 | 31 | install [--root] 32 | Install the distribuiton and do not launch the shell when complete. 33 | --root 34 | Do not create a user account and leave the default user set to root. 35 | 36 | run 37 | Run the provided command line in the current working directory. If no 38 | command line is provided, the default shell is launched. 39 | 40 | config [setting [value]] 41 | Configure settings for this distribution. 42 | Settings: 43 | --default-user 44 | Sets the default user to . This must be an existing user. 45 | 46 | help 47 | Print usage information. 48 | . 49 | 50 | MessageId=1006 SymbolicName=MSG_STATUS_INSTALLING 51 | Language=English 52 | Installing, this may take a few minutes... 53 | . 54 | 55 | MessageId=1007 SymbolicName=MSG_INSTALL_SUCCESS 56 | Language=English 57 | Installation successful! 58 | . 59 | 60 | MessageId=1008 SymbolicName=MSG_ERROR_CODE 61 | Language=English 62 | Error: 0x%1!x! %2 63 | . 64 | 65 | MessageId=1009 SymbolicName=MSG_ENTER_USERNAME 66 | Language=English 67 | Enter new UNIX username: %0 68 | . 69 | 70 | MessageId=1010 SymbolicName=MSG_CREATE_USER_PROMPT 71 | Language=English 72 | Please create a default UNIX user account. The username does not need to match your Windows username. 73 | For more information visit: https://aka.ms/wslusers 74 | . 75 | 76 | MessageId=1011 SymbolicName=MSG_PRESS_A_KEY 77 | Language=English 78 | Press any key to continue... 79 | . 80 | 81 | MessageId=1012 SymbolicName=MSG_MISSING_OPTIONAL_COMPONENT 82 | Language=English 83 | The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again. 84 | See https://aka.ms/wslinstall for details. 85 | . 86 | 87 | MessageId=1013 SymbolicName=MSG_INSTALL_ALREADY_EXISTS 88 | Language=English 89 | The distribution installation has become corrupted. 90 | Please select Reset from App Settings or uninstall and reinstall the app. 91 | . 92 | 93 | MessageId=1014 SymbolicName=MSG_CREATE_ROOT_PROMPT 94 | Language=English 95 | Please create a root account password. This is the account used to perform administrative functions on Linux. 96 | . 97 | 98 | MessageId=1015 SymbolicName=MSG_WELCOME_MSG_PROMPT 99 | Language=English 100 | Welcome to GentooWSL. 101 | . 102 | -------------------------------------------------------------------------------- /DistroLauncher/DistributionInfo.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #include "stdafx.h" 7 | 8 | bool DistributionInfo::CreateUser(std::wstring_view userName) 9 | { 10 | // Create the user account. 11 | DWORD exitCode; 12 | std::wstring commandLine = L"/usr/sbin/useradd -m "; 13 | commandLine += userName; 14 | HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); 15 | if ((FAILED(hr)) || (exitCode != 0)) { 16 | return false; 17 | } 18 | 19 | // Add the user account to any relevant groups. 20 | commandLine = L"/usr/sbin/usermod -aG adm,audio,cdrom,wheel,portage,usb "; 21 | commandLine += userName; 22 | hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); 23 | if ((FAILED(hr)) || (exitCode != 0)) { 24 | 25 | // Delete the user if the group add command failed. 26 | commandLine = L"/usr/sbin/userdel "; 27 | commandLine += userName; 28 | g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); 29 | return false; 30 | } 31 | 32 | // Set the password for the user 33 | commandLine = L"/usr/bin/passwd "; 34 | commandLine += userName; 35 | hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); 36 | 37 | if ((FAILED(hr)) || (exitCode != 0)) { 38 | 39 | return false; 40 | 41 | } 42 | 43 | return true; 44 | } 45 | 46 | bool DistributionInfo::SetRootPassword() 47 | { 48 | DWORD exitCode; 49 | std::wstring commandLine = L"/usr/bin/passwd "; 50 | commandLine += L"root"; 51 | HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); 52 | if (FAILED(hr) || exitCode != 0) { 53 | return false; 54 | } 55 | return true; 56 | } 57 | 58 | ULONG DistributionInfo::QueryUid(std::wstring_view userName) 59 | { 60 | // Create a pipe to read the output of the launched process. 61 | HANDLE readPipe; 62 | HANDLE writePipe; 63 | SECURITY_ATTRIBUTES sa{ sizeof(sa), nullptr, true }; 64 | ULONG uid = UID_INVALID; 65 | if (CreatePipe(&readPipe, &writePipe, &sa, 0)) { 66 | // Query the UID of the supplied username. 67 | std::wstring command = L"/usr/bin/id -u "; 68 | command += userName; 69 | int returnValue = 0; 70 | HANDLE child; 71 | HRESULT hr = g_wslApi.WslLaunch(command.c_str(), true, GetStdHandle(STD_INPUT_HANDLE), writePipe, GetStdHandle(STD_ERROR_HANDLE), &child); 72 | if (SUCCEEDED(hr)) { 73 | // Wait for the child to exit and ensure process exited successfully. 74 | WaitForSingleObject(child, INFINITE); 75 | DWORD exitCode; 76 | if ((GetExitCodeProcess(child, &exitCode) == false) || (exitCode != 0)) { 77 | hr = E_INVALIDARG; 78 | } 79 | 80 | CloseHandle(child); 81 | if (SUCCEEDED(hr)) { 82 | char buffer[64]; 83 | DWORD bytesRead; 84 | 85 | // Read the output of the command from the pipe and convert to a UID. 86 | if (ReadFile(readPipe, buffer, (sizeof(buffer) - 1), &bytesRead, nullptr)) { 87 | buffer[bytesRead] = ANSI_NULL; 88 | try { 89 | uid = std::stoul(buffer, nullptr, 10); 90 | 91 | } 92 | catch (...) {} 93 | } 94 | } 95 | } 96 | 97 | CloseHandle(readPipe); 98 | CloseHandle(writePipe); 99 | } 100 | 101 | return uid; 102 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignorable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | orleans.codegen.cs 203 | 204 | # Since there are multiple workflows, uncomment next line to ignore bower_components 205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 206 | #bower_components/ 207 | 208 | # RIA/Silverlight projects 209 | Generated_Code/ 210 | 211 | # Backup & report files from converting an old project file 212 | # to a newer Visual Studio version. Backup files are not needed, 213 | # because we have git ;-) 214 | _UpgradeReport_Files/ 215 | Backup*/ 216 | UpgradeLog*.XML 217 | UpgradeLog*.htm 218 | 219 | # SQL Server files 220 | *.mdf 221 | *.ldf 222 | *.ndf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | node_modules/ 238 | 239 | # Typescript v1 declaration files 240 | typings/ 241 | 242 | # Visual Studio 6 build log 243 | *.plg 244 | 245 | # Visual Studio 6 workspace options file 246 | *.opt 247 | 248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 249 | *.vbw 250 | 251 | # Visual Studio LightSwitch build output 252 | **/*.HTMLClient/GeneratedArtifacts 253 | **/*.DesktopClient/GeneratedArtifacts 254 | **/*.DesktopClient/ModelManifest.xml 255 | **/*.Server/GeneratedArtifacts 256 | **/*.Server/ModelManifest.xml 257 | _Pvt_Extensions 258 | 259 | # Paket dependency manager 260 | .paket/paket.exe 261 | paket-files/ 262 | 263 | # FAKE - F# Make 264 | .fake/ 265 | 266 | # JetBrains Rider 267 | .idea/ 268 | *.sln.iml 269 | 270 | # CodeRush 271 | .cr/ 272 | 273 | # Python Tools for Visual Studio (PTVS) 274 | __pycache__/ 275 | *.pyc 276 | 277 | # Cake - Uncomment if you are using it 278 | # tools/** 279 | # !tools/packages.config 280 | 281 | # Telerik's JustMock configuration file 282 | *.jmconfig 283 | 284 | # BizTalk build output 285 | *.btp.cs 286 | *.btm.cs 287 | *.odx.cs 288 | *.xsd.cs 289 | 290 | 291 | 292 | DistroLauncher/MSG*.bin 293 | DistroLauncher/messages.rc 294 | DistroLauncher/messages.h 295 | *.lib 296 | *.dll 297 | *.exe 298 | *.tar.gz 299 | *.bak 300 | -------------------------------------------------------------------------------- /DistroLauncher-Appx/DistroLauncher-Appx.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | f63472f9-d0a0-412e-aa3d-a4e822970486 6 | 7 | 8 | 3cd39ea5-301d-4878-9d47-b5dbb30f6c95 9 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 10 | 11 | 12 | 13 | 14 | Assets 15 | 16 | 17 | Assets 18 | 19 | 20 | Assets 21 | 22 | 23 | Assets 24 | 25 | 26 | Assets 27 | 28 | 29 | Assets 30 | 31 | 32 | Assets 33 | 34 | 35 | Assets 36 | 37 | 38 | Assets 39 | 40 | 41 | Assets 42 | 43 | 44 | Assets 45 | 46 | 47 | Assets 48 | 49 | 50 | Assets 51 | 52 | 53 | Assets 54 | 55 | 56 | Assets 57 | 58 | 59 | Assets 60 | 61 | 62 | Assets 63 | 64 | 65 | Assets 66 | 67 | 68 | Assets 69 | 70 | 71 | Assets 72 | 73 | 74 | Assets 75 | 76 | 77 | Assets 78 | 79 | 80 | Assets 81 | 82 | 83 | Assets 84 | 85 | 86 | Assets 87 | 88 | 89 | Assets 90 | 91 | 92 | Assets 93 | 94 | 95 | Assets 96 | 97 | 98 | Assets 99 | 100 | 101 | Assets 102 | 103 | 104 | Assets 105 | 106 | 107 | Assets 108 | 109 | 110 | Assets 111 | 112 | 113 | Assets 114 | 115 | 116 | Assets 117 | 118 | 119 | Assets 120 | 121 | 122 | Assets 123 | 124 | 125 | Assets 126 | 127 | 128 | Assets 129 | 130 | 131 | Assets 132 | 133 | 134 | Assets 135 | 136 | 137 | Assets 138 | 139 | 140 | Assets 141 | 142 | 143 | Assets 144 | 145 | 146 | Assets 147 | 148 | 149 | Assets 150 | 151 | 152 | Assets 153 | 154 | 155 | Assets 156 | 157 | 158 | Assets 159 | 160 | 161 | Assets 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /DistroLauncher/DistroLauncher.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // Licensed under the terms described in the LICENSE file in the root of this project. 4 | // 5 | 6 | #include "stdafx.h" 7 | 8 | // Commandline arguments: 9 | #define ARG_CONFIG L"config" 10 | #define ARG_CONFIG_DEFAULT_USER L"--default-user" 11 | #define ARG_INSTALL L"install" 12 | #define ARG_INSTALL_ROOT L"--root" 13 | #define ARG_RUN L"run" 14 | #define ARG_RUN_C L"-c" 15 | 16 | // Helper class for calling WSL Functions: 17 | // https://msdn.microsoft.com/en-us/library/windows/desktop/mt826874(v=vs.85).aspx 18 | WslApiLoader g_wslApi(DistributionInfo::Name); 19 | 20 | static HRESULT InstallDistribution(bool createUser); 21 | static HRESULT SetDefaultUser(std::wstring_view userName); 22 | 23 | HRESULT InstallDistribution(bool createUser) 24 | { 25 | // Register the distribution. 26 | Helpers::PrintMessage(MSG_STATUS_INSTALLING); 27 | HRESULT hr = g_wslApi.WslRegisterDistribution(); 28 | if (FAILED(hr)) { 29 | return hr; 30 | } 31 | 32 | // Delete /etc/resolv.conf to allow WSL to generate a version based on Windows networking information. 33 | DWORD exitCode; 34 | hr = g_wslApi.WslLaunchInteractive(L"/bin/rm /etc/resolv.conf", true, &exitCode); 35 | if (FAILED(hr)) { 36 | return hr; 37 | } 38 | 39 | // Create /etc/shadow and /etc/gshadow 40 | hr = g_wslApi.WslLaunchInteractive(L"/usr/sbin/pwconv ; /usr/sbin/grpconv", true, &exitCode); 41 | if (FAILED(hr)) { 42 | return hr; 43 | } 44 | 45 | // Make /etc/shadow and /etc/gshadow writeable 46 | hr = g_wslApi.WslLaunchInteractive(L"chmod 0744 /etc/shadow ; chmod 0744 /etc/gshadow", true, &exitCode); 47 | if (FAILED(hr)) { 48 | return hr; 49 | } 50 | 51 | // Enable su 52 | hr = g_wslApi.WslLaunchInteractive(L"chown -R root:root /bin/su ; chmod 755 /bin/su ; chmod u+s /bin/su", true, &exitCode); 53 | if (FAILED(hr)) { 54 | return hr; 55 | } 56 | 57 | // Configure dbus (no longer required as of Fedora 30) 58 | // hr = g_wslApi.WslLaunchInteractive(L"dbus-uuidgen --ensure", true, &exitCode); 59 | // if (FAILED(hr)) { 60 | // return hr; 61 | // } 62 | 63 | // Display welcome 64 | Helpers::PrintMessage(MSG_WELCOME_MSG_PROMPT); 65 | 66 | // Set root password 67 | // UINT8 count = 0; 68 | // Helpers::PrintMessage(MSG_CREATE_ROOT_PROMPT); 69 | // while (!DistributionInfo::SetRootPassword()) { 70 | // count++; 71 | // } 72 | 73 | // Create a user account. 74 | if (createUser) { 75 | Helpers::PrintMessage(MSG_CREATE_USER_PROMPT); 76 | std::wstring userName; 77 | do { 78 | userName = Helpers::GetUserInput(MSG_ENTER_USERNAME, 32); 79 | 80 | } while (!DistributionInfo::CreateUser(userName)); 81 | 82 | // Set this user account as the default. 83 | hr = SetDefaultUser(userName); 84 | if (FAILED(hr)) { 85 | return hr; 86 | } 87 | } 88 | 89 | return hr; 90 | } 91 | 92 | HRESULT SetDefaultUser(std::wstring_view userName) 93 | { 94 | // Query the UID of the given user name and configure the distribution 95 | // to use this UID as the default. 96 | ULONG uid = DistributionInfo::QueryUid(userName); 97 | if (uid == UID_INVALID) { 98 | return E_INVALIDARG; 99 | } 100 | 101 | HRESULT hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT); 102 | if (FAILED(hr)) { 103 | return hr; 104 | } 105 | 106 | return hr; 107 | } 108 | 109 | int wmain(int argc, wchar_t const *argv[]) 110 | { 111 | // Update the title bar of the console window. 112 | SetConsoleTitleW(DistributionInfo::WindowTitle.c_str()); 113 | 114 | // Initialize a vector of arguments. 115 | std::vector arguments; 116 | for (int index = 1; index < argc; index += 1) { 117 | arguments.push_back(argv[index]); 118 | } 119 | 120 | // Ensure that the Windows Subsystem for Linux optional component is installed. 121 | DWORD exitCode = 1; 122 | if (!g_wslApi.WslIsOptionalComponentInstalled()) { 123 | Helpers::PrintMessage(MSG_MISSING_OPTIONAL_COMPONENT); 124 | if (arguments.empty()) { 125 | Helpers::PromptForInput(); 126 | } 127 | 128 | return exitCode; 129 | } 130 | 131 | // Install the distribution if it is not already. 132 | bool installOnly = ((arguments.size() > 0) && (arguments[0] == ARG_INSTALL)); 133 | HRESULT hr = S_OK; 134 | if (!g_wslApi.WslIsDistributionRegistered()) { 135 | 136 | // If the "--root" option is specified, do not create a user account. 137 | bool useRoot = ((installOnly) && (arguments.size() > 1) && (arguments[1] == ARG_INSTALL_ROOT)); 138 | hr = InstallDistribution(!useRoot); 139 | if (FAILED(hr)) { 140 | if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) { 141 | Helpers::PrintMessage(MSG_INSTALL_ALREADY_EXISTS); 142 | } 143 | 144 | } else { 145 | Helpers::PrintMessage(MSG_INSTALL_SUCCESS); 146 | } 147 | 148 | exitCode = SUCCEEDED(hr) ? 0 : 1; 149 | } 150 | 151 | // Parse the command line arguments. 152 | if ((SUCCEEDED(hr)) && (!installOnly)) { 153 | if (arguments.empty()) { 154 | hr = g_wslApi.WslLaunchInteractive(L"", false, &exitCode); 155 | 156 | // Check exitCode to see if wsl.exe returned that it could not start the Linux process 157 | // then prompt users for input so they can view the error message. 158 | if (SUCCEEDED(hr) && exitCode == UINT_MAX) { 159 | Helpers::PromptForInput(); 160 | } 161 | 162 | } else if ((arguments[0] == ARG_RUN) || 163 | (arguments[0] == ARG_RUN_C)) { 164 | 165 | std::wstring command; 166 | for (size_t index = 1; index < arguments.size(); index += 1) { 167 | command += L" "; 168 | command += arguments[index]; 169 | } 170 | 171 | hr = g_wslApi.WslLaunchInteractive(command.c_str(), true, &exitCode); 172 | 173 | } else if (arguments[0] == ARG_CONFIG) { 174 | hr = E_INVALIDARG; 175 | if (arguments.size() == 3) { 176 | if (arguments[1] == ARG_CONFIG_DEFAULT_USER) { 177 | hr = SetDefaultUser(arguments[2]); 178 | } 179 | } 180 | 181 | if (SUCCEEDED(hr)) { 182 | exitCode = 0; 183 | } 184 | 185 | } else { 186 | Helpers::PrintMessage(MSG_USAGE); 187 | return exitCode; 188 | } 189 | } 190 | 191 | // If an error was encountered, print an error message. 192 | if (FAILED(hr)) { 193 | if (hr == HRESULT_FROM_WIN32(ERROR_LINUX_SUBSYSTEM_NOT_PRESENT)) { 194 | Helpers::PrintMessage(MSG_MISSING_OPTIONAL_COMPONENT); 195 | 196 | } else { 197 | Helpers::PrintErrorMessage(hr); 198 | } 199 | 200 | if (arguments.empty()) { 201 | Helpers::PromptForInput(); 202 | } 203 | } 204 | 205 | return SUCCEEDED(hr) ? exitCode : 1; 206 | } -------------------------------------------------------------------------------- /DistroLauncher/DistroLauncher.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | ARM64 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | ARM64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2} 23 | Win32Proj 24 | DistroLauncher 25 | 10.0.18362.0 26 | launcher 27 | 28 | 29 | 30 | Application 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | Application 37 | true 38 | v142 39 | Unicode 40 | true 41 | 42 | 43 | Application 44 | false 45 | v142 46 | true 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v142 53 | true 54 | Unicode 55 | true 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | true 68 | ClCompile 69 | 70 | 71 | 72 | Use 73 | Level3 74 | Disabled 75 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 76 | true 77 | stdcpp17 78 | 79 | 80 | Console 81 | true 82 | onecore.lib; 83 | 84 | 85 | 86 | 87 | Use 88 | Level3 89 | Disabled 90 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 91 | true 92 | stdcpp17 93 | 94 | 95 | Console 96 | true 97 | onecore.lib; 98 | 99 | 100 | 101 | 102 | Level3 103 | Use 104 | MaxSpeed 105 | true 106 | true 107 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 108 | true 109 | stdcpp17 110 | MultiThreaded 111 | 112 | 113 | Console 114 | true 115 | true 116 | true 117 | onecore.lib; 118 | 119 | 120 | 121 | 122 | Level3 123 | Use 124 | MaxSpeed 125 | true 126 | true 127 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 128 | true 129 | stdcpp17 130 | MultiThreaded 131 | 132 | 133 | Console 134 | true 135 | true 136 | true 137 | onecore.lib; 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | Create 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | Document 166 | false 167 | mc %(FullPath) 168 | Compiling Messages... 169 | %(Filename).rc;%(Filename).h;MSG0409.bin 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /DistroLauncher-Appx/DistroLauncher-Appx.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {f63472f9-d0a0-412e-aa3d-a4e822970486} 5 | DistroLauncher_Appx 6 | en-US 7 | 14.0 8 | true 9 | Windows Store 10 | 10.0.18362.0 11 | 10.0.17134.0 12 | 10.0 13 | GentooWSL 14 | DistroLauncher-Appx 15 | True 16 | 17 | 18 | 19 | 20 | Debug 21 | ARM64 22 | 23 | 24 | Debug 25 | x64 26 | 27 | 28 | Release 29 | ARM64 30 | 31 | 32 | Release 33 | x64 34 | 35 | 36 | 37 | Application 38 | true 39 | v142 40 | 41 | 42 | Application 43 | true 44 | v142 45 | true 46 | 47 | 48 | Application 49 | false 50 | true 51 | v142 52 | true 53 | 54 | 55 | Application 56 | false 57 | true 58 | v142 59 | true 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | True 79 | Always 80 | 86120E98D4B2462752FD86EDB8F76B18FD758CC9 81 | False 82 | x64|arm64 83 | 1 84 | OnApplicationRun 85 | 86 | 87 | 88 | false 89 | 90 | 91 | 92 | 93 | 94 | Designer 95 | 96 | 97 | 98 | 99 | 100 | 101 | true 102 | 103 | 104 | 105 | 106 | true 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | true 157 | 158 | 159 | 160 | 161 | true 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | Document 176 | false 177 | Copy $(SolutionDir)\$(platform)\$(Configuration)\launcher.exe into $(SolutionDir)\$(platform)\$(Configuration)\$(ProjectName)\$(targetname).exe 178 | copy $(SolutionDir)\$(platform)\$(Configuration)\launcher.exe $(SolutionDir)\$(platform)\$(Configuration)\$(ProjectName)\$(targetname).exe 179 | $(targetname).exe 180 | 181 | 182 | 183 | 184 | 185 | 186 | --------------------------------------------------------------------------------