aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-12-10 08:09:31 +0100
committermarha <marha@users.sourceforge.net>2012-12-10 08:09:31 +0100
commit514b4afb64ccbf8e954270105ed5064272a2be68 (patch)
tree34f951c36753ad755d79ca9b27912741cf736373 /xorg-server/hw
parent47470c46f1602e73cb083600f72c5401cdb9f74e (diff)
downloadvcxsrv-514b4afb64ccbf8e954270105ed5064272a2be68.tar.gz
vcxsrv-514b4afb64ccbf8e954270105ed5064272a2be68.tar.bz2
vcxsrv-514b4afb64ccbf8e954270105ed5064272a2be68.zip
Solved problem of prompt not being shown in Windows Xp
Diffstat (limited to 'xorg-server/hw')
-rw-r--r--xorg-server/hw/xwin/xlaunch/main.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc
index 0d2e76f90..9211fb503 100644
--- a/xorg-server/hw/xwin/xlaunch/main.cc
+++ b/xorg-server/hw/xwin/xlaunch/main.cc
@@ -766,18 +766,13 @@ class CMyWizard : public CWizard
#if 1
// Create a console, otherwise some commands will not execute with plink
HWINSTA h=GetProcessWindowStation();
- HWINSTA horig=h;
HWND hConsoleWnd=NULL;
if (h)
{
- h=CreateWindowStationW(NULL, 0, STANDARD_RIGHTS_READ, NULL);
- if (h)
- SetProcessWindowStation(h);
AllocConsole();
- SetProcessWindowStation(horig);
- CloseWindowStation(h);
hConsoleWnd=GetConsoleWindow();
ShowWindow(hConsoleWnd, SW_HIDE ); // make it hidden, the disadvantage of this method is that the console window flashes
+ // but we must be able to show it when the client puts some output
}
HANDLE hChildStdinRd;
@@ -797,7 +792,7 @@ class CMyWizard : public CWizard
// Ensure the write handle to the pipe for STDIN is not inherited.
if ( ! SetHandleInformation(hChildStdinWr, HANDLE_FLAG_INHERIT, 0) )
throw win32_error("SetHandleInformation failed", GetLastError());
-
+
if (!CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0))
throw win32_error("CreatePipe failed", GetLastError());
@@ -826,28 +821,33 @@ class CMyWizard : public CWizard
HANDLE hConsoleOutput=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleMode(hConsoleInput, 0); // Needed to disable local echo, and return only upon carriage return of read function
while (1)
- {
+ {
char Buf[NRINPUTS];
if (!WaitForSingleObject(pic.hProcess, 20 ))
{
// Child does not exist anymore, but it could be that there is still error output in the pipes
// So wait some time, that then check the output again
Sleep(500);
- if (CheckOutput(hChildStdoutRd, hStdOut, hConsoleOutput, hConsoleWnd))
+ if (CheckOutput(hChildStdoutRd, hStdOut, hConsoleOutput, hConsoleWnd) || IsWindowVisible(hConsoleWnd))
{
// Wait some input to close the window
while (!CheckInput(hConsoleInput, Buf, hConsoleWnd)) Sleep(10);
}
- break;
+ break;
+ }
+ if (!WaitForSingleObject(pi.hProcess, 0))
+ {
+ TerminateProcess(pic.hProcess, (DWORD)-1);
+ break;
}
CheckOutput(hChildStdoutRd, hStdOut, hConsoleOutput, hConsoleWnd);
-
+
int w=CheckInput(hConsoleInput, Buf, hConsoleWnd);
if (w)
{ // Write it to the client
- _write(hStdIn, Buf, w);
- }
- }
+ _write(hStdIn, Buf, w);
+ }
+ }
#else
// Hide a console window
// FIXME: This may make it impossible to enter the password