* autoload.cc: Fix typo in comment.
(ShowWindowAsync): Define. (AttachConsole): Define. * fhandler_console.cc (fhandler_console::need_invisible): Add band-aid for Windows 7 AllocConsole bug.
This commit is contained in:
parent
e490a1f83c
commit
a4175657bf
|
@ -364,6 +364,7 @@ LoadDLLfunc (SendMessageA, 16, user32)
|
||||||
LoadDLLfunc (SetClipboardData, 8, user32)
|
LoadDLLfunc (SetClipboardData, 8, user32)
|
||||||
LoadDLLfunc (SetThreadDesktop, 4, user32)
|
LoadDLLfunc (SetThreadDesktop, 4, user32)
|
||||||
LoadDLLfunc (SetProcessWindowStation, 4, user32)
|
LoadDLLfunc (SetProcessWindowStation, 4, user32)
|
||||||
|
LoadDLLfuncEx (ShowWindowAsync, 8, user32, 1)
|
||||||
|
|
||||||
LoadDLLfunc (accept, 12, ws2_32)
|
LoadDLLfunc (accept, 12, ws2_32)
|
||||||
LoadDLLfunc (bind, 12, ws2_32)
|
LoadDLLfunc (bind, 12, ws2_32)
|
||||||
|
@ -396,7 +397,7 @@ LoadDLLfunc (WSASetLastError, 4, ws2_32)
|
||||||
// LoadDLLfunc (WSAStartup, 8, ws2_32)
|
// LoadDLLfunc (WSAStartup, 8, ws2_32)
|
||||||
LoadDLLfunc (WSAWaitForMultipleEvents, 20, ws2_32)
|
LoadDLLfunc (WSAWaitForMultipleEvents, 20, ws2_32)
|
||||||
|
|
||||||
// 50 = ERROR_NOT_SUPPORTED. Returned if OS doesn't supprot iphlpapi funcs
|
// 50 = ERROR_NOT_SUPPORTED. Returned if OS doesn't support iphlpapi funcs
|
||||||
LoadDLLfuncEx2 (GetAdaptersAddresses, 20, iphlpapi, 1, 50)
|
LoadDLLfuncEx2 (GetAdaptersAddresses, 20, iphlpapi, 1, 50)
|
||||||
LoadDLLfuncEx2 (GetExtendedTcpTable, 24, iphlpapi, 1, 50)
|
LoadDLLfuncEx2 (GetExtendedTcpTable, 24, iphlpapi, 1, 50)
|
||||||
LoadDLLfuncEx2 (GetIfEntry, 4, iphlpapi, 1, 50)
|
LoadDLLfuncEx2 (GetIfEntry, 4, iphlpapi, 1, 50)
|
||||||
|
@ -408,6 +409,7 @@ LoadDLLfuncEx2 (SendARP, 16, iphlpapi, 1, 50)
|
||||||
|
|
||||||
LoadDLLfunc (CoTaskMemFree, 4, ole32)
|
LoadDLLfunc (CoTaskMemFree, 4, ole32)
|
||||||
|
|
||||||
|
LoadDLLfuncEx (AttachConsole, 0, kernel32, 1)
|
||||||
LoadDLLfuncEx (FindFirstVolumeA, 8, kernel32, 1)
|
LoadDLLfuncEx (FindFirstVolumeA, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx (FindNextVolumeA, 12, kernel32, 1)
|
LoadDLLfuncEx (FindNextVolumeA, 12, kernel32, 1)
|
||||||
LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1)
|
LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1)
|
||||||
|
|
|
@ -1977,9 +1977,20 @@ fhandler_console::need_invisible ()
|
||||||
debug_printf ("window station is not visible");
|
debug_printf ("window station is not visible");
|
||||||
invisible_console = true;
|
invisible_console = true;
|
||||||
}
|
}
|
||||||
else
|
/* Band-aid for Windows 7. AllocConsole is broken on W7 in that it
|
||||||
|
doesn't allocate the console in the hidden, active WindowStation,
|
||||||
|
but instead on the WindowStation on which the application has
|
||||||
|
originally been started on. This effectively disallows to create
|
||||||
|
a hidden console.
|
||||||
|
So what we do now is this. First we try to attach to an existing
|
||||||
|
console window of the parent process. If that doesn't work, we
|
||||||
|
skip generating a hidden WindowStation entirely. After creating
|
||||||
|
the new console, we hide it. Unfortunately it's still visible in
|
||||||
|
the taskbar. Hopefully this will be fixed in SP1... */
|
||||||
|
else if (!wincap.has_broken_alloc_console () || !AttachConsole (-1))
|
||||||
{
|
{
|
||||||
if (myself->ctty != TTY_CONSOLE)
|
if (myself->ctty != TTY_CONSOLE
|
||||||
|
&& !wincap.has_broken_alloc_console ())
|
||||||
{
|
{
|
||||||
h = CreateWindowStationW (NULL, 0, WINSTA_ACCESS, NULL);
|
h = CreateWindowStationW (NULL, 0, WINSTA_ACCESS, NULL);
|
||||||
termios_printf ("%p = CreateWindowStation(NULL), %E", h);
|
termios_printf ("%p = CreateWindowStation(NULL), %E", h);
|
||||||
|
@ -1991,6 +2002,8 @@ fhandler_console::need_invisible ()
|
||||||
}
|
}
|
||||||
b = AllocConsole (); /* will cause flashing if CreateWindowStation
|
b = AllocConsole (); /* will cause flashing if CreateWindowStation
|
||||||
failed */
|
failed */
|
||||||
|
if (b && wincap.has_broken_alloc_console ())
|
||||||
|
ShowWindowAsync (GetConsoleWindow (), SW_HIDE);
|
||||||
debug_printf ("h %p, horig %p, flags %p", h, horig, oi.dwFlags);
|
debug_printf ("h %p, horig %p, flags %p", h, horig, oi.dwFlags);
|
||||||
if (horig && h && h != horig && SetProcessWindowStation (horig))
|
if (horig && h && h != horig && SetProcessWindowStation (horig))
|
||||||
CloseWindowStation (h);
|
CloseWindowStation (h);
|
||||||
|
|
Loading…
Reference in New Issue