Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to detect lack of VMMS certificate #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions NanaBox/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ void NanaBox::MainWindow::RdpClientOnRemoteDesktopSizeChange(

void NanaBox::MainWindow::RdpClientOnLoginComplete()
{
this->m_connectionOnceSuccessful = true;
if (this->m_RdpClientMode == RdpClientMode::EnhancedSession)
{
this->m_RdpClientMode = RdpClientMode::EnhancedVideoSyncedSession;
Expand All @@ -1075,8 +1076,6 @@ void NanaBox::MainWindow::RdpClientOnLoginComplete()
void NanaBox::MainWindow::RdpClientOnDisconnected(
_In_ LONG DisconnectReason)
{
UNREFERENCED_PARAMETER(DisconnectReason);

this->m_MouseCaptureMode = false;
::ClipCursor(nullptr);

Expand All @@ -1090,7 +1089,16 @@ void NanaBox::MainWindow::RdpClientOnDisconnected(

if (this->m_VirtualMachineRunning)
{
if (this->m_NeedRdpClientModeChange)
if (DisconnectReason == 4 && !this->m_connectionOnceSuccessful)
{
::ShowMessageDialog(
nullptr,
Mile::WinRT::GetLocalizedString(L"Messages/RdpFailInstructionText"),
Mile::WinRT::GetLocalizedString(L"Messages/RdpFailContentText"));

this->m_VirtualMachine->Terminate();
}
else if (this->m_NeedRdpClientModeChange)
{
try
{
Expand Down
1 change: 1 addition & 0 deletions NanaBox/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ namespace NanaBox
LONG_PTR m_RememberedMainWindowStyle;
std::wstring m_WindowTitle;
bool m_MouseCaptureMode = false;
bool m_connectionOnceSuccessful = false;

void InitializeVirtualMachine();

Expand Down
8 changes: 8 additions & 0 deletions NanaBox/Strings/en/Messages.resw
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,12 @@
<value>Hyper-V is not enabled.</value>
<comment>Hyper-V is not enabled.</comment>
</data>
<data name="RdpFailContentText" xml:space="preserve">
<value>This likely means there isn’t a valid VMMS certificate installed. Please see instructions in NanaBox’s README.</value>
<comment>This likely means there isn’t a valid VMMS certificate installed. Please see instructions in NanaBox’s README.</comment>
</data>
<data name="RdpFailInstructionText" xml:space="preserve">
<value>Connecting to VM failed</value>
<comment>Connecting to VM failed</comment>
</data>
</root>
8 changes: 8 additions & 0 deletions NanaBox/Strings/zh-Hans/Messages.resw
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,12 @@
<value>Hyper-V 未启用。</value>
<comment>Hyper-V is not enabled.</comment>
</data>
<data name="RdpFailContentText" xml:space="preserve">
<value />
<comment>This likely means there isn’t a valid VMMS certificate installed. Please see instructions in NanaBox’s README.</comment>
</data>
<data name="RdpFailInstructionText" xml:space="preserve">
<value />
<comment>Connecting to VM failed</comment>
</data>
</root>