diff options
author | Ron Yorston <rmy@pobox.com> | 2023-06-01 13:52:33 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-06-01 14:03:51 +0100 |
commit | a1ccb78df0a218d8fa760015f82bca6b7939b95b (patch) | |
tree | 2ab8ed04eadafc0ea6f709f2bf3fa5f267135491 /win32 | |
parent | 82accfc19fcbda7cd2245a727ca493b582fb0994 (diff) | |
download | busybox-w32-a1ccb78df0a218d8fa760015f82bca6b7939b95b.tar.gz busybox-w32-a1ccb78df0a218d8fa760015f82bca6b7939b95b.tar.bz2 busybox-w32-a1ccb78df0a218d8fa760015f82bca6b7939b95b.zip |
ash: enable 'set -/+o noconsole'
Previously the 'noconsole' shell option could only be set as a
shell command line option. Allow it to be changed from within
the shell by 'set -o noconsole' or 'set +o noconsole'.
The console window is now minimised rather than hidden. This
makes it easier for the user to access the console when 'noconsole'
is in effect.
Adds 8-32 bytes.
(GitHub issue #325)
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index be4fc7aa1..2cf4a45a2 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -2185,17 +2185,15 @@ int enumerate_links(const char *file, char *name) | |||
2185 | #endif | 2185 | #endif |
2186 | 2186 | ||
2187 | #if ENABLE_ASH_NOCONSOLE | 2187 | #if ENABLE_ASH_NOCONSOLE |
2188 | void hide_console(void) | 2188 | void hide_console(int hide) |
2189 | { | 2189 | { |
2190 | DWORD dummy; | ||
2191 | DECLARE_PROC_ADDR(DWORD, GetConsoleProcessList, LPDWORD, DWORD); | ||
2192 | DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); | 2190 | DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); |
2191 | DECLARE_PROC_ADDR(BOOL, IsIconic, HWND); | ||
2193 | 2192 | ||
2194 | if (INIT_PROC_ADDR(kernel32.dll, GetConsoleProcessList) && | 2193 | if (INIT_PROC_ADDR(user32.dll, ShowWindow) && |
2195 | INIT_PROC_ADDR(user32.dll, ShowWindow)) { | 2194 | INIT_PROC_ADDR(user32.dll, IsIconic)) { |
2196 | if (GetConsoleProcessList(&dummy, 1) == 1) { | 2195 | if (IsIconic(GetConsoleWindow()) == !hide) |
2197 | ShowWindow(GetConsoleWindow(), SW_HIDE); | 2196 | ShowWindow(GetConsoleWindow(), hide ? SW_MINIMIZE : SW_NORMAL); |
2198 | } | ||
2199 | } | 2197 | } |
2200 | } | 2198 | } |
2201 | #endif | 2199 | #endif |