ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
15 participants
492 discussions
Start a n
N
ew thread
[jimtabor] 62748: [Win32k] - Switch menu allocation to desktop stack.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Apr 14 06:54:41 2014 New Revision: 62748 URL:
http://svn.reactos.org/svn/reactos?rev=62748&view=rev
Log: [Win32k] - Switch menu allocation to desktop stack. Modified: trunk/reactos/win32ss/user/ntuser/object.c trunk/reactos/win32ss/user/user32/misc/misc.c Modified: trunk/reactos/win32ss/user/ntuser/object.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/object…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/object.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/object.c [iso-8859-1] Mon Apr 14 06:54:41 2014 @@ -337,7 +337,7 @@ switch (type) { case TYPE_WINDOW: -// case TYPE_MENU: + case TYPE_MENU: case TYPE_HOOK: case TYPE_CALLPROC: case TYPE_INPUTCONTEXT: @@ -436,7 +436,7 @@ switch (type) { case TYPE_WINDOW: -// case TYPE_MENU: + case TYPE_MENU: case TYPE_HOOK: case TYPE_CALLPROC: case TYPE_INPUTCONTEXT: Modified: trunk/reactos/win32ss/user/user32/misc/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/m…
============================================================================== --- trunk/reactos/win32ss/user/user32/misc/misc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/misc.c [iso-8859-1] Mon Apr 14 06:54:41 2014 @@ -311,7 +311,7 @@ { FALSE, /* TYPE_FREE (not used) */ FALSE, /* TYPE_WINDOW */ - TRUE, /* TYPE_MENU FALSE */ + FALSE, /* TYPE_MENU */ TRUE, /* TYPE_CURSOR */ TRUE, /* TYPE_SETWINDOWPOS */ FALSE, /* TYPE_HOOK */ @@ -324,7 +324,7 @@ TRUE, /* TYPE_MONITOR */ FALSE, /* TYPE_KBDLAYOUT */ FALSE, /* TYPE_KBDFILE */ - TRUE, /* TYPE_WINEVENTHOOK */ + TRUE, /* TYPE_WINEVENTHOOK */ FALSE, /* TYPE_TIMER */ FALSE, /* TYPE_INPUTCONTEXT */ FALSE, /* TYPE_HIDDATA */
10 years, 8 months
1
0
0
0
[jimtabor] 62747: [User32] - Fixed get menu info, check parameters first than the handle. See CORE-8064.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Apr 14 06:05:34 2014 New Revision: 62747 URL:
http://svn.reactos.org/svn/reactos?rev=62747&view=rev
Log: [User32] - Fixed get menu info, check parameters first than the handle. See CORE-8064. Modified: trunk/reactos/win32ss/user/user32/windows/menu.c Modified: trunk/reactos/win32ss/user/user32/windows/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] Mon Apr 14 06:05:34 2014 @@ -4269,14 +4269,14 @@ BOOL res = FALSE; PVOID pMenu; - if (!(pMenu = ValidateHandle(hmenu, TYPE_MENU))) - return FALSE; - if (!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO))) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } + + if (!(pMenu = ValidateHandle(hmenu, TYPE_MENU))) + return FALSE; RtlZeroMemory(&mi, sizeof(MENUINFO)); mi.cbSize = sizeof(MENUINFO);
10 years, 8 months
1
0
0
0
[jimtabor] 62746: [User32] - Patch by Victor Martinez Calvo : Fix Invalid parameter handling in GetMenuInfo and SetLastError. Modified handle validation by me. See CORE-8064. - Moved code and added...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Apr 14 05:43:02 2014 New Revision: 62746 URL:
http://svn.reactos.org/svn/reactos?rev=62746&view=rev
Log: [User32] - Patch by Victor Martinez Calvo : Fix Invalid parameter handling in GetMenuInfo and SetLastError. Modified handle validation by me. See CORE-8064. - Moved code and added a non-client create function ID. Modified: trunk/reactos/win32ss/user/user32/windows/menu.c Modified: trunk/reactos/win32ss/user/user32/windows/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] Mon Apr 14 05:43:02 2014 @@ -1147,9 +1147,8 @@ if ( (Wnd->style & WS_MINIMIZE)) { UserGetInsideRectNC(Wnd, &rect); - UserDrawSysMenuButton(hWnd, hdc, &rect, - lpitem->fState & (MF_HILITE | MF_MOUSESELECT)); - } + UserDrawSysMenuButton(hWnd, hdc, &rect, lpitem->fState & (MF_HILITE | MF_MOUSESELECT)); + } return; } @@ -1816,6 +1815,10 @@ { if (!pWnd->fnid) { + if (Message != WM_NCCREATE) + { + return DefWindowProcA(Wnd, Message, wParam, lParam); + } NtUserSetWindowFNID(Wnd, FNID_MENU); } else @@ -4264,9 +4267,16 @@ { ROSMENUINFO mi; BOOL res = FALSE; - - if(!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO))) - return FALSE; + PVOID pMenu; + + if (!(pMenu = ValidateHandle(hmenu, TYPE_MENU))) + return FALSE; + + if (!lpcmi || (lpcmi->cbSize != sizeof(MENUINFO))) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } RtlZeroMemory(&mi, sizeof(MENUINFO)); mi.cbSize = sizeof(MENUINFO);
10 years, 8 months
1
0
0
0
[jimtabor] 62745: [User32] - Cleanup and plug in. Removed code that is not used, this code served us well. An assessment is needed to be made, base on speed and necessity, on what stays or moved or...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Apr 14 01:52:37 2014 New Revision: 62745 URL:
http://svn.reactos.org/svn/reactos?rev=62745&view=rev
Log: [User32] - Cleanup and plug in. Removed code that is not used, this code served us well. An assessment is needed to be made, base on speed and necessity, on what stays or moved or duplicated. - See CORE-7447. Modified: trunk/reactos/win32ss/user/user32/windows/defwnd.c Modified: trunk/reactos/win32ss/user/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] Mon Apr 14 01:52:37 2014 @@ -153,32 +153,6 @@ } } -#if 0 -VOID -DefWndSetRedraw(HWND hWnd, WPARAM wParam) -{ - LONG Style = GetWindowLongPtr(hWnd, GWL_STYLE); - /* Content can be redrawn after a change. */ - if (wParam) - { - if (!(Style & WS_VISIBLE)) /* Not Visible */ - { - SetWindowLongPtr(hWnd, GWL_STYLE, WS_VISIBLE); - } - } - else /* Content cannot be redrawn after a change. */ - { - if (Style & WS_VISIBLE) /* Visible */ - { - RedrawWindow( hWnd, NULL, 0, RDW_ALLCHILDREN | RDW_VALIDATE ); - Style &= ~WS_VISIBLE; - SetWindowLongPtr(hWnd, GWL_STYLE, Style); /* clear bits */ - } - } - return; -} -#endif - LRESULT DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam, ULONG Style) { @@ -255,502 +229,6 @@ return((LRESULT)SetCursor(LoadCursorW(0, IDC_ARROW))); } -static LONG -DefWndStartSizeMove(HWND hWnd, PWND Wnd, WPARAM wParam, POINT *capturePoint) -{ - LONG hittest = 0; - POINT pt; - MSG msg; - RECT rectWindow; - ULONG Style = Wnd->style; - - rectWindow = Wnd->rcWindow; - - if ((wParam & 0xfff0) == SC_MOVE) - { - /* Move pointer at the center of the caption */ - RECT rect; - UserGetInsideRectNC(Wnd, &rect); - if (Style & WS_SYSMENU) - rect.left += GetSystemMetrics(SM_CXSIZE) + 1; - if (Style & WS_MINIMIZEBOX) - rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; - if (Style & WS_MAXIMIZEBOX) - rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; - //pt.x = rectWindow.left + (rect.right - rect.left) / 2; - //pt.y = rectWindow.top + rect.top + GetSystemMetrics(SM_CYSIZE)/2; - pt.x = (rect.right + rect.left) / 2; - pt.y = rect.top + GetSystemMetrics(SM_CYSIZE)/2; - ERR("SC_MOVE\n"); - hittest = HTCAPTION; - *capturePoint = pt; - } - else /* SC_SIZE */ - { - pt.x = pt.y = 0; - while(!hittest) - { - if (!GetMessageW(&msg, NULL, 0, 0)) break; //return 0; - if (CallMsgFilterW( &msg, MSGF_SIZE )) continue; - - switch(msg.message) - { - case WM_MOUSEMOVE: - //// Clamp the mouse position to the window rectangle when starting a window resize. - //pt.x = min( max( msg.pt.x, rectWindow.left ), rectWindow.right - 1 ); - //pt.y = min( max( msg.pt.y, rectWindow.top ), rectWindow.bottom - 1 ); - //// Breaks a win test. - hittest = DefWndNCHitTest(hWnd, msg.pt); - if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) hittest = 0; - break; - - case WM_LBUTTONUP: - return 0; - - case WM_KEYDOWN: - switch(msg.wParam) - { - case VK_UP: - hittest = HTTOP; - pt.x =(rectWindow.left+rectWindow.right)/2; - pt.y = rectWindow.top + GetSystemMetrics(SM_CYFRAME) / 2; - break; - case VK_DOWN: - hittest = HTBOTTOM; - pt.x =(rectWindow.left+rectWindow.right)/2; - pt.y = rectWindow.bottom - GetSystemMetrics(SM_CYFRAME) / 2; - break; - case VK_LEFT: - hittest = HTLEFT; - pt.x = rectWindow.left + GetSystemMetrics(SM_CXFRAME) / 2; - pt.y =(rectWindow.top+rectWindow.bottom)/2; - break; - case VK_RIGHT: - hittest = HTRIGHT; - pt.x = rectWindow.right - GetSystemMetrics(SM_CXFRAME) / 2; - pt.y =(rectWindow.top+rectWindow.bottom)/2; - break; - case VK_RETURN: - case VK_ESCAPE: - return 0; - } - default: - TranslateMessage( &msg ); - DispatchMessageW( &msg ); - break; - } - } - *capturePoint = pt; - } - SetCursorPos( pt.x, pt.y ); - DefWndHandleSetCursor(hWnd, (WPARAM)hWnd, MAKELONG(hittest, WM_MOUSEMOVE), Style); - //SendMessageW(hWnd, WM_SETCURSOR, (WPARAM)hWnd, MAKELONG(hittest, WM_MOUSEMOVE)); - return hittest; -} - -#define ON_LEFT_BORDER(hit) \ - (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT)) -#define ON_RIGHT_BORDER(hit) \ - (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT)) -#define ON_TOP_BORDER(hit) \ - (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT)) -#define ON_BOTTOM_BORDER(hit) \ - (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) - -static VOID -UserDrawWindowFrame(HDC hdc, const RECT *rect, - ULONG width, ULONG height) -{ - HBRUSH hbrush = SelectObject( hdc, gpsi->hbrGray ); - - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left - width, height, PATINVERT ); - PatBlt( hdc, rect->left, rect->top + height, width, - rect->bottom - rect->top - height, PATINVERT ); - PatBlt( hdc, rect->left + width, rect->bottom - 1, - rect->right - rect->left - width, -height, PATINVERT ); - PatBlt( hdc, rect->right - 1, rect->top, -width, - rect->bottom - rect->top - height, PATINVERT ); - SelectObject( hdc, hbrush ); -} - -static VOID -UserDrawMovingFrame(HDC hdc, RECT *rect, BOOL thickframe) -{ - if(thickframe) - { - UserDrawWindowFrame(hdc, rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME)); - } - else - { - UserDrawWindowFrame(hdc, rect, 1, 1); - } -} - -static VOID -DefWndDoSizeMove(HWND hwnd, WORD wParam) -{ - HRGN DesktopRgn; - MSG msg; - RECT sizingRect, mouseRect, origRect, clipRect, unmodRect; - HDC hdc; - LONG hittest = (LONG)(wParam & 0x0f); - HCURSOR hDragCursor = 0, hOldCursor = 0; - POINT minTrack, maxTrack; - POINT capturePoint, pt; - ULONG Style, ExStyle; - BOOL thickframe; - BOOL iconic; - BOOL moved = FALSE; - DWORD dwPoint = GetMessagePos(); - BOOL DragFullWindows = FALSE; - HWND hWndParent = NULL; - PWND Wnd; - WPARAM syscommand = wParam & 0xfff0; - HMONITOR mon = 0; - - Wnd = ValidateHwnd(hwnd); - if (!Wnd) - return; - - Style = Wnd->style; - ExStyle = Wnd->ExStyle; - iconic = (Style & WS_MINIMIZE) != 0; - - // - // Show window contents while dragging the window, get flag from registry data. - // - SystemParametersInfoW(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0); - - pt.x = GET_X_LPARAM(dwPoint); - pt.y = GET_Y_LPARAM(dwPoint); - capturePoint = pt; - - TRACE("hwnd %p command %04lx, hittest %d, pos %d,%d\n", - hwnd, syscommand, hittest, pt.x, pt.y); - - if ((Style & WS_MAXIMIZE) || !IsWindowVisible(hwnd)) return; - - thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic; - - if (syscommand == SC_MOVE) - { - ERR("SC_MOVE\n"); - if (!hittest) hittest = DefWndStartSizeMove(hwnd, Wnd, wParam, &capturePoint); - if (!hittest) return; - } - else /* SC_SIZE */ - { - if (!thickframe) return; - if (hittest && (syscommand != SC_MOUSEMENU)) - { - hittest += (HTLEFT - WMSZ_LEFT); - } - else - { - SetCapture(hwnd); - hittest = DefWndStartSizeMove(hwnd, Wnd, wParam, &capturePoint); - if (!hittest) - { - ReleaseCapture(); - return; - } - } - } - - /* Get min/max info */ - - WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack); - sizingRect = Wnd->rcWindow; - ERR("x %d y %d X %d Y %d\n",pt.x,pt.y,sizingRect.left,sizingRect.top); - if (Style & WS_CHILD) - { - hWndParent = GetParent(hwnd); - MapWindowPoints( 0, hWndParent, (LPPOINT)&sizingRect, 2 ); - unmodRect = sizingRect; - GetClientRect(hWndParent, &mouseRect ); - clipRect = mouseRect; - MapWindowPoints(hWndParent, HWND_DESKTOP, (LPPOINT)&clipRect, 2); - } - else - { - if(!(ExStyle & WS_EX_TOPMOST)) - { - SystemParametersInfoW(SPI_GETWORKAREA, 0, &clipRect, 0); - mouseRect = clipRect; - } - else - { - SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); - clipRect = mouseRect; - } - mon = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST ); - unmodRect = sizingRect; - } - ClipCursor(&clipRect); - - origRect = sizingRect; - if (ON_LEFT_BORDER(hittest)) - { - mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x ); - mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x ); - } - else if (ON_RIGHT_BORDER(hittest)) - { - mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x ); - mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x ); - } - if (ON_TOP_BORDER(hittest)) - { - mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y ); - mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y); - } - else if (ON_BOTTOM_BORDER(hittest)) - { - mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y ); - mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y ); - } - if (Style & WS_CHILD) - { - MapWindowPoints( hWndParent, 0, (LPPOINT)&mouseRect, 2 ); - } - - IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, hwnd, OBJID_WINDOW, CHILDID_SELF, 0); - SendMessageW( hwnd, WM_ENTERSIZEMOVE, 0, 0 ); - NtUserxSetGUIThreadHandle(MSQ_STATE_MOVESIZE, hwnd); - if (GetCapture() != hwnd) SetCapture( hwnd ); - - if (Style & WS_CHILD) - { - /* Retrieve a default cache DC (without using the window style) */ - hdc = GetDCEx(hWndParent, 0, DCX_CACHE); - DesktopRgn = NULL; - } - else - { - hdc = GetDC( 0 ); - DesktopRgn = CreateRectRgnIndirect(&clipRect); - } - - SelectObject(hdc, DesktopRgn); - - if( iconic ) /* create a cursor for dragging */ - { - HICON hIcon = (HICON)GetClassLongPtrW(hwnd, GCL_HICON); - if(!hIcon) hIcon = (HICON)SendMessageW( hwnd, WM_QUERYDRAGICON, 0, 0L); - if( hIcon ) hDragCursor = CursorIconToCursor( hIcon, TRUE ); - if( !hDragCursor ) iconic = FALSE; - } - - /* invert frame if WIN31_LOOK to indicate mouse click on caption */ - if( !iconic && !DragFullWindows) - { - UserDrawMovingFrame( hdc, &sizingRect, thickframe); - } - - for(;;) - { - int dx = 0, dy = 0; - - if (!GetMessageW(&msg, 0, 0, 0)) break; - if (CallMsgFilterW( &msg, MSGF_SIZE )) continue; - - /* Exit on button-up, Return, or Esc */ - if ((msg.message == WM_LBUTTONUP) || - ((msg.message == WM_KEYDOWN) && - ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break; - - if (msg.message == WM_PAINT) - { - if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); - UpdateWindow( msg.hwnd ); - if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); - continue; - } - - if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE)) - { - TranslateMessage( &msg ); - DispatchMessageW( &msg ); - continue; /* We are not interested in other messages */ - } - - pt = msg.pt; - - if (msg.message == WM_KEYDOWN) switch(msg.wParam) - { - case VK_UP: pt.y -= 8; break; - case VK_DOWN: pt.y += 8; break; - case VK_LEFT: pt.x -= 8; break; - case VK_RIGHT: pt.x += 8; break; - } - - pt.x = max( pt.x, mouseRect.left ); - pt.x = min( pt.x, mouseRect.right - 1 ); - pt.y = max( pt.y, mouseRect.top ); - pt.y = min( pt.y, mouseRect.bottom - 1 ); - - if (!hWndParent) - { - HMONITOR newmon; - MONITORINFO info; - - if ((newmon = MonitorFromPoint( pt, MONITOR_DEFAULTTONULL ))) - mon = newmon; - - info.cbSize = sizeof(info); - if (mon && GetMonitorInfoW( mon, &info )) - { - pt.x = max( pt.x, info.rcWork.left ); - pt.x = min( pt.x, info.rcWork.right - 1 ); - pt.y = max( pt.y, info.rcWork.top ); - pt.y = min( pt.y, info.rcWork.bottom - 1 ); - } - } - - dx = pt.x - capturePoint.x; - dy = pt.y - capturePoint.y; - - if (dx || dy) - { - if( !moved ) - { - moved = TRUE; - - if( iconic ) /* ok, no system popup tracking */ - { - hOldCursor = SetCursor(hDragCursor); - ShowCursor( TRUE ); - } - } - - if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y ); - else - { - RECT newRect = unmodRect; - - if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy ); - if (ON_LEFT_BORDER(hittest)) newRect.left += dx; - else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; - if (ON_TOP_BORDER(hittest)) newRect.top += dy; - else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; - if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); - capturePoint = pt; - - /* determine the hit location */ - unmodRect = newRect; - if (syscommand == SC_SIZE) - { - WPARAM wpSizingHit = 0; - - if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT) - wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT); - SendMessageW( hwnd, WM_SIZING, wpSizingHit, (LPARAM)&newRect ); - } - else - SendMessageW( hwnd, WM_MOVING, 0, (LPARAM)&newRect ); - - if (!iconic) - { - if(!DragFullWindows) - UserDrawMovingFrame( hdc, &newRect, thickframe ); - else - { /* To avoid any deadlocks, all the locks on the windows - structures must be suspended before the SetWindowPos */ - //ERR("SWP 1\n"); - SetWindowPos( hwnd, 0, newRect.left, newRect.top, - newRect.right - newRect.left, - newRect.bottom - newRect.top, - ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); - } - } - sizingRect = newRect; - } - } - } - - ReleaseCapture(); - ClipCursor(NULL); - if( iconic ) - { - if( moved ) /* restore cursors, show icon title later on */ - { - ShowCursor( FALSE ); - SetCursor( hOldCursor ); - } - DestroyCursor( hDragCursor ); - } - else if(!DragFullWindows) - UserDrawMovingFrame( hdc, &sizingRect, thickframe ); - - if (Style & WS_CHILD) - ReleaseDC( hWndParent, hdc ); - else - { - ReleaseDC( 0, hdc ); - if(DesktopRgn) - { - DeleteObject(DesktopRgn); - } - } - //// This causes the mdi child window to jump up when it is moved. - //if (hWndParent) MapWindowPoints( 0, hWndParent, (POINT *)&sizingRect, 2 ); - - if (ISITHOOKED(WH_CBT)) - { - LRESULT lResult; - NtUserMessageCall( hwnd, WM_CBT, HCBT_MOVESIZE, (LPARAM)&sizingRect, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, FALSE); - if (lResult) moved = FALSE; - } - - NtUserxSetGUIThreadHandle(MSQ_STATE_MOVESIZE, NULL); - SendMessageW( hwnd, WM_EXITSIZEMOVE, 0, 0 ); - SendMessageW( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L); - - /* window moved or resized */ - if (moved) - { - /* if the moving/resizing isn't canceled call SetWindowPos - * with the new position or the new size of the window - */ - if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) ) - { - /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */ - if(!DragFullWindows )//|| iconic) breaks 2 win tests. - { - //ERR("SWP 2\n"); - SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top, - sizingRect.right - sizingRect.left, - sizingRect.bottom - sizingRect.top, - ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); - } - } - else - { /* restore previous size/position */ - if(DragFullWindows) - { - //ERR("SWP 3\n"); - SetWindowPos( hwnd, 0, origRect.left, origRect.top, - origRect.right - origRect.left, - origRect.bottom - origRect.top, - ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); - } - } - } - - if( IsWindow(hwnd) ) - if( iconic ) - { - /* Single click brings up the system menu when iconized */ - if( !moved ) - { - if( Style & WS_SYSMENU ) - SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y)); - } - } -} - - /*********************************************************************** * DefWndTrackScrollBar * @@ -785,7 +263,6 @@ LRESULT DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { -// WINDOWPLACEMENT wp; POINT Pt; LRESULT lResult; @@ -801,8 +278,9 @@ { case SC_MOVE: case SC_SIZE: - DefWndDoSizeMove(hWnd, wParam); + NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, FALSE); break; + case SC_MINIMIZE: if (hWnd == GetActiveWindow()) ShowOwnedPopups(hWnd,FALSE); @@ -823,6 +301,7 @@ case SC_CLOSE: return SendMessageW(hWnd, WM_CLOSE, 0, 0); + // case SC_DEFAULT: case SC_MOUSEMENU: { @@ -887,65 +366,6 @@ return(0); } -#if 0 // Move to Win32k -LRESULT -DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos) -{ - POINT maxTrack, minTrack; - LONG style = GetWindowLongPtrA(hWnd, GWL_STYLE); - - if (Pos->flags & SWP_NOSIZE) return 0; - if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) - { - WinPosGetMinMaxInfo(hWnd, NULL, NULL, &minTrack, &maxTrack); - Pos->cx = min(Pos->cx, maxTrack.x); - Pos->cy = min(Pos->cy, maxTrack.y); - if (!(style & WS_MINIMIZE)) - { - if (Pos->cx < minTrack.x) Pos->cx = minTrack.x; - if (Pos->cy < minTrack.y) Pos->cy = minTrack.y; - } - } - else - { - Pos->cx = max(Pos->cx, 0); - Pos->cy = max(Pos->cy, 0); - } - return 0; -} - -LRESULT -DefWndHandleWindowPosChanged(HWND hWnd, WINDOWPOS* Pos) -{ - RECT Rect; - - GetClientRect(hWnd, &Rect); - MapWindowPoints(hWnd, (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_CHILD ? - GetParent(hWnd) : NULL), (LPPOINT) &Rect, 2); - - if (! (Pos->flags & SWP_NOCLIENTMOVE)) - { - SendMessageW(hWnd, WM_MOVE, 0, MAKELONG(Rect.left, Rect.top)); - } - - if (! (Pos->flags & SWP_NOCLIENTSIZE)) - { - WPARAM wp = SIZE_RESTORED; - if (IsZoomed(hWnd)) - { - wp = SIZE_MAXIMIZED; - } - else if (IsIconic(hWnd)) - { - wp = SIZE_MINIMIZED; - } - SendMessageW(hWnd, WM_SIZE, wp, - MAKELONG(Rect.right - Rect.left, Rect.bottom - Rect.top)); - } - - return 0; -} -#endif /*********************************************************************** * DefWndControlColor @@ -1032,7 +452,7 @@ DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) { HICON hIcon, hIconSmall, hIconOld; - + if ( wParam > ICON_SMALL2 ) { SetLastError(ERROR_INVALID_PARAMETER); @@ -1195,17 +615,7 @@ { return (DefWndNCLButtonDblClk(hWnd, wParam, lParam)); } -/* Moved to Win32k - case WM_WINDOWPOSCHANGING: - { - return (DefWndHandleWindowPosChanging(hWnd, (WINDOWPOS*)lParam)); - } - - case WM_WINDOWPOSCHANGED: - { - return (DefWndHandleWindowPosChanged(hWnd, (WINDOWPOS*)lParam)); - } -*/ + case WM_NCRBUTTONDOWN: return NC_HandleNCRButtonDown( hWnd, wParam, lParam ); @@ -1344,34 +754,7 @@ } return (0); } -/* Moved to Win32k - case WM_SYNCPAINT: - { - HRGN hRgn; - hRgn = CreateRectRgn(0, 0, 0, 0); - if (GetUpdateRgn(hWnd, hRgn, FALSE) != NULLREGION) - { - RedrawWindow(hWnd, NULL, hRgn, - RDW_ERASENOW | RDW_ERASE | RDW_FRAME | - RDW_ALLCHILDREN); - } - DeleteObject(hRgn); - return (0); - } - - case WM_SETREDRAW: - { - LONG_PTR Style = GetWindowLongPtrW(hWnd, GWL_STYLE); - if (wParam) SetWindowLongPtr(hWnd, GWL_STYLE, Style | WS_VISIBLE); - else - { - RedrawWindow(hWnd, NULL, 0, RDW_ALLCHILDREN | RDW_VALIDATE); - Style &= ~WS_VISIBLE; - SetWindowLongPtr(hWnd, GWL_STYLE, Style); - } - return (0); - } -*/ + case WM_CLOSE: DestroyWindow(hWnd); return (0); @@ -1885,6 +1268,7 @@ case WM_SETHOTKEY: case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: + case WM_APPCOMMAND: { LRESULT lResult; NtUserMessageCall( hWnd, Msg, wParam, lParam, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, !bUnicode);
10 years, 8 months
1
0
0
0
[jimtabor] 62744: [Win32k] - Move the system command Move and Size to Win32k. Fix most redraw issues. ATM this will be plugged in after User32 DefWnd cleanup. - Move more DefWindowProc functions in...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Apr 13 23:53:34 2014 New Revision: 62744 URL:
http://svn.reactos.org/svn/reactos?rev=62744&view=rev
Log: [Win32k] - Move the system command Move and Size to Win32k. Fix most redraw issues. ATM this will be plugged in after User32 DefWnd cleanup. - Move more DefWindowProc functions into Win32k, these too will been needed soon. - Added more server side support functions. - See CORE-7447. Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.c trunk/reactos/win32ss/user/ntuser/cursoricon.h trunk/reactos/win32ss/user/ntuser/cursoricon_new.c trunk/reactos/win32ss/user/ntuser/defwnd.c trunk/reactos/win32ss/user/ntuser/input.h trunk/reactos/win32ss/user/ntuser/monitor.c trunk/reactos/win32ss/user/ntuser/monitor.h trunk/reactos/win32ss/user/ntuser/win32.h Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/cursoricon.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/cursoricon.c [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -330,6 +330,55 @@ } } +HCURSOR FASTCALL +IntSetCursor( + HCURSOR hCursor) +{ + PCURICON_OBJECT pcurOld, pcurNew; + HCURSOR hOldCursor = NULL; + + if (hCursor) + { + pcurNew = UserGetCurIconObject(hCursor); + if (!pcurNew) + { + EngSetLastError(ERROR_INVALID_CURSOR_HANDLE); + goto leave; + } + } + else + { + pcurNew = NULL; + } + + pcurOld = UserSetCursor(pcurNew, FALSE); + if (pcurOld) + { + hOldCursor = (HCURSOR)pcurOld->Self; + UserDereferenceObject(pcurOld); + } +leave: + return hOldCursor; +} + +BOOL FASTCALL +IntDestroyCursor( + HANDLE hCurIcon, + BOOL bForce) +{ + PCURICON_OBJECT CurIcon; + BOOL ret; + + if (!(CurIcon = UserGetCurIconObject(hCurIcon))) + { + return FALSE; + } + + ret = IntDestroyCurIconObject(CurIcon, PsGetCurrentProcessWin32Process()); + /* Note: IntDestroyCurIconObject will remove our reference for us! */ + + return ret; +} /* * @implemented Modified: trunk/reactos/win32ss/user/ntuser/cursoricon.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/cursoricon.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/cursoricon.h [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -113,6 +113,8 @@ BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook); BOOL APIENTRY UserClipCursor(RECTL *prcl); PSYSTEM_CURSORINFO IntGetSysCursorInfo(VOID); +HCURSOR FASTCALL IntSetCursor(HCURSOR hCursor); +BOOL FASTCALL IntDestroyCursor(HANDLE hCurIcon, BOOL bForce); #define IntReleaseCurIconObject(CurIconObj) \ UserDereferenceObject(CurIconObj) Modified: trunk/reactos/win32ss/user/ntuser/cursoricon_new.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/cursor…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/cursoricon_new.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/cursoricon_new.c [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -246,6 +246,66 @@ } } +HCURSOR FASTCALL +IntSetCursor( + HCURSOR hCursor) +{ + PCURICON_OBJECT pcurOld, pcurNew; + HCURSOR hOldCursor = NULL; + + if (hCursor) + { + pcurNew = UserGetCurIconObject(hCursor); + if (!pcurNew) + { + EngSetLastError(ERROR_INVALID_CURSOR_HANDLE); + goto leave; + } + pcurNew->CURSORF_flags |= CURSORF_CURRENT; + } + else + { + pcurNew = NULL; + } + + pcurOld = UserSetCursor(pcurNew, FALSE); + if (pcurOld) + { + hOldCursor = pcurOld->head.h; + pcurOld->CURSORF_flags &= ~CURSORF_CURRENT; + if(UserObjectInDestroy(hOldCursor)) + { + /* Destroy it once and for all */ + IntDestroyCurIconObject(pcurOld, TRUE); + hOldCursor = NULL; + } + else + { + UserDereferenceObject(pcurOld); + } + } +leave: + return hOldCursor; +} + +BOOL FASTCALL +IntDestroyCursor( + HANDLE hCurIcon, + BOOL bForce) +{ + PCURICON_OBJECT CurIcon; + BOOL ret; + + if (!(CurIcon = UserGetCurIconObject(hCurIcon))) + { + RETURN(FALSE); + } + + ret = IntDestroyCurIconObject(CurIcon, bForce); + /* Note: IntDestroyCurIconObject will remove our reference for us! */ + + return ret; +} /* * @implemented Modified: trunk/reactos/win32ss/user/ntuser/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/defwnd…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -11,6 +11,26 @@ #include <windowsx.h> DBG_DEFAULT_CHANNEL(UserDefwnd); + +#define UserHasDlgFrameStyle(Style, ExStyle) \ + (((ExStyle) & WS_EX_DLGMODALFRAME) || \ + (((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME)))) + +#define UserHasThickFrameStyle(Style, ExStyle) \ + (((Style) & WS_THICKFRAME) && \ + (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME))) + +#define UserHasThinFrameStyle(Style, ExStyle) \ + (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP)))) + +#define ON_LEFT_BORDER(hit) \ + (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT)) +#define ON_RIGHT_BORDER(hit) \ + (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT)) +#define ON_TOP_BORDER(hit) \ + (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT)) +#define ON_BOTTOM_BORDER(hit) \ + (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) // Client Shutdown messages #define MCS_SHUTDOWNTIMERS 1 @@ -132,7 +152,6 @@ return IntGetSysColorBrush(COLOR_WINDOW); } - LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS* Pos) @@ -163,27 +182,27 @@ LRESULT FASTCALL DefWndHandleWindowPosChanged(PWND pWnd, WINDOWPOS* Pos) { - RECT Rect; - LONG style = pWnd->style; - - IntGetClientRect(pWnd, &Rect); - IntMapWindowPoints(pWnd, (style & WS_CHILD ? IntGetParent(pWnd) : NULL), (LPPOINT) &Rect, 2); - - if (!(Pos->flags & SWP_NOCLIENTMOVE)) - { + RECT Rect; + LONG style = pWnd->style; + + IntGetClientRect(pWnd, &Rect); + IntMapWindowPoints(pWnd, (style & WS_CHILD ? IntGetParent(pWnd) : NULL), (LPPOINT) &Rect, 2); + + if (!(Pos->flags & SWP_NOCLIENTMOVE)) + { co_IntSendMessage(UserHMGetHandle(pWnd), WM_MOVE, 0, MAKELONG(Rect.left, Rect.top)); - } - - if (!(Pos->flags & SWP_NOCLIENTSIZE) || (Pos->flags & SWP_STATECHANGED)) - { + } + + if (!(Pos->flags & SWP_NOCLIENTSIZE) || (Pos->flags & SWP_STATECHANGED)) + { if (style & WS_MINIMIZE) co_IntSendMessage(UserHMGetHandle(pWnd), WM_SIZE, SIZE_MINIMIZED, 0 ); else { WPARAM wp = (style & WS_MAXIMIZE) ? SIZE_MAXIMIZED : SIZE_RESTORED; co_IntSendMessage(UserHMGetHandle(pWnd), WM_SIZE, wp, MAKELONG(Rect.right - Rect.left, Rect.bottom - Rect.top)); } - } - return 0; + } + return 0; } VOID FASTCALL @@ -192,12 +211,12 @@ ULONG width, ULONG height) { - HBRUSH hbrush = NtGdiSelectBrush( hdc, gpsi->hbrGray ); - NtGdiPatBlt( hdc, rect->left, rect->top, rect->right - rect->left - width, height, PATINVERT ); - NtGdiPatBlt( hdc, rect->left, rect->top + height, width, rect->bottom - rect->top - height, PATINVERT ); - NtGdiPatBlt( hdc, rect->left + width, rect->bottom - 1, rect->right - rect->left - width, -height, PATINVERT ); - NtGdiPatBlt( hdc, rect->right - 1, rect->top, -width, rect->bottom - rect->top - height, PATINVERT ); - NtGdiSelectBrush( hdc, hbrush ); + HBRUSH hbrush = NtGdiSelectBrush( hdc, gpsi->hbrGray ); + NtGdiPatBlt( hdc, rect->left, rect->top, rect->right - rect->left - width, height, PATINVERT ); + NtGdiPatBlt( hdc, rect->left, rect->top + height, width, rect->bottom - rect->top - height, PATINVERT ); + NtGdiPatBlt( hdc, rect->left + width, rect->bottom - 1, rect->right - rect->left - width, -height, PATINVERT ); + NtGdiPatBlt( hdc, rect->right - 1, rect->top, -width, rect->bottom - rect->top - height, PATINVERT ); + NtGdiSelectBrush( hdc, hbrush ); } VOID FASTCALL @@ -205,10 +224,503 @@ RECTL *rect, BOOL thickframe) { - if (thickframe) UserDrawWindowFrame(hdc, rect, UserGetSystemMetrics(SM_CXFRAME), UserGetSystemMetrics(SM_CYFRAME)); - else UserDrawWindowFrame(hdc, rect, 1, 1); + if (thickframe) UserDrawWindowFrame(hdc, rect, UserGetSystemMetrics(SM_CXFRAME), UserGetSystemMetrics(SM_CYFRAME)); + else UserDrawWindowFrame(hdc, rect, 1, 1); } +/*********************************************************************** + * NC_GetInsideRect + * + * Get the 'inside' rectangle of a window, i.e. the whole window rectangle + * but without the borders (if any). + */ +void FASTCALL +NC_GetInsideRect(PWND Wnd, RECT *rect) +{ + ULONG Style; + ULONG ExStyle; + + Style = Wnd->style; + ExStyle = Wnd->ExStyle; + + rect->top = rect->left = 0; + rect->right = Wnd->rcWindow.right - Wnd->rcWindow.left; + rect->bottom = Wnd->rcWindow.bottom - Wnd->rcWindow.top; + + if (Style & WS_ICONIC) return; + + /* Remove frame from rectangle */ + if (UserHasThickFrameStyle(Style, ExStyle )) + { + RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME)); + } + else + { + if (UserHasDlgFrameStyle(Style, ExStyle )) + { + RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); + /* FIXME: this isn't in NC_AdjustRect? why not? */ + if (ExStyle & WS_EX_DLGMODALFRAME) + RECTL_vInflateRect( rect, -1, 0 ); + } + else + { + if (UserHasThinFrameStyle(Style, ExStyle)) + { + RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); + } + } + } + /* We have additional border information if the window + * is a child (but not an MDI child) */ + if ((Style & WS_CHILD) && !(ExStyle & WS_EX_MDICHILD)) + { + if (ExStyle & WS_EX_CLIENTEDGE) + RECTL_vInflateRect (rect, -UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE)); + if (ExStyle & WS_EX_STATICEDGE) + RECTL_vInflateRect (rect, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); + } +} + +LONG FASTCALL +DefWndStartSizeMove(PWND Wnd, WPARAM wParam, POINT *capturePoint) +{ + LONG hittest = 0; + POINT pt; + MSG msg; + RECT rectWindow; + ULONG Style = Wnd->style; + PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); + + rectWindow = Wnd->rcWindow; + + if ((wParam & 0xfff0) == SC_MOVE) + { + /* Move pointer at the center of the caption */ + RECT rect = rectWindow; + /* Note: to be exactly centered we should take the different types + * of border into account, but it shouldn't make more than a few pixels + * of difference so let's not bother with that */ + if (Style & WS_SYSMENU) + rect.left += UserGetSystemMetrics(SM_CXSIZE) + 1; + if (Style & WS_MINIMIZEBOX) + rect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1; + if (Style & WS_MAXIMIZEBOX) + rect.right -= UserGetSystemMetrics(SM_CXSIZE) + 1; + pt.x = (rect.right + rect.left) / 2; + pt.y = rect.top + UserGetSystemMetrics(SM_CYSIZE)/2; + hittest = HTCAPTION; + *capturePoint = pt; + } + else /* SC_SIZE */ + { + pt.x = pt.y = 0; + while (!hittest) + { + if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) return 0; + if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue; + + switch(msg.message) + { + case WM_MOUSEMOVE: + //// Clamp the mouse position to the window rectangle when starting a window resize. + pt.x = min( max( msg.pt.x, rectWindow.left ), rectWindow.right - 1 ); + pt.y = min( max( msg.pt.y, rectWindow.top ), rectWindow.bottom - 1 ); + hittest = GetNCHitEx(Wnd, pt); + if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) hittest = 0; + break; + + case WM_LBUTTONUP: + return 0; + + case WM_KEYDOWN: + switch (msg.wParam) + { + case VK_UP: + hittest = HTTOP; + pt.x = (rectWindow.left+rectWindow.right)/2; + pt.y = rectWindow.top + UserGetSystemMetrics(SM_CYFRAME) / 2; + break; + case VK_DOWN: + hittest = HTBOTTOM; + pt.x = (rectWindow.left+rectWindow.right)/2; + pt.y = rectWindow.bottom - UserGetSystemMetrics(SM_CYFRAME) / 2; + break; + case VK_LEFT: + hittest = HTLEFT; + pt.x = rectWindow.left + UserGetSystemMetrics(SM_CXFRAME) / 2; + pt.y = (rectWindow.top+rectWindow.bottom)/2; + break; + case VK_RIGHT: + hittest = HTRIGHT; + pt.x = rectWindow.right - UserGetSystemMetrics(SM_CXFRAME) / 2; + pt.y = (rectWindow.top+rectWindow.bottom)/2; + break; + case VK_RETURN: + case VK_ESCAPE: + return 0; + } + default: + IntTranslateKbdMessage( &msg, 0 ); + pti->TIF_flags |= TIF_MOVESIZETRACKING; + IntDispatchMessage( &msg ); + pti->TIF_flags |= TIF_MOVESIZETRACKING; + break; + } + } + *capturePoint = pt; + } + UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE); + co_IntSendMessage(UserHMGetHandle(Wnd), WM_SETCURSOR, (WPARAM)UserHMGetHandle(Wnd), MAKELONG(hittest, WM_MOUSEMOVE)); + return hittest; +} + +// +// System Command Size and Move +// +// Perform SC_MOVE and SC_SIZE commands. +// +VOID FASTCALL +DefWndDoSizeMove(PWND pwnd, WORD wParam) +{ + MSG msg; + RECT sizingRect, mouseRect, origRect, unmodRect; + HDC hdc; + LONG hittest = (LONG)(wParam & 0x0f); + HCURSOR hDragCursor = 0, hOldCursor = 0; + POINT minTrack, maxTrack; + POINT capturePoint, pt; + ULONG Style, ExStyle; + BOOL thickframe; + BOOL iconic; + BOOL moved = FALSE; + BOOL DragFullWindows = FALSE; + PWND pWndParent = NULL; + WPARAM syscommand = (wParam & 0xfff0); + PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); + //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!! + // The task bar can grow in size and can not reduce due to the change + // in the work area. + + Style = pwnd->style; + ExStyle = pwnd->ExStyle; + iconic = (Style & WS_MINIMIZE) != 0; + + if ((Style & WS_MAXIMIZE) || !IntIsWindowVisible(pwnd)) return; + + thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic; + + // + // Show window contents while dragging the window, get flag from registry data. + // + UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0); + + pt.x = pti->ptLast.x; + pt.y = pti->ptLast.y; + capturePoint = pt; + UserClipCursor( NULL ); + + TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n", + pwnd, syscommand, hittest, pt.x, pt.y); + + if (syscommand == SC_MOVE) + { + if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint); + if (!hittest) return; + } + else /* SC_SIZE */ + { + if (!thickframe) return; + if (hittest && (syscommand != SC_MOUSEMENU)) + { + hittest += (HTLEFT - WMSZ_LEFT); + } + else + { + co_UserSetCapture(UserHMGetHandle(pwnd)); + hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint); + if (!hittest) + { + IntReleaseCapture(); + return; + } + } + } + + /* Get min/max info */ + + co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack); + sizingRect = pwnd->rcWindow; + origRect = sizingRect; + if (Style & WS_CHILD) + { + pWndParent = IntGetParent(pwnd); + IntGetClientRect( pWndParent, &mouseRect ); + IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 ); + IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 ); + unmodRect = sizingRect; + } + else + { + if (!(ExStyle & WS_EX_TOPMOST)) + { + UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0); + } + else + { + RECTL_vSetRect(&mouseRect, 0, 0, UserGetSystemMetrics(SM_CXSCREEN), UserGetSystemMetrics(SM_CYSCREEN)); + } + unmodRect = sizingRect; + } + + if (ON_LEFT_BORDER(hittest)) + { + mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left ); + mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left ); + } + else if (ON_RIGHT_BORDER(hittest)) + { + mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right ); + mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right ); + } + if (ON_TOP_BORDER(hittest)) + { + mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top ); + mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top); + } + else if (ON_BOTTOM_BORDER(hittest)) + { + mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom ); + mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom ); + } + + hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE ); + + if ( iconic ) /* create a cursor for dragging */ + { + hDragCursor = pwnd->pcls->hIcon;; + if ( !hDragCursor ) hDragCursor = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 ); + if ( !hDragCursor ) iconic = FALSE; + } + + /* repaint the window before moving it around */ + co_UserRedrawWindow( pwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN); + + IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0); + + co_IntSendMessage( UserHMGetHandle(pwnd), WM_ENTERSIZEMOVE, 0, 0 ); + + MsqSetStateWindow(pti, MSQ_STATE_MOVESIZE, UserHMGetHandle(pwnd)); + + if (IntGetCapture() != UserHMGetHandle(pwnd)) co_UserSetCapture( UserHMGetHandle(pwnd) ); + + pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING; + + for(;;) + { + int dx = 0, dy = 0; + + if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break; + if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue; + + /* Exit on button-up, Return, or Esc */ + if ((msg.message == WM_LBUTTONUP) || + ((msg.message == WM_KEYDOWN) && + ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break; + + if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE)) + { + IntTranslateKbdMessage( &msg , 0 ); + IntDispatchMessage( &msg ); + continue; /* We are not interested in other messages */ + } + + pt = msg.pt; + + if (msg.message == WM_KEYDOWN) switch(msg.wParam) + { + case VK_UP: pt.y -= 8; break; + case VK_DOWN: pt.y += 8; break; + case VK_LEFT: pt.x -= 8; break; + case VK_RIGHT: pt.x += 8; break; + } + + pt.x = max( pt.x, mouseRect.left ); + pt.x = min( pt.x, mouseRect.right - 1 ); + pt.y = max( pt.y, mouseRect.top ); + pt.y = min( pt.y, mouseRect.bottom - 1 ); + + dx = pt.x - capturePoint.x; + dy = pt.y - capturePoint.y; + + if (dx || dy) + { + if ( !moved ) + { + moved = TRUE; + + if ( iconic ) /* ok, no system popup tracking */ + { + hOldCursor = IntSetCursor(hDragCursor); + UserShowCursor( TRUE ); + } + else if(!DragFullWindows) + UserDrawMovingFrame( hdc, &sizingRect, thickframe ); + } + + if (msg.message == WM_KEYDOWN) UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE); + else + { + RECT newRect = unmodRect; + + if (!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); + if (hittest == HTCAPTION) RECTL_vOffsetRect( &newRect, dx, dy ); + if (ON_LEFT_BORDER(hittest)) newRect.left += dx; + else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; + if (ON_TOP_BORDER(hittest)) newRect.top += dy; + else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; + capturePoint = pt; + + // + // Save the new position to the unmodified rectangle. This allows explorer task bar + // sizing. Explorer will forces back the position unless a certain amount of sizing + // has occurred. + // + unmodRect = newRect; + + /* determine the hit location */ + if (syscommand == SC_SIZE) + { + WPARAM wpSizingHit = 0; + + if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT) + wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT); + co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect ); + } + else + co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect ); + + if (!iconic) + { + if (!DragFullWindows) + UserDrawMovingFrame( hdc, &newRect, thickframe ); + else + { // Moving the whole window now! + PWND pwndTemp; + //// This causes the mdi child window to jump up when it is moved. + //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 ); + co_WinPosSetWindowPos( pwnd, + 0, + newRect.left, + newRect.top, + newRect.right - newRect.left, + newRect.bottom - newRect.top, + ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); + + // Update all the windows after the move or size, including this window. + for ( pwndTemp = pwnd->head.rpdesk->pDeskInfo->spwnd->spwndChild; + pwndTemp; + pwndTemp = pwndTemp->spwndNext ) + { + RECTL rect; + // Only the windows that overlap will be redrawn. + if (RECTL_bIntersectRect( &rect, &pwnd->rcWindow, &pwndTemp->rcWindow )) + { + co_UserRedrawWindow( pwndTemp, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN); + } + } + } + } + sizingRect = newRect; + } + } + } + + pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING; + + IntReleaseCapture(); + + if ( iconic ) + { + if ( moved ) /* restore cursors, show icon title later on */ + { + UserShowCursor( FALSE ); + IntSetCursor( hOldCursor ); + } + IntDestroyCursor( hDragCursor, FALSE ); + } + else if ( moved && !DragFullWindows ) + UserDrawMovingFrame( hdc, &sizingRect, thickframe ); + + UserReleaseDC(NULL, hdc, FALSE); + + //// This causes the mdi child window to jump up when it is moved. + //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 ); + + if (co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)UserHMGetHandle(pwnd), (LPARAM)&sizingRect)) + { + ERR("DoSizeMove : WH_CBT Call Hook return!\n"); + moved = FALSE; + } + + IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0); + + MsqSetStateWindow(pti, MSQ_STATE_MOVESIZE, NULL); + + co_IntSendMessage( UserHMGetHandle(pwnd), WM_EXITSIZEMOVE, 0, 0 ); + //// wine mdi hack + co_IntSendMessage( UserHMGetHandle(pwnd), WM_SETVISIBLE, !!(pwnd->style & WS_MINIMIZE), 0L); + //// + /* window moved or resized */ + if (moved) + { + /* if the moving/resizing isn't canceled call SetWindowPos + * with the new position or the new size of the window + */ + if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) ) + { + /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */ + if (!DragFullWindows || iconic ) + { + co_WinPosSetWindowPos( pwnd, + 0, + sizingRect.left, + sizingRect.top, + sizingRect.right - sizingRect.left, + sizingRect.bottom - sizingRect.top, + ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); + } + } + else + { /* restore previous size/position */ + if ( DragFullWindows ) + { + co_WinPosSetWindowPos( pwnd, + 0, + origRect.left, + origRect.top, + origRect.right - origRect.left, + origRect.bottom - origRect.top, + ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 ); + } + } + } + + if ( IntIsWindow(UserHMGetHandle(pwnd)) ) + if ( iconic ) + { + /* Single click brings up the system menu when iconized */ + if ( !moved ) + { + if( Style & WS_SYSMENU ) + co_IntSendMessage( UserHMGetHandle(pwnd), WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y)); + } + } +} + +// +// Handle a WM_SYSCOMMAND message. Called from DefWindowProc(). +// LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam) { @@ -227,15 +739,58 @@ { case SC_MOVE: case SC_SIZE: - //DefWndDoSizeMove(pWnd, wParam); - ERR("SC_MOVESIZE\n"); + DefWndDoSizeMove(pWnd, wParam); break; + + case SC_MINIMIZE: + if (UserHMGetHandle(pWnd) == UserGetActiveWindow()) + IntShowOwnedPopups(pWnd,FALSE); // This is done in ShowWindow! Need to retest! + co_WinPosShowWindow( pWnd, SW_MINIMIZE ); + break; + + case SC_MAXIMIZE: + if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow()) + IntShowOwnedPopups(pWnd,TRUE); + co_WinPosShowWindow( pWnd, SW_MAXIMIZE ); + break; + + case SC_RESTORE: + if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow()) + IntShowOwnedPopups(pWnd,TRUE); + co_WinPosShowWindow( pWnd, SW_RESTORE ); + break; + + case SC_CLOSE: + return co_IntSendMessage(UserHMGetHandle(pWnd), WM_CLOSE, 0, 0); case SC_SCREENSAVE: ERR("Screensaver Called!\n"); UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always lParam 0 == not Secure break; + case SC_HOTKEY: + { + USER_REFERENCE_ENTRY Ref; + + pWnd = ValidateHwndNoErr((HWND)lParam); + if (pWnd) + { + if (pWnd->spwndLastActive) + { + pWnd = pWnd->spwndLastActive; + } + UserRefObjectCo(pWnd, &Ref); + co_IntSetForegroundWindow(pWnd); + UserDerefObjectCo(pWnd); + if (pWnd->style & WS_MINIMIZE) + { + UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_RESTORE, 0); + } + } + } + break; + + default: // We do not support anything else here so we should return normal even when sending a hook. return 0; @@ -243,6 +798,39 @@ return(Hook ? 1 : 0); // Don't call us again from user space. } + +VOID FASTCALL DefWndPrint( PWND pwnd, HDC hdc, ULONG uFlags) +{ + /* + * Visibility flag. + */ + if ( (uFlags & PRF_CHECKVISIBLE) && + !IntIsWindowVisible(pwnd) ) + return; + + /* + * Unimplemented flags. + */ + if ( (uFlags & PRF_CHILDREN) || + (uFlags & PRF_OWNED) || + (uFlags & PRF_NONCLIENT) ) + { + FIXME("WM_PRINT message with unsupported flags\n"); + } + + /* + * Background + */ + if ( uFlags & PRF_ERASEBKGND) + co_IntSendMessage(UserHMGetHandle(pwnd), WM_ERASEBKGND, (WPARAM)hdc, 0); + + /* + * Client area + */ + if ( uFlags & PRF_CLIENT) + co_IntSendMessage(UserHMGetHandle(pwnd), WM_PRINTCLIENT, (WPARAM)hdc, uFlags); +} + /* Win32k counterpart of User DefWindowProc @@ -304,6 +892,10 @@ UserDerefObjectCo(Wnd->spwndParent); break; + case WM_CLOSE: + co_UserDestroyWindow(Wnd); + break; + case WM_CTLCOLORMSGBOX: case WM_CTLCOLOREDIT: case WM_CTLCOLORLISTBOX: @@ -316,6 +908,51 @@ case WM_CTLCOLOR: return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam)); + case WM_ACTIVATE: + /* The default action in Windows is to set the keyboard focus to + * the window, if it's being activated and not minimized */ + if (LOWORD(wParam) != WA_INACTIVE && + !(Wnd->style & WS_MINIMIZE)) + { + //ERR("WM_ACTIVATE %p\n",hWnd); + co_UserSetFocus(Wnd); + } + break; + + case WM_MOUSEWHEEL: + if (Wnd->style & WS_CHILD) + { + HWND hwndParent; + PWND pwndParent = IntGetParent(Wnd); + hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL; + return co_IntSendMessage( hwndParent, WM_MOUSEWHEEL, wParam, lParam); + } + break; + + case WM_ERASEBKGND: + case WM_ICONERASEBKGND: + { + RECT Rect; + HBRUSH hBrush = Wnd->pcls->hbrBackground; + if (!hBrush) return 0; + if (hBrush <= (HBRUSH)COLOR_MENUBAR) + { + hBrush = IntGetSysColorBrush((INT)hBrush); + } + if (Wnd->pcls->style & CS_PARENTDC) + { + /* can't use GetClipBox with a parent DC or we fill the whole parent */ + IntGetClientRect(Wnd, &Rect); + GreDPtoLP((HDC)wParam, (LPPOINT)&Rect, 2); + } + else + { + GdiGetClipBox((HDC)wParam, &Rect); + } + FillRect((HDC)wParam, &Rect, hBrush); + return (1); + } + case WM_GETHOTKEY: //ERR("WM_GETHOTKEY\n"); return DefWndGetHotKey(Wnd); @@ -329,6 +966,46 @@ Point.x = GET_X_LPARAM(lParam); Point.y = GET_Y_LPARAM(lParam); return GetNCHitEx(Wnd, Point); + } + + case WM_PRINT: + { + DefWndPrint(Wnd, (HDC)wParam, lParam); + return (0); + } + + case WM_PAINTICON: + case WM_PAINT: + { + PAINTSTRUCT Ps; + HDC hDC; + + /* If already in Paint and Client area is not empty just return. */ + if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient)) + { + ERR("In Paint and Client area is not empty!\n"); + return 0; + } + + hDC = IntBeginPaint(Wnd, &Ps); + if (hDC) + { + HICON hIcon; + if (((Wnd->style & WS_MINIMIZE) != 0) && (hIcon = Wnd->pcls->hIcon)) + { + RECT ClientRect; + INT x, y; + PCURICON_OBJECT pIcon; + if (!(pIcon = UserGetCurIconObject(hIcon))) return 0; + ERR("Doing Paint and Client area is empty!\n"); + IntGetClientRect(Wnd, &ClientRect); + x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2; + y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2; + UserDrawIconEx( hDC, x, y, pIcon, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE ); + } + IntEndPaint(Wnd, &Ps); + } + return (0); } case WM_SYNCPAINT: @@ -430,7 +1107,6 @@ { if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size. - hIcon = (HICON)1; } return hIcon; } Modified: trunk/reactos/win32ss/user/ntuser/input.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/input.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/input.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/input.h [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -97,6 +97,5 @@ ((ks)[GET_KS_BYTE(vk)] | GET_KS_LOCK_BIT(vk)) : \ ((ks)[GET_KS_BYTE(vk)] & ~GET_KS_LOCK_BIT(vk))) - extern PKL gspklBaseLayout; extern KEYBOARD_ATTRIBUTES gKeyboardInfo; Modified: trunk/reactos/win32ss/user/ntuser/monitor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/monito…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/monitor.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/monitor.c [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -467,6 +467,35 @@ return UserGetMonitorObject(hMonitor); } +PMONITOR +FASTCALL +UserMonitorFromPoint( + IN POINT pt, + IN DWORD dwFlags) +{ + RECTL rc; + HMONITOR hMonitor = NULL; + + /* Check if flags are valid */ + if (dwFlags != MONITOR_DEFAULTTONULL && + dwFlags != MONITOR_DEFAULTTOPRIMARY && + dwFlags != MONITOR_DEFAULTTONEAREST) + { + EngSetLastError(ERROR_INVALID_FLAGS); + return NULL; + } + + /* Fill rect (bottom-right exclusive) */ + rc.left = pt.x; + rc.right = pt.x + 1; + rc.top = pt.y; + rc.bottom = pt.y + 1; + + /* Find intersecting monitor */ + IntGetMonitorsFromRect(&rc, &hMonitor, NULL, 1, dwFlags); + + return UserGetMonitorObject(hMonitor); +} /* PUBLIC FUNCTIONS ***********************************************************/ Modified: trunk/reactos/win32ss/user/ntuser/monitor.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/monito…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/monitor.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/monitor.h [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -29,5 +29,6 @@ PMONITOR NTAPI UserGetMonitorObject(IN HMONITOR); PMONITOR NTAPI UserGetPrimaryMonitor(VOID); PMONITOR NTAPI UserMonitorFromRect(PRECTL,DWORD); +PMONITOR FASTCALL UserMonitorFromPoint(POINT,DWORD); /* EOF */ Modified: trunk/reactos/win32ss/user/ntuser/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/win32.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/win32.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/win32.h [iso-8859-1] Sun Apr 13 23:53:34 2014 @@ -125,7 +125,7 @@ /* Queue of messages posted to the queue. */ LIST_ENTRY PostedMessagesListHead; // mlPost - + UINT fsChangeBitsRemoved; UINT cWindows; UINT cVisWindows; LIST_ENTRY aphkStart[NB_HOOKS]; @@ -238,6 +238,7 @@ struct _CURICON_OBJECT* pCursorCache; LUID luidSession; USERSTARTUPINFO usi; + PVOID pW32Job; DWORD dwLayout; DWORD dwRegisteredClasses; /* ReactOS */
10 years, 8 months
1
0
0
0
[tkreuzer] 62743: [NTOSKRNL] Simplify code in ExpLookupHandleTableEntry CORE-6843 #resolve
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Apr 13 16:45:58 2014 New Revision: 62743 URL:
http://svn.reactos.org/svn/reactos?rev=62743&view=rev
Log: [NTOSKRNL] Simplify code in ExpLookupHandleTableEntry CORE-6843 #resolve Modified: trunk/reactos/ntoskrnl/ex/handle.c trunk/reactos/ntoskrnl/include/internal/ex.h Modified: trunk/reactos/ntoskrnl/ex/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/handle.c?rev=6…
============================================================================== --- trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] Sun Apr 13 16:45:58 2014 @@ -34,90 +34,59 @@ PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, - IN EXHANDLE LookupHandle) -{ - ULONG TableLevel, NextHandle; - ULONG_PTR i, j, k, TableBase; - PHANDLE_TABLE_ENTRY Entry = NULL; - EXHANDLE Handle = LookupHandle; - PUCHAR Level1, Level2, Level3; - - /* Clear the tag bits and check what the next handle is */ + IN EXHANDLE Handle) +{ + ULONG TableLevel; + ULONG_PTR TableBase; + PHANDLE_TABLE_ENTRY HandleArray, Entry; + PVOID *PointerArray; + + /* Clear the tag bits */ Handle.TagBits = 0; - NextHandle = *(volatile ULONG*)&HandleTable->NextHandleNeedingPool; - if (Handle.Value >= NextHandle) return NULL; + + /* Check if the handle is in the allocated range */ + if (Handle.Value >= HandleTable->NextHandleNeedingPool) + { + return NULL; + } /* Get the table code */ - TableBase = *(volatile ULONG_PTR*)&HandleTable->TableCode; + TableBase = HandleTable->TableCode; /* Extract the table level and actual table base */ TableLevel = (ULONG)(TableBase & 3); - TableBase = TableBase - TableLevel; + TableBase &= ~3; + + PointerArray = (PVOID*)TableBase; + HandleArray = (PHANDLE_TABLE_ENTRY)TableBase; /* Check what level we're running at */ switch (TableLevel) { - /* Direct index */ + case 2: + + /* Get the mid level pointer array */ + PointerArray = PointerArray[Handle.HighIndex]; + + /* Fall through */ + case 1: + + /* Get the handle array */ + HandleArray = PointerArray[Handle.MidIndex]; + + /* Fall through */ case 0: - /* Use level 1 and just get the entry directly */ - Level1 = (PUCHAR)TableBase; - Entry = (PVOID)&Level1[Handle.Value * - (sizeof(HANDLE_TABLE_ENTRY) / - SizeOfHandle(1))]; - break; - - /* Nested index into mid level */ - case 1: - - /* Get the second table and index into it */ - Level2 = (PUCHAR)TableBase; - i = Handle.Value % SizeOfHandle(LOW_LEVEL_ENTRIES); - - /* Substract this index, and get the next one */ - Handle.Value -= i; - j = Handle.Value / - (SizeOfHandle(LOW_LEVEL_ENTRIES) / sizeof(PHANDLE_TABLE_ENTRY)); - - /* Now get the next table and get the entry from it */ - Level1 = (PUCHAR)*(PHANDLE_TABLE_ENTRY*)&Level2[j]; - Entry = (PVOID)&Level1[i * - (sizeof(HANDLE_TABLE_ENTRY) / - SizeOfHandle(1))]; - break; - - /* Nested index into high level */ - case 2: - - /* Start with the 3rd level table */ - Level3 = (PUCHAR)TableBase; - i = Handle.Value % SizeOfHandle(LOW_LEVEL_ENTRIES); - - /* Subtract this index and get the index for the next lower table */ - Handle.Value -= i; - k = Handle.Value / - (SizeOfHandle(LOW_LEVEL_ENTRIES) / sizeof(PHANDLE_TABLE_ENTRY)); - - /* Get the remaining index in the 2nd level table */ - j = k % (MID_LEVEL_ENTRIES * sizeof(PHANDLE_TABLE_ENTRY)); - - /* Get the remaining index, which is in the third table */ - k -= j; - k /= MID_LEVEL_ENTRIES; - - /* Extract the table level for the handle in each table */ - Level2 = (PUCHAR)*(PHANDLE_TABLE_ENTRY*)&Level3[k]; - Level1 = (PUCHAR)*(PHANDLE_TABLE_ENTRY*)&Level2[j]; - - /* Get the handle table entry */ - Entry = (PVOID)&Level1[i * - (sizeof(HANDLE_TABLE_ENTRY) / - SizeOfHandle(1))]; - - default: + /* Get the entry using the low index */ + Entry = &HandleArray[Handle.LowIndex]; /* All done */ break; + + default: + + NT_ASSERT(FALSE); + Entry = NULL; } /* Return the handle entry */ @@ -217,7 +186,7 @@ PAGED_CODE(); /* Check which level we're at */ - if (!TableLevel) + if (TableLevel == 0) { /* Select the first level table base and just free it */ Level1 = (PVOID)TableBase; @@ -504,7 +473,7 @@ PAGED_CODE(); /* Check how many levels we already have */ - if (!TableLevel) + if (TableLevel == 0) { /* Allocate a mid level, since we only have a low level */ Mid = ExpAllocateMidLevelTable(HandleTable, DoInit, &Low); @@ -599,6 +568,11 @@ Value = InterlockedExchangePointer((PVOID*)&ThirdLevel[i][j], Low); ASSERT(Value == NULL); } + } + else + { + /* Something is really broken */ + ASSERT(FALSE); } /* Update the index of the next handle */ Modified: trunk/reactos/ntoskrnl/include/internal/ex.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ex.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ex.h [iso-8859-1] Sun Apr 13 16:45:58 2014 @@ -33,18 +33,32 @@ extern KSPIN_LOCK ExpNonPagedLookasideListLock; extern KSPIN_LOCK ExpPagedLookasideListLock; -typedef struct _EXHANDLE -{ - union - { - struct - { - ULONG TagBits:2; - ULONG Index:30; - }; - HANDLE GenericHandleOverlay; - ULONG_PTR Value; - }; +#ifdef _WIN64 +#define HANDLE_LOW_BITS (PAGE_SHIFT - 4) +#define HANDLE_HIGH_BITS (PAGE_SHIFT - 3) +#else +#define HANDLE_LOW_BITS (PAGE_SHIFT - 3) +#define HANDLE_HIGH_BITS (PAGE_SHIFT - 2) +#endif +#define KERNEL_FLAG_BITS (sizeof(PVOID)*8 - 31) + +typedef union _EXHANDLE +{ + struct + { + ULONG_PTR TagBits:2; + ULONG_PTR Index:29; + }; + struct + { + ULONG_PTR TagBits2:2; + ULONG_PTR LowIndex:HANDLE_LOW_BITS; + ULONG_PTR MidIndex:HANDLE_HIGH_BITS; + ULONG_PTR HighIndex:HANDLE_HIGH_BITS; + ULONG_PTR KernelFlag:KERNEL_FLAG_BITS; + }; + HANDLE GenericHandleOverlay; + ULONG_PTR Value; } EXHANDLE, *PEXHANDLE; typedef struct _ETIMER
10 years, 8 months
1
0
0
0
[pschweitzer] 62742: [KMTESTS:NPFS] Add more tests for file info Tested by Thomas. CORE-7451
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Apr 13 16:16:30 2014 New Revision: 62742 URL:
http://svn.reactos.org/svn/reactos?rev=62742&view=rev
Log: [KMTESTS:NPFS] Add more tests for file info Tested by Thomas. CORE-7451 Added: trunk/rostests/kmtests/npfs/NpfsFileInfo.c (with props) Modified: trunk/rostests/kmtests/CMakeLists.txt trunk/rostests/kmtests/kmtest_drv/testlist.c Modified: trunk/rostests/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?re…
============================================================================== --- trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] Sun Apr 13 16:16:30 2014 @@ -30,6 +30,7 @@ example/KernelType.c npfs/NpfsConnect.c npfs/NpfsCreate.c + npfs/NpfsFileInfo.c npfs/NpfsHelpers.c npfs/NpfsReadWrite.c npfs/NpfsVolumeInfo.c Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Sun Apr 13 16:16:30 2014 @@ -40,6 +40,7 @@ KMT_TESTFUNC Test_MmSection; KMT_TESTFUNC Test_NpfsConnect; KMT_TESTFUNC Test_NpfsCreate; +KMT_TESTFUNC Test_NpfsFileInfo; KMT_TESTFUNC Test_NpfsReadWrite; KMT_TESTFUNC Test_NpfsVolumeInfo; KMT_TESTFUNC Test_ObReference; @@ -95,6 +96,7 @@ { "MmSection", Test_MmSection }, { "NpfsConnect", Test_NpfsConnect }, { "NpfsCreate", Test_NpfsCreate }, + { "NpfsFileInfo", Test_NpfsFileInfo }, { "NpfsReadWrite", Test_NpfsReadWrite }, { "NpfsVolumeInfo", Test_NpfsVolumeInfo }, { "ObReference", Test_ObReference }, Added: trunk/rostests/kmtests/npfs/NpfsFileInfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/npfs/NpfsFileInfo…
============================================================================== --- trunk/rostests/kmtests/npfs/NpfsFileInfo.c (added) +++ trunk/rostests/kmtests/npfs/NpfsFileInfo.c [iso-8859-1] Sun Apr 13 16:16:30 2014 @@ -0,0 +1,153 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory + * PURPOSE: Kernel-Mode Test Suite NPFS file information test + * PROGRAMMER: Pierre Schweitzer <pierre(a)reactos.org> + */ + +#include <kmt_test.h> +#include "npfs.h" + +#define MAX_INSTANCES 1 +#define IN_QUOTA 4096 +#define OUT_QUOTA 4096 +#define PIPE_NAME L"\\KmtestNpfsFileInfoTestPipe" + +static +VOID +TestFileInfo( + IN HANDLE ServerHandle) +{ + NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + + struct { + FILE_ALL_INFORMATION; + WCHAR PartialName[50]; + } FileAllInfo; + + RtlFillMemory(&FileAllInfo, sizeof(FileAllInfo), 0xFF); + Status = ZwQueryInformationFile(ServerHandle, + &IoStatusBlock, + &FileAllInfo, + sizeof(FileAllInfo), + FileAllInformation); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_hex(IoStatusBlock.Status, STATUS_SUCCESS); + ok_eq_longlong(FileAllInfo.BasicInformation.CreationTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.LastAccessTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.LastWriteTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.ChangeTime.QuadPart, 0); + ok_eq_ulong(FileAllInfo.BasicInformation.FileAttributes, FILE_ATTRIBUTE_NORMAL); + ok_eq_longlong(FileAllInfo.StandardInformation.AllocationSize.QuadPart, 8192); + ok_eq_longlong(FileAllInfo.StandardInformation.EndOfFile.QuadPart, 0); + ok_eq_ulong(FileAllInfo.StandardInformation.NumberOfLinks, 1); + ok_bool_true(FileAllInfo.StandardInformation.DeletePending, "DeletePending"); + ok_bool_false(FileAllInfo.StandardInformation.Directory, "Directory"); + ok(FileAllInfo.InternalInformation.IndexNumber.QuadPart != 0xFFFFFFFFFFFFFFFF, "FileAllInfo.InternalInformation.IndexNumber = 0xFFFFFFFFFFFFFFFF, whereas it shouldn't\n"); + ok(FileAllInfo.InternalInformation.IndexNumber.QuadPart != 0, "FileAllInfo.InternalInformation.IndexNumber = 0, whereas it shouldn't\n"); + ok_eq_ulong(FileAllInfo.EaInformation.EaSize, 0); + ok_eq_ulong(FileAllInfo.AccessInformation.AccessFlags, (FILE_GENERIC_READ | FILE_GENERIC_WRITE)); + ok_eq_longlong(FileAllInfo.PositionInformation.CurrentByteOffset.QuadPart, 0); + ok_eq_ulong(FileAllInfo.ModeInformation.Mode, FILE_SYNCHRONOUS_IO_NONALERT); + ok_eq_ulong(FileAllInfo.AlignmentInformation.AlignmentRequirement, 0); + ok_eq_ulong(FileAllInfo.NameInformation.FileNameLength, sizeof(PIPE_NAME) - sizeof(WCHAR)); + ok_eq_size(RtlCompareMemory(FileAllInfo.NameInformation.FileName, PIPE_NAME, sizeof(PIPE_NAME) - sizeof(WCHAR)), (sizeof(PIPE_NAME) - sizeof(WCHAR))); + ok_eq_wchar(FileAllInfo.NameInformation.FileName[sizeof(PIPE_NAME) / sizeof(WCHAR) - 1], 0xFFFF); + ok_eq_ulong(IoStatusBlock.Information, (FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName) + sizeof(PIPE_NAME) - sizeof(WCHAR))); + + RtlFillMemory(&FileAllInfo, sizeof(FileAllInfo), 0xFF); + Status = ZwQueryInformationFile(ServerHandle, + &IoStatusBlock, + &FileAllInfo, + sizeof(FILE_ALL_INFORMATION) + 4 * sizeof(WCHAR), + FileAllInformation); + ok_eq_hex(Status, STATUS_BUFFER_OVERFLOW); + ok_eq_hex(IoStatusBlock.Status, STATUS_BUFFER_OVERFLOW); + ok_eq_longlong(FileAllInfo.BasicInformation.CreationTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.LastAccessTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.LastWriteTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.ChangeTime.QuadPart, 0); + ok_eq_ulong(FileAllInfo.BasicInformation.FileAttributes, FILE_ATTRIBUTE_NORMAL); + ok_eq_longlong(FileAllInfo.StandardInformation.AllocationSize.QuadPart, 8192); + ok_eq_longlong(FileAllInfo.StandardInformation.EndOfFile.QuadPart, 0); + ok_eq_ulong(FileAllInfo.StandardInformation.NumberOfLinks, 1); + ok_bool_true(FileAllInfo.StandardInformation.DeletePending, "DeletePending"); + ok_bool_false(FileAllInfo.StandardInformation.Directory, "Directory"); + ok(FileAllInfo.InternalInformation.IndexNumber.QuadPart != 0xFFFFFFFFFFFFFFFF, "FileAllInfo.InternalInformation.IndexNumber = 0xFFFFFFFFFFFFFFFF, whereas it shouldn't\n"); + ok(FileAllInfo.InternalInformation.IndexNumber.QuadPart != 0, "FileAllInfo.InternalInformation.IndexNumber = 0, whereas it shouldn't\n"); + ok_eq_ulong(FileAllInfo.EaInformation.EaSize, 0); + ok_eq_ulong(FileAllInfo.AccessInformation.AccessFlags, (FILE_GENERIC_READ | FILE_GENERIC_WRITE)); + ok_eq_longlong(FileAllInfo.PositionInformation.CurrentByteOffset.QuadPart, 0); + ok_eq_ulong(FileAllInfo.ModeInformation.Mode, FILE_SYNCHRONOUS_IO_NONALERT); + ok_eq_ulong(FileAllInfo.AlignmentInformation.AlignmentRequirement, 0); + ok_eq_ulong(FileAllInfo.NameInformation.FileNameLength, sizeof(PIPE_NAME) - sizeof(WCHAR)); + ok_eq_size(RtlCompareMemory(FileAllInfo.NameInformation.FileName, PIPE_NAME, 6 * sizeof(WCHAR)), (6 * sizeof(WCHAR))); + ok_eq_wchar(FileAllInfo.NameInformation.FileName[6], 0xFFFF); + ok_eq_ulong(IoStatusBlock.Information, (FIELD_OFFSET(FILE_ALL_INFORMATION, NameInformation.FileName) + 6 * sizeof(WCHAR))); + + RtlFillMemory(&FileAllInfo, sizeof(FileAllInfo), 0xFF); + Status = ZwQueryInformationFile(ServerHandle, + &IoStatusBlock, + &FileAllInfo, + sizeof(FILE_ALL_INFORMATION) - 4, + FileAllInformation); + ok_eq_hex(Status, STATUS_BUFFER_OVERFLOW); + ok_eq_hex(IoStatusBlock.Status, STATUS_BUFFER_OVERFLOW); + ok_eq_longlong(FileAllInfo.BasicInformation.CreationTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.LastAccessTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.LastWriteTime.QuadPart, 0); + ok_eq_longlong(FileAllInfo.BasicInformation.ChangeTime.QuadPart, 0); + ok_eq_ulong(FileAllInfo.BasicInformation.FileAttributes, FILE_ATTRIBUTE_NORMAL); + ok_eq_longlong(FileAllInfo.StandardInformation.AllocationSize.QuadPart, 8192); + ok_eq_longlong(FileAllInfo.StandardInformation.EndOfFile.QuadPart, 0); + ok_eq_ulong(FileAllInfo.StandardInformation.NumberOfLinks, 1); + ok_bool_true(FileAllInfo.StandardInformation.DeletePending, "DeletePending"); + ok_bool_false(FileAllInfo.StandardInformation.Directory, "Directory"); + ok(FileAllInfo.InternalInformation.IndexNumber.QuadPart != 0xFFFFFFFFFFFFFFFF, "FileAllInfo.InternalInformation.IndexNumber = 0xFFFFFFFFFFFFFFFF, whereas it shouldn't\n"); + ok(FileAllInfo.InternalInformation.IndexNumber.QuadPart != 0, "FileAllInfo.InternalInformation.IndexNumber = 0, whereas it shouldn't\n"); + ok_eq_ulong(FileAllInfo.EaInformation.EaSize, 0); + ok_eq_ulong(FileAllInfo.AccessInformation.AccessFlags, (FILE_GENERIC_READ | FILE_GENERIC_WRITE)); + ok_eq_longlong(FileAllInfo.PositionInformation.CurrentByteOffset.QuadPart, 0); + ok_eq_ulong(FileAllInfo.ModeInformation.Mode, FILE_SYNCHRONOUS_IO_NONALERT); + ok_eq_ulong(FileAllInfo.AlignmentInformation.AlignmentRequirement, 0); + ok_eq_ulong(FileAllInfo.NameInformation.FileNameLength, sizeof(PIPE_NAME) - sizeof(WCHAR)); + ok_eq_wchar(FileAllInfo.NameInformation.FileName[0], 0xFFFF); + ok_eq_ulong(IoStatusBlock.Information, (sizeof(FILE_ALL_INFORMATION) - 4)); +} + +static KSTART_ROUTINE RunTest; +static +VOID +NTAPI +RunTest( + IN PVOID Context) +{ + NTSTATUS Status; + HANDLE ServerHandle; + + UNREFERENCED_PARAMETER(Context); + + ServerHandle = INVALID_HANDLE_VALUE; + Status = NpCreatePipe(&ServerHandle, + DEVICE_NAMED_PIPE PIPE_NAME, + BYTE_STREAM, QUEUE, BYTE_STREAM, DUPLEX, + MAX_INSTANCES, + IN_QUOTA, + OUT_QUOTA); + ok_eq_hex(Status, STATUS_SUCCESS); + ok(ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE, "ServerHandle = %p\n", ServerHandle); + if (!skip(NT_SUCCESS(Status) && ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE, "No pipe\n")) + { + TestFileInfo(ServerHandle); + ObCloseHandle(ServerHandle, KernelMode); + } +} + +START_TEST(NpfsFileInfo) +{ + PKTHREAD Thread; + + Thread = KmtStartThread(RunTest, NULL); + KmtFinishThread(Thread, NULL); +} Propchange: trunk/rostests/kmtests/npfs/NpfsFileInfo.c ------------------------------------------------------------------------------ svn:eol-style = native
10 years, 8 months
1
0
0
0
[hbelusca] 62741: [CONSRV]: Do not capture the mouse in the double-click case.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Apr 13 15:38:05 2014 New Revision: 62741 URL:
http://svn.reactos.org/svn/reactos?rev=62741&view=rev
Log: [CONSRV]: Do not capture the mouse in the double-click case. Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c [iso-8859-1] Sun Apr 13 15:38:05 2014 @@ -1240,7 +1240,6 @@ Console->Selection.dwSelectionAnchor = cL; Console->dwSelectionCursor = cR; - SetCapture(GuiData->hWindow); Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor);
10 years, 8 months
1
0
0
0
[hbelusca] 62740: [CONSRV] Code reorganization: move console-window-class - related code into a file.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Apr 13 15:13:55 2014 New Revision: 62740 URL:
http://svn.reactos.org/svn/reactos?rev=62740&view=rev
Log: [CONSRV] Code reorganization: move console-window-class - related code into a file. Added: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c - copied, changed from r62739, trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h - copied, changed from r62737, trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.h Modified: trunk/reactos/win32ss/user/winsrv/consrv.cmake trunk/reactos/win32ss/user/winsrv/consrv/consrv.h trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/fullscreen.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/graphics.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.h trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/win32ss/user/winsrv/consrv.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/consrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Copied: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c (from r62739, trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Copied: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h (from r62737, trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.h) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/fullscreen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/graphics.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
10 years, 8 months
1
0
0
0
[hbelusca] 62739: [CONSRV] - Fix console selection and selection mode text that displays in the console title: - Correctly set selection flags; - Ignore the first mouse event when the console is be...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Apr 13 13:21:55 2014 New Revision: 62739 URL:
http://svn.reactos.org/svn/reactos?rev=62739&view=rev
Log: [CONSRV] - Fix console selection and selection mode text that displays in the console title: - Correctly set selection flags; - Ignore the first mouse event when the console is being activated with the mouse, when we are in "QuickEdit" mode (avoids e.g. an erroneous paste if somebody right-clicks on the console); gather the console window position to consistently update GuiData->GuiInfo.WindowOrigin (needed when console properties are displayed). Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c [iso-8859-1] Sun Apr 13 13:21:55 2014 @@ -24,7 +24,7 @@ #include "resource.h" /* GUI Console Window Class name */ -#define GUI_CONSOLE_WINDOW_CLASS L"ConsoleWindowClass" +#define GUI_CONWND_CLASS L"ConsoleWindowClass" #ifndef WM_APP #define WM_APP 0x8000 @@ -277,21 +277,15 @@ { case ID_SYSTEM_EDIT_MARK: { - LPWSTR WindowTitle = NULL; - SIZE_T Length = 0; - + /* Clear the old selection */ + // GuiConsoleUpdateSelection(Console, NULL); + Console->Selection.dwFlags = CONSOLE_NO_SELECTION; + + /* Restart a new selection */ Console->dwSelectionCursor.X = ActiveBuffer->ViewOrigin.X; Console->dwSelectionCursor.Y = ActiveBuffer->ViewOrigin.Y; Console->Selection.dwSelectionAnchor = Console->dwSelectionCursor; - Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS; GuiConsoleUpdateSelection(Console, &Console->Selection.dwSelectionAnchor); - - Length = Console->Title.Length + sizeof(L"Mark - ")/sizeof(WCHAR) + 1; - WindowTitle = ConsoleAllocHeap(0, Length * sizeof(WCHAR)); - wcscpy(WindowTitle, L"Mark - "); - wcscat(WindowTitle, Console->Title.Buffer); - SetWindowText(GuiData->hWindow, WindowTitle); - ConsoleFreeHeap(WindowTitle); break; } @@ -306,8 +300,9 @@ case ID_SYSTEM_EDIT_SELECTALL: { - LPWSTR WindowTitle = NULL; - SIZE_T Length = 0; + /* Clear the old selection */ + // GuiConsoleUpdateSelection(Console, NULL); + Console->Selection.dwFlags = CONSOLE_NO_SELECTION; /* * The selection area extends to the whole screen buffer's width. @@ -337,15 +332,9 @@ Console->dwSelectionCursor.Y = ActiveBuffer->ScreenBufferSize.Y - 1; } - Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS | CONSOLE_MOUSE_SELECTION; + /* Restart a new selection */ + Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION; GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor); - - Length = Console->Title.Length + sizeof(L"Selection - ")/sizeof(WCHAR) + 1; - WindowTitle = ConsoleAllocHeap(0, Length * sizeof(WCHAR)); - wcscpy(WindowTitle, L"Selection - "); - wcscat(WindowTitle, Console->Title.Buffer); - SetWindowText(GuiData->hWindow, WindowTitle); - ConsoleFreeHeap(WindowTitle); break; } @@ -579,14 +568,16 @@ GuiConsoleUpdateSelection(PCONSOLE Console, PCOORD coord) { PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data; - RECT oldRect, newRect; + RECT oldRect; SmallRectToRect(GuiData, &oldRect, &Console->Selection.srSelection); if (coord != NULL) { + RECT newRect; SMALL_RECT rc; - /* exchange left/top with right/bottom if required */ + + /* Exchange left/top with right/bottom if required */ rc.Left = min(Console->Selection.dwSelectionAnchor.X, coord->X); rc.Top = min(Console->Selection.dwSelectionAnchor.Y, coord->Y); rc.Right = max(Console->Selection.dwSelectionAnchor.X, coord->X); @@ -600,7 +591,7 @@ { HRGN rgn1, rgn2; - /* calculate the region that needs to be updated */ + /* Calculate the region that needs to be updated */ if ((rgn1 = CreateRectRgnIndirect(&oldRect))) { if ((rgn2 = CreateRectRgnIndirect(&newRect))) @@ -619,20 +610,54 @@ { InvalidateRect(GuiData->hWindow, &newRect, FALSE); } + Console->Selection.dwFlags |= CONSOLE_SELECTION_NOT_EMPTY; Console->Selection.srSelection = rc; Console->dwSelectionCursor = *coord; - ConioPause(Console, PAUSED_FROM_SELECTION); + + if ((Console->Selection.dwFlags & CONSOLE_SELECTION_IN_PROGRESS) == 0) + { + LPWSTR SelectionType, WindowTitle = NULL; + SIZE_T Length = 0; + + /* Clear the old selection */ + if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) + { + InvalidateRect(GuiData->hWindow, &oldRect, FALSE); + } + + if (Console->Selection.dwFlags & CONSOLE_MOUSE_SELECTION) + { + SelectionType = L"Selection - "; + } + else + { + SelectionType = L"Mark - "; + } + + Length = Console->Title.Length + wcslen(SelectionType) + 1; + WindowTitle = ConsoleAllocHeap(0, Length * sizeof(WCHAR)); + wcscpy(WindowTitle, SelectionType); + wcscat(WindowTitle, Console->Title.Buffer); + SetWindowText(GuiData->hWindow, WindowTitle); + ConsoleFreeHeap(WindowTitle); + + Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS; + ConioPause(Console, PAUSED_FROM_SELECTION); + } } else { - /* clear the selection */ + /* Clear the selection */ if (Console->Selection.dwFlags & CONSOLE_SELECTION_NOT_EMPTY) { InvalidateRect(GuiData->hWindow, &oldRect, FALSE); } + Console->Selection.dwFlags = CONSOLE_NO_SELECTION; ConioUnpause(Console, PAUSED_FROM_SELECTION); + + SetWindowText(GuiData->hWindow, Console->Title.Buffer); } } @@ -768,8 +793,6 @@ { /* Cancel selection if ESC or Ctrl-C are pressed */ GuiConsoleUpdateSelection(Console, NULL); - SetWindowText(GuiData->hWindow, Console->Title.Buffer); - goto Quit; } @@ -879,7 +902,6 @@ { /* Clear the selection and send the key into the input buffer */ GuiConsoleUpdateSelection(Console, NULL); - SetWindowText(GuiData->hWindow, Console->Title.Buffer); } else { @@ -1096,10 +1118,11 @@ { if (msg != WM_LBUTTONDOWN && msg != WM_MBUTTONDOWN && - msg != WM_RBUTTONDOWN) + msg != WM_RBUTTONDOWN && + msg != WM_MOUSEMOVE) { /* - * If this mouse signal is not a button-down action, + * If this mouse signal is not a button-down action or a move, * then it is the last signal being ignored. */ GuiData->IgnoreNextMouseSignal = FALSE; @@ -1107,7 +1130,7 @@ else { /* - * This mouse signal is a button-down action. + * This mouse signal is a button-down action or a move. * Ignore it and perform default action. */ Err = TRUE; @@ -1128,33 +1151,28 @@ { case WM_LBUTTONDOWN: { - LPWSTR WindowTitle = NULL; - SIZE_T Length = 0; - + /* Clear the old selection */ + // GuiConsoleUpdateSelection(Console, NULL); + Console->Selection.dwFlags = CONSOLE_NO_SELECTION; + + /* Restart a new selection */ Console->Selection.dwSelectionAnchor = PointToCoord(GuiData, lParam); SetCapture(GuiData->hWindow); - Console->Selection.dwFlags |= CONSOLE_SELECTION_IN_PROGRESS | CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; + Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; GuiConsoleUpdateSelection(Console, &Console->Selection.dwSelectionAnchor); - Length = Console->Title.Length + sizeof(L"Selection - ")/sizeof(WCHAR) + 1; - WindowTitle = ConsoleAllocHeap(0, Length * sizeof(WCHAR)); - wcscpy(WindowTitle, L"Selection - "); - wcscat(WindowTitle, Console->Title.Buffer); - SetWindowText(GuiData->hWindow, WindowTitle); - ConsoleFreeHeap(WindowTitle); - break; } case WM_LBUTTONUP: { - COORD c; + // COORD c; if (!(Console->Selection.dwFlags & CONSOLE_MOUSE_DOWN)) break; - c = PointToCoord(GuiData, lParam); + // c = PointToCoord(GuiData, lParam); Console->Selection.dwFlags &= ~CONSOLE_MOUSE_DOWN; - GuiConsoleUpdateSelection(Console, &c); + // GuiConsoleUpdateSelection(Console, &c); ReleaseCapture(); break; @@ -1166,6 +1184,9 @@ if (GetType(Buffer) == TEXTMODE_BUFFER) { +#ifdef IS_WHITESPACE +#undef IS_WHITESPACE +#endif #define IS_WHITESPACE(c) \ ((c) == L'\0' || (c) == L' ' || (c) == L'\t' || (c) == L'\r' || (c) == L'\n') @@ -1192,10 +1213,19 @@ ++ptrR; } + /* + * Update the selection started with the single + * left-click that preceded this double-click. + */ Console->Selection.dwSelectionAnchor = cL; Console->dwSelectionCursor = cR; + SetCapture(GuiData->hWindow); + Console->Selection.dwFlags |= CONSOLE_MOUSE_SELECTION | CONSOLE_MOUSE_DOWN; GuiConsoleUpdateSelection(Console, &Console->dwSelectionCursor); + + /* Ignore the next mouse move signal */ + GuiData->IgnoreNextMouseSignal = TRUE; } break; @@ -1213,6 +1243,7 @@ GuiConsoleCopy(GuiData); } + /* Ignore the next mouse move signal */ GuiData->IgnoreNextMouseSignal = TRUE; break; } @@ -1378,9 +1409,10 @@ static VOID GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData) { + PCONSOLE Console = GuiData->Console; + if (OpenClipboard(GuiData->hWindow) == TRUE) { - PCONSOLE Console = GuiData->Console; PCONSOLE_SCREEN_BUFFER Buffer = GuiData->ActiveBuffer; if (GetType(Buffer) == TEXTMODE_BUFFER) @@ -1393,11 +1425,10 @@ } CloseClipboard(); - - /* Clear the selection */ - GuiConsoleUpdateSelection(Console, NULL); - SetWindowText(GuiData->hWindow, Console->Title.Buffer); - } + } + + /* Clear the selection */ + GuiConsoleUpdateSelection(Console, NULL); } VOID @@ -1739,7 +1770,14 @@ } } - if (ActivationState == WA_CLICKACTIVE) GuiData->IgnoreNextMouseSignal = TRUE; + /* + * When we are in QuickEdit mode, ignore the next mouse signal + * when we are going to be enabled again via the mouse, in order + * to prevent e.g. an erroneous right-click from the user which + * would have as an effect to paste some unwanted text... + */ + if (Console->QuickEdit && (ActivationState == WA_CLICKACTIVE)) + GuiData->IgnoreNextMouseSignal = TRUE; break; } @@ -1750,6 +1788,10 @@ case WM_PAINT: GuiConsoleHandlePaint(GuiData); + break; + + case WM_TIMER: + GuiConsoleHandleTimer(GuiData); break; case WM_PALETTECHANGED: @@ -1815,10 +1857,6 @@ break; } - case WM_TIMER: - GuiConsoleHandleTimer(GuiData); - break; - case WM_SETCURSOR: { /* @@ -2013,6 +2051,25 @@ GuiConsoleGetMinMaxInfo(GuiData, (PMINMAXINFO)lParam); break; + case WM_MOVE: + { + if (ConDrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE)) + { + // TODO: Simplify the code. + // See: GuiConsoleNotifyWndProc() PM_CREATE_CONSOLE. + + RECT rcWnd; + + /* Retrieve our real position */ + GetWindowRect(GuiData->hWindow, &rcWnd); + GuiData->GuiInfo.WindowOrigin.x = rcWnd.left; + GuiData->GuiInfo.WindowOrigin.y = rcWnd.top; + + LeaveCriticalSection(&Console->Lock); + } + break; + } + case WM_SIZE: GuiConsoleResize(GuiData, wParam, lParam); break; @@ -2101,9 +2158,10 @@ { PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)lParam; PCONSOLE Console = GuiData->Console; + RECT rcWnd; NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, - GUI_CONSOLE_WINDOW_CLASS, + GUI_CONWND_CLASS, Console->Title.Buffer, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, @@ -2135,6 +2193,11 @@ SendMessageW(GuiData->hWindow, WM_SETICON, ICON_BIG, (LPARAM)GuiData->hIcon); SendMessageW(GuiData->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)GuiData->hIconSm); } + + /* Retrieve our real position */ + GetWindowRect(GuiData->hWindow, &rcWnd); + GuiData->GuiInfo.WindowOrigin.x = rcWnd.left; + GuiData->GuiInfo.WindowOrigin.y = rcWnd.top; /* Move and resize the window to the user's values */ /* CAN WE DEADLOCK ?? */ @@ -2289,7 +2352,7 @@ LR_SHARED); ghDefaultCursor = LoadCursorW(NULL, IDC_ARROW); wc.cbSize = sizeof(WNDCLASSEXW); - wc.lpszClassName = GUI_CONSOLE_WINDOW_CLASS; + wc.lpszClassName = GUI_CONWND_CLASS; wc.lpfnWndProc = GuiConsoleWndProc; wc.style = CS_DBLCLKS /* | CS_HREDRAW | CS_VREDRAW */; wc.hInstance = ConSrvDllInstance;
10 years, 8 months
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200