Author: dgorbachev
Date: Sun Feb 8 11:41:21 2009
New Revision: 39493
URL:
http://svn.reactos.org/svn/reactos?rev=39493&view=rev
Log:
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).
Modified:
trunk/reactos/base/shell/cmd/console.c
trunk/reactos/dll/keyboard/kbdja/kbdja.c
Modified: trunk/reactos/base/shell/cmd/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/console.c?r…
==============================================================================
--- trunk/reactos/base/shell/cmd/console.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/console.c [iso-8859-1] Sun Feb 8 11:41:21 2009
@@ -157,18 +157,18 @@
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 @@
TCHAR szOut[OUTPUT_BUFFER_SIZE];
DWORD dwWritten;
- 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;
+ len = _vstprintf(szOut, szFormat, arg_ptr);
+#ifdef _UNICODE
+ pBuf = cmd_alloc(len * 2 + 1);
+ len = WideCharToMultiByte(OutputCodePage, 0, szOut, len + 1, pBuf, len * 2 + 1, NULL,
NULL) - 1;
#else
pBuf = szOut;
#endif
@@ -226,7 +226,6 @@
len,
&dwWritten,
NULL);
-
#ifdef _UNICODE
cmd_free(pBuf);
Modified: trunk/reactos/dll/keyboard/kbdja/kbdja.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/keyboard/kbdja/kbdja.c…
==============================================================================
--- trunk/reactos/dll/keyboard/kbdja/kbdja.c [iso-8859-1] (original)
+++ trunk/reactos/dll/keyboard/kbdja/kbdja.c [iso-8859-1] Sun Feb 8 11:41:21 2009
@@ -63,7 +63,7 @@
/* 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 @@
/* 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_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 @@
{ 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 @@
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[] = {