From 870fc91a5d0c0ce2150cacdcdc4f333e4660a5bf Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 12 Feb 2016 21:49:05 +0100 Subject: [run-virt] openslx.exe: disable screensaver/standby, don't show error if patching shutdown button caption fails on the first try --- remote/modules/run-virt/compile | 5 +++++ .../data/opt/openslx/vmchooser/data/openslx.exe | Bin 15360 -> 15360 bytes remote/modules/run-virt/winres.c | 13 ++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100755 remote/modules/run-virt/compile (limited to 'remote/modules') diff --git a/remote/modules/run-virt/compile b/remote/modules/run-virt/compile new file mode 100755 index 00000000..4db15686 --- /dev/null +++ b/remote/modules/run-virt/compile @@ -0,0 +1,5 @@ +#!/bin/sh + +rm -- winres.exe +i686-w64-mingw32-gcc -std=c99 -Os -Wl,--subsystem,windows -o winres.exe winres.c -lole32 -luuid -lgdi32 #-lws2_32 +strip winres.exe && echo "Successfully created winres.exe" diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe index a1616798..114a0dc0 100755 Binary files a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe and b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe differ diff --git a/remote/modules/run-virt/winres.c b/remote/modules/run-virt/winres.c index a9037b61..c9065c03 100644 --- a/remote/modules/run-virt/winres.c +++ b/remote/modules/run-virt/winres.c @@ -51,15 +51,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // Mute sound by default if (retVer && version.dwMajorVersion >= 6) muteSound(); + // Disable screen saver as it might give the false impression that the session is securely locked + SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0); + // Disable standby and idle-mode (this is a VM!) + if (version.dwMajorVersion >= 6) { // Vista+ + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_AWAYMODE_REQUIRED); + } else { // XP/2003 + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); + } // Shutdown button label if (retVer && version.dwMajorVersion == 6 && version.dwMinorVersion == 1) { // Only on Windows 7 char buffer[100]; - ret = setShutdownText(); - if (ret != 0) { - snprintf(buffer, 100, "Returned %d", ret); - MessageBoxA(0, buffer, "Set caption", 0); - } // Repeatedly set caption UINT_PTR tRet = SetTimer(NULL, 0, 5000, (TIMERPROC)&resetShutdown); if (tRet == 0) { -- cgit v1.2.3-55-g7522