mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 07:40:21 +00:00
kernelbase: Move KERNEL32_CONSOLE_ALLOC handling to kernelbase.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
af47236499
commit
26e04d52fe
|
@ -1129,7 +1129,7 @@ BOOL CONSOLE_Init(RTL_USER_PROCESS_PARAMETERS *params)
|
|||
*/
|
||||
if (!params->hStdInput || params->hStdInput == INVALID_HANDLE_VALUE)
|
||||
params->hStdInput = 0;
|
||||
else if (VerifyConsoleIoHandle(params->hStdInput))
|
||||
else if (!is_console_handle(params->hStdInput) && VerifyConsoleIoHandle(params->hStdInput))
|
||||
{
|
||||
params->hStdInput = console_handle_map(params->hStdInput);
|
||||
save_console_mode(params->hStdInput);
|
||||
|
@ -1137,12 +1137,12 @@ BOOL CONSOLE_Init(RTL_USER_PROCESS_PARAMETERS *params)
|
|||
|
||||
if (!params->hStdOutput || params->hStdOutput == INVALID_HANDLE_VALUE)
|
||||
params->hStdOutput = 0;
|
||||
else if (VerifyConsoleIoHandle(params->hStdOutput))
|
||||
else if (!is_console_handle(params->hStdOutput) && VerifyConsoleIoHandle(params->hStdOutput))
|
||||
params->hStdOutput = console_handle_map(params->hStdOutput);
|
||||
|
||||
if (!params->hStdError || params->hStdError == INVALID_HANDLE_VALUE)
|
||||
params->hStdError = 0;
|
||||
else if (VerifyConsoleIoHandle(params->hStdError))
|
||||
else if (!is_console_handle(params->hStdError) && VerifyConsoleIoHandle(params->hStdError))
|
||||
params->hStdError = console_handle_map(params->hStdError);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -147,19 +147,6 @@ static BOOL process_attach( HMODULE module )
|
|||
LoadLibraryA( "krnl386.exe16" );
|
||||
}
|
||||
|
||||
if (params->ConsoleHandle == KERNEL32_CONSOLE_ALLOC)
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA(0);
|
||||
params->ConsoleHandle = NULL;
|
||||
if (RtlImageNtHeader(mod)->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
|
||||
AllocConsole();
|
||||
}
|
||||
/* else TODO for DETACHED_PROCESS:
|
||||
* 1/ inherit console + handles
|
||||
* 2/ create std handles, if handles are not inherited
|
||||
* TBD when not using wineserver handles for console handles
|
||||
*/
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ static inline BOOL set_ntstatus( NTSTATUS status )
|
|||
}
|
||||
|
||||
/* 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 DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1729,5 +1729,15 @@ HRESULT WINAPI ResizePseudoConsole( HPCON handle, COORD size )
|
|||
|
||||
void init_console( void )
|
||||
{
|
||||
RTL_USER_PROCESS_PARAMETERS *params = RtlGetCurrentPeb()->ProcessParameters;
|
||||
|
||||
if (params->ConsoleHandle == CONSOLE_HANDLE_ALLOC)
|
||||
{
|
||||
HMODULE mod = GetModuleHandleW( NULL );
|
||||
params->ConsoleHandle = NULL;
|
||||
if (RtlImageNtHeader( mod )->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
|
||||
AllocConsole();
|
||||
}
|
||||
|
||||
RtlAddVectoredExceptionHandler( FALSE, handle_ctrl_c );
|
||||
}
|
||||
|
|
|
@ -226,4 +226,7 @@ enum condrv_renderer_event_type
|
|||
CONSOLE_RENDERER_EXIT_EVENT,
|
||||
};
|
||||
|
||||
/* Wine specific values for console inheritance (params->ConsoleHandle) */
|
||||
#define CONSOLE_HANDLE_ALLOC ((HANDLE)1)
|
||||
|
||||
#endif /* _INC_CONDRV */
|
||||
|
|
Loading…
Reference in a new issue