public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: drop support for simple invisible console code
@ 2021-10-29 19:03 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-10-29 19:03 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4bc8f1adb462946c9f23b06295eed792574242aa

commit 4bc8f1adb462946c9f23b06295eed792574242aa
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Oct 29 18:08:32 2021 +0200

    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>

Diff:
---
 winsup/cygwin/fhandler.h          |  1 -
 winsup/cygwin/fhandler_console.cc | 34 ++--------------------------------
 winsup/cygwin/wincap.cc           | 11 -----------
 winsup/cygwin/wincap.h            |  2 --
 4 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index c033f7816..ea8d6e9e1 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -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);
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index aee5e8284..940c66a6e 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -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);
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index b94f38e31..6c4bcd08e 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -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,
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 5b81af562..764519616 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-29 19:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 19:03 [newlib-cygwin] Cygwin: drop support for simple invisible console code Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).