From: Andrew Boyarshin Date: Thu, 11 Aug 2022 23:58:18 +0000 (+0700) Subject: [KERNEL32] lpNumberOfCharsWritten is optional for WriteConsole (#1079) X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=c15a9c1d097cfd5c10c361a24981ff215fcd4153 [KERNEL32] lpNumberOfCharsWritten is optional for WriteConsole (#1079) Some applications (and libraries, like replxx) rely on this undocumented behavior. --- diff --git a/dll/win32/kernel32/client/console/readwrite.c b/dll/win32/kernel32/client/console/readwrite.c index b06f7ab8299..00fbf7761cb 100644 --- a/dll/win32/kernel32/client/console/readwrite.c +++ b/dll/win32/kernel32/client/console/readwrite.c @@ -681,8 +681,8 @@ IntWriteConsole(IN HANDLE hConsoleOutput, /* Release the capture buffer if needed */ if (CaptureBuffer) CsrFreeCaptureBuffer(CaptureBuffer); - /* Retrieve the results */ - if (Success) + /* Retrieve the results. NOTE: lpNumberOfCharsWritten optional since Vista+ */ + if (Success && lpNumberOfCharsWritten) { _SEH2_TRY { @@ -695,7 +695,7 @@ IntWriteConsole(IN HANDLE hConsoleOutput, } _SEH2_END; } - else + else if (!Success) { BaseSetLastNTError(ApiMessage.Status); }