xref: /PHP-7.4/win32/console.h (revision 12bfd9a5)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) The PHP Group                                          |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Author: Michele Locati <mlocati@gmail.com>                           |
16   +----------------------------------------------------------------------+
17 */
18 
19 #ifndef PHP_WIN32_CONSOLE_H
20 #define PHP_WIN32_CONSOLE_H
21 
22 #ifndef PHP_WINUTIL_API
23 #ifdef PHP_EXPORTS
24 # define PHP_WINUTIL_API __declspec(dllexport)
25 #else
26 # define PHP_WINUTIL_API __declspec(dllimport)
27 #endif
28 #endif
29 
30 #include "php.h"
31 #include "php_streams.h"
32 #include <windows.h>
33 
34 #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
35 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
36 #endif
37 
38 
39 /*
40 Check if a file descriptor associated to a stream is a console
41 (valid fileno, neither redirected nor piped)
42 */
43 PHP_WINUTIL_API BOOL php_win32_console_fileno_is_console(zend_long fileno);
44 
45 /*
46 Check if the console attached to a file descriptor (screen buffer, not STDIN)
47 has the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag set
48 */
49 PHP_WINUTIL_API BOOL php_win32_console_fileno_has_vt100(zend_long fileno);
50 
51 /*
52 Set/unset the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for the screen buffer (STDOUT/STDERR)
53 associated to a file descriptor
54 */
55 PHP_WINUTIL_API BOOL php_win32_console_fileno_set_vt100(zend_long fileno, BOOL enable);
56 
57 /* Check, whether the program has its own console. If a process was launched
58 	through a GUI, it will have it's own console. For more info see
59 	http://support.microsoft.com/kb/99115 */
60 PHP_WINUTIL_API BOOL php_win32_console_is_own(void);
61 
62 /* Check whether the current SAPI is run on console. */
63 PHP_WINUTIL_API BOOL php_win32_console_is_cli_sapi(void);
64 
65 #endif
66