diff --git a/client/client_state.cpp b/client/client_state.cpp index f71e39687c..266dc47c5c 100644 --- a/client/client_state.cpp +++ b/client/client_state.cpp @@ -252,6 +252,16 @@ void CLIENT_STATE::show_host_info() { tz<0?"":"+", tz ); +#ifdef _WIN64 + if (host_info.os_wsl_enabled) { + msg_printf(NULL, MSG_INFO, + "WSL detected: %s: %s", host_info.os_wsl_name, host_info.os_wsl_version + ); + } else { + msg_printf(NULL, MSG_INFO, "No WSL found."); + } +#endif + if (strlen(host_info.virtualbox_version)) { msg_printf(NULL, MSG_INFO, "VirtualBox version: %s", diff --git a/client/hostinfo_win.cpp b/client/hostinfo_win.cpp index a4f83fd05e..eb96a9b43c 100644 --- a/client/hostinfo_win.cpp +++ b/client/hostinfo_win.cpp @@ -327,20 +327,19 @@ bool CreateWslProcess(const std::string& command, HANDLE& handle) { si.cb = sizeof(STARTUPINFO); si.hStdError = out_write; si.hStdOutput = out_write; - si.hStdInput = NULL/*in_read*/; + si.hStdInput = NULL; si.dwFlags |= STARTF_USESTDHANDLES; - const DWORD dwFlags = CREATE_NEW_CONSOLE/*CREATE_NO_WINDOW*/; + const DWORD dwFlags = CREATE_NO_WINDOW; //std::stringstream ss; //ss << "PATH=" << getenv("PATH") << '\0'; //LPCH env = GetEnvironmentStrings(); const std::string cmd = "bash -c \"" + command + "\""; - const bool res = (CreateProcess(NULL, (LPSTR)cmd.c_str(), NULL, NULL, TRUE, dwFlags, NULL, /*(LPVOID)env*/ NULL, &si, &pi) == TRUE); + const bool res = (CreateProcess(NULL, (LPSTR)cmd.c_str(), NULL, NULL, TRUE, dwFlags, NULL, NULL, &si, &pi) == TRUE); if (res) { - //CloseHandle(pi.hProcess); handle = pi.hProcess; CloseHandle(pi.hThread); } @@ -362,12 +361,6 @@ int close_handles_and_exit(const int return_code) { return return_code; } -// -//bool WriteToPipe(const std::string& str) { -// DWORD written; -// -// return WriteFile(in_write, str.c_str(), (DWORD)str.size(), &written, NULL) == TRUE; -//} std::string ReadFromPipe(HANDLE handle) { DWORD avail, read, exitcode; @@ -1089,9 +1082,11 @@ int get_os_information( snprintf( os_version, os_version_size, "%s%s%s", szSKU, szServicePack, szVersion ); +#ifdef _WIN64 if (osvi.dwMajorVersion >= 10) { return get_wsl_information(os_wsl_enabled, os_wsl_name, os_wsl_name_size, os_wsl_version, os_wsl_version_size); } +#endif return 0; }