diff options
| author | Simon Rettberg | 2016-10-05 13:17:30 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-10-05 13:17:30 +0200 |
| commit | b14ba5392a5d05156c824ee722c85217a684e0a6 (patch) | |
| tree | d9d9dbf1c33fea3ff420d00abbd1a51223fe7780 /remote/modules | |
| parent | [pvs2] Implement hybrid mode where the manager is running on the second virtu... (diff) | |
| download | tm-scripts-b14ba5392a5d05156c824ee722c85217a684e0a6.tar.gz tm-scripts-b14ba5392a5d05156c824ee722c85217a684e0a6.tar.xz tm-scripts-b14ba5392a5d05156c824ee722c85217a684e0a6.zip | |
[run-virt] Finish support for runscript in openslx.exe and setup_virtual_floppy
Diffstat (limited to 'remote/modules')
| -rw-r--r-- | remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc | 20 | ||||
| -rwxr-xr-x | remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe | bin | 61952 -> 53248 bytes | |||
| -rwxr-xr-x | remote/modules/run-virt/winres/compile | 2 | ||||
| -rw-r--r-- | remote/modules/run-virt/winres/winres.c | 17 |
4 files changed, 28 insertions, 11 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc index 3fd5c109..d9ae052c 100644 --- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc +++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc @@ -50,7 +50,16 @@ else done fi -# Info file +wait "$WGET" + +# Check downloaded runscript, handle extension marker +EXT= +if [ -s "$RUNSCRIPT" ]; then + EXT=$(head -n 1 "$RUNSCRIPT" | grep -o -i '^EXT=.*$' | cut -d '=' -f 2-) + [ -n "$EXT" ] && [ "x${EXT:0:1}" != "x." ] && EXT=".$EXT" +fi + +# Write info file UNAME= [ -s "${HOME}/.account" ] && UNAME=$(cat "${HOME}/.account") [ -z "${UNAME}" ] && UNAME=$(whoami) @@ -61,6 +70,7 @@ resolution=${RESOLUTION} createMissingRemap=${SHARE_CREATE_MISSING_REMAP} remapMode=${SHARE_REMAP_MODE_INI} homeDrive=${SHARE_HOME_DRIVE} +scriptExt=${EXT} [remap] documents=${SHARE_DOCUMENTS} @@ -70,12 +80,6 @@ media=${SHARE_MEDIA} other=${SHARE_OTHER} HIER -wait "$WGET" -EXT= -if [ -s "$RUNSCRIPT" ]; then - EXT=$(head -n 1 "$RUNSCRIPT" | grep -o -i '^EXT=.*$' | cut -d '=' -f 2-) -fi - # Copy all them there filez into floppy image mcopy -i "${FLOPPYIMG}" "${TMPDIR}/openslx.ini" "${TMPDIR}/HOSTRES.TXT" "${SHARES}" "::/" mcopy -i "${FLOPPYIMG}" "$VMCHOOSER_DIR/data/openslx.exe" "::/" @@ -89,7 +93,7 @@ mcopy -s -i "${FLOPPYIMG}" "$VMCHOOSER_DIR/data/linux" "::/" # User supplied runscript if [ -n "$EXT" ]; then sed -i '1d' "${RUNSCRIPT}" - mcopy -i "${FLOPPYIMG}" "${RUNSCRIPT}" "::/runscript.${EXT}" + mcopy -i "${FLOPPYIMG}" "${RUNSCRIPT}" "::/runscript${EXT}" fi rm -f -- "${SHARES}" "${TMPDIR}/openslx.ini" "${TMPDIR}/HOSTRES.TXT" 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 8b98311a..c0904c92 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/winres/compile b/remote/modules/run-virt/winres/compile index 772571fb..da2f59eb 100755 --- a/remote/modules/run-virt/winres/compile +++ b/remote/modules/run-virt/winres/compile @@ -2,7 +2,7 @@ rm -- winres.exe 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 +i686-w64-mingw32-gcc -Wall -Wextra -pedantic -Wno-unused-parameter -flto -std=c99 -Os -Wl,--subsystem,windows -o winres.exe winres.c resource.res -lole32 -luuid -lgdi32 -lws2_32 -lshell32 -lmpr -lshlwapi rm -- resource.res if strip winres.exe; then echo "Successfully created winres.exe" diff --git a/remote/modules/run-virt/winres/winres.c b/remote/modules/run-virt/winres/winres.c index dc4d2858..d92b6521 100644 --- a/remote/modules/run-virt/winres/winres.c +++ b/remote/modules/run-virt/winres/winres.c @@ -4,6 +4,7 @@ #define WIN32_LEAN_AND_MEAN #define _UNICODE #define UNICODE +#define NO_SHLWAPI_STRFCNS #include <windows.h> #include <winsock2.h> #include <winnetwk.h> @@ -21,6 +22,8 @@ #include <shlguid.h> #include <strsafe.h> #include <tlhelp32.h> +#include <shlwapi.h> +#include <shellapi.h> DEFINE_GUID(ID_IAudioEndpointVolume, 0x5CDF2C82, 0x841E, 0x4546, 0x97, 0x22, 0x0C, 0xF7, 0x40, 0x78, 0x22, 0x9A); DEFINE_GUID(ID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7,0x46, 0xde,0x8d,0xb6,0x36,0x17,0xe6); @@ -61,6 +64,9 @@ static int _folderStatus = FS_UNKNOWN; // -1 = Not handled yet, 0 = patching fai static int _remapMode = RM_NONE; static const char* _remapHomeDrive = NULL; +#define SCRIPTFILELEN (50) +char _scriptFile[SCRIPTFILELEN]; + struct { BOOL documents; BOOL downloads; @@ -282,6 +288,9 @@ static void loadPaths() buffer[1] = ':'; buffer[2] = '\0'; _remapHomeDrive = strdup(buffer); + // Get extension for autorun script + GetPrivateProfileStringA("openslx", "scriptExt", "", buffer, sizeof(buffer), SETTINGS_FILE); + StringCchPrintfA(_scriptFile, SCRIPTFILELEN, "B:\\runscript%s", buffer); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) @@ -296,10 +305,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } winVer.dwOSVersionInfoSize = sizeof(winVer); BOOL retVer = GetVersionEx(&winVer); - CoInitialize(NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); _startTime = GetTickCount(); loadPaths(); - loadPaths(); if (lpCmdLine != NULL && strstr(lpCmdLine, "debug") != NULL) { alog("Windows Version %d.%d", (int)winVer.dwMajorVersion, (int)winVer.dwMinorVersion); } @@ -334,6 +342,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine alog("Could not create timer for resolution setting: %d", (int)GetLastError()); } } + // Runscript (if any) + if (PathFileExistsA(_scriptFile)) { + ShellExecuteA(NULL, "open", _scriptFile, NULL, "B:\\", SW_SHOWNORMAL); + } // Message pump MSG Msg; while(GetMessage(&Msg, NULL, 0, 0) > 0) { @@ -341,6 +353,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine DispatchMessage(&Msg); } FreeLibrary(hKernel32); + FreeLibrary(hShell32); return 0; } |
