From 30819de412f30d4aea33015e034a69674421d332 Mon Sep 17 00:00:00 2001 From: Ulf Wohlers Date: Mon, 24 Feb 2003 15:43:13 +0000 Subject: [PATCH] copy psp file table to child processes Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@689 --- src/dos/dos_execute.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/dos/dos_execute.cpp b/src/dos/dos_execute.cpp index c7339972..ac5c01a8 100644 --- a/src/dos/dos_execute.cpp +++ b/src/dos/dos_execute.cpp @@ -184,12 +184,20 @@ static void SetupPSP(Bit16u pspseg,Bit16u memsize,Bit16u envseg) { DOS_PSP psp(pspseg); psp.MakeNew(memsize); psp.SetEnvironment(envseg); - psp.SetFileHandle(STDIN ,DOS_FindDevice("CON")); - psp.SetFileHandle(STDOUT,DOS_FindDevice("CON")); - psp.SetFileHandle(STDERR,DOS_FindDevice("CON")); - psp.SetFileHandle(STDAUX,DOS_FindDevice("CON")); - psp.SetFileHandle(STDNUL,DOS_FindDevice("CON")); - psp.SetFileHandle(STDPRN,DOS_FindDevice("CON")); + /* Copy file handles */ + if (DOS_PSP::rootpsp!=dos.psp) { + // TODO: Improve this + // If prog wasnt started from commandline copy file table (California Games 2) + DOS_PSP oldpsp(dos.psp); + psp.CopyFileTable(&oldpsp); + } else { + psp.SetFileHandle(STDIN ,DOS_FindDevice("CON")); + psp.SetFileHandle(STDOUT,DOS_FindDevice("CON")); + psp.SetFileHandle(STDERR,DOS_FindDevice("CON")); + psp.SetFileHandle(STDAUX,DOS_FindDevice("CON")); + psp.SetFileHandle(STDNUL,DOS_FindDevice("CON")); + psp.SetFileHandle(STDPRN,DOS_FindDevice("CON")); + } /* Save old DTA in psp */ psp.SetDTA(dos.dta); /* Setup the DTA */