[Win32ss|NtUser]

- Support process start up user show window parameter.

svn path=/trunk/; revision=66088
This commit is contained in:
James Tabor 2015-01-26 15:00:24 +00:00
parent 63ae430acc
commit 8d5b642a5f
3 changed files with 61 additions and 4 deletions

View file

@ -33,6 +33,7 @@
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
#define MAKEINTATOM(i) (LPWSTR)((ULONG_PTR)((WORD)(i)))
#define WINBASEAPI
#define STARTF_USESHOWWINDOW 1
#define STARTF_USESIZE 2
#define STARTF_USEPOSITION 4
#include <stdarg.h>

View file

@ -461,12 +461,15 @@ InitThreadCallback(PETHREAD Thread)
NTSTATUS Status = STATUS_SUCCESS;
PTEB pTeb;
LARGE_INTEGER LargeTickCount;
PRTL_USER_PROCESS_PARAMETERS ProcessParams;
Process = Thread->ThreadsProcess;
pTeb = NtCurrentTeb();
ASSERT(pTeb);
ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
/* Allocate a new Win32 thread info */
Status = AllocW32Thread(Thread, &ptiCurrent);
if (!NT_SUCCESS(Status))
@ -557,6 +560,24 @@ InitThreadCallback(PETHREAD Thread)
pci->CodePage = ptiCurrent->KeyboardLayout->CodePage;
}
/* Need to pass the user Startup Information to the current process. */
if ( ProcessParams )
{
if ( ptiCurrent->ppi->usi.cb == 0 ) // Not initialized yet.
{
if ( ProcessParams->WindowFlags != 0 ) // Need window flags set.
{
ptiCurrent->ppi->usi.cb = sizeof(USERSTARTUPINFO);
ptiCurrent->ppi->usi.dwX = ProcessParams->StartingX;
ptiCurrent->ppi->usi.dwY = ProcessParams->StartingY;
ptiCurrent->ppi->usi.dwXSize = ProcessParams->CountX;
ptiCurrent->ppi->usi.dwYSize = ProcessParams->CountY;
ptiCurrent->ppi->usi.dwFlags = ProcessParams->WindowFlags;
ptiCurrent->ppi->usi.wShowWindow = (WORD)ProcessParams->ShowWindowFlags;
}
}
}
/* Assign a default window station and desktop to the process */
/* Do not try to open a desktop or window station before winlogon initializes */
if (ptiCurrent->ppi->hdeskStartup == NULL && gpidLogon != 0)
@ -565,13 +586,11 @@ InitThreadCallback(PETHREAD Thread)
HDESK hDesk = NULL;
UNICODE_STRING DesktopPath;
PDESKTOP pdesk;
PRTL_USER_PROCESS_PARAMETERS ProcessParams;
/*
* inherit the thread desktop and process window station (if not yet inherited) from the process startup
* info structure. See documentation of CreateProcess()
*/
ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
Status = STATUS_UNSUCCESSFUL;
if (ProcessParams && ProcessParams->DesktopInfo.Length > 0)

View file

@ -2168,6 +2168,7 @@ co_WinPosShowWindow(PWND Wnd, INT Cmd)
PTHREADINFO pti;
//HRGN VisibleRgn;
BOOL ShowOwned = FALSE;
BOOL FirstTime = FALSE;
ASSERT_REFS_CO(Wnd);
//ERR("co_WinPosShowWindow START\n");
@ -2175,6 +2176,42 @@ co_WinPosShowWindow(PWND Wnd, INT Cmd)
WasVisible = (Wnd->style & WS_VISIBLE) != 0;
style = Wnd->style;
ERR("co_WinPosShowWindow START hwnd %p Cmd %d usicmd %d\n",Wnd->head.h,Cmd,pti->ppi->usi.wShowWindow);
if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
{
if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
{
if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
{
if (Wnd->spwndOwner == NULL)
{
if ( Cmd == SW_SHOWNORMAL || Cmd == SW_SHOW)
{
Cmd = SW_SHOWDEFAULT;
}
FirstTime = TRUE;
ERR("co_WPSW FT 1\n");
}
}
}
}
if ( Cmd == SW_SHOWDEFAULT )
{
if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
{
Cmd = pti->ppi->usi.wShowWindow;
FirstTime = TRUE;
ERR("co_WPSW FT 2\n");
}
}
if (FirstTime)
{
pti->ppi->usi.dwFlags &= ~(STARTF_USEPOSITION|STARTF_USESIZE|STARTF_USESHOWWINDOW);
}
switch (Cmd)
{
case SW_HIDE:
@ -2182,7 +2219,7 @@ co_WinPosShowWindow(PWND Wnd, INT Cmd)
if (!WasVisible)
{
//ERR("co_WinPosShowWindow Exit Bad\n");
return(FALSE);
return FALSE;
}
Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if (Wnd != pti->MessageQueue->spwndActive)
@ -2406,7 +2443,7 @@ co_WinPosShowWindow(PWND Wnd, INT Cmd)
if (!(style & WS_CHILD)) co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_ACTIVATE, WA_ACTIVE, 0);
}
//ERR("co_WinPosShowWindow EXIT\n");
return(WasVisible);
return WasVisible;
}
static PWND