From: Aleksandar Andrejevic Date: Tue, 10 Dec 2013 01:30:53 +0000 (+0000) Subject: [NTVDM] X-Git-Tag: backups/0.3.17@66124~1365^2~185 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=76f1085bdcfd8f67dc852b69ec0eb93406938db4 [NTVDM] Fix the file reading subfunction (AH = 3Fh) of INT 21h. When reading from the console, it always stops on a carriage return. svn path=/branches/ntvdm/; revision=61256 --- diff --git a/subsystems/ntvdm/dos.c b/subsystems/ntvdm/dos.c index 88d4cd46b65..48c53ab0cb0 100644 --- a/subsystems/ntvdm/dos.c +++ b/subsystems/ntvdm/dos.c @@ -2001,26 +2001,34 @@ VOID WINAPI DosInt21h(LPWORD Stack) WORD Count = getCX(); WORD BytesRead = 0; WORD ErrorCode = ERROR_SUCCESS; + CHAR Character; if (IsConsoleHandle(DosGetRealHandle(Handle))) { while (Stack[STACK_COUNTER] < Count) { /* Read a character from the BIOS */ - // FIXME: Security checks! - Buffer[Stack[STACK_COUNTER]] = LOBYTE(BiosGetCharacter()); + Character = LOBYTE(BiosGetCharacter()); /* Stop if the BOP needs to be repeated */ if (getCF()) break; - /* Increment the counter */ - Stack[STACK_COUNTER]++; + // FIXME: Security checks! + Buffer[Stack[STACK_COUNTER]++] = Character; + + if (Character == '\r') + { + /* Stop on first carriage return */ + break; + } } - if (Stack[STACK_COUNTER] < Count) - ErrorCode = ERROR_NOT_READY; - else - BytesRead = Count; + if (Character != '\r') + { + if (Stack[STACK_COUNTER] < Count) ErrorCode = ERROR_NOT_READY; + else BytesRead = Count; + } + else BytesRead = Stack[STACK_COUNTER]; } else {