[KERNEL32][CONSRV]
[reactos.git] / reactos / dll / win32 / kernel32 / client / console / readwrite.c
index a2c8b9c..d42f8d0 100644 (file)
@@ -120,11 +120,11 @@ IntReadConsole(HANDLE hConsoleInput,
 static
 BOOL
 IntGetConsoleInput(HANDLE hConsoleInput,
-                   BOOL bRead,
                    PINPUT_RECORD lpBuffer,
                    DWORD nLength,
                    LPDWORD lpNumberOfEventsRead,
-                   BOOL bUnicode)
+                   WORD wFlags,
+                   BOOLEAN bUnicode)
 {
     NTSTATUS Status;
     CONSOLE_API_MESSAGE ApiMessage;
@@ -158,10 +158,10 @@ IntGetConsoleInput(HANDLE hConsoleInput,
 
     /* Set up the data to send to the Console Server */
     GetInputRequest->InputHandle = hConsoleInput;
-    GetInputRequest->Unicode = bUnicode;
-    GetInputRequest->bRead = bRead;
     GetInputRequest->InputsRead = 0;
     GetInputRequest->Length = nLength;
+    GetInputRequest->wFlags = wFlags;
+    GetInputRequest->Unicode = bUnicode;
 
     /* Call the server */
     Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
@@ -460,7 +460,8 @@ IntWriteConsoleInput(HANDLE hConsoleInput,
                      PINPUT_RECORD lpBuffer,
                      DWORD nLength,
                      LPDWORD lpNumberOfEventsWritten,
-                     BOOL bUnicode)
+                     BOOL bUnicode,
+                     BOOL bAppendToEnd)
 {
     CONSOLE_API_MESSAGE ApiMessage;
     PCONSOLE_WRITEINPUT WriteInputRequest = &ApiMessage.Data.WriteInputRequest;
@@ -488,8 +489,9 @@ IntWriteConsoleInput(HANDLE hConsoleInput,
 
     /* Set up the data to send to the Console Server */
     WriteInputRequest->InputHandle = hConsoleInput;
-    WriteInputRequest->Unicode = bUnicode;
     WriteInputRequest->Length = nLength;
+    WriteInputRequest->Unicode = bUnicode;
+    WriteInputRequest->AppendToEnd = bAppendToEnd;
 
     /* Call the server */
     CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
@@ -823,10 +825,10 @@ PeekConsoleInputW(HANDLE hConsoleInput,
                   LPDWORD lpNumberOfEventsRead)
 {
     return IntGetConsoleInput(hConsoleInput,
-                              FALSE,
                               lpBuffer,
                               nLength,
                               lpNumberOfEventsRead,
+                              CONSOLE_READ_KEEPEVENT | CONSOLE_READ_CONTINUE,
                               TRUE);
 }
 
@@ -844,10 +846,10 @@ PeekConsoleInputA(HANDLE hConsoleInput,
                   LPDWORD lpNumberOfEventsRead)
 {
     return IntGetConsoleInput(hConsoleInput,
-                              FALSE,
                               lpBuffer,
                               nLength,
                               lpNumberOfEventsRead,
+                              CONSOLE_READ_KEEPEVENT | CONSOLE_READ_CONTINUE,
                               FALSE);
 }
 
@@ -865,10 +867,10 @@ ReadConsoleInputW(HANDLE hConsoleInput,
                   LPDWORD lpNumberOfEventsRead)
 {
     return IntGetConsoleInput(hConsoleInput,
-                              TRUE,
                               lpBuffer,
                               nLength,
                               lpNumberOfEventsRead,
+                              0,
                               TRUE);
 }
 
@@ -886,29 +888,55 @@ ReadConsoleInputA(HANDLE hConsoleInput,
                   LPDWORD lpNumberOfEventsRead)
 {
     return IntGetConsoleInput(hConsoleInput,
-                              TRUE,
                               lpBuffer,
                               nLength,
                               lpNumberOfEventsRead,
+                              0,
                               FALSE);
 }
 
 
+/*--------------------------------------------------------------
+ *     ReadConsoleInputExW
+ *
+ * @implemented
+ */
 BOOL
 WINAPI
-ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2)
+ReadConsoleInputExW(HANDLE hConsoleInput,
+                    PINPUT_RECORD lpBuffer,
+                    DWORD nLength,
+                    LPDWORD lpNumberOfEventsRead,
+                    WORD wFlags)
 {
-    STUB;
-    return FALSE;
+    return IntGetConsoleInput(hConsoleInput,
+                              lpBuffer,
+                              nLength,
+                              lpNumberOfEventsRead,
+                              wFlags,
+                              TRUE);
 }
 
 
+/*--------------------------------------------------------------
+ *     ReadConsoleInputExA
+ *
+ * @implemented
+ */
 BOOL
 WINAPI
-ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2)
+ReadConsoleInputExA(HANDLE hConsoleInput,
+                    PINPUT_RECORD lpBuffer,
+                    DWORD nLength,
+                    LPDWORD lpNumberOfEventsRead,
+                    WORD wFlags)
 {
-    STUB;
-    return FALSE;
+    return IntGetConsoleInput(hConsoleInput,
+                              lpBuffer,
+                              nLength,
+                              lpNumberOfEventsRead,
+                              wFlags,
+                              FALSE);
 }
 
 
@@ -1086,6 +1114,7 @@ WriteConsoleInputW(HANDLE hConsoleInput,
                                 (PINPUT_RECORD)lpBuffer,
                                 nLength,
                                 lpNumberOfEventsWritten,
+                                TRUE,
                                 TRUE);
 }
 
@@ -1106,6 +1135,49 @@ WriteConsoleInputA(HANDLE hConsoleInput,
                                 (PINPUT_RECORD)lpBuffer,
                                 nLength,
                                 lpNumberOfEventsWritten,
+                                FALSE,
+                                TRUE);
+}
+
+
+/*--------------------------------------------------------------
+ *     WriteConsoleInputVDMW
+ *
+ * @implemented
+ */
+BOOL
+WINAPI
+WriteConsoleInputVDMW(HANDLE hConsoleInput,
+                      CONST INPUT_RECORD *lpBuffer,
+                      DWORD nLength,
+                      LPDWORD lpNumberOfEventsWritten)
+{
+    return IntWriteConsoleInput(hConsoleInput,
+                                (PINPUT_RECORD)lpBuffer,
+                                nLength,
+                                lpNumberOfEventsWritten,
+                                TRUE,
+                                FALSE);
+}
+
+
+/*--------------------------------------------------------------
+ *     WriteConsoleInputVDMA
+ *
+ * @implemented
+ */
+BOOL
+WINAPI
+WriteConsoleInputVDMA(HANDLE hConsoleInput,
+                      CONST INPUT_RECORD *lpBuffer,
+                      DWORD nLength,
+                      LPDWORD lpNumberOfEventsWritten)
+{
+    return IntWriteConsoleInput(hConsoleInput,
+                                (PINPUT_RECORD)lpBuffer,
+                                nLength,
+                                lpNumberOfEventsWritten,
+                                FALSE,
                                 FALSE);
 }