mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 04:13:35 +00:00
[KERNEL32/WIN32CSR] - Use ShowCmd from STARTUPINFO when creating console window
svn path=/trunk/; revision=54456
This commit is contained in:
@@ -67,6 +67,7 @@ BasepInitConsole(VOID)
|
||||
BOOLEAN NotConsole = FALSE;
|
||||
PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters;
|
||||
LPCWSTR ExeName;
|
||||
STARTUPINFO si;
|
||||
|
||||
WCHAR lpTest[MAX_PATH];
|
||||
GetModuleFileNameW(NULL, lpTest, MAX_PATH);
|
||||
@@ -86,8 +87,9 @@ BasepInitConsole(VOID)
|
||||
else
|
||||
{
|
||||
/* Assume one is needed */
|
||||
GetStartupInfo(&si);
|
||||
Request.Data.AllocConsoleRequest.ConsoleNeeded = TRUE;
|
||||
Request.Data.AllocConsoleRequest.Visible = TRUE;
|
||||
Request.Data.AllocConsoleRequest.ShowCmd = si.wShowWindow;
|
||||
|
||||
/* Handle the special flags given to us by BasepInitializeEnvironment */
|
||||
if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS)
|
||||
@@ -108,7 +110,7 @@ BasepInitConsole(VOID)
|
||||
/* We'll get the real one soon */
|
||||
DPRINT("Creating new invisible console\n");
|
||||
Parameters->ConsoleHandle = NULL;
|
||||
Request.Data.AllocConsoleRequest.Visible = FALSE;
|
||||
Request.Data.AllocConsoleRequest.ShowCmd = SW_HIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1823,6 +1823,7 @@ AllocConsole(VOID)
|
||||
ULONG CsrRequest;
|
||||
NTSTATUS Status;
|
||||
HANDLE hStdError;
|
||||
STARTUPINFO si;
|
||||
|
||||
if (NtCurrentPeb()->ProcessParameters->ConsoleHandle)
|
||||
{
|
||||
@@ -1831,9 +1832,11 @@ AllocConsole(VOID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GetStartupInfo(&si);
|
||||
|
||||
Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher;
|
||||
Request.Data.AllocConsoleRequest.ConsoleNeeded = TRUE;
|
||||
Request.Data.AllocConsoleRequest.Visible = TRUE;
|
||||
Request.Data.AllocConsoleRequest.ShowCmd = si.wShowWindow;
|
||||
|
||||
CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef struct
|
||||
{
|
||||
PCONTROLDISPATCHER CtrlDispatcher;
|
||||
BOOLEAN ConsoleNeeded;
|
||||
BOOLEAN Visible;
|
||||
INT ShowCmd;
|
||||
HANDLE Console;
|
||||
HANDLE InputHandle;
|
||||
HANDLE OutputHandle;
|
||||
|
||||
@@ -67,7 +67,7 @@ ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
|
||||
}
|
||||
|
||||
static NTSTATUS WINAPI
|
||||
CsrInitConsole(PCSRSS_CONSOLE Console, BOOL Visible)
|
||||
CsrInitConsole(PCSRSS_CONSOLE Console, int ShowCmd)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
SECURITY_ATTRIBUTES SecurityAttributes;
|
||||
@@ -142,7 +142,7 @@ CsrInitConsole(PCSRSS_CONSOLE Console, BOOL Visible)
|
||||
}
|
||||
if (GuiMode)
|
||||
{
|
||||
Status = GuiInitConsole(Console, Visible);
|
||||
Status = GuiInitConsole(Console, ShowCmd);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
HeapFree(Win32CsrApiHeap,0, NewBuffer);
|
||||
@@ -217,7 +217,7 @@ CSR_API(CsrAllocConsole)
|
||||
/* insert process data required for GUI initialization */
|
||||
InsertHeadList(&Console->ProcessList, &ProcessData->ProcessEntry);
|
||||
/* Initialize the Console */
|
||||
Status = CsrInitConsole(Console, Request->Data.AllocConsoleRequest.Visible);
|
||||
Status = CsrInitConsole(Console, Request->Data.AllocConsoleRequest.ShowCmd);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Console init failed\n");
|
||||
|
||||
@@ -2097,10 +2097,7 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
if (NULL != NewWindow)
|
||||
{
|
||||
SetWindowLongW(hWnd, GWL_USERDATA, GetWindowLongW(hWnd, GWL_USERDATA) + 1);
|
||||
if (wParam)
|
||||
{
|
||||
ShowWindow(NewWindow, SW_SHOW);
|
||||
}
|
||||
ShowWindow(NewWindow, (int)wParam);
|
||||
}
|
||||
return (LRESULT) NewWindow;
|
||||
case PM_DESTROY_CONSOLE:
|
||||
@@ -2280,7 +2277,7 @@ static CSRSS_CONSOLE_VTBL GuiVtbl =
|
||||
};
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
GuiInitConsole(PCSRSS_CONSOLE Console, BOOL Visible)
|
||||
GuiInitConsole(PCSRSS_CONSOLE Console, int ShowCmd)
|
||||
{
|
||||
HANDLE GraphicsStartupEvent;
|
||||
HANDLE ThreadHandle;
|
||||
@@ -2347,7 +2344,7 @@ GuiInitConsole(PCSRSS_CONSOLE Console, BOOL Visible)
|
||||
*/
|
||||
GuiData->hGuiInitEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
/* create console */
|
||||
PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, Visible, (LPARAM) Console);
|
||||
PostMessageW(NotifyWnd, PM_CREATE_CONSOLE, ShowCmd, (LPARAM) Console);
|
||||
|
||||
/* wait untill initialization has finished */
|
||||
WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE);
|
||||
|
||||
Reference in New Issue
Block a user