From: Aleksandar Andrejevic Date: Thu, 26 Mar 2015 23:19:22 +0000 (+0000) Subject: [NTVDM] X-Git-Tag: backups/colins-printing-for-freedom@73041~706 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=034607a078d495cfb3fa7afa669cabee2ea8f6c0 [NTVDM] In the DOS CON driver, for special keys, always send the scancode right after the 0x00 byte. svn path=/trunk/; revision=66906 --- diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c index 6406bfaaaad..89f80b7c05d 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c @@ -21,13 +21,14 @@ /* PRIVATE VARIABLES **********************************************************/ PDOS_DEVICE_NODE ConIn = NULL, ConOut = NULL; +BYTE ExtendedCode = 0; /* PRIVATE FUNCTIONS **********************************************************/ WORD NTAPI ConDrvReadInput(PDOS_DEVICE_NODE Device, DWORD Buffer, PWORD Length) { CHAR Character; - WORD BytesRead; + WORD BytesRead = 0; PCHAR Pointer = (PCHAR)FAR_POINTER(Buffer); /* Save AX */ @@ -36,17 +37,31 @@ WORD NTAPI ConDrvReadInput(PDOS_DEVICE_NODE Device, DWORD Buffer, PWORD Length) /* * Use BIOS Get Keystroke function */ - for (BytesRead = 0; BytesRead < *Length; BytesRead++) + while (BytesRead < *Length) { - /* Call the BIOS INT 16h, AH=00h "Get Keystroke" */ - setAH(0x00); - Int32Call(&DosContext, BIOS_KBD_INTERRUPT); + if (!ExtendedCode) + { + /* Call the BIOS INT 16h, AH=00h "Get Keystroke" */ + setAH(0x00); + Int32Call(&DosContext, BIOS_KBD_INTERRUPT); + + /* Retrieve the character in AL (scan code is in AH) */ + Character = getAL(); + } + else + { + /* Return the extended code */ + Character = ExtendedCode; + + /* And then clear it */ + ExtendedCode = 0; + } - /* Retrieve the character in AL (scan code is in AH) */ - Character = getAL(); + /* Check if this is a special character */ + if (Character == 0) ExtendedCode = getAH(); if (DoEcho) DosPrintCharacter(DOS_OUTPUT_HANDLE, Character); - Pointer[BytesRead] = Character; + Pointer[BytesRead++] = Character; /* Stop on first carriage return */ if (Character == '\r') diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c index 683d7f2ed11..2d79c6e2064 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c @@ -2030,7 +2030,7 @@ VOID WINAPI DosInt21h(LPWORD Stack) WORD BytesRead = 0; WORD ErrorCode; - DPRINT1("INT 21h, AH = 3Fh\n"); + DPRINT("DosReadFile(0x%04X)\n", getBX()); DoEcho = TRUE; ErrorCode = DosReadFile(getBX(),