Currently, the buffer of 128KB is passed to GetConsoleProcessList().
This causes page fault in the select() loop for console due to:
https://github.com/microsoft/terminal/issues/18264
because the previous code calls GetConsoleProcessList() with large
buffer and PeekConsoleInput() with small buffer alternately.
With this patch, the minimum buffer size is used that is determined
by GetConsoleProcessList() with small buffer passed.
Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256841.html
Fixes: 72770148ad0a ("Cygwin: pty: Prevent pty from changing code page of parent console.")
Reported-by: Steven Buehler <buehlersj@outlook.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
(cherry picked from commit 1a49c17840660bc0e493b7db2d9ce5289906049d)