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
45ade6c2
Commit
45ade6c2
authored
Aug 30, 2010
by
Eric Pouech
Committed by
Alexandre Julliard
Sep 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Allocate a console (without renderer) when starting a program from unix console.
parent
daaee9e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
26 deletions
+63
-26
console.c
dlls/kernel32/console.c
+47
-0
kernel_main.c
dlls/kernel32/kernel_main.c
+2
-19
kernel_private.h
dlls/kernel32/kernel_private.h
+5
-0
process.c
dlls/kernel32/process.c
+1
-1
thread.c
dlls/ntdll/thread.c
+8
-6
No files found.
dlls/kernel32/console.c
View file @
45ade6c2
...
@@ -2715,3 +2715,50 @@ DWORD WINAPI GetConsoleProcessList(LPDWORD processlist, DWORD processcount)
...
@@ -2715,3 +2715,50 @@ DWORD WINAPI GetConsoleProcessList(LPDWORD processlist, DWORD processcount)
return
0
;
return
0
;
}
}
BOOL
CONSOLE_Init
(
RTL_USER_PROCESS_PARAMETERS
*
params
)
{
if
(
params
->
ConsoleHandle
==
KERNEL32_CONSOLE_SHELL
)
{
HANDLE
conin
;
/* FIXME: to be done even if program is a GUI ? */
/* This is wine specific: we have no parent (we're started from unix)
* so, create a simple console with bare handles
*/
SERVER_START_REQ
(
alloc_console
)
{
req
->
access
=
GENERIC_READ
|
GENERIC_WRITE
;
req
->
attributes
=
OBJ_INHERIT
;
req
->
pid
=
0xffffffff
;
wine_server_call
(
req
);
conin
=
wine_server_ptr_handle
(
reply
->
handle_in
);
/* reply->event shouldn't be created by server */
}
SERVER_END_REQ
;
if
(
!
params
->
hStdInput
)
params
->
hStdInput
=
conin
;
}
/* convert value from server:
* + 0 => INVALID_HANDLE_VALUE
* + console handle needs to be mapped
*/
if
(
!
params
->
hStdInput
)
params
->
hStdInput
=
INVALID_HANDLE_VALUE
;
else
if
(
VerifyConsoleIoHandle
(
console_handle_map
(
params
->
hStdInput
)))
params
->
hStdInput
=
console_handle_map
(
params
->
hStdInput
);
if
(
!
params
->
hStdOutput
)
params
->
hStdOutput
=
INVALID_HANDLE_VALUE
;
else
if
(
VerifyConsoleIoHandle
(
console_handle_map
(
params
->
hStdOutput
)))
params
->
hStdOutput
=
console_handle_map
(
params
->
hStdOutput
);
if
(
!
params
->
hStdError
)
params
->
hStdError
=
INVALID_HANDLE_VALUE
;
else
if
(
VerifyConsoleIoHandle
(
console_handle_map
(
params
->
hStdError
)))
params
->
hStdError
=
console_handle_map
(
params
->
hStdError
);
return
TRUE
;
}
dlls/kernel32/kernel_main.c
View file @
45ade6c2
...
@@ -96,24 +96,7 @@ static BOOL process_attach( HMODULE module )
...
@@ -96,24 +96,7 @@ static BOOL process_attach( HMODULE module )
/* Setup computer name */
/* Setup computer name */
COMPUTERNAME_Init
();
COMPUTERNAME_Init
();
/* convert value from server:
CONSOLE_Init
(
params
);
* + 0 => INVALID_HANDLE_VALUE
* + console handle needs to be mapped
*/
if
(
!
params
->
hStdInput
)
params
->
hStdInput
=
INVALID_HANDLE_VALUE
;
else
if
(
VerifyConsoleIoHandle
(
console_handle_map
(
params
->
hStdInput
)))
params
->
hStdInput
=
console_handle_map
(
params
->
hStdInput
);
if
(
!
params
->
hStdOutput
)
params
->
hStdOutput
=
INVALID_HANDLE_VALUE
;
else
if
(
VerifyConsoleIoHandle
(
console_handle_map
(
params
->
hStdOutput
)))
params
->
hStdOutput
=
console_handle_map
(
params
->
hStdOutput
);
if
(
!
params
->
hStdError
)
params
->
hStdError
=
INVALID_HANDLE_VALUE
;
else
if
(
VerifyConsoleIoHandle
(
console_handle_map
(
params
->
hStdError
)))
params
->
hStdError
=
console_handle_map
(
params
->
hStdError
);
/* copy process information from ntdll */
/* copy process information from ntdll */
ENV_CopyStartupInformation
();
ENV_CopyStartupInformation
();
...
@@ -128,7 +111,7 @@ static BOOL process_attach( HMODULE module )
...
@@ -128,7 +111,7 @@ static BOOL process_attach( HMODULE module )
/* finish the process initialisation for console bits, if needed */
/* finish the process initialisation for console bits, if needed */
__wine_set_signal_handler
(
SIGINT
,
CONSOLE_HandleCtrlC
);
__wine_set_signal_handler
(
SIGINT
,
CONSOLE_HandleCtrlC
);
if
(
params
->
ConsoleHandle
==
(
HANDLE
)
1
)
/* FIXME */
if
(
params
->
ConsoleHandle
==
KERNEL32_CONSOLE_ALLOC
)
{
{
HMODULE
mod
=
GetModuleHandleA
(
0
);
HMODULE
mod
=
GetModuleHandleA
(
0
);
if
(
RtlImageNtHeader
(
mod
)
->
OptionalHeader
.
Subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_CUI
)
if
(
RtlImageNtHeader
(
mod
)
->
OptionalHeader
.
Subsystem
==
IMAGE_SUBSYSTEM_WINDOWS_CUI
)
...
...
dlls/kernel32/kernel_private.h
View file @
45ade6c2
...
@@ -28,6 +28,7 @@ BOOL WINAPI VerifyConsoleIoHandle(HANDLE);
...
@@ -28,6 +28,7 @@ BOOL WINAPI VerifyConsoleIoHandle(HANDLE);
HANDLE
WINAPI
DuplicateConsoleHandle
(
HANDLE
,
DWORD
,
BOOL
,
DWORD
);
HANDLE
WINAPI
DuplicateConsoleHandle
(
HANDLE
,
DWORD
,
BOOL
,
DWORD
);
BOOL
WINAPI
CloseConsoleHandle
(
HANDLE
handle
);
BOOL
WINAPI
CloseConsoleHandle
(
HANDLE
handle
);
HANDLE
WINAPI
GetConsoleInputWaitHandle
(
void
);
HANDLE
WINAPI
GetConsoleInputWaitHandle
(
void
);
BOOL
CONSOLE_Init
(
RTL_USER_PROCESS_PARAMETERS
*
params
);
static
inline
BOOL
is_console_handle
(
HANDLE
h
)
static
inline
BOOL
is_console_handle
(
HANDLE
h
)
{
{
...
@@ -46,6 +47,10 @@ static inline obj_handle_t console_handle_unmap(HANDLE h)
...
@@ -46,6 +47,10 @@ static inline obj_handle_t console_handle_unmap(HANDLE h)
return
wine_server_obj_handle
(
h
!=
INVALID_HANDLE_VALUE
?
(
HANDLE
)((
UINT_PTR
)
h
^
3
)
:
INVALID_HANDLE_VALUE
);
return
wine_server_obj_handle
(
h
!=
INVALID_HANDLE_VALUE
?
(
HANDLE
)((
UINT_PTR
)
h
^
3
)
:
INVALID_HANDLE_VALUE
);
}
}
/* Some Wine specific values for Console inheritance (params->ConsoleHandle) */
#define KERNEL32_CONSOLE_ALLOC ((HANDLE)1)
#define KERNEL32_CONSOLE_SHELL ((HANDLE)2)
extern
HMODULE
kernel32_handle
;
extern
HMODULE
kernel32_handle
;
extern
const
WCHAR
*
DIR_Windows
;
extern
const
WCHAR
*
DIR_Windows
;
...
...
dlls/kernel32/process.c
View file @
45ade6c2
...
@@ -1527,7 +1527,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
...
@@ -1527,7 +1527,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
info
->
console_flags
=
cur_params
->
ConsoleFlags
;
info
->
console_flags
=
cur_params
->
ConsoleFlags
;
if
(
flags
&
CREATE_NEW_PROCESS_GROUP
)
info
->
console_flags
=
1
;
if
(
flags
&
CREATE_NEW_PROCESS_GROUP
)
info
->
console_flags
=
1
;
if
(
flags
&
CREATE_NEW_CONSOLE
)
info
->
console
=
(
obj_handle_t
)
1
;
/* FIXME: cf. kernel_main.c */
if
(
flags
&
CREATE_NEW_CONSOLE
)
info
->
console
=
wine_server_obj_handle
(
KERNEL32_CONSOLE_ALLOC
);
if
(
startup
->
dwFlags
&
STARTF_USESTDHANDLES
)
if
(
startup
->
dwFlags
&
STARTF_USESTDHANDLES
)
{
{
...
...
dlls/ntdll/thread.c
View file @
45ade6c2
...
@@ -276,12 +276,14 @@ HANDLE thread_init(void)
...
@@ -276,12 +276,14 @@ HANDLE thread_init(void)
}
}
else
else
{
{
/* This is wine specific: we have no parent (we're started from unix)
if
(
isatty
(
0
)
||
isatty
(
1
)
||
isatty
(
2
))
* so, create a simple console with bare handles to unix stdio
params
.
ConsoleHandle
=
(
HANDLE
)
2
;
/* see kernel32/kernel_private.h */
*/
if
(
!
isatty
(
0
))
wine_server_fd_to_handle
(
0
,
GENERIC_READ
|
SYNCHRONIZE
,
OBJ_INHERIT
,
&
params
.
hStdInput
);
wine_server_fd_to_handle
(
0
,
GENERIC_READ
|
SYNCHRONIZE
,
OBJ_INHERIT
,
&
params
.
hStdInput
);
wine_server_fd_to_handle
(
1
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
&
params
.
hStdOutput
);
if
(
!
isatty
(
1
))
wine_server_fd_to_handle
(
2
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
&
params
.
hStdError
);
wine_server_fd_to_handle
(
1
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
&
params
.
hStdOutput
);
if
(
!
isatty
(
2
))
wine_server_fd_to_handle
(
2
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
&
params
.
hStdError
);
}
}
/* initialize time values in user_shared_data */
/* initialize time values in user_shared_data */
...
...
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