diff options
Diffstat (limited to 'win/rfb_win32/LaunchProcess.cxx')
-rw-r--r-- | win/rfb_win32/LaunchProcess.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/win/rfb_win32/LaunchProcess.cxx b/win/rfb_win32/LaunchProcess.cxx index 56a712e6..16ced64b 100644 --- a/win/rfb_win32/LaunchProcess.cxx +++ b/win/rfb_win32/LaunchProcess.cxx @@ -44,10 +44,20 @@ void LaunchProcess::start(HANDLE userToken, bool createConsole) { await(); returnCode = STILL_ACTIVE; + DWORD size; + char desktopName[256]; + char buf[256]; + HDESK desktop = GetThreadDesktop(GetCurrentThreadId()); + if (!GetUserObjectInformation(desktop, UOI_NAME, buf, 256, &size)) + throw rdr::SystemException("unable to launch process", GetLastError()); + + snprintf(desktopName, 256, "WinSta0\\%s", buf); + // - Create storage for the process startup information STARTUPINFO sinfo; memset(&sinfo, 0, sizeof(sinfo)); sinfo.cb = sizeof(sinfo); + sinfo.lpDesktop = desktopName; // - Concoct a suitable command-line TCharArray exePath; |