aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/xlaunch/main.cc
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-08 16:07:41 +0000
committermarha <marha@users.sourceforge.net>2011-03-08 16:07:41 +0000
commit5db9846bc402a2bba9e56fc1023df27b8e474bcb (patch)
treeaebfd609289cbb0f8da2bdcdba707e27c0e3ae7a /xorg-server/hw/xwin/xlaunch/main.cc
parenteec75c45028d4d0ff945bcc83b6257eec6d8839d (diff)
downloadvcxsrv-5db9846bc402a2bba9e56fc1023df27b8e474bcb.tar.gz
vcxsrv-5db9846bc402a2bba9e56fc1023df27b8e474bcb.tar.bz2
vcxsrv-5db9846bc402a2bba9e56fc1023df27b8e474bcb.zip
Change current directory to the place where xlaunch is installed
Close vcxsrv when local client is started
Diffstat (limited to 'xorg-server/hw/xwin/xlaunch/main.cc')
-rw-r--r--xorg-server/hw/xwin/xlaunch/main.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc
index 9a9908f55..0a80630f0 100644
--- a/xorg-server/hw/xwin/xlaunch/main.cc
+++ b/xorg-server/hw/xwin/xlaunch/main.cc
@@ -609,7 +609,7 @@ class CMyWizard : public CWizard
}
// Prepare program startup
- STARTUPINFO si, sic;
+ STARTUPINFO si, sic;
PROCESS_INFORMATION pi, pic;
HANDLE handles[2];
DWORD hcount = 0;
@@ -626,8 +626,11 @@ class CMyWizard : public CWizard
#ifdef _DEBUG
printf("%s\n", buffer.c_str());
#endif
+ char CurDir[MAX_PATH];
+ GetModuleFileName(NULL,CurDir,MAX_PATH);
+ *strrchr(CurDir,'\\')=0;
if( !CreateProcess( NULL, (CHAR*)buffer.c_str(), NULL, NULL,
- FALSE, 0, NULL, NULL, &si, &pi ))
+ FALSE, 0, NULL, CurDir, &si, &pi ))
throw win32_error("CreateProcess failed");
handles[hcount++] = pi.hProcess;
@@ -656,7 +659,7 @@ class CMyWizard : public CWizard
// Start the child process.
if( !CreateProcess( NULL, (CHAR*)client.c_str(), NULL, NULL,
- FALSE, 0, NULL, NULL, &sic, &pic ))
+ FALSE, 0, NULL, CurDir, &sic, &pic ))
{
DWORD err = GetLastError();
while (hcount--)
@@ -673,7 +676,7 @@ class CMyWizard : public CWizard
printf("killing process!\n");
#endif
// Check if Xsrv is still running, but only when we started a local program
- if (0)
+ if (config.local)
{
DWORD exitcode;
GetExitCodeProcess(pi.hProcess, &exitcode);