diff options
author | Ron Yorston <rmy@pobox.com> | 2019-02-17 13:59:17 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-02-17 13:59:17 +0000 |
commit | 743580b4c029e200b1390075a1328ab314973bc2 (patch) | |
tree | ee967e8fe9f8c2016d50fddbe2b8837b6fa7aa79 /win32 | |
parent | 5d710374afe4545d8e14c0559857b50ceceb1df3 (diff) | |
download | busybox-w32-743580b4c029e200b1390075a1328ab314973bc2.tar.gz busybox-w32-743580b4c029e200b1390075a1328ab314973bc2.tar.bz2 busybox-w32-743580b4c029e200b1390075a1328ab314973bc2.zip |
ash: updated support for hiding console
Move the code to hide the console to a separate function in
win32/mingw.c. Use lazy loading to avoid problems on platforms
where the require APIs aren't supported (PR #70).
Enable console hiding in the default 64-bit configuration.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 03636a04b..5cfba22f7 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1397,3 +1397,19 @@ int enumerate_links(const char *file, char *name) | |||
1397 | return 1; | 1397 | return 1; |
1398 | } | 1398 | } |
1399 | #endif | 1399 | #endif |
1400 | |||
1401 | #if ENABLE_ASH_NOCONSOLE | ||
1402 | void hide_console(void) | ||
1403 | { | ||
1404 | DWORD dummy; | ||
1405 | DECLARE_PROC_ADDR(DWORD, GetConsoleProcessList, LPDWORD, DWORD); | ||
1406 | DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); | ||
1407 | |||
1408 | if (INIT_PROC_ADDR(kernel32.dll, GetConsoleProcessList) && | ||
1409 | INIT_PROC_ADDR(user32.dll, ShowWindow)) { | ||
1410 | if (GetConsoleProcessList(&dummy, 1) == 1) { | ||
1411 | ShowWindow(GetConsoleWindow(), SW_HIDE); | ||
1412 | } | ||
1413 | } | ||
1414 | } | ||
1415 | #endif | ||