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
7b3c0fbe
Commit
7b3c0fbe
authored
Dec 10, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Add an OpenConsoleW() replacement wrapper.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
30e5f121
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
10 deletions
+33
-10
console.c
dlls/kernelbase/console.c
+25
-0
file.c
dlls/kernelbase/file.c
+6
-10
kernelbase.h
dlls/kernelbase/kernelbase.h
+2
-0
No files found.
dlls/kernelbase/console.c
View file @
7b3c0fbe
...
@@ -157,6 +157,31 @@ static COORD get_largest_console_window_size( HANDLE handle )
...
@@ -157,6 +157,31 @@ static COORD get_largest_console_window_size( HANDLE handle )
return
c
;
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.@)
* AttachConsole (kernelbase.@)
...
...
dlls/kernelbase/file.c
View file @
7b3c0fbe
...
@@ -428,8 +428,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
...
@@ -428,8 +428,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
DWORD
dosdev
;
DWORD
dosdev
;
const
WCHAR
*
vxd_name
=
NULL
;
const
WCHAR
*
vxd_name
=
NULL
;
static
const
WCHAR
bkslashes_with_dotW
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
0
};
static
const
WCHAR
bkslashes_with_dotW
[]
=
{
'\\'
,
'\\'
,
'.'
,
'\\'
,
0
};
static
const
WCHAR
coninW
[]
=
{
'C'
,
'O'
,
'N'
,
'I'
,
'N'
,
'$'
,
0
};
static
const
WCHAR
conoutW
[]
=
{
'C'
,
'O'
,
'N'
,
'O'
,
'U'
,
'T'
,
'$'
,
0
};
SECURITY_QUALITY_OF_SERVICE
qos
;
SECURITY_QUALITY_OF_SERVICE
qos
;
static
const
UINT
nt_disposition
[
5
]
=
static
const
UINT
nt_disposition
[
5
]
=
...
@@ -462,12 +460,10 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
...
@@ -462,12 +460,10 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
/* Open a console for CONIN$ or CONOUT$ */
/* Open a console for CONIN$ or CONOUT$ */
if
(
!
wcsicmp
(
filename
,
coninW
)
||
!
wcsicmp
(
filename
,
conoutW
))
if
(
!
wcsicmp
(
filename
,
L"CONIN$"
))
{
return
open_console
(
FALSE
,
access
,
sa
,
creation
?
OPEN_EXISTING
:
0
);
ret
=
OpenConsoleW
(
filename
,
access
,
sa
&&
sa
->
bInheritHandle
,
creation
?
OPEN_EXISTING
:
0
);
if
(
!
wcsicmp
(
filename
,
L"CONOUT$"
))
if
(
ret
==
INVALID_HANDLE_VALUE
)
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
open_console
(
TRUE
,
access
,
sa
,
creation
?
OPEN_EXISTING
:
0
);
return
ret
;
}
if
(
!
wcsncmp
(
filename
,
bkslashes_with_dotW
,
4
))
if
(
!
wcsncmp
(
filename
,
bkslashes_with_dotW
,
4
))
{
{
...
@@ -502,9 +498,9 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
...
@@ -502,9 +498,9 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
switch
(
access
&
(
GENERIC_READ
|
GENERIC_WRITE
))
switch
(
access
&
(
GENERIC_READ
|
GENERIC_WRITE
))
{
{
case
GENERIC_READ
:
case
GENERIC_READ
:
return
OpenConsoleW
(
coninW
,
access
,
sa
&&
sa
->
bInheritHandle
,
OPEN_EXISTING
);
return
open_console
(
FALSE
,
access
,
sa
,
OPEN_EXISTING
);
case
GENERIC_WRITE
:
case
GENERIC_WRITE
:
return
OpenConsoleW
(
conoutW
,
access
,
sa
&&
sa
->
bInheritHandle
,
OPEN_EXISTING
);
return
open_console
(
TRUE
,
access
,
sa
,
OPEN_EXISTING
);
default:
default:
SetLastError
(
ERROR_FILE_NOT_FOUND
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
INVALID_HANDLE_VALUE
;
return
INVALID_HANDLE_VALUE
;
...
...
dlls/kernelbase/kernelbase.h
View file @
7b3c0fbe
...
@@ -35,6 +35,8 @@ extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
...
@@ -35,6 +35,8 @@ extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
static
const
BOOL
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
static
const
BOOL
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
extern
BOOL
is_wow64
DECLSPEC_HIDDEN
;
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
)
static
inline
BOOL
is_console_handle
(
HANDLE
h
)
{
{
return
h
!=
INVALID_HANDLE_VALUE
&&
((
UINT_PTR
)
h
&
3
)
==
3
;
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