Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
cd9f96c7
Commit
cd9f96c7
authored
Sep 22, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Move ReadConsoleInput.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
79cb33e1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
67 deletions
+32
-67
console.c
dlls/kernel32/console.c
+0
-63
kernel32.spec
dlls/kernel32/kernel32.spec
+2
-2
console.c
dlls/kernelbase/console.c
+28
-0
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+2
-2
No files found.
dlls/kernel32/console.c
View file @
cd9f96c7
...
...
@@ -58,33 +58,9 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
console
);
static
CRITICAL_SECTION
CONSOLE_CritSect
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
CONSOLE_CritSect
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": CONSOLE_CritSect"
)
}
};
static
CRITICAL_SECTION
CONSOLE_CritSect
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
const
WCHAR
coninW
[]
=
{
'C'
,
'O'
,
'N'
,
'I'
,
'N'
,
'$'
,
0
};
static
const
WCHAR
conoutW
[]
=
{
'C'
,
'O'
,
'N'
,
'O'
,
'U'
,
'T'
,
'$'
,
0
};
/* map input records to ASCII */
static
void
input_records_WtoA
(
INPUT_RECORD
*
buffer
,
int
count
)
{
UINT
cp
=
GetConsoleCP
();
int
i
;
char
ch
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
buffer
[
i
].
EventType
!=
KEY_EVENT
)
continue
;
WideCharToMultiByte
(
cp
,
0
,
&
buffer
[
i
].
Event
.
KeyEvent
.
uChar
.
UnicodeChar
,
1
,
&
ch
,
1
,
NULL
,
NULL
);
buffer
[
i
].
Event
.
KeyEvent
.
uChar
.
AsciiChar
=
ch
;
}
}
/******************************************************************************
* GetConsoleWindow [KERNEL32.@] Get hwnd of the console window.
*
...
...
@@ -396,45 +372,6 @@ BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer,
/***********************************************************************
* ReadConsoleInputA (KERNEL32.@)
*/
BOOL
WINAPI
ReadConsoleInputA
(
HANDLE
handle
,
INPUT_RECORD
*
buffer
,
DWORD
length
,
DWORD
*
count
)
{
DWORD
read
;
if
(
!
ReadConsoleInputW
(
handle
,
buffer
,
length
,
&
read
))
return
FALSE
;
input_records_WtoA
(
buffer
,
read
);
if
(
count
)
*
count
=
read
;
return
TRUE
;
}
/***********************************************************************
* ReadConsoleInputW (KERNEL32.@)
*/
BOOL
WINAPI
ReadConsoleInputW
(
HANDLE
hConsoleInput
,
PINPUT_RECORD
lpBuffer
,
DWORD
nLength
,
LPDWORD
lpNumberOfEventsRead
)
{
DWORD
idx
=
0
;
DWORD
timeout
=
INFINITE
;
if
(
!
nLength
)
{
if
(
lpNumberOfEventsRead
)
*
lpNumberOfEventsRead
=
0
;
return
TRUE
;
}
/* loop until we get at least one event */
while
(
read_console_input
(
hConsoleInput
,
&
lpBuffer
[
idx
],
timeout
)
==
rci_gotone
&&
++
idx
<
nLength
)
timeout
=
0
;
if
(
lpNumberOfEventsRead
)
*
lpNumberOfEventsRead
=
idx
;
return
idx
!=
0
;
}
/***********************************************************************
* GetNumberOfConsoleMouseButtons (KERNEL32.@)
*/
BOOL
WINAPI
GetNumberOfConsoleMouseButtons
(
LPDWORD
nrofbuttons
)
...
...
dlls/kernel32/kernel32.spec
View file @
cd9f96c7
...
...
@@ -1194,10 +1194,10 @@
@ stdcall -import RaiseException(long long long ptr)
# @ stub RaiseFailFastException
@ stdcall ReadConsoleA(long ptr long ptr ptr)
@ stdcall ReadConsoleInputA(long ptr long ptr)
@ stdcall
-import
ReadConsoleInputA(long ptr long ptr)
@ stub ReadConsoleInputExA
@ stub ReadConsoleInputExW
@ stdcall ReadConsoleInputW(long ptr long ptr)
@ stdcall
-import
ReadConsoleInputW(long ptr long ptr)
@ stdcall -import ReadConsoleOutputA(long ptr long long ptr)
@ stdcall -import ReadConsoleOutputAttribute(long ptr long long ptr)
@ stdcall -import ReadConsoleOutputCharacterA(long ptr long long ptr)
...
...
dlls/kernelbase/console.c
View file @
cd9f96c7
...
...
@@ -1393,6 +1393,34 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleWindowInfo( HANDLE handle, BOOL absolute
}
/***********************************************************************
* ReadConsoleInputA (kernelbase.@)
*/
BOOL
WINAPI
ReadConsoleInputA
(
HANDLE
handle
,
INPUT_RECORD
*
buffer
,
DWORD
length
,
DWORD
*
count
)
{
DWORD
read
;
if
(
!
ReadConsoleInputW
(
handle
,
buffer
,
length
,
&
read
))
return
FALSE
;
input_records_WtoA
(
buffer
,
read
);
if
(
count
)
*
count
=
read
;
return
TRUE
;
}
/***********************************************************************
* ReadConsoleInputW (kernelbase.@)
*/
BOOL
WINAPI
ReadConsoleInputW
(
HANDLE
handle
,
INPUT_RECORD
*
buffer
,
DWORD
length
,
DWORD
*
count
)
{
int
blocking
=
1
;
if
(
!
console_ioctl
(
handle
,
IOCTL_CONDRV_READ_INPUT
,
&
blocking
,
sizeof
(
blocking
),
buffer
,
length
*
sizeof
(
*
buffer
),
count
))
return
FALSE
;
*
count
/=
sizeof
(
*
buffer
);
return
TRUE
;
}
/******************************************************************************
* WriteConsoleInputA (kernelbase.@)
*/
...
...
dlls/kernelbase/kernelbase.spec
View file @
cd9f96c7
...
...
@@ -1238,10 +1238,10 @@
# @ stub RaiseFailFastException
@ stdcall ReOpenFile(ptr long long long)
@ stdcall ReadConsoleA(long ptr long ptr ptr) kernel32.ReadConsoleA
@ stdcall ReadConsoleInputA(long ptr long ptr)
kernel32.ReadConsoleInputA
@ stdcall ReadConsoleInputA(long ptr long ptr)
@ stub ReadConsoleInputExA
@ stub ReadConsoleInputExW
@ stdcall ReadConsoleInputW(long ptr long ptr)
kernel32.ReadConsoleInputW
@ stdcall ReadConsoleInputW(long ptr long ptr)
@ stdcall ReadConsoleOutputA(long ptr long long ptr)
@ stdcall ReadConsoleOutputAttribute(long ptr long long ptr)
@ stdcall ReadConsoleOutputCharacterA(long ptr long long ptr)
...
...
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