Kenichi Aramaki (karamaki-at-gmail-dot-com):

- Fix Japanese keyboard layout (bug #4145).
- Fix buffer overflow in CMD.EXE when dealing with double-byte code page (bug #4146).

svn path=/trunk/; revision=39493
This commit is contained in:
Dmitry Gorbachev 2009-02-08 17:41:21 +00:00
parent a44e51e9d6
commit 468038e6d4
2 changed files with 18 additions and 18 deletions

View file

@ -157,18 +157,18 @@ VOID ConOutChar (TCHAR c)
VOID ConPuts(LPTSTR szText, DWORD nStdHandle)
{
DWORD dwWritten;
HANDLE hStdHandle;
HANDLE hStdHandle;
PCHAR pBuf;
INT len;
len = _tcslen(szText);
#ifdef _UNICODE
pBuf = cmd_alloc(len + 1);
len = WideCharToMultiByte( OutputCodePage, 0, szText, len + 1, pBuf, len + 1, NULL, NULL) - 1;
pBuf = cmd_alloc(len * 2 + 1);
len = WideCharToMultiByte(OutputCodePage, 0, szText, len + 1, pBuf, len * 2 + 1, NULL, NULL) - 1;
#else
pBuf = szText;
#endif
hStdHandle = GetStdHandle(nStdHandle);
hStdHandle = GetStdHandle(nStdHandle);
WriteFile (hStdHandle,
pBuf,
@ -213,10 +213,10 @@ VOID ConPrintf(LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle)
TCHAR szOut[OUTPUT_BUFFER_SIZE];
DWORD dwWritten;
len = _vstprintf (szOut, szFormat, arg_ptr);
len = _vstprintf(szOut, szFormat, arg_ptr);
#ifdef _UNICODE
pBuf = cmd_alloc(len + 1);
len = WideCharToMultiByte( OutputCodePage, 0, szOut, len + 1, pBuf, len + 1, NULL, NULL) - 1;
pBuf = cmd_alloc(len * 2 + 1);
len = WideCharToMultiByte(OutputCodePage, 0, szOut, len + 1, pBuf, len * 2 + 1, NULL, NULL) - 1;
#else
pBuf = szOut;
#endif
@ -227,7 +227,6 @@ VOID ConPrintf(LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle)
&dwWritten,
NULL);
#ifdef _UNICODE
cmd_free(pBuf);
#endif

View file

@ -63,7 +63,7 @@ ROSDATA USHORT scancode_to_vk[] = {
/* Third letters row */
'Z', 'X', 'C', 'V',
'B', 'N', 'M', VK_OEM_COMMA,
VK_OEM_PERIOD,VK_OEM_2,/*VK_OEM_5,*/ VK_RSHIFT,
VK_OEM_PERIOD,VK_OEM_2, VK_RSHIFT,
/* - 37 - */
/* Bottom Row */
VK_MULTIPLY, VK_LMENU, VK_SPACE, VK_CAPITAL,
@ -100,13 +100,13 @@ ROSDATA USHORT scancode_to_vk[] = {
/* Not sure who uses these codes */
VK_EMPTY, VK_EMPTY, VK_EMPTY,
/* - 72 - */
VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY,
VK_EMPTY, VK_OEM_102, VK_EMPTY, VK_EMPTY,
/* - 76 - */
/* One more f-key */
VK_F24,
/* - 77 - */
VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY,
VK_EMPTY, VK_EMPTY, VK_EMPTY, VK_EMPTY, /* PA1 */
VK_EMPTY, VK_EMPTY, VK_OEM_5, VK_EMPTY, /* PA1 */
VK_EMPTY,
/* - 80 - */
0
@ -181,11 +181,12 @@ ROSDATA VK_TO_WCHARS2 key_to_chars_2mod[] = {
ROSDATA VK_TO_WCHARS3 key_to_chars_3mod[] = {
/* Normal, Shifted, Ctrl */
/* Legacy (telnet-style) ascii escapes */
{ VK_OEM_4, 0, {'[', '{', 0x1b /* ESC */} },
{ VK_OEM_6, 0, {']', '}', 0x1d /* GS */} },
{ VK_OEM_5, 0, {'\\','|', 0x1c /* FS */} },
{ VK_RETURN,0, {'\r', '\r', '\n'} },
{ 0,0 }
{ VK_OEM_4, NOCAPS, {'[' , '{' , 0x1b /* ESC */} },
{ VK_OEM_6, NOCAPS, {']' , '}' , 0x1d /* GS */} },
{ VK_OEM_5, NOCAPS, {'\\', '|' , 0x1c /* FS */} }, /* Yen */
{ VK_OEM_102, NOCAPS, {'\\', '_' , 0x1c /* FS */} }, /* 'ro' */
{ VK_RETURN, NOCAPS, {'\r', '\r', '\n' } },
{ 0, 0 }
};
ROSDATA VK_TO_WCHARS4 key_to_chars_4mod[] = {
@ -239,7 +240,7 @@ ROSDATA VK_TO_WCHARS1 keypad_numbers[] = {
{ VK_NUMPAD9, 0, {'9'} },
{ VK_DECIMAL, 0, {'.'} },
{ VK_BACK, 0, {'\010'} },
{ 0,0 }
{ 0, 0 }
};
#define vk_master(n,x) { (PVK_TO_WCHARS1)x, n, sizeof(x[0]) }
@ -249,7 +250,7 @@ ROSDATA VK_TO_WCHAR_TABLE vk_to_wchar_master_table[] = {
vk_master(2,key_to_chars_2mod),
vk_master(3,key_to_chars_3mod),
vk_master(4,key_to_chars_4mod),
{ 0,0,0 }
{ 0, 0, 0 }
};
ROSDATA VSC_LPWSTR key_names[] = {