From 3cad917f6c2ed9235f254ec1b8d48652b7feee16 Mon Sep 17 00:00:00 2001 From: Hilderin <81109165+Hilderin@users.noreply.github.com> Date: Sat, 23 Dec 2023 08:19:01 -0500 Subject: [PATCH] Removing RemoteFX code and adjusting Readme.md --- README.md | 1 + src/win32_init.c | 54 +----------------------------------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index e3d18ec8..f4509120 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395) - [Win32] Bugfix: The OSMesa library was not unloaded on termination - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050) + - [Win32] Bugfix: Disabled cursor mode doesn't work right when connected over RDP (#1276) - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - [Cocoa] Moved main menu creation to GLFW initialization time (#1649) diff --git a/src/win32_init.c b/src/win32_init.c index 22848830..5f30aca6 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -460,61 +460,9 @@ static void createBlankCursor(void) // Check if the session was started in Remote Desktop -// Reference: https://learn.microsoft.com/en-us/windows/win32/termserv/detecting-the-terminal-services-environment static BOOL isCurrentRemoteSession() { - BOOL fIsRemoteable = FALSE; - - if (GetSystemMetrics(SM_REMOTESESSION)) - { - fIsRemoteable = TRUE; - } - else - { - HKEY hRegKey = NULL; - LONG lResult; - - lResult = RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\"), - 0, // ulOptions - KEY_READ, - &hRegKey - ); - - if (lResult == ERROR_SUCCESS) - { - DWORD dwGlassSessionId; - DWORD cbGlassSessionId = sizeof(dwGlassSessionId); - DWORD dwType; - - lResult = RegQueryValueEx( - hRegKey, - TEXT("GlassSessionId"), - NULL, // lpReserved - &dwType, - (BYTE*)&dwGlassSessionId, - &cbGlassSessionId - ); - - if (lResult == ERROR_SUCCESS) - { - DWORD dwCurrentSessionId; - - if (ProcessIdToSessionId(GetCurrentProcessId(), &dwCurrentSessionId)) - { - fIsRemoteable = (dwCurrentSessionId != dwGlassSessionId); - } - } - } - - if (hRegKey) - { - RegCloseKey(hRegKey); - } - } - - return fIsRemoteable; + return GetSystemMetrics(SM_REMOTESESSION) > 0; }