From df08445bd481759168feb40dd4e9ba3169d6d78e Mon Sep 17 00:00:00 2001 From: Mohsen Seifi Date: Wed, 7 Apr 2021 00:37:33 +0100 Subject: [PATCH] Slackware optimizations in launcher --- .../WSLackware.appxmanifest | 78 ++-- .../DistroLauncher/DistributionInfo.cpp | 181 ++++----- .../DistroLauncher/DistributionInfo.h | 50 +-- .../DistroLauncher/DistroLauncher.cpp | 347 ++++++++--------- .../DistroLauncher/messages.h | 356 +++++++++--------- .../DistroLauncher/messages.rc | 4 +- 6 files changed, 513 insertions(+), 503 deletions(-) diff --git a/src/WSLackwareLauncher/DistroLauncher-WSLackware/WSLackware.appxmanifest b/src/WSLackwareLauncher/DistroLauncher-WSLackware/WSLackware.appxmanifest index 8feefeb..83194d3 100644 --- a/src/WSLackwareLauncher/DistroLauncher-WSLackware/WSLackware.appxmanifest +++ b/src/WSLackwareLauncher/DistroLauncher-WSLackware/WSLackware.appxmanifest @@ -1,40 +1,40 @@ - - - - - - WSLackware - Mohsens22 - Assets\Tiles\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + WSLackware + Mohsens22 + Assets\Tiles\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.cpp b/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.cpp index 1720f40..3b76c09 100644 --- a/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.cpp +++ b/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.cpp @@ -1,87 +1,94 @@ -// -// Copyright (C) Microsoft. All rights reserved. -// Licensed under the terms described in the LICENSE file in the root of this project. -// - -#include "stdafx.h" - -bool DistributionInfo::CreateUser(std::wstring_view userName) -{ - // Create the user account and Add the user account to any relevant groups. - DWORD exitCode; - std::wstring commandLine = L"useradd "; - commandLine += userName; - commandLine += L" -g users -G adm,cdrom,plugdev,wheel,power,netdev,floppy,input,lp -m"; - HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); - if ((FAILED(hr)) || (exitCode != 0)) { - return false; - } - - //set password - commandLine = L"passwd "; - commandLine += userName; - HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); - if ((FAILED(hr)) || (exitCode != 0)) { - return false; - } - - // - commandLine = L"echo \" % wheel ALL = (ALL)ALL\" >> /etc/sudoers"; - commandLine += userName; - hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); - if ((FAILED(hr)) || (exitCode != 0)) { - - // Delete the user if the group add command failed. - commandLine = L"userdel -r "; - commandLine += userName; - g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); - return false; - } - - return true; -} - -ULONG DistributionInfo::QueryUid(std::wstring_view userName) -{ - // Create a pipe to read the output of the launched process. - HANDLE readPipe; - HANDLE writePipe; - SECURITY_ATTRIBUTES sa{sizeof(sa), nullptr, true}; - ULONG uid = UID_INVALID; - if (CreatePipe(&readPipe, &writePipe, &sa, 0)) { - // Query the UID of the supplied username. - std::wstring command = L"/usr/bin/id -u "; - command += userName; - int returnValue = 0; - HANDLE child; - HRESULT hr = g_wslApi.WslLaunch(command.c_str(), true, GetStdHandle(STD_INPUT_HANDLE), writePipe, GetStdHandle(STD_ERROR_HANDLE), &child); - if (SUCCEEDED(hr)) { - // Wait for the child to exit and ensure process exited successfully. - WaitForSingleObject(child, INFINITE); - DWORD exitCode; - if ((GetExitCodeProcess(child, &exitCode) == false) || (exitCode != 0)) { - hr = E_INVALIDARG; - } - - CloseHandle(child); - if (SUCCEEDED(hr)) { - char buffer[64]; - DWORD bytesRead; - - // Read the output of the command from the pipe and convert to a UID. - if (ReadFile(readPipe, buffer, (sizeof(buffer) - 1), &bytesRead, nullptr)) { - buffer[bytesRead] = ANSI_NULL; - try { - uid = std::stoul(buffer, nullptr, 10); - - } catch( ... ) { } - } - } - } - - CloseHandle(readPipe); - CloseHandle(writePipe); - } - - return uid; -} +// +// Copyright (C) Microsoft. All rights reserved. +// Licensed under the terms described in the LICENSE file in the root of this project. +// + +#include "stdafx.h" + +bool DistributionInfo::CreateUser(std::wstring_view userName) +{ + // Create the user account and Add the user account to any relevant groups. + DWORD exitCode; + std::wstring commandLine = L"useradd "; + commandLine += userName; + commandLine += L" -g users -G adm,cdrom,plugdev,wheel,power,netdev,floppy,input,lp -m"; + HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); + if ((FAILED(hr)) || (exitCode != 0)) { + return false; + } + + //set password + commandLine = L"passwd "; + commandLine += userName; + hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); + if ((FAILED(hr)) || (exitCode != 0)) { + return false; + } + + + if ((FAILED(hr)) || (exitCode != 0)) { + + // Delete the user if the group add command failed. + commandLine = L"userdel -r "; + commandLine += userName; + g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); + return false; + } + //set password + commandLine = L"cp /tmp/.bashrc /home/"; + commandLine += userName; + commandLine += L"/.profile"; + hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); + if ((FAILED(hr)) || (exitCode != 0)) { + return false; + } + + + + return true; +} + +ULONG DistributionInfo::QueryUid(std::wstring_view userName) +{ + // Create a pipe to read the output of the launched process. + HANDLE readPipe; + HANDLE writePipe; + SECURITY_ATTRIBUTES sa{sizeof(sa), nullptr, true}; + ULONG uid = UID_INVALID; + if (CreatePipe(&readPipe, &writePipe, &sa, 0)) { + // Query the UID of the supplied username. + std::wstring command = L"/usr/bin/id -u "; + command += userName; + int returnValue = 0; + HANDLE child; + HRESULT hr = g_wslApi.WslLaunch(command.c_str(), true, GetStdHandle(STD_INPUT_HANDLE), writePipe, GetStdHandle(STD_ERROR_HANDLE), &child); + if (SUCCEEDED(hr)) { + // Wait for the child to exit and ensure process exited successfully. + WaitForSingleObject(child, INFINITE); + DWORD exitCode; + if ((GetExitCodeProcess(child, &exitCode) == false) || (exitCode != 0)) { + hr = E_INVALIDARG; + } + + CloseHandle(child); + if (SUCCEEDED(hr)) { + char buffer[64]; + DWORD bytesRead; + + // Read the output of the command from the pipe and convert to a UID. + if (ReadFile(readPipe, buffer, (sizeof(buffer) - 1), &bytesRead, nullptr)) { + buffer[bytesRead] = ANSI_NULL; + try { + uid = std::stoul(buffer, nullptr, 10); + + } catch( ... ) { } + } + } + } + + CloseHandle(readPipe); + CloseHandle(writePipe); + } + + return uid; +} diff --git a/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.h b/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.h index cdf9743..55ba684 100644 --- a/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.h +++ b/src/WSLackwareLauncher/DistroLauncher/DistributionInfo.h @@ -1,26 +1,26 @@ -// -// Copyright (C) Microsoft. All rights reserved. -// Licensed under the terms described in the LICENSE file in the root of this project. -// - -#pragma once - -namespace DistributionInfo -{ - // The name of the distribution. This will be displayed to the user via - // wslconfig.exe and in other places. It must conform to the following - // regular expression: ^[a-zA-Z0-9._-]+$ - // - // WARNING: This value must not change between versions of your app, - // otherwise users upgrading from older versions will see launch failures. - const std::wstring Name = L"WSLackware"; - - // The title bar for the console window while the distribution is installing. - const std::wstring WindowTitle = L"WSLackware"; - - // Create and configure a user account. - bool CreateUser(std::wstring_view userName); - - // Query the UID of the user account. - ULONG QueryUid(std::wstring_view userName); +// +// Copyright (C) Microsoft. All rights reserved. +// Licensed under the terms described in the LICENSE file in the root of this project. +// + +#pragma once + +namespace DistributionInfo +{ + // The name of the distribution. This will be displayed to the user via + // wslconfig.exe and in other places. It must conform to the following + // regular expression: ^[a-zA-Z0-9._-]+$ + // + // WARNING: This value must not change between versions of your app, + // otherwise users upgrading from older versions will see launch failures. + const std::wstring Name = L"WSLackware"; + + // The title bar for the console window while the distribution is installing. + const std::wstring WindowTitle = L"Slackware for Windows"; + + // Create and configure a user account. + bool CreateUser(std::wstring_view userName); + + // Query the UID of the user account. + ULONG QueryUid(std::wstring_view userName); } \ No newline at end of file diff --git a/src/WSLackwareLauncher/DistroLauncher/DistroLauncher.cpp b/src/WSLackwareLauncher/DistroLauncher/DistroLauncher.cpp index c54dc63..8392b6a 100644 --- a/src/WSLackwareLauncher/DistroLauncher/DistroLauncher.cpp +++ b/src/WSLackwareLauncher/DistroLauncher/DistroLauncher.cpp @@ -1,172 +1,175 @@ -// -// Copyright (C) Microsoft. All rights reserved. -// Licensed under the terms described in the LICENSE file in the root of this project. -// - -#include "stdafx.h" - -// Commandline arguments: -#define ARG_CONFIG L"config" -#define ARG_CONFIG_DEFAULT_USER L"--default-user" -#define ARG_INSTALL L"install" -#define ARG_INSTALL_ROOT L"--root" -#define ARG_RUN L"run" -#define ARG_RUN_C L"-c" - -// Helper class for calling WSL Functions: -// https://msdn.microsoft.com/en-us/library/windows/desktop/mt826874(v=vs.85).aspx -WslApiLoader g_wslApi(DistributionInfo::Name); - -static HRESULT InstallDistribution(bool createUser); -static HRESULT SetDefaultUser(std::wstring_view userName); - -HRESULT InstallDistribution(bool createUser) -{ - // Register the distribution. - Helpers::PrintMessage(MSG_STATUS_INSTALLING); - HRESULT hr = g_wslApi.WslRegisterDistribution(); - if (FAILED(hr)) { - return hr; - } - - // Delete /etc/resolv.conf to allow WSL to generate a version based on Windows networking information. - DWORD exitCode; - hr = g_wslApi.WslLaunchInteractive(L"/bin/rm /etc/resolv.conf", true, &exitCode); - if (FAILED(hr)) { - return hr; - } - - // Create a user account. - if (createUser) { - Helpers::PrintMessage(MSG_CREATE_USER_PROMPT); - std::wstring userName; - do { - userName = Helpers::GetUserInput(MSG_ENTER_USERNAME, 32); - - } while (!DistributionInfo::CreateUser(userName)); - - // Set this user account as the default. - hr = SetDefaultUser(userName); - if (FAILED(hr)) { - return hr; - } - } - - return hr; -} - -HRESULT SetDefaultUser(std::wstring_view userName) -{ - // Query the UID of the given user name and configure the distribution - // to use this UID as the default. - ULONG uid = DistributionInfo::QueryUid(userName); - if (uid == UID_INVALID) { - return E_INVALIDARG; - } - - HRESULT hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT); - if (FAILED(hr)) { - return hr; - } - - return hr; -} - -int wmain(int argc, wchar_t const *argv[]) -{ - // Update the title bar of the console window. - SetConsoleTitleW(DistributionInfo::WindowTitle.c_str()); - - // Initialize a vector of arguments. - std::vector arguments; - for (int index = 1; index < argc; index += 1) { - arguments.push_back(argv[index]); - } - - // Ensure that the Windows Subsystem for Linux optional component is installed. - DWORD exitCode = 1; - if (!g_wslApi.WslIsOptionalComponentInstalled()) { - Helpers::PrintMessage(MSG_MISSING_OPTIONAL_COMPONENT); - if (arguments.empty()) { - Helpers::PromptForInput(); - } - - return exitCode; - } - - // Install the distribution if it is not already. - bool installOnly = ((arguments.size() > 0) && (arguments[0] == ARG_INSTALL)); - HRESULT hr = S_OK; - if (!g_wslApi.WslIsDistributionRegistered()) { - - // If the "--root" option is specified, do not create a user account. - bool useRoot = ((installOnly) && (arguments.size() > 1) && (arguments[1] == ARG_INSTALL_ROOT)); - hr = InstallDistribution(!useRoot); - if (FAILED(hr)) { - if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) { - Helpers::PrintMessage(MSG_INSTALL_ALREADY_EXISTS); - } - - } else { - Helpers::PrintMessage(MSG_INSTALL_SUCCESS); - } - - exitCode = SUCCEEDED(hr) ? 0 : 1; - } - - // Parse the command line arguments. - if ((SUCCEEDED(hr)) && (!installOnly)) { - if (arguments.empty()) { - hr = g_wslApi.WslLaunchInteractive(L"", false, &exitCode); - - // Check exitCode to see if wsl.exe returned that it could not start the Linux process - // then prompt users for input so they can view the error message. - if (SUCCEEDED(hr) && exitCode == UINT_MAX) { - Helpers::PromptForInput(); - } - - } else if ((arguments[0] == ARG_RUN) || - (arguments[0] == ARG_RUN_C)) { - - std::wstring command; - for (size_t index = 1; index < arguments.size(); index += 1) { - command += L" "; - command += arguments[index]; - } - - hr = g_wslApi.WslLaunchInteractive(command.c_str(), true, &exitCode); - - } else if (arguments[0] == ARG_CONFIG) { - hr = E_INVALIDARG; - if (arguments.size() == 3) { - if (arguments[1] == ARG_CONFIG_DEFAULT_USER) { - hr = SetDefaultUser(arguments[2]); - } - } - - if (SUCCEEDED(hr)) { - exitCode = 0; - } - - } else { - Helpers::PrintMessage(MSG_USAGE); - return exitCode; - } - } - - // If an error was encountered, print an error message. - if (FAILED(hr)) { - if (hr == HRESULT_FROM_WIN32(ERROR_LINUX_SUBSYSTEM_NOT_PRESENT)) { - Helpers::PrintMessage(MSG_MISSING_OPTIONAL_COMPONENT); - - } else { - Helpers::PrintErrorMessage(hr); - } - - if (arguments.empty()) { - Helpers::PromptForInput(); - } - } - - return SUCCEEDED(hr) ? exitCode : 1; -} +// +// Copyright (C) Microsoft. All rights reserved. +// Licensed under the terms described in the LICENSE file in the root of this project. +// + +#include "stdafx.h" + +// Commandline arguments: +#define ARG_CONFIG L"config" +#define ARG_CONFIG_DEFAULT_USER L"--default-user" +#define ARG_INSTALL L"install" +#define ARG_INSTALL_ROOT L"--root" +#define ARG_RUN L"run" +#define ARG_RUN_C L"-c" + +// Helper class for calling WSL Functions: +// https://msdn.microsoft.com/en-us/library/windows/desktop/mt826874(v=vs.85).aspx +WslApiLoader g_wslApi(DistributionInfo::Name); + +static HRESULT InstallDistribution(bool createUser); +static HRESULT SetDefaultUser(std::wstring_view userName); + +HRESULT InstallDistribution(bool createUser) +{ + // Register the distribution. + Helpers::PrintMessage(MSG_STATUS_INSTALLING); + HRESULT hr = g_wslApi.WslRegisterDistribution(); + if (FAILED(hr)) { + return hr; + } + + // Delete /etc/resolv.conf to allow WSL to generate a version based on Windows networking information. + DWORD exitCode; + hr = g_wslApi.WslLaunchInteractive(L"/bin/rm /etc/resolv.conf", true, &exitCode); + if (FAILED(hr)) { + return hr; + } + + // Create a user account. + if (createUser) { + Helpers::PrintMessage(MSG_CREATE_USER_PROMPT); + std::wstring userName; + do { + userName = Helpers::GetUserInput(MSG_ENTER_USERNAME, 32); + + } while (!DistributionInfo::CreateUser(userName)); + + // Set this user account as the default. + hr = SetDefaultUser(userName); + if (FAILED(hr)) { + return hr; + } + + } + + + + return hr; +} + +HRESULT SetDefaultUser(std::wstring_view userName) +{ + // Query the UID of the given user name and configure the distribution + // to use this UID as the default. + ULONG uid = DistributionInfo::QueryUid(userName); + if (uid == UID_INVALID) { + return E_INVALIDARG; + } + + HRESULT hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT); + if (FAILED(hr)) { + return hr; + } + + return hr; +} + +int wmain(int argc, wchar_t const *argv[]) +{ + // Update the title bar of the console window. + SetConsoleTitleW(DistributionInfo::WindowTitle.c_str()); + + // Initialize a vector of arguments. + std::vector arguments; + for (int index = 1; index < argc; index += 1) { + arguments.push_back(argv[index]); + } + + // Ensure that the Windows Subsystem for Linux optional component is installed. + DWORD exitCode = 1; + if (!g_wslApi.WslIsOptionalComponentInstalled()) { + Helpers::PrintMessage(MSG_MISSING_OPTIONAL_COMPONENT); + if (arguments.empty()) { + Helpers::PromptForInput(); + } + + return exitCode; + } + + // Install the distribution if it is not already. + bool installOnly = ((arguments.size() > 0) && (arguments[0] == ARG_INSTALL)); + HRESULT hr = S_OK; + if (!g_wslApi.WslIsDistributionRegistered()) { + + // If the "--root" option is specified, do not create a user account. + bool useRoot = ((installOnly) && (arguments.size() > 1) && (arguments[1] == ARG_INSTALL_ROOT)); + hr = InstallDistribution(!useRoot); + if (FAILED(hr)) { + if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) { + Helpers::PrintMessage(MSG_INSTALL_ALREADY_EXISTS); + } + + } else { + Helpers::PrintMessage(MSG_INSTALL_SUCCESS); + } + + exitCode = SUCCEEDED(hr) ? 0 : 1; + } + + // Parse the command line arguments. + if ((SUCCEEDED(hr)) && (!installOnly)) { + if (arguments.empty()) { + hr = g_wslApi.WslLaunchInteractive(L"", false, &exitCode); + + // Check exitCode to see if wsl.exe returned that it could not start the Linux process + // then prompt users for input so they can view the error message. + if (SUCCEEDED(hr) && exitCode == UINT_MAX) { + Helpers::PromptForInput(); + } + + } else if ((arguments[0] == ARG_RUN) || + (arguments[0] == ARG_RUN_C)) { + + std::wstring command; + for (size_t index = 1; index < arguments.size(); index += 1) { + command += L" "; + command += arguments[index]; + } + + hr = g_wslApi.WslLaunchInteractive(command.c_str(), true, &exitCode); + + } else if (arguments[0] == ARG_CONFIG) { + hr = E_INVALIDARG; + if (arguments.size() == 3) { + if (arguments[1] == ARG_CONFIG_DEFAULT_USER) { + hr = SetDefaultUser(arguments[2]); + } + } + + if (SUCCEEDED(hr)) { + exitCode = 0; + } + + } else { + Helpers::PrintMessage(MSG_USAGE); + return exitCode; + } + } + + // If an error was encountered, print an error message. + if (FAILED(hr)) { + if (hr == HRESULT_FROM_WIN32(ERROR_LINUX_SUBSYSTEM_NOT_PRESENT)) { + Helpers::PrintMessage(MSG_MISSING_OPTIONAL_COMPONENT); + + } else { + Helpers::PrintErrorMessage(hr); + } + + if (arguments.empty()) { + Helpers::PromptForInput(); + } + } + + return SUCCEEDED(hr) ? exitCode : 1; +} diff --git a/src/WSLackwareLauncher/DistroLauncher/messages.h b/src/WSLackwareLauncher/DistroLauncher/messages.h index 45b24e8..86cc7e4 100644 --- a/src/WSLackwareLauncher/DistroLauncher/messages.h +++ b/src/WSLackwareLauncher/DistroLauncher/messages.h @@ -1,178 +1,178 @@ -// -// Values are 32 bit values laid out as follows: -// -// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 -// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 -// +---+-+-+-----------------------+-------------------------------+ -// |Sev|C|R| Facility | Code | -// +---+-+-+-----------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// R - is a reserved bit -// -// Facility - is the facility code -// -// Code - is the facility's status code -// -// -// Define the facility codes -// - - -// -// Define the severity codes -// - - -// -// MessageId: MSG_WSL_REGISTER_DISTRIBUTION_FAILED -// -// MessageText: -// -// WslRegisterDistribution failed with error: 0x%1!x! -// -#define MSG_WSL_REGISTER_DISTRIBUTION_FAILED 0x000003E9L - -// -// MessageId: MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED -// -// MessageText: -// -// WslGetDistributionConfiguration failed with error: 0x%1!x! -// -#define MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED 0x000003EAL - -// -// MessageId: MSG_WSL_LAUNCH_INTERACTIVE_FAILED -// -// MessageText: -// -// WslLaunchInteractive %1 failed with error: 0x%2!x! -// -#define MSG_WSL_LAUNCH_INTERACTIVE_FAILED 0x000003EBL - -// -// MessageId: MSG_WSL_LAUNCH_FAILED -// -// MessageText: -// -// WslLaunch %1 failed with error: 0x%2!x! -// -#define MSG_WSL_LAUNCH_FAILED 0x000003ECL - -// -// MessageId: MSG_USAGE -// -// MessageText: -// -// Launches or configures a Linux distribution. -// -// Usage: -// -// Launches the user's default shell in the user's home directory. -// -// install [--root] -// Install the distribuiton and do not launch the shell when complete. -// --root -// Do not create a user account and leave the default user set to root. -// -// run -// Run the provided command line in the current working directory. If no -// command line is provided, the default shell is launched. -// -// config [setting [value]] -// Configure settings for this distribution. -// Settings: -// --default-user -// Sets the default user to . This must be an existing user. -// -// help -// Print usage information. -// -#define MSG_USAGE 0x000003EDL - -// -// MessageId: MSG_STATUS_INSTALLING -// -// MessageText: -// -// Installing WSLackware, this may take a few minutes... -// -#define MSG_STATUS_INSTALLING 0x000003EEL - -// -// MessageId: MSG_INSTALL_SUCCESS -// -// MessageText: -// -// Installation successful! -// -#define MSG_INSTALL_SUCCESS 0x000003EFL - -// -// MessageId: MSG_ERROR_CODE -// -// MessageText: -// -// Error: 0x%1!x! %2 -// -#define MSG_ERROR_CODE 0x000003F0L - -// -// MessageId: MSG_ENTER_USERNAME -// -// MessageText: -// -// Enter new UNIX username: %0 -// -#define MSG_ENTER_USERNAME 0x000003F1L - -// -// MessageId: MSG_CREATE_USER_PROMPT -// -// MessageText: -// -// Please create a default UNIX user account. The username does not need to match your Windows username. -// For more information visit: https://aka.ms/wslusers -// -#define MSG_CREATE_USER_PROMPT 0x000003F2L - -// -// MessageId: MSG_PRESS_A_KEY -// -// MessageText: -// -// Press any key to continue... -// -#define MSG_PRESS_A_KEY 0x000003F3L - -// -// MessageId: MSG_MISSING_OPTIONAL_COMPONENT -// -// MessageText: -// -// The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again. -// See https://aka.ms/wslinstall for details. -// -#define MSG_MISSING_OPTIONAL_COMPONENT 0x000003F4L - -// -// MessageId: MSG_INSTALL_ALREADY_EXISTS -// -// MessageText: -// -// The distribution installation has become corrupted. -// Please select Reset from App Settings or uninstall and reinstall the app. -// -#define MSG_INSTALL_ALREADY_EXISTS 0x000003F5L - +// +// Values are 32 bit values laid out as follows: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---+-+-+-----------------------+-------------------------------+ +// |Sev|C|R| Facility | Code | +// +---+-+-+-----------------------+-------------------------------+ +// +// where +// +// Sev - is the severity code +// +// 00 - Success +// 01 - Informational +// 10 - Warning +// 11 - Error +// +// C - is the Customer code flag +// +// R - is a reserved bit +// +// Facility - is the facility code +// +// Code - is the facility's status code +// +// +// Define the facility codes +// + + +// +// Define the severity codes +// + + +// +// MessageId: MSG_WSL_REGISTER_DISTRIBUTION_FAILED +// +// MessageText: +// +// WslRegisterDistribution failed with error: 0x%1!x! +// +#define MSG_WSL_REGISTER_DISTRIBUTION_FAILED 0x000003E9L + +// +// MessageId: MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED +// +// MessageText: +// +// WslGetDistributionConfiguration failed with error: 0x%1!x! +// +#define MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED 0x000003EAL + +// +// MessageId: MSG_WSL_LAUNCH_INTERACTIVE_FAILED +// +// MessageText: +// +// WslLaunchInteractive %1 failed with error: 0x%2!x! +// +#define MSG_WSL_LAUNCH_INTERACTIVE_FAILED 0x000003EBL + +// +// MessageId: MSG_WSL_LAUNCH_FAILED +// +// MessageText: +// +// WslLaunch %1 failed with error: 0x%2!x! +// +#define MSG_WSL_LAUNCH_FAILED 0x000003ECL + +// +// MessageId: MSG_USAGE +// +// MessageText: +// +// Launches or configures a Linux distribution. +// +// Usage: +// +// Launches the user's default shell in the user's home directory. +// +// install [--root] +// Install the distribuiton and do not launch the shell when complete. +// --root +// Do not create a user account and leave the default user set to root. +// +// run +// Run the provided command line in the current working directory. If no +// command line is provided, the default shell is launched. +// +// config [setting [value]] +// Configure settings for this distribution. +// Settings: +// --default-user +// Sets the default user to . This must be an existing user. +// +// help +// Print usage information. +// +#define MSG_USAGE 0x000003EDL + +// +// MessageId: MSG_STATUS_INSTALLING +// +// MessageText: +// +// Installing WSLackware, this may take a few minutes... +// +#define MSG_STATUS_INSTALLING 0x000003EEL + +// +// MessageId: MSG_INSTALL_SUCCESS +// +// MessageText: +// +// Installation successful! +// +#define MSG_INSTALL_SUCCESS 0x000003EFL + +// +// MessageId: MSG_ERROR_CODE +// +// MessageText: +// +// Error: 0x%1!x! %2 +// +#define MSG_ERROR_CODE 0x000003F0L + +// +// MessageId: MSG_ENTER_USERNAME +// +// MessageText: +// +// Enter new UNIX username: %0 +// +#define MSG_ENTER_USERNAME 0x000003F1L + +// +// MessageId: MSG_CREATE_USER_PROMPT +// +// MessageText: +// +// Please create a default UNIX user account. The username does not need to match your Windows username. +// For more information visit: https://aka.ms/wslusers +// +#define MSG_CREATE_USER_PROMPT 0x000003F2L + +// +// MessageId: MSG_PRESS_A_KEY +// +// MessageText: +// +// Press any key to continue... +// +#define MSG_PRESS_A_KEY 0x000003F3L + +// +// MessageId: MSG_MISSING_OPTIONAL_COMPONENT +// +// MessageText: +// +// The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again. +// See https://aka.ms/wslinstall for details. +// +#define MSG_MISSING_OPTIONAL_COMPONENT 0x000003F4L + +// +// MessageId: MSG_INSTALL_ALREADY_EXISTS +// +// MessageText: +// +// The distribution installation has become corrupted. +// Please select Reset from App Settings or uninstall and reinstall the app. +// +#define MSG_INSTALL_ALREADY_EXISTS 0x000003F5L + diff --git a/src/WSLackwareLauncher/DistroLauncher/messages.rc b/src/WSLackwareLauncher/DistroLauncher/messages.rc index e87d298..4bd3ab7 100644 --- a/src/WSLackwareLauncher/DistroLauncher/messages.rc +++ b/src/WSLackwareLauncher/DistroLauncher/messages.rc @@ -1,2 +1,2 @@ -LANGUAGE 0x9,0x1 -1 11 "MSG00409.bin" +LANGUAGE 0x9,0x1 +1 11 "MSG00409.bin"