Jacek Caban (@jacek) commented about dlls/kernelbase/console.c:
*/ BOOL WINAPI AllocConsole(void) {
- RTL_USER_PROCESS_PARAMETERS *params = RtlGetCurrentPeb()->ProcessParameters;
- /* allow gui applications to create a genuine console over a unix one */
- if (RtlImageNtHeader( GetModuleHandleW( NULL ) )->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI &&
(params->ConsoleHandle == CONSOLE_HANDLE_SHELL_NO_WINDOW ||
console_ioctl( params->ConsoleHandle, IOCTL_CONDRV_IS_UNIX, NULL, 0, NULL, 0, NULL )))
I'm afraid of breaking a use case where an application calls `AllocConsole` just to make sure there is a console, but it expects the call to fail if it's already attached to a console. Would limiting it to `CONSOLE_HANDLE_SHELL_NO_WINDOW` be enough for the problematic case?