public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: drop support for simple invisible console code
Date: Fri, 29 Oct 2021 19:03:32 +0000 (GMT)	[thread overview]
Message-ID: <20211029190332.D13BD3858439@sourceware.org> (raw)

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)


                 reply	other threads:[~2021-10-29 19:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211029190332.D13BD3858439@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).