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
This commit is contained in:
Aleksandar Andrejevic 2013-12-10 01:30:53 +00:00
parent b20613401f
commit 76f1085bdc

View file

@ -2001,26 +2001,34 @@ VOID WINAPI DosInt21h(LPWORD Stack)
WORD Count = getCX(); WORD Count = getCX();
WORD BytesRead = 0; WORD BytesRead = 0;
WORD ErrorCode = ERROR_SUCCESS; WORD ErrorCode = ERROR_SUCCESS;
CHAR Character;
if (IsConsoleHandle(DosGetRealHandle(Handle))) if (IsConsoleHandle(DosGetRealHandle(Handle)))
{ {
while (Stack[STACK_COUNTER] < Count) while (Stack[STACK_COUNTER] < Count)
{ {
/* Read a character from the BIOS */ /* Read a character from the BIOS */
// FIXME: Security checks! Character = LOBYTE(BiosGetCharacter());
Buffer[Stack[STACK_COUNTER]] = LOBYTE(BiosGetCharacter());
/* Stop if the BOP needs to be repeated */ /* Stop if the BOP needs to be repeated */
if (getCF()) break; if (getCF()) break;
/* Increment the counter */ // FIXME: Security checks!
Stack[STACK_COUNTER]++; Buffer[Stack[STACK_COUNTER]++] = Character;
if (Character == '\r')
{
/* Stop on first carriage return */
break;
}
} }
if (Stack[STACK_COUNTER] < Count) if (Character != '\r')
ErrorCode = ERROR_NOT_READY; {
else if (Stack[STACK_COUNTER] < Count) ErrorCode = ERROR_NOT_READY;
BytesRead = Count; else BytesRead = Count;
}
else BytesRead = Stack[STACK_COUNTER];
} }
else else
{ {