conhost crashes on SetConsoleWindowInfo #8072

Closed
opened 2026-01-31 01:20:03 +00:00 by claunia · 14 comments
Owner

Originally created by @PhMajerus on GitHub (May 11, 2020).

Found a new issue with conhost in Windows 10 20H1/2004 as pushed to the release preview ring.
Windows 10 build 19041.208 (up to date release preview ring) on a Surface Book 2 15", conhost.exe file version 10.0.19041.153.

The following code, compiled as CUI and launched from a cmd.exe prompt, will crash conhost, closing the window.

int main()
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SMALL_RECT srNewWinSize;
srNewWinSize.Top = 1;
srNewWinSize.Left = 1;
srNewWinSize.Right = 40;
srNewWinSize.Bottom = 20;
SetConsoleWindowInfo(hStdOut, TRUE, &srNewWinSize);
}

This used to work fine in previous versions of Windows 10, it seems to be a new issue with 20H1/2004.

Originally created by @PhMajerus on GitHub (May 11, 2020). Found a new issue with conhost in Windows 10 20H1/2004 as pushed to the release preview ring. Windows 10 build 19041.208 (up to date release preview ring) on a Surface Book 2 15", conhost.exe file version 10.0.19041.153. The following code, compiled as CUI and launched from a cmd.exe prompt, will crash conhost, closing the window. int main() { HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); SMALL_RECT srNewWinSize; srNewWinSize.Top = 1; srNewWinSize.Left = 1; srNewWinSize.Right = 40; srNewWinSize.Bottom = 20; SetConsoleWindowInfo(hStdOut, TRUE, &srNewWinSize); } This used to work fine in previous versions of Windows 10, it seems to be a new issue with 20H1/2004.
Author
Owner

@DHowett-MSFT commented on GitHub (May 11, 2020):

hmm

image

This seems to be working properly for me. Digging more.

