https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c15a9c1d097cfd5c10c36…
commit c15a9c1d097cfd5c10c361a24981ff215fcd4153
Author: Andrew Boyarshin <andrew.boyarshin(a)gmail.com>
AuthorDate: Fri Aug 12 06:58:18 2022 +0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Aug 12 01:58:18 2022 +0200
[KERNEL32] lpNumberOfCharsWritten is optional for WriteConsole (#1079)
Some applications (and libraries, like replxx) rely on this undocumented behavior.
---
dll/win32/kernel32/client/console/readwrite.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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);
}