Cygwin: console: Fix conflict on shared names between sessions.
commitf7a77d014693a88b8a3dbecfd792956e99a7323e
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 3 Jul 2024 13:35:20 +0000 (3 22:35 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 3 Jul 2024 14:17:33 +0000 (3 23:17 +0900)
tree928285cd6565873cae68299e47c29e13201ab617
parenta5ffae145514df36ed134d3f36cedb9f81f743ea
Cygwin: console: Fix conflict on shared names between sessions.

Previously, shared names in the console were created using get_minor().
However, get_minor() was not unique to the console across sessions.
This is because EnumWindows(), which is used to look for console windows,
cannot enumerate windows across sessions. This causes conflict on the
shared names between sessions (e.g. sessions of different users,
different services, a service and a user session, etc.).

With this patch, GetConsoleWindow() is used instead of get_minor().
GetConsoleWindow() has been used for the name of shared memory, which
should be unique to each console.

Addresses: https://cygwin.com/pipermail/cygwin/2024-April/255893.html
Fixes: ff4440fcf768 ("Cygwin: console: Introduce new thread which handles input signal.");
Reported-by: Johannes Khoshnazar-Thoma <johannes@johannesthoma.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
winsup/cygwin/fhandler/console.cc
winsup/cygwin/release/3.5.4