[KERNEL32] lpNumberOfCharsWritten is optional for WriteConsole (#1079)

Some applications (and libraries, like replxx) rely on this undocumented behavior.
This commit is contained in:
Andrew Boyarshin 2022-08-12 06:58:18 +07:00 committed by GitHub
parent 934e5212e4
commit c15a9c1d09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -681,8 +681,8 @@ IntWriteConsole(IN HANDLE hConsoleOutput,
/* Release the capture buffer if needed */ /* Release the capture buffer if needed */
if (CaptureBuffer) CsrFreeCaptureBuffer(CaptureBuffer); if (CaptureBuffer) CsrFreeCaptureBuffer(CaptureBuffer);
/* Retrieve the results */ /* Retrieve the results. NOTE: lpNumberOfCharsWritten optional since Vista+ */
if (Success) if (Success && lpNumberOfCharsWritten)
{ {
_SEH2_TRY _SEH2_TRY
{ {
@ -695,7 +695,7 @@ IntWriteConsole(IN HANDLE hConsoleOutput,
} }
_SEH2_END; _SEH2_END;
} }
else else if (!Success)
{ {
BaseSetLastNTError(ApiMessage.Status); BaseSetLastNTError(ApiMessage.Status);
} }