Skip to content

Commit

Permalink
Export Win32 console functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati committed Oct 4, 2016
1 parent d9b1c99 commit 2f05643
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions win32/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "win32/console.h"

BOOL php_win32_console_os_supports_vt100()
PHP_WINUTIL_API BOOL php_win32_console_os_supports_vt100()
{
const DWORD MINV_MAJOR = 10, MINV_MINOR = 0, MINV_BUILD = 10586;
OSVERSIONINFOEX osvi = EG(windows_version_info);
Expand Down Expand Up @@ -53,7 +53,7 @@ BOOL php_win32_console_os_supports_vt100()

}

BOOL php_win32_console_handle_is_redirected(DWORD handle_id)
PHP_WINUTIL_API BOOL php_win32_console_handle_is_redirected(DWORD handle_id)
{
BOOL result = FALSE;
HANDLE handle = handle_id ? GetStdHandle(handle_id) : INVALID_HANDLE_VALUE;
Expand All @@ -66,7 +66,7 @@ BOOL php_win32_console_handle_is_redirected(DWORD handle_id)
return result;
}

BOOL php_win32_console_handle_has_vt100(DWORD handle_id)
PHP_WINUTIL_API BOOL php_win32_console_handle_has_vt100(DWORD handle_id)
{
BOOL result = FALSE;
HANDLE handle = handle_id ? GetStdHandle(handle_id) : INVALID_HANDLE_VALUE;
Expand All @@ -83,7 +83,7 @@ BOOL php_win32_console_handle_has_vt100(DWORD handle_id)
return result;
}

BOOL php_win32_console_handle_set_vt100(DWORD handle_id, BOOL enable)
PHP_WINUTIL_API BOOL php_win32_console_handle_set_vt100(DWORD handle_id, BOOL enable)
{
BOOL result = FALSE;
HANDLE handle = handle_id ? GetStdHandle(handle_id) : INVALID_HANDLE_VALUE;
Expand Down
16 changes: 12 additions & 4 deletions win32/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
#ifndef PHP_WIN32_CONSOLE_H
#define PHP_WIN32_CONSOLE_H

#ifndef PHP_WINUTIL_API
#ifdef PHP_EXPORTS
# define PHP_WINUTIL_API __declspec(dllexport)
#else
# define PHP_WINUTIL_API __declspec(dllimport)
#endif
#endif

#include "php.h"
#include "php_streams.h"
#include <windows.h>
Expand All @@ -30,20 +38,20 @@
#endif

/* Check if the current Windows version supports VT100 control codes */
BOOL php_win32_console_os_supports_vt100();
PHP_WINUTIL_API BOOL php_win32_console_os_supports_vt100();

/* Check if the standard handle (STD_OUTPUT_HANDLE, STD_ERROR_HANDLE)
is redirected to a file */
BOOL php_win32_console_handle_is_redirected(DWORD handle_id);
PHP_WINUTIL_API BOOL php_win32_console_handle_is_redirected(DWORD handle_id);

/* Check if the console attached to the specified standard handle
(STD_OUTPUT_HANDLE, STD_ERROR_HANDLE) has the
ENABLE_VIRTUAL_TERMINAL_PROCESSING flag set */
BOOL php_win32_console_handle_has_vt100(DWORD handle_id);
PHP_WINUTIL_API BOOL php_win32_console_handle_has_vt100(DWORD handle_id);

/* Set/unset the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for the console
attached to the specified standard handle (STD_OUTPUT_HANDLE,
STD_ERROR_HANDLE) */
BOOL php_win32_console_handle_set_vt100(DWORD handle_id, BOOL enable);
PHP_WINUTIL_API BOOL php_win32_console_handle_set_vt100(DWORD handle_id, BOOL enable);

#endif

0 comments on commit 2f05643

Please sign in to comment.