[NTVDM]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Thu, 26 Mar 2015 23:31:01 +0000 (23:31 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Thu, 26 Mar 2015 23:31:01 +0000 (23:31 +0000)
On DOS, CONIN$ and CONOUT$ are actually the same thing - a device called CON.

svn path=/trunk/; revision=66907

reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/condrv.c
reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c
reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.h

index 89f80b7..6129014 100644 (file)
@@ -20,7 +20,7 @@
 
 /* PRIVATE VARIABLES **********************************************************/
 
-PDOS_DEVICE_NODE ConIn = NULL, ConOut = NULL;
+PDOS_DEVICE_NODE Con = NULL;
 BYTE ExtendedCode = 0;
 
 /* PRIVATE FUNCTIONS **********************************************************/
@@ -141,30 +141,22 @@ WORD NTAPI ConDrvClose(PDOS_DEVICE_NODE Device)
 
 /* PUBLIC FUNCTIONS ***********************************************************/
 
-VOID ConDrvInitialize(PDOS_DEVICE_NODE *InputDevice, PDOS_DEVICE_NODE *OutputDevice)
+VOID ConDrvInitialize(VOID)
 {
-    ConIn = DosCreateDevice(DOS_DEVATTR_STDIN
-                            | DOS_DEVATTR_CON
-                            | DOS_DEVATTR_CHARACTER,
-                            "CONIN$");
-    ConOut = DosCreateDevice(DOS_DEVATTR_STDOUT
-                             | DOS_DEVATTR_CON
-                             | DOS_DEVATTR_CHARACTER,
-                             "CONOUT$");
-    ASSERT(ConIn != NULL && ConOut != NULL);
-
-    ConIn->ReadRoutine = ConDrvReadInput;
-    ConIn->InputStatusRoutine = ConDrvInputStatus;
-    ConOut->WriteRoutine = ConDrvWriteOutput;
-    ConIn->OpenRoutine = ConOut->OpenRoutine = ConDrvOpen;
-    ConIn->CloseRoutine = ConOut->CloseRoutine = ConDrvClose;
-
-    if (InputDevice) *InputDevice = ConIn;
-    if (OutputDevice) *OutputDevice = ConOut;
+    Con = DosCreateDevice(DOS_DEVATTR_STDIN
+                          | DOS_DEVATTR_STDOUT
+                          | DOS_DEVATTR_CON
+                          | DOS_DEVATTR_CHARACTER,
+                          "CON");
+
+    Con->ReadRoutine        = ConDrvReadInput;
+    Con->InputStatusRoutine = ConDrvInputStatus;
+    Con->WriteRoutine       = ConDrvWriteOutput;
+    Con->OpenRoutine        = ConDrvOpen;
+    Con->CloseRoutine       = ConDrvClose;
 }
 
 VOID ConDrvCleanup(VOID)
 {
-    if (ConIn) DosDeleteDevice(ConIn);
-    if (ConOut) DosDeleteDevice(ConOut);
+    if (Con) DosDeleteDevice(Con);
 }
index 2d79c6e..45ef842 100644 (file)
@@ -311,9 +311,8 @@ static VOID DosCopyHandleTable(LPBYTE DestinationTable)
     {
         PDOS_SFT_ENTRY SftEntry;
         HANDLE StandardHandles[3];
-        PDOS_DEVICE_NODE ConIn = DosGetDevice("CONIN$");
-        PDOS_DEVICE_NODE ConOut = DosGetDevice("CONOUT$");
-        ASSERT(ConIn != NULL && ConOut != NULL);
+        PDOS_DEVICE_NODE Con = DosGetDevice("CON");
+        ASSERT(Con != NULL);
 
         /* Get the native standard handles */
         StandardHandles[0] = GetStdHandle(STD_INPUT_HANDLE);
@@ -322,12 +321,10 @@ static VOID DosCopyHandleTable(LPBYTE DestinationTable)
 
         for (i = 0; i < 3; i++)
         {
-            PDOS_DEVICE_NODE Device = (i == 0) ? ConIn : ConOut;
-
             /* Find the corresponding SFT entry */
             if (IsConsoleHandle(StandardHandles[i]))
             {
-                SftEntry = DosFindDeviceSftEntry(Device);
+                SftEntry = DosFindDeviceSftEntry(Con);
             }
             else
             {
@@ -349,10 +346,10 @@ static VOID DosCopyHandleTable(LPBYTE DestinationTable)
                 if (IsConsoleHandle(StandardHandles[i]))
                 {
                     SftEntry->Type = DOS_SFT_ENTRY_DEVICE;
-                    SftEntry->DeviceNode = Device;
+                    SftEntry->DeviceNode = Con;
 
                     /* Call the open routine */
-                    if (Device->OpenRoutine) Device->OpenRoutine(Device);
+                    if (Con->OpenRoutine) Con->OpenRoutine(Con);
                 }
                 else
                 {
@@ -2854,7 +2851,6 @@ BOOLEAN DosKRNLInitialize(VOID)
     CHAR CurrentDirectory[MAX_PATH];
     CHAR DosDirectory[DOS_DIR_LENGTH];
     LPSTR Path;
-    PDOS_DEVICE_NODE ConInDevice, ConOutDevice;
 
     FILE *Stream;
     WCHAR Buffer[256];
@@ -2915,7 +2911,7 @@ BOOLEAN DosKRNLInitialize(VOID)
     EmsDrvInitialize();
 
     /* Load the CON driver */
-    ConDrvInitialize(&ConInDevice, &ConOutDevice);
+    ConDrvInitialize();
 
 #endif
 
index 1e56838..eb8d8e2 100644 (file)
@@ -201,7 +201,7 @@ VOID DosPrintCharacter(WORD FileHandle, CHAR Character);
 BOOLEAN DosBIOSInitialize(VOID);
 VOID EmsDrvInitialize(VOID);
 VOID EmsDrvCleanup(VOID);
-VOID ConDrvInitialize(PDOS_DEVICE_NODE *InputDevice, PDOS_DEVICE_NODE *OutputDevice);
+VOID ConDrvInitialize(VOID);
 VOID ConDrvCleanup(VOID);
 
 /*