Implement FR #77377 handle CTRL+C in Windows

This commit is contained in:
Anatol Belski 2019-02-08 18:10:31 -08:00
parent e1dd8cd678
commit 12bfd9a5f5
11 changed files with 294 additions and 9 deletions

View file

@ -22,6 +22,8 @@
#include "SAPI.h"
#include <emmintrin.h>
#include "win32/console.h"
ZEND_TLS const struct php_win32_cp *cur_cp = NULL;
ZEND_TLS const struct php_win32_cp *orig_cp = NULL;
ZEND_TLS const struct php_win32_cp *cur_out_cp = NULL;
@ -289,11 +291,6 @@ __forceinline static char *php_win32_cp_get_enc(void)
return enc;
}/*}}}*/
__forceinline static BOOL php_win32_cp_is_cli_sapi()
{/*{{{*/
return strlen(sapi_module.name) >= sizeof("cli") - 1 && !strncmp(sapi_module.name, "cli", sizeof("cli") - 1);
}/*}}}*/
PW32CP const struct php_win32_cp *php_win32_cp_get_current(void)
{/*{{{*/
return cur_cp;
@ -473,7 +470,7 @@ PW32CP const struct php_win32_cp *php_win32_cp_do_setup(const char *enc)
if (!orig_cp) {
orig_cp = php_win32_cp_get_by_id(GetACP());
}
if (php_win32_cp_is_cli_sapi()) {
if (php_win32_console_is_cli_sapi()) {
if (!orig_in_cp) {
orig_in_cp = php_win32_cp_get_by_id(GetConsoleCP());
if (!orig_in_cp) {
@ -499,7 +496,7 @@ PW32CP const struct php_win32_cp *php_win32_cp_do_update(const char *enc)
}
cur_cp = php_win32_cp_get_by_enc(enc);
if (php_win32_cp_is_cli_sapi()) {
if (php_win32_console_is_cli_sapi()) {
php_win32_cp_cli_do_setup(cur_cp->id);
}
@ -574,7 +571,7 @@ PHP_FUNCTION(sapi_windows_cp_set)
RETURN_FALSE;
}
if (php_win32_cp_is_cli_sapi()) {
if (php_win32_console_is_cli_sapi()) {
cp = php_win32_cp_cli_do_setup((DWORD)id);
} else {
cp = php_win32_cp_set_by_id((DWORD)id);