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
0556d9e6
Commit
0556d9e6
authored
Jun 25, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use NtCreateFile for console handles in CreateFileW.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d2a3104f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
58 deletions
+6
-58
console.c
dlls/kernel32/tests/console.c
+0
-5
console.c
dlls/kernelbase/console.c
+0
-26
file.c
dlls/kernelbase/file.c
+6
-25
kernelbase.h
dlls/kernelbase/kernelbase.h
+0
-2
No files found.
dlls/kernel32/tests/console.c
View file @
0556d9e6
...
...
@@ -1308,7 +1308,6 @@ static void test_CreateFileW(void)
cf_table
[
index
].
creation
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
!
index
&&
ret
==
INVALID_HANDLE_VALUE
)
{
todo_wine
win_skip
(
"Skipping NT path tests, not supported on this Windows version
\n
"
);
skip_nt
=
TRUE
;
continue
;
...
...
@@ -3208,25 +3207,21 @@ static void test_FreeConsole(void)
ok
(
ret
,
"FreeConsole failed: %u
\n
"
,
GetLastError
());
handle
=
CreateFileA
(
"CONOUT$"
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
todo_wine
ok
(
handle
==
INVALID_HANDLE_VALUE
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
/* winxp */
)),
"CreateFileA failed: %u
\n
"
,
GetLastError
());
handle
=
CreateFileA
(
"CONIN$"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
todo_wine
ok
(
handle
==
INVALID_HANDLE_VALUE
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
/* winxp */
)),
"CreateFileA failed: %u
\n
"
,
GetLastError
());
handle
=
CreateFileA
(
"CON"
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
todo_wine
ok
(
handle
==
INVALID_HANDLE_VALUE
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
/* winxp */
)),
"CreateFileA failed: %u
\n
"
,
GetLastError
());
handle
=
CreateFileA
(
"CON"
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
todo_wine
ok
(
handle
==
INVALID_HANDLE_VALUE
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
||
broken
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
/* winxp */
)),
"CreateFileA failed: %u
\n
"
,
GetLastError
());
...
...
dlls/kernelbase/console.c
View file @
0556d9e6
...
...
@@ -172,32 +172,6 @@ static COORD get_largest_console_window_size( HANDLE handle )
return
c
;
}
/* helper function to replace OpenConsoleW */
HANDLE
open_console
(
BOOL
output
,
DWORD
access
,
SECURITY_ATTRIBUTES
*
sa
,
DWORD
creation
)
{
HANDLE
ret
;
if
(
creation
!=
OPEN_EXISTING
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
INVALID_HANDLE_VALUE
;
}
SERVER_START_REQ
(
open_console
)
{
req
->
from
=
wine_server_obj_handle
(
ULongToHandle
(
output
));
req
->
access
=
access
;
req
->
attributes
=
sa
&&
sa
->
bInheritHandle
?
OBJ_INHERIT
:
0
;
req
->
share
=
FILE_SHARE_READ
|
FILE_SHARE_WRITE
;
wine_server_call_err
(
req
);
ret
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
if
(
ret
)
ret
=
console_handle_map
(
ret
);
return
ret
;
}
/******************************************************************
* AttachConsole (kernelbase.@)
*/
...
...
dlls/kernelbase/file.c
View file @
0556d9e6
...
...
@@ -744,13 +744,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
(
sharing
&
FILE_SHARE_DELETE
)
?
"FILE_SHARE_DELETE "
:
""
,
creation
,
attributes
);
/* Open a console for CONIN$ or CONOUT$ */
if
(
!
wcsicmp
(
filename
,
L"CONIN$"
))
return
open_console
(
FALSE
,
access
,
sa
,
creation
?
OPEN_EXISTING
:
0
);
if
(
!
wcsicmp
(
filename
,
L"CONOUT$"
))
return
open_console
(
TRUE
,
access
,
sa
,
creation
?
OPEN_EXISTING
:
0
);
if
(
!
wcsncmp
(
filename
,
L"
\\\\
.
\\
"
,
4
))
{
if
((
filename
[
4
]
&&
filename
[
5
]
==
':'
&&
!
filename
[
6
])
||
...
...
@@ -771,24 +764,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
}
else
dosdev
=
RtlIsDosDeviceName_U
(
filename
);
if
(
dosdev
)
{
if
(
LOWORD
(
dosdev
)
==
3
*
sizeof
(
WCHAR
)
&&
!
wcsnicmp
(
filename
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
L"CON"
,
3
))
{
switch
(
access
&
(
GENERIC_READ
|
GENERIC_WRITE
))
{
case
GENERIC_READ
:
return
open_console
(
FALSE
,
access
,
sa
,
OPEN_EXISTING
);
case
GENERIC_WRITE
:
return
open_console
(
TRUE
,
access
,
sa
,
OPEN_EXISTING
);
default:
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
INVALID_HANDLE_VALUE
;
}
}
}
if
(
creation
<
CREATE_NEW
||
creation
>
TRUNCATE_EXISTING
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
...
@@ -853,6 +828,12 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
}
else
{
if
(
dosdev
&&
((
LOWORD
(
dosdev
)
==
3
*
sizeof
(
WCHAR
)
&&
!
wcsnicmp
(
filename
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
L"CON"
,
3
))
||
(
LOWORD
(
dosdev
)
==
6
*
sizeof
(
WCHAR
)
&&
!
wcsnicmp
(
filename
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
L"CONIN$"
,
6
))
||
(
LOWORD
(
dosdev
)
==
7
*
sizeof
(
WCHAR
)
&&
!
wcsnicmp
(
filename
+
HIWORD
(
dosdev
)
/
sizeof
(
WCHAR
),
L"CONOUT$"
,
7
))))
ret
=
console_handle_map
(
ret
);
if
((
creation
==
CREATE_ALWAYS
&&
io
.
Information
==
FILE_OVERWRITTEN
)
||
(
creation
==
OPEN_ALWAYS
&&
io
.
Information
==
FILE_OPENED
))
SetLastError
(
ERROR_ALREADY_EXISTS
);
...
...
dlls/kernelbase/kernelbase.h
View file @
0556d9e6
...
...
@@ -35,8 +35,6 @@ extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
static
const
BOOL
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
extern
BOOL
is_wow64
DECLSPEC_HIDDEN
;
extern
HANDLE
open_console
(
BOOL
output
,
DWORD
access
,
SECURITY_ATTRIBUTES
*
sa
,
DWORD
creation
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
is_console_handle
(
HANDLE
h
)
{
return
h
!=
INVALID_HANDLE_VALUE
&&
((
UINT_PTR
)
h
&
3
)
==
3
;
...
...
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