[CONSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 29 Jul 2014 15:54:03 +0000 (15:54 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 29 Jul 2014 15:54:03 +0000 (15:54 +0000)
Fix returned number of read/write codes.

svn path=/branches/condrv_restructure/; revision=63770

win32ss/user/winsrv/consrv/condrv/text.c
win32ss/user/winsrv/consrv/conoutput.c

index ff7ffa7..e0b0e8a 100644 (file)
@@ -1117,7 +1117,7 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
 Cleanup:
     if (tmpString) RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString);
 
-    // if (NumCodesWritten) *NumCodesWritten = Written;
+    if (NumCodesWritten) *NumCodesWritten = NumCodesToWrite; // Written;
     return Status;
 }
 
@@ -1194,7 +1194,7 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
         TermDrawRegion(Console, &UpdateRect);
     }
 
-    // if (NumCodesWritten) *NumCodesWritten = Written; // NumCodesToWrite;
+    if (NumCodesWritten) *NumCodesWritten = NumCodesToWrite; // Written;
     return STATUS_SUCCESS;
 }
 
@@ -1329,7 +1329,11 @@ ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console,
                   CapturedDestinationOrigin.X + ConioRectWidth(&SrcRegion ) - 1);
 
     if (!Unicode)
-        ConsoleAnsiCharToUnicodeChar(Console, &FillChar.Char.UnicodeChar, &FillChar.Char.AsciiChar);
+    {
+        WCHAR tmp;
+        ConsoleAnsiCharToUnicodeChar(Console, &tmp, &FillChar.Char.AsciiChar);
+        FillChar.Char.UnicodeChar = tmp;
+    }
 
     ConioMoveRegion(Buffer, &SrcRegion, &DstRegion, &CapturedClipRectangle, FillChar);
 
index 9bb862a..7df379a 100644 (file)
@@ -586,7 +586,11 @@ CSR_API(SrvReadConsoleOutputString)
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                      ReadOutputCodeRequest->OutputHandle,
                                      &Buffer, GENERIC_READ, TRUE);
-    if (!NT_SUCCESS(Status)) return Status;
+    if (!NT_SUCCESS(Status))
+    {
+        ReadOutputCodeRequest->NumCodes = 0;
+        return Status;
+    }
 
     Status = ConDrvReadConsoleOutputString(Buffer->Header.Console,
                                            Buffer,
@@ -670,7 +674,11 @@ CSR_API(SrvWriteConsoleOutputString)
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                      WriteOutputCodeRequest->OutputHandle,
                                      &Buffer, GENERIC_WRITE, TRUE);
-    if (!NT_SUCCESS(Status)) return Status;
+    if (!NT_SUCCESS(Status))
+    {
+        WriteOutputCodeRequest->NumCodes = 0;
+        return Status;
+    }
 
     Status = ConDrvWriteConsoleOutputString(Buffer->Header.Console,
                                             Buffer,
@@ -712,7 +720,11 @@ CSR_API(SrvFillConsoleOutput)
     Status = ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                                      FillOutputRequest->OutputHandle,
                                      &Buffer, GENERIC_WRITE, TRUE);
-    if (!NT_SUCCESS(Status)) return Status;
+    if (!NT_SUCCESS(Status))
+    {
+        FillOutputRequest->NumCodes = 0;
+        return Status;
+    }
 
     Status = ConDrvFillConsoleOutput(Buffer->Header.Console,
                                      Buffer,