diff --git a/windows/winmiscs.c b/windows/winmiscs.c index 1fc14d71..d1662330 100644 --- a/windows/winmiscs.c +++ b/windows/winmiscs.c @@ -267,3 +267,11 @@ bool platform_sha1_hw_available(void) } #endif + +bool is_console_handle(HANDLE handle) +{ + DWORD ignored_output; + if (GetConsoleMode(handle, &ignored_output)) + return true; + return false; +} diff --git a/windows/winstuff.h b/windows/winstuff.h index ee6a055a..3334674b 100644 --- a/windows/winstuff.h +++ b/windows/winstuff.h @@ -569,6 +569,8 @@ GLOBAL bool restricted_acl; void escape_registry_key(const char *in, strbuf *out); void unescape_registry_key(const char *in, strbuf *out); +bool is_console_handle(HANDLE); + /* A few pieces of up-to-date Windows API definition needed for older * compilers. */ #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32