From 298012359b52a9bf1ca22e0d1bedf23ec3e7680f Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Mon, 22 Feb 2016 16:28:15 +0100 Subject: extcap: move windows functions into extcap-base Change-Id: Iec7fed027a24992afd673b09c32470af51739ae5 Reviewed-on: https://code.wireshark.org/review/14075 Reviewed-by: Roland Knall --- extcap/randpktdump.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'extcap/randpktdump.c') diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c index c808fbaf74..7651b6635c 100644 --- a/extcap/randpktdump.c +++ b/extcap/randpktdump.c @@ -34,7 +34,6 @@ #define RANDPKTDUMP_VERSION_RELEASE 0 #define verbose_print(...) { if (verbose) printf(__VA_ARGS__); } -#define errmsg_print(...) { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); } static gboolean verbose = TRUE; @@ -63,48 +62,6 @@ static struct option longopts[] = { { 0, 0, 0, 0 } }; -#ifdef _WIN32 -BOOLEAN IsHandleRedirected(DWORD handle) -{ - HANDLE h = GetStdHandle(handle); - if (h) { - BY_HANDLE_FILE_INFORMATION fi; - if (GetFileInformationByHandle(h, &fi)) { - return TRUE; - } - } - return FALSE; -} - -static void attach_parent_console() -{ - BOOL outRedirected, errRedirected; - - outRedirected = IsHandleRedirected(STD_OUTPUT_HANDLE); - errRedirected = IsHandleRedirected(STD_ERROR_HANDLE); - - if (outRedirected && errRedirected) { - /* Both standard output and error handles are redirected. - * There is no point in attaching to parent process console. - */ - return; - } - - if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) { - /* Console attach failed. */ - return; - } - - /* Console attach succeeded */ - if (outRedirected == FALSE) { - freopen("CONOUT$", "w", stdout); - } - - if (errRedirected == FALSE) { - freopen("CONOUT$", "w", stderr); - } -} -#endif static void help(const char* binname) { -- cgit v1.2.1