@DHowett-MSFT commented on GitHub (May 11, 2020): _hmm_ ![image](https://user-images.githubusercontent.com/14316954/81617827-fef5f500-939a-11ea-8db6-31452241ba52.png) This seems to be working properly for me. Digging more.
Author
Owner

@DHowett-MSFT commented on GitHub (May 11, 2020):

I don't recall signing off on any conhost changes that would have given it a different build number than 19041.1 (!)

@DHowett-MSFT commented on GitHub (May 11, 2020): I don't recall signing off on any conhost changes that would have given it a different build number than 19041.1 (!)
Author
Owner

@DHowett-MSFT commented on GitHub (May 11, 2020):

Looks like it's working properly for me on .152/.208 as well.

If you can get a dump from conhost.exe when this happens, can you send it to me? E-mail's in my GitHub profile. 😄

@DHowett-MSFT commented on GitHub (May 11, 2020): Looks like it's working properly for me on .152/.208 as well. If you can get a dump from conhost.exe when this happens, can you send it to me? E-mail's in my GitHub profile. :smile:
Author
Owner

@PhMajerus commented on GitHub (May 12, 2020):

Some system32 files are 19041.1 dated Dec 7, 2019, others are 19041.153 dated April 167 and May 12, 2020 (spotted container.dll and computecore.dll for example), some are even 19041.84 (werui.dll).

I've sent a crash dump by e-mail, let me know if you need any other.

@PhMajerus commented on GitHub (May 12, 2020): Some system32 files are 19041.1 dated Dec 7, 2019, others are 19041.153 dated April 167 and May 12, 2020 (spotted container.dll and computecore.dll for example), some are even 19041.84 (werui.dll). I've sent a crash dump by e-mail, let me know if you need any other.
Author
Owner

@DHowett-MSFT commented on GitHub (May 13, 2020):

Puzzlingly, it looks like we're falling over while trying to render an area that's absolutely on the screen. What other buffer parameters are you using? Starting width/height, buffer width/height?

@DHowett-MSFT commented on GitHub (May 13, 2020): Puzzlingly, it looks like we're falling over while trying to render an area that's absolutely on the screen. What other buffer parameters are you using? Starting width/height, buffer width/height?
Author
Owner

@PhMajerus commented on GitHub (May 13, 2020):

I don't have any non-default setting in the registry, no UseDx in HKCU\Console.
Startup configuration is, I believe, the default for cmd.exe: Window size is 120×30, Buffer is 120×9001, CP is 437, and font is Consolas at size 16. Crash is the code shown above, compiled in VC++2017 x86 as conresize.exe.

Note I have EN-US as UI language, but also French and Japanese language packs installed (so console sees MS Gothic, Mincho, NSimSun, SimSun-ExtB, and installed the 4 Cascadia fonts systemwide, but the console is using Cascadia when the crash occurs.
Also, regional format is set to French (France), just in case you use APIs that rely on user's number formats somewhere (dot isn't the default decimal separator), and the system ANSI codepage is EN-US.

Shall I send a few other crash dumps to see if you can find other details?

@PhMajerus commented on GitHub (May 13, 2020): I don't have any non-default setting in the registry, no UseDx in HKCU\Console. Startup configuration is, I believe, the default for cmd.exe: Window size is 120×30, Buffer is 120×9001, CP is 437, and font is Consolas at size 16. Crash is the code shown above, compiled in VC++2017 x86 as conresize.exe. Note I have EN-US as UI language, but also French and Japanese language packs installed (so console sees MS Gothic, Mincho, NSimSun, SimSun-ExtB, and installed the 4 Cascadia fonts systemwide, but the console is using Cascadia when the crash occurs. Also, regional format is set to French (France), just in case you use APIs that rely on user's number formats somewhere (dot isn't the default decimal separator), and the system ANSI codepage is EN-US. Shall I send a few other crash dumps to see if you can find other details?
Author
Owner

@DHowett-MSFT commented on GitHub (May 14, 2020):

This is a real thinker. Sure, a couple more crash dumps might help, but... I'm utterly baffled. If that's the reproducer, and those are the conhosts, and it's just what you get when you run it from CMD this should be an absolute bullseye 😄

@DHowett-MSFT commented on GitHub (May 14, 2020): This is a real thinker. Sure, a couple more crash dumps might help, but... I'm utterly baffled. If that's the reproducer, and those are the conhosts, and it's just what you get when you run it from CMD this should be an absolute bullseye :smile:
Author
Owner

@ghost commented on GitHub (May 18, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (May 18, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@DHowett commented on GitHub (May 21, 2020):

Gonna hold this one for a sec.

@DHowett commented on GitHub (May 21, 2020): Gonna hold this one for a sec.
Author
Owner

@PhMajerus commented on GitHub (May 21, 2020):

@DHowett Thanks, I'll get back to you with some more crash dumps once we're done with Build, Mixed Reality Dev Days and a day or two of sleep to recover 😅

@PhMajerus commented on GitHub (May 21, 2020): @DHowett Thanks, I'll get back to you with some more crash dumps once we're done with Build, Mixed Reality Dev Days and a day or two of sleep to recover 😅
Author
Owner

@zadjii-msft commented on GitHub (Jun 10, 2020):

Hey I'm just gonna necro this thread now that we're all a good amount past Build. @DHowett did you ever get a chance to look at those crash dumps?

@zadjii-msft commented on GitHub (Jun 10, 2020): Hey I'm just gonna necro this thread now that we're all a good amount past Build. @DHowett did you ever get a chance to look at those crash dumps?
Author
Owner

@PhMajerus commented on GitHub (Jun 10, 2020):

Sorry for the delay after Build, we had a lot of offline things to take care of.
The issue is still happening every single time with yesterday's update to Insider Release Preview build 19041.329.
Sending some more crashdumps to @DHowett-MSFT.

@PhMajerus commented on GitHub (Jun 10, 2020): Sorry for the delay after Build, we had a lot of offline things to take care of. The issue is still happening every single time with yesterday's update to Insider Release Preview build 19041.329. Sending some more crashdumps to @DHowett-MSFT.
Author
Owner

@zadjii-msft commented on GitHub (Dec 6, 2022):

@PhMajerus You still seeing this/? I'm not seeing this anymore on a conhost built from main, so I'm assuming it was fixed in... the last two years.

@zadjii-msft commented on GitHub (Dec 6, 2022): @PhMajerus You still seeing this/? I'm not seeing this anymore on a conhost built from `main`, so I'm assuming it was fixed in... _the last two years_.
Author
Owner

@PhMajerus commented on GitHub (Dec 6, 2022):

@zadjii-msft No, testing on Win11 22621.900 (Release Preview channel) doesn't crash anymore.
I'm not sure when it got fixed, but it might be a good idea to keep this scenario as a test to catch any regression with the console API.
Closing this now.

@PhMajerus commented on GitHub (Dec 6, 2022): @zadjii-msft No, testing on Win11 22621.900 (Release Preview channel) doesn't crash anymore. I'm not sure when it got fixed, but it might be a good idea to keep this scenario as a test to catch any regression with the console API. Closing this now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8072