Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
aee674c9
Commit
aee674c9
authored
Jan 24, 2011
by
Eric Pouech
Committed by
Alexandre Julliard
Jan 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Properly manage UTF-8 (and any wcs) input strings.
parent
ff057db6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
12 deletions
+19
-12
console.c
dlls/kernel32/console.c
+14
-4
console_private.h
dlls/kernel32/console_private.h
+1
-1
term.c
dlls/kernel32/term.c
+4
-7
No files found.
dlls/kernel32/console.c
View file @
aee674c9
...
...
@@ -1101,8 +1101,9 @@ static enum read_console_input_return bare_console_fetch_input(HANDLE handle, in
{
enum
read_console_input_return
ret
;
char
input
[
8
];
WCHAR
inputw
[
8
];
int
i
;
size_t
idx
=
0
;
size_t
idx
=
0
,
idxw
;
unsigned
numEvent
;
INPUT_RECORD
ir
[
8
];
DWORD
written
;
...
...
@@ -1157,12 +1158,21 @@ static enum read_console_input_return bare_console_fetch_input(HANDLE handle, in
break
;
case
-
1
:
/* we haven't found the string into key-db, push full input string into server */
for
(
i
=
0
;
i
<
idx
;
i
++
)
idxw
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
input
,
idx
,
inputw
,
sizeof
(
inputw
)
/
sizeof
(
inputw
[
0
]));
/* we cannot translate yet... likely we need more chars (wait max 1/2s for next char) */
if
(
idxw
==
0
)
{
timeout
=
500
;
next_char
=
TRUE
;
break
;
}
for
(
i
=
0
;
i
<
idxw
;
i
++
)
{
numEvent
=
TERM_FillSimpleChar
(
input
[
i
],
ir
);
numEvent
=
TERM_FillSimpleChar
(
input
w
[
i
],
ir
);
WriteConsoleInputW
(
handle
,
ir
,
numEvent
,
&
written
);
}
ret
=
idx
==
0
?
rci_timeout
:
rci_gotone
;
ret
=
rci_gotone
;
break
;
default:
/* we got a transformation from key-db... push this into server */
...
...
dlls/kernel32/console_private.h
View file @
aee674c9
...
...
@@ -36,7 +36,7 @@ extern WCHAR* CONSOLE_Readline(HANDLE, BOOL);
/* term.c */
extern
BOOL
TERM_Init
(
void
);
extern
BOOL
TERM_Exit
(
void
);
extern
unsigned
TERM_FillSimpleChar
(
unsigned
real_inchar
,
INPUT_RECORD
*
ir
);
extern
unsigned
TERM_FillSimpleChar
(
WCHAR
real_inchar
,
INPUT_RECORD
*
ir
);
extern
int
TERM_FillInputRecord
(
const
char
*
in
,
size_t
len
,
INPUT_RECORD
*
ir
);
#endif
/* __WINE_CONSOLE_PRIVATE_H */
dlls/kernel32/term.c
View file @
aee674c9
...
...
@@ -87,11 +87,10 @@ static inline void init_complex_char(INPUT_RECORD* ir, BOOL down, WORD vk, WORD
* TERM_FillSimpleChar
*
*/
unsigned
TERM_FillSimpleChar
(
unsigned
real_inchar
,
INPUT_RECORD
*
ir
)
unsigned
TERM_FillSimpleChar
(
WCHAR
real_inchar
,
INPUT_RECORD
*
ir
)
{
unsigned
vk
;
unsigned
inchar
;
char
ch
;
WCHAR
inchar
;
unsigned
numEvent
=
0
;
DWORD
cks
=
0
;
...
...
@@ -110,8 +109,7 @@ unsigned TERM_FillSimpleChar(unsigned real_inchar, INPUT_RECORD* ir)
inchar
=
real_inchar
;
break
;
}
if
((
inchar
&
~
0xFF
)
!=
0
)
FIXME
(
"What a char (%u)
\n
"
,
inchar
);
vk
=
vkkeyscan_table
[
inchar
];
vk
=
(
inchar
<
256
)
?
vkkeyscan_table
[
inchar
]
:
0
;
if
(
vk
&
0x0100
)
init_complex_char
(
&
ir
[
numEvent
++
],
1
,
0x2a
,
0x10
,
SHIFT_PRESSED
);
if
((
vk
&
0x0200
)
||
(
unsigned
char
)
real_inchar
<=
26
)
...
...
@@ -132,8 +130,7 @@ unsigned TERM_FillSimpleChar(unsigned real_inchar, INPUT_RECORD* ir)
ir
[
numEvent
].
Event
.
KeyEvent
.
wVirtualKeyCode
=
vk
;
ir
[
numEvent
].
Event
.
KeyEvent
.
wVirtualScanCode
=
mapvkey_0
[
vk
&
0x00ff
];
/* VirtualKeyCodes to ScanCode */
ch
=
inchar
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
&
ch
,
1
,
&
ir
[
numEvent
].
Event
.
KeyEvent
.
uChar
.
UnicodeChar
,
1
);
ir
[
numEvent
].
Event
.
KeyEvent
.
uChar
.
UnicodeChar
=
inchar
;
ir
[
numEvent
+
1
]
=
ir
[
numEvent
];
ir
[
numEvent
+
1
].
Event
.
KeyEvent
.
bKeyDown
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment