mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-11 23:39:22 -06:00
Fix formatting and whitespace issues in WSLA and wsladiag sources
This commit is contained in:
parent
650e460d4a
commit
4d0492ae58
@ -47,7 +47,7 @@ endif()
|
|||||||
|
|
||||||
set_source_files_properties(${OUTPUT_PACKAGE} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${OUTPUT_PACKAGE} PROPERTIES GENERATED TRUE)
|
||||||
|
|
||||||
if (DEFINED WSL_POST_BUILD_COMMAND)
|
if (DEFINED WSL_POST_BUILD_COMMAND AND NOT "${WSL_POST_BUILD_COMMAND}" STREQUAL "")
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET msipackage
|
TARGET msipackage
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
|
|||||||
@ -1,9 +1,15 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) Microsoft. All rights reserved.
|
Copyright (c) Microsoft. All rights reserved.
|
||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
main.cpp
|
|
||||||
|
wsladiag.cpp
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
Entry point for the wsladiag tool, performs WSL runtime initialization and parses --list/--help.
|
|
||||||
|
TODO
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|||||||
@ -20,11 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
using wsl::windows::service::wsla::WSLASession;
|
using wsl::windows::service::wsla::WSLASession;
|
||||||
|
|
||||||
WSLASession::WSLASession(
|
WSLASession::WSLASession(ULONG id, const WSLA_SESSION_SETTINGS& Settings, WSLAUserSessionImpl& userSessionImpl, const VIRTUAL_MACHINE_SETTINGS& VmSettings) :
|
||||||
ULONG id,
|
|
||||||
const WSLA_SESSION_SETTINGS& Settings,
|
|
||||||
WSLAUserSessionImpl& userSessionImpl,
|
|
||||||
const VIRTUAL_MACHINE_SETTINGS& VmSettings) :
|
|
||||||
|
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_sessionSettings(Settings),
|
m_sessionSettings(Settings),
|
||||||
@ -60,18 +56,16 @@ WSLASession::~WSLASession()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSLASession::CopyDisplayName(
|
void WSLASession::CopyDisplayName(_Out_writes_z_(bufferLength) PWSTR buffer, size_t bufferLength) const
|
||||||
_Out_writes_z_(bufferLength) PWSTR buffer,
|
|
||||||
size_t bufferLength) const
|
|
||||||
{
|
{
|
||||||
THROW_HR_IF(E_BOUNDS, m_displayName.size() + 1 > bufferLength);
|
THROW_HR_IF(E_BOUNDS, m_displayName.size() + 1 > bufferLength);
|
||||||
wcscpy_s(buffer, bufferLength, m_displayName.c_str());
|
wcscpy_s(buffer, bufferLength, m_displayName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring& WSLASession::DisplayName() const
|
/** const std::wstring& WSLASession::DisplayName() const
|
||||||
{
|
{
|
||||||
return m_displayName;
|
return m_displayName;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
HRESULT WSLASession::PullImage(LPCWSTR Image, const WSLA_REGISTRY_AUTHENTICATION_INFORMATION* RegistryInformation, IProgressCallback* ProgressCallback)
|
HRESULT WSLASession::PullImage(LPCWSTR Image, const WSLA_REGISTRY_AUTHENTICATION_INFORMATION* RegistryInformation, IProgressCallback* ProgressCallback)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,9 +30,13 @@ public:
|
|||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
void CopyDisplayName(
|
|
||||||
_Out_writes_z_(bufferLength) PWSTR buffer,
|
const std::wstring& GetDisplayName() const noexcept
|
||||||
size_t bufferLength) const;
|
{
|
||||||
|
return m_displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CopyDisplayName(_Out_writes_z_(bufferLength) PWSTR buffer, size_t bufferLength) const;
|
||||||
|
|
||||||
// Image management.
|
// Image management.
|
||||||
IFACEMETHOD(PullImage)(_In_ LPCWSTR Image, _In_ const WSLA_REGISTRY_AUTHENTICATION_INFORMATION* RegistryInformation, _In_ IProgressCallback* ProgressCallback) override;
|
IFACEMETHOD(PullImage)(_In_ LPCWSTR Image, _In_ const WSLA_REGISTRY_AUTHENTICATION_INFORMATION* RegistryInformation, _In_ IProgressCallback* ProgressCallback) override;
|
||||||
|
|||||||
@ -54,7 +54,6 @@ HRESULT WSLAUserSessionImpl::CreateSession(const WSLA_SESSION_SETTINGS* Settings
|
|||||||
{
|
{
|
||||||
std::lock_guard lock(m_lock);
|
std::lock_guard lock(m_lock);
|
||||||
m_sessions.emplace(session.Get());
|
m_sessions.emplace(session.Get());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client now owns the session.
|
// Client now owns the session.
|
||||||
@ -73,7 +72,7 @@ HRESULT WSLAUserSessionImpl::OpenSessionByName(LPCWSTR DisplayName, IWSLASession
|
|||||||
// TODO: Check for duplicate on session creation.
|
// TODO: Check for duplicate on session creation.
|
||||||
for (auto& e : m_sessions)
|
for (auto& e : m_sessions)
|
||||||
{
|
{
|
||||||
if (e->DisplayName() == DisplayName)
|
if (e->GetDisplayName() == DisplayName)
|
||||||
{
|
{
|
||||||
THROW_IF_FAILED(e->QueryInterface(__uuidof(IWSLASession), (void**)Session));
|
THROW_IF_FAILED(e->QueryInterface(__uuidof(IWSLASession), (void**)Session));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -81,9 +80,9 @@ HRESULT WSLAUserSessionImpl::OpenSessionByName(LPCWSTR DisplayName, IWSLASession
|
|||||||
}
|
}
|
||||||
|
|
||||||
return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
|
return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT wsl::windows::service::wsla::WSLAUserSessionImpl::ListSessions(
|
HRESULT wsl::windows::service::wsla::WSLAUserSessionImpl::ListSessions(_Out_ WSLA_SESSION_INFORMATION** Sessions, _Out_ ULONG* SessionsCount)
|
||||||
_Out_ WSLA_SESSION_INFORMATION** Sessions, _Out_ ULONG* SessionsCount)
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(m_lock);
|
std::lock_guard lock(m_lock);
|
||||||
auto output = wil::make_unique_cotaskmem<WSLA_SESSION_INFORMATION[]>(m_sessions.size());
|
auto output = wil::make_unique_cotaskmem<WSLA_SESSION_INFORMATION[]>(m_sessions.size());
|
||||||
@ -94,16 +93,13 @@ HRESULT wsl::windows::service::wsla::WSLAUserSessionImpl::ListSessions(
|
|||||||
output[index].SessionId = session->GetId();
|
output[index].SessionId = session->GetId();
|
||||||
output[index].CreatorPid = 0; // placeholder until we populate this later
|
output[index].CreatorPid = 0; // placeholder until we populate this later
|
||||||
|
|
||||||
session->CopyDisplayName(
|
session->CopyDisplayName(output[index].DisplayName, _countof(output[index].DisplayName));
|
||||||
output[index].DisplayName,
|
|
||||||
_countof(output[index].DisplayName));
|
|
||||||
|
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
*Sessions = output.release();
|
*Sessions = output.release();
|
||||||
*SessionsCount = static_cast<ULONG>(m_sessions.size());
|
*SessionsCount = static_cast<ULONG>(m_sessions.size());
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wsl::windows::service::wsla::WSLAUserSession::WSLAUserSession(std::weak_ptr<WSLAUserSessionImpl>&& Session) :
|
wsl::windows::service::wsla::WSLAUserSession::WSLAUserSession(std::weak_ptr<WSLAUserSessionImpl>&& Session) :
|
||||||
|
|||||||
@ -17,6 +17,8 @@ Abstract:
|
|||||||
#include "WSLASession.h"
|
#include "WSLASession.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <mutex>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace wsl::windows::service::wsla {
|
namespace wsl::windows::service::wsla {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user