-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
Needs-ReproWe can't figure out how to make this happen. Please help find a simplified repro.We can't figure out how to make this happen. Please help find a simplified repro.Product-ConhostFor issues in the Console codebaseFor issues in the Console codebaseWork-ItemIt's being tracked by an actual work item internally. (to be removed soon)It's being tracked by an actual work item internally. (to be removed soon)
Description
- Your Windows build number: [Version 10.0.17760.1]
What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)
Using SetConsoleScreenBufferInfoEx to make the console buffer and window smaller, simultaneously, can crash the v2 conhost with a recent Insiders build.
Steps:
- Open a cmd/powershell console window.
- Open the console properties and uncheck the "Layout > Wrap text output on resize" option.
- Run the test program I included.
- The console window disappears.
What's wrong / what should be happening instead:
SetConsoleScreenBufferInfoEx shouldn't crash. The text Hello? should appear, and the console should return control to cmd/powershell.
Aside 1: I don't think this affects winpty at all.
Aside 2: SetConsoleScreenBufferInfoEx seems to handle srWindow differently than both SetConsoleWindowInfo and GetConsoleScreenBufferInfoEx. It tends to set the window size to 1 less width/height than the requested size, so a pair of calls to GetConsoleScreenBufferInfoEx and SetConsoleScreenBufferInfoEx shrinks the console window.
Test program
#include <windows.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFOEX info = { sizeof(info) };
GetConsoleScreenBufferInfoEx(conout, &info);
info.dwSize.X = 120;
info.dwSize.Y = 5000;
info.srWindow.Left = info.srWindow.Top = 0;
info.srWindow.Right = 121;
info.srWindow.Bottom = 26;
SetConsoleScreenBufferInfoEx(conout, &info);
SetConsoleCursorPosition(conout, COORD { 0, 4000 });
info.dwSize.X = 80;
info.dwSize.Y = 20;
info.srWindow.Right = 41;
info.srWindow.Bottom = 11;
SetConsoleScreenBufferInfoEx(conout, &info);
printf("Hello?\n");
return 0;
}johnd0e
Metadata
Metadata
Assignees
Labels
Needs-ReproWe can't figure out how to make this happen. Please help find a simplified repro.We can't figure out how to make this happen. Please help find a simplified repro.Product-ConhostFor issues in the Console codebaseFor issues in the Console codebaseWork-ItemIt's being tracked by an actual work item internally. (to be removed soon)It's being tracked by an actual work item internally. (to be removed soon)