Author: jimtabor Date: Mon Jan 26 15:00:24 2015 New Revision: 66088
URL: http://svn.reactos.org/svn/reactos?rev=66088&view=rev Log: [Win32ss|NtUser] - Support process start up user show window parameter.
Modified: trunk/reactos/win32ss/pch.h trunk/reactos/win32ss/user/ntuser/main.c trunk/reactos/win32ss/user/ntuser/winpos.c
Modified: trunk/reactos/win32ss/pch.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/pch.h?rev=66088&... ============================================================================== --- trunk/reactos/win32ss/pch.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/pch.h [iso-8859-1] Mon Jan 26 15:00:24 2015 @@ -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>
Modified: trunk/reactos/win32ss/user/ntuser/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c?... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] Mon Jan 26 15:00:24 2015 @@ -461,11 +461,14 @@ 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); @@ -557,6 +560,24 @@ 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 @@ 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)
Modified: trunk/reactos/win32ss/user/ntuser/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] Mon Jan 26 15:00:24 2015 @@ -2168,12 +2168,49 @@ PTHREADINFO pti; //HRGN VisibleRgn; BOOL ShowOwned = FALSE; + BOOL FirstTime = FALSE; ASSERT_REFS_CO(Wnd); //ERR("co_WinPosShowWindow START\n");
pti = PsGetCurrentThreadWin32Thread(); 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) { @@ -2182,7 +2219,7 @@ 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 @@ if (!(style & WS_CHILD)) co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_ACTIVATE, WA_ACTIVE, 0); } //ERR("co_WinPosShowWindow EXIT\n"); - return(WasVisible); + return WasVisible; }
static PWND