Cygwin: drop support for simple invisible console code

i. e., Vista/2008.

AllocConsole appears to allow creating a console only on the currently
visible desktop since Windows 7, which broke the simple code opening
the console on an invisible desktop in an invisible window station.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-10-29 18:08:32 +02:00
parent e8bfe36281
commit 4bc8f1adb4
4 changed files with 2 additions and 46 deletions

View File

@ -2118,7 +2118,6 @@ private:
/* Input calls */
int igncr_enabled ();
void set_cursor_maybe ();
static bool create_invisible_console (HWINSTA);
static bool create_invisible_console_workaround (bool force);
static console_state *open_shared_console (HWND, HANDLE&, bool&);
void fix_tab_position (void);

View File

@ -3530,34 +3530,7 @@ fhandler_console::fixup_after_fork_exec (bool execing)
setup_io_mutex ();
}
// #define WINSTA_ACCESS (WINSTA_READATTRIBUTES | STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | WINSTA_CREATEDESKTOP | WINSTA_EXITWINDOWS)
#define WINSTA_ACCESS WINSTA_ALL_ACCESS
/* Create a console in an invisible window station. This should work
in all versions of Windows NT except Windows 7 (so far). */
bool
fhandler_console::create_invisible_console (HWINSTA horig)
{
HWINSTA h = CreateWindowStationW (NULL, 0, WINSTA_ACCESS, NULL);
termios_printf ("%p = CreateWindowStation(NULL), %E", h);
BOOL b;
if (h)
{
b = SetProcessWindowStation (h);
termios_printf ("SetProcessWindowStation %d, %E", b);
}
b = AllocConsole (); /* will cause flashing if CreateWindowStation
failed */
if (!h)
SetParent (GetConsoleWindow (), HWND_MESSAGE);
if (horig && h && h != horig && SetProcessWindowStation (horig))
CloseWindowStation (h);
termios_printf ("%d = AllocConsole (), %E", b);
invisible_console = true;
return b;
}
/* Ugly workaround for Windows 7 and later.
/* Ugly workaround to create invisible console required since Windows 7.
First try to just attach to any console which may have started this
app. If that works use this as our "invisible console".
@ -3707,10 +3680,7 @@ fhandler_console::need_invisible (bool force)
AllocConsole ();
invisible_console = true;
}
else if (wincap.has_broken_alloc_console ())
b = create_invisible_console_workaround (force);
else
b = create_invisible_console (h);
b = create_invisible_console_workaround (force);
}
debug_printf ("invisible_console %d", invisible_console);

View File

@ -25,7 +25,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
is_server:false,
needs_query_information:true,
has_gaa_largeaddress_bug:true,
has_broken_alloc_console:false,
has_console_logon_sid:false,
has_precise_system_time:false,
has_microsoft_accounts:false,
@ -59,7 +58,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
is_server:false,
needs_query_information:true,
has_gaa_largeaddress_bug:true,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:false,
has_microsoft_accounts:false,
@ -93,7 +91,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
is_server:false,
needs_query_information:true,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -127,7 +124,6 @@ wincaps wincap_8_1 __attribute__((section (".cygwin_dll_common"), shared)) = {
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -161,7 +157,6 @@ wincaps wincap_10_1507 __attribute__((section (".cygwin_dll_common"), shared))
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -195,7 +190,6 @@ wincaps wincap_10_1607 __attribute__((section (".cygwin_dll_common"), shared))
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -229,7 +223,6 @@ wincaps wincap_10_1703 __attribute__((section (".cygwin_dll_common"), shared)) =
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -263,7 +256,6 @@ wincaps wincap_10_1709 __attribute__((section (".cygwin_dll_common"), shared)) =
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -297,7 +289,6 @@ wincaps wincap_10_1803 __attribute__((section (".cygwin_dll_common"), shared)) =
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -331,7 +322,6 @@ wincaps wincap_10_1809 __attribute__((section (".cygwin_dll_common"), shared)) =
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,
@ -365,7 +355,6 @@ wincaps wincap_10_1903 __attribute__((section (".cygwin_dll_common"), shared)) =
is_server:false,
needs_query_information:false,
has_gaa_largeaddress_bug:false,
has_broken_alloc_console:true,
has_console_logon_sid:true,
has_precise_system_time:true,
has_microsoft_accounts:true,

View File

@ -19,7 +19,6 @@ struct wincaps
unsigned is_server : 1;
unsigned needs_query_information : 1;
unsigned has_gaa_largeaddress_bug : 1;
unsigned has_broken_alloc_console : 1;
unsigned has_console_logon_sid : 1;
unsigned has_precise_system_time : 1;
unsigned has_microsoft_accounts : 1;
@ -85,7 +84,6 @@ public:
bool IMPLEMENT (is_server)
bool IMPLEMENT (needs_query_information)
bool IMPLEMENT (has_gaa_largeaddress_bug)
bool IMPLEMENT (has_broken_alloc_console)
bool IMPLEMENT (has_console_logon_sid)
bool IMPLEMENT (has_precise_system_time)
bool IMPLEMENT (has_microsoft_accounts)