diff options
| author | Simon Rettberg | 2016-03-30 12:06:00 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-03-30 12:06:00 +0200 |
| commit | d27c3de74a40b0544ecbc51cddd02f1277feb28f (patch) | |
| tree | bb381f2a02c4b76032c2eb8a031221e9d03e4b2c /remote | |
| parent | [vmchooser2] Pass --no-vtx to vmchooser if applicable (diff) | |
| download | tm-scripts-d27c3de74a40b0544ecbc51cddd02f1277feb28f.tar.gz tm-scripts-d27c3de74a40b0544ecbc51cddd02f1277feb28f.tar.xz tm-scripts-d27c3de74a40b0544ecbc51cddd02f1277feb28f.zip | |
[run-virt] Better support for win10 folder remapping
Diffstat (limited to 'remote')
| -rwxr-xr-x | remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe | bin | 58368 -> 61952 bytes | |||
| -rwxr-xr-x | remote/modules/run-virt/winres/compile (renamed from remote/modules/run-virt/compile) | 4 | ||||
| -rw-r--r-- | remote/modules/run-virt/winres/winres.c (renamed from remote/modules/run-virt/winres.c) | 30 | ||||
| -rw-r--r-- | remote/modules/run-virt/winres/winres.manifest | 34 | ||||
| -rw-r--r-- | remote/modules/run-virt/winres/winres.rc | 4 |
5 files changed, 65 insertions, 7 deletions
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 Binary files differindex f8349ae9..e6e5771e 100755 --- a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe +++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe diff --git a/remote/modules/run-virt/compile b/remote/modules/run-virt/winres/compile index 8c950d7b..772571fb 100755 --- a/remote/modules/run-virt/compile +++ b/remote/modules/run-virt/winres/compile @@ -1,7 +1,9 @@ #!/bin/sh rm -- winres.exe -i686-w64-mingw32-gcc -Wall -Wextra -pedantic -Wno-unused-parameter -std=c99 -Os -Wl,--subsystem,windows -o winres.exe winres.c -lole32 -luuid -lgdi32 -lws2_32 -lshell32 -lmpr +i686-w64-mingw32-windres -i winres.rc -o resource.res -O coff +i686-w64-mingw32-gcc -Wall -Wextra -pedantic -Wno-unused-parameter -std=c99 -Os -Wl,--subsystem,windows -o winres.exe winres.c resource.res -lole32 -luuid -lgdi32 -lws2_32 -lshell32 -lmpr +rm -- resource.res if strip winres.exe; then echo "Successfully created winres.exe" echo "It has NOT been moved to data/.../openslx.exe" diff --git a/remote/modules/run-virt/winres.c b/remote/modules/run-virt/winres/winres.c index 626a1048..acc15e93 100644 --- a/remote/modules/run-virt/winres.c +++ b/remote/modules/run-virt/winres/winres.c @@ -43,6 +43,7 @@ static const ssize_t KEYLEN = 16; #define SETTINGS_FILE "B:\\OPENSLX.INI" #define SETTINGS_FILE_W L"B:\\OPENSLX.INI" +static OSVERSIONINFO winVer; static BOOL bGetShares = FALSE; static netdrive_t drives[DRIVEMAX]; static wchar_t desktopPath[MAX_PATH+1], tempPath[MAX_PATH+1], programsPath[MAX_PATH+1], windowsPath[MAX_PATH+1]; @@ -241,19 +242,21 @@ static void loadPaths() int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { - OSVERSIONINFO version; - version.dwOSVersionInfoSize = sizeof(version); - BOOL retVer = GetVersionEx(&version); + winVer.dwOSVersionInfoSize = sizeof(winVer); + BOOL retVer = GetVersionEx(&winVer); CoInitialize(NULL); _startTime = GetTickCount(); loadPaths(); + if (lpCmdLine != NULL && strstr(lpCmdLine, "debug") != NULL) { + alog("Windows Version %d.%d", (int)winVer.dwMajorVersion, (int)winVer.dwMinorVersion); + } // Mute sound by default - if (retVer && version.dwMajorVersion >= 6) + if (retVer && winVer.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+ + if (winVer.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); @@ -267,7 +270,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } } // Shutdown button label - if (retVer && version.dwMajorVersion == 6 && version.dwMinorVersion == 1) { + if (retVer && winVer.dwMajorVersion == 6 && winVer.dwMinorVersion == 1) { // Only on Windows 7 // Repeatedly set caption UINT_PTR tRet = SetTimer(NULL, 0, 5230, (TIMERPROC)&resetShutdown); @@ -946,6 +949,7 @@ static void patchUserPaths(wchar_t *letter) return; } // Ha! + const BOOL win10 = winVer.dwMajorVersion >= 10; if (remap.other) { patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{56784854-C6CB-462B-8169-88E350ACB882}", L"Contacts", L"Profile\\Contacts", L"Kontakte", NULL); patchRegPath(&patchOk, &anyMapped, hKey, letter, L"Favorites", L"Favorites", L"Profile\\Favorites", L"Favoriten", NULL); @@ -957,15 +961,29 @@ static void patchUserPaths(wchar_t *letter) patchRegPath(&patchOk, &anyMapped, hKey, letter, L"My Video", L"Videos", L"My Videos", L"Eigene Videos", NULL); patchRegPath(&patchOk, &anyMapped, hKey, letter, L"My Pictures", L"Pictures", L"My Pictures", L"Eigene Bilder", L"Bilder", NULL); patchRegPath(&patchOk, &anyMapped, hKey, letter, L"My Music", L"Music", L"My Music", L"Eigene Musik", L"Musik", NULL); + if (win10) { + patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{35286a68-3c57-41a1-bbb1-0eae73d76c95}", L"Videos", L"My Videos", L"Eigene Videos", NULL); + patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{0ddd015d-b06c-45d5-8c4c-f59713854639}", L"Pictures", L"My Pictures", L"Eigene Bilder", L"Bilder", NULL); + patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{a0c69a99-21c8-4671-8703-7934162fcf1d}", L"Music", L"My Music", L"Eigene Musik", L"Musik", NULL); + } } if (remap.downloads) { patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{374DE290-123F-4565-9164-39C4925E467B}", L"Downloads", L"Profile\\Downloads", NULL); + if (win10) { + patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{7d83ee9b-2244-4e70-b1f5-5393042af1e4}", L"Downloads", L"Profile\\Downloads", NULL); + } } if (remap.documents) { patchRegPath(&patchOk, &anyMapped, hKey, letter, L"Personal", L"Documents", L"Dokumente", L"My Documents", L"Eigene Dateien", NULL); + if (win10) { + patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{f42ee2d3-909f-4907-8871-4c22fc0bf756}", L"Documents", L"Dokumente", L"My Documents", L"Eigene Dateien", NULL); + } } if (remap.desktop) { patchRegPath(&patchOk, &anyMapped, hKey, letter, L"Desktop", L"Windows Desktop", L"Desktop", L"Arbeitsfl\u00E4che", NULL); + if (win10) { + patchRegPath(&patchOk, &anyMapped, hKey, letter, L"{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}", L"Windows Desktop", L"Desktop", L"Arbeitsfl\u00E4che", NULL); + } } RegCloseKey(hKey); if (!anyMapped) { diff --git a/remote/modules/run-virt/winres/winres.manifest b/remote/modules/run-virt/winres/winres.manifest new file mode 100644 index 00000000..a4ffc98e --- /dev/null +++ b/remote/modules/run-virt/winres/winres.manifest @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> + <assemblyIdentity type="win32" + name="org.openslx.windows.winres" + version="4.0.0.0" + processorArchitecture="x86" + publicKeyToken="0000000000000000" + /> + <description>Sausageface</description> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel + level="asInvoker" + uiAccess="false" + /> + </requestedPrivileges> + </security> + </trustInfo> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows Vista --> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + <!-- Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + </application> + </compatibility> +</assembly> diff --git a/remote/modules/run-virt/winres/winres.rc b/remote/modules/run-virt/winres/winres.rc new file mode 100644 index 00000000..a9faf9a0 --- /dev/null +++ b/remote/modules/run-virt/winres/winres.rc @@ -0,0 +1,4 @@ +#include <windows.h> + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "winres.manifest" + |
