Author: aandrejevic
Date: Thu Mar 26 23:19:22 2015
New Revision: 66906

URL: http://svn.reactos.org/svn/reactos?rev=66906&view=rev
Log:
[NTVDM]
In the DOS CON driver, for special keys, always send the scancode right after
the 0x00 byte.


Modified:
    trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c
    trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c

Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c?rev=66906&r1=66905&r2=66906&view=diff
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c  [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c  [iso-8859-1] 
Thu Mar 26 23:19:22 2015
@@ -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 @@
     /*
      * 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();
+            /* 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;
+        }
+
+        /* 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')

Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c?rev=66906&r1=66905&r2=66906&view=diff
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c     [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c     [iso-8859-1] 
Thu Mar 26 23:19:22 2015
@@ -2030,7 +2030,7 @@
             WORD BytesRead = 0;
             WORD ErrorCode;
 
-            DPRINT1("INT 21h, AH = 3Fh\n");
+            DPRINT("DosReadFile(0x%04X)\n", getBX());
 
             DoEcho = TRUE;
             ErrorCode = DosReadFile(getBX(),


Reply via email to