mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +00:00
New Windows utility function: is_console_handle().
Rather like isatty() on Unix, this tells you if a raw Windows HANDLE points at a console or not. Useful to know if your standard output or standard error is going to be shown to a user, or redirected to something that will make automated use of it.
This commit is contained in:
parent
bc1aa9c656
commit
f9b1a2bbc2
@ -267,3 +267,11 @@ bool platform_sha1_hw_available(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool is_console_handle(HANDLE handle)
|
||||||
|
{
|
||||||
|
DWORD ignored_output;
|
||||||
|
if (GetConsoleMode(handle, &ignored_output))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -569,6 +569,8 @@ GLOBAL bool restricted_acl;
|
|||||||
void escape_registry_key(const char *in, strbuf *out);
|
void escape_registry_key(const char *in, strbuf *out);
|
||||||
void unescape_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
|
/* A few pieces of up-to-date Windows API definition needed for older
|
||||||
* compilers. */
|
* compilers. */
|
||||||
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||||
|
Loading…
Reference in New Issue
Block a user