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
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
September 2005
----- 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
22 participants
582 discussions
Start a n
N
ew thread
[navaraf] 17931: Partial clean-up of the painting functions:
by navaraf@svn.reactos.com
Partial clean-up of the painting functions: - Get rid of the DCX_WINDOWPAINT flag (it wasn't used anyway). - Remove the PaintPosted field from message queue, we don't need it. - Use screen cooridnates for the WindowUpdate region instead of window relative ones. - Fix the algorithm for retrieving paint messages to respect the painting order. - Remove the NCUpdateRegion field from window object and calculate it on demand. - Fix GetDCEx to take region in screen coordinates. Modified: trunk/reactos/subsys/win32k/include/dce.h Modified: trunk/reactos/subsys/win32k/include/msgqueue.h Modified: trunk/reactos/subsys/win32k/include/window.h Modified: trunk/reactos/subsys/win32k/ntuser/msgqueue.c Modified: trunk/reactos/subsys/win32k/ntuser/painting.c Modified: trunk/reactos/subsys/win32k/ntuser/vis.c Modified: trunk/reactos/subsys/win32k/ntuser/windc.c Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c Modified: trunk/reactos/subsys/win32k/objects/cliprgn.c _____ Modified: trunk/reactos/subsys/win32k/include/dce.h --- trunk/reactos/subsys/win32k/include/dce.h 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/include/dce.h 2005-09-19 10:39:26 UTC (rev 17931) @@ -39,7 +39,7 @@ #define DCX_DCEEMPTY 0x00000800 #define DCX_DCEBUSY 0x00001000 #define DCX_DCEDIRTY 0x00002000 -#define DCX_WINDOWPAINT 0x00020000 +#define DCX_USESTYLE 0x00010000 #define DCX_KEEPCLIPRGN 0x00040000 #define DCX_NOCLIPCHILDREN 0x00080000 _____ Modified: trunk/reactos/subsys/win32k/include/msgqueue.h --- trunk/reactos/subsys/win32k/include/msgqueue.h 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/include/msgqueue.h 2005-09-19 10:39:26 UTC (rev 17931) @@ -81,8 +81,6 @@ ULONG LastMsgRead; /* Current window with focus (ie. receives keyboard input) for this queue. */ HWND FocusWindow; - /* True if a window needs painting. */ - BOOLEAN PaintPosted; /* Count of paints pending. */ ULONG PaintCount; /* Current active window for this queue. */ _____ Modified: trunk/reactos/subsys/win32k/include/window.h --- trunk/reactos/subsys/win32k/include/window.h 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/include/window.h 2005-09-19 10:39:26 UTC (rev 17931) @@ -60,7 +60,6 @@ UINT IDMenu; /* Handle of region of the window to be updated. */ HANDLE UpdateRegion; - HANDLE NCUpdateRegion; /* Handle of the window region. */ HANDLE WindowRegion; /* Pointer to the owning thread's message queue. */ _____ Modified: trunk/reactos/subsys/win32k/ntuser/msgqueue.c --- trunk/reactos/subsys/win32k/ntuser/msgqueue.c 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/ntuser/msgqueue.c 2005-09-19 10:39:26 UTC (rev 17931) @@ -103,7 +103,6 @@ MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue) { Queue->PaintCount++; - Queue->PaintPosted = TRUE; Queue->QueueBits |= QS_PAINT; Queue->ChangedBits |= QS_PAINT; if (Queue->WakeMask & QS_PAINT) @@ -114,10 +113,6 @@ MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue) { Queue->PaintCount--; - if (Queue->PaintCount == 0) - { - Queue->PaintPosted = FALSE; - } } @@ -1341,7 +1336,6 @@ KeQueryTickCount(&LargeTickCount); MessageQueue->LastMsgRead = LargeTickCount.u.LowPart; MessageQueue->FocusWindow = NULL; - MessageQueue->PaintPosted = FALSE; MessageQueue->PaintCount = 0; MessageQueue->WakeMask = ~0; MessageQueue->NewMessagesHandle = NULL; _____ Modified: trunk/reactos/subsys/win32k/ntuser/painting.c --- trunk/reactos/subsys/win32k/ntuser/painting.c 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/ntuser/painting.c 2005-09-19 10:39:26 UTC (rev 17931) @@ -35,10 +35,52 @@ #define NDEBUG #include <debug.h> -#define DCX_USESTYLE 0x10000 - /* PRIVATE FUNCTIONS **********************************************************/ +/** + * @name IntIntersectWithParents + * + * Intersect window rectangle with all parent client rectangles. + * + * @param Child + * Pointer to child window to start intersecting from. + * @param WindowRect + * Pointer to rectangle that we want to intersect in screen + * coordinates on input and intersected rectangle on output (if TRUE + * is returned). + * + * @return + * If any parent is minimized or invisible or the resulting rectangle + * is empty then FALSE is returned. Otherwise TRUE is returned. + */ + +BOOL FASTCALL +IntIntersectWithParents(PWINDOW_OBJECT Child, PRECT WindowRect) +{ + PWINDOW_OBJECT ParentWindow; + + ParentWindow = Child->Parent; + while (ParentWindow != NULL) + { + if (!(ParentWindow->Style & WS_VISIBLE) || + (ParentWindow->Style & WS_MINIMIZE)) + { + return FALSE; + } + + if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->ClientRect)) + { + return FALSE; + } + + /* FIXME: Layered windows. */ + + ParentWindow = ParentWindow->Parent; + } + + return TRUE; +} + VOID FASTCALL IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion) { @@ -46,28 +88,128 @@ while (ParentWindow) { - if (!(ParentWindow->Style & WS_CLIPCHILDREN)) + if (ParentWindow->Style & WS_CLIPCHILDREN) + break; + + if (ParentWindow->UpdateRegion != 0) { - if (ParentWindow->UpdateRegion != 0) + NtGdiCombineRgn(ParentWindow->UpdateRegion, ParentWindow->UpdateRegion, + ValidRegion, RGN_DIFF); + /* FIXME: If the resulting region is empty, remove fake posted paint message */ + } + + ParentWindow = ParentWindow->Parent; + } +} + +/** + * @name IntCalcWindowRgn + * + * Get a window or client region. + */ + +HRGN FASTCALL +IntCalcWindowRgn(PWINDOW_OBJECT Window, BOOL Client) +{ + HRGN hRgnWindow; + UINT RgnType; + + if (Client) + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + else + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + + if (Window->WindowRegion != NULL && !(Window->Style & WS_MINIMIZE)) + { + NtGdiOffsetRgn(hRgnWindow, + -Window->WindowRect.left, + -Window->WindowRect.top); + RgnType = NtGdiCombineRgn(hRgnWindow, hRgnWindow, Window->WindowRegion, RGN_AND); + NtGdiOffsetRgn(hRgnWindow, + Window->WindowRect.left, + Window->WindowRect.top); + } + + return hRgnWindow; +} + +/** + * @name IntGetNCUpdateRgn + * + * Get non-client update region of a window and optionally validate it. + * + * @param Window + * Pointer to window to get the NC update region from. + * @param Validate + * Set to TRUE to force validating the NC update region. + * + * @return + * Handle to NC update region. The caller is responsible for deleting + * it. + */ + +HRGN FASTCALL +IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate) +{ + HRGN hRgnNonClient; + HRGN hRgnWindow; + UINT RgnType; + + if (Window->UpdateRegion != NULL && + Window->UpdateRegion != (HRGN)1) + { + hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0); + hRgnWindow = IntCalcWindowRgn(Window, TRUE); + + /* + * If region creation fails it's safe to fallback to whole + * window region. + */ + + if (hRgnNonClient == NULL) + { + return (HRGN)1; + } + + RgnType = NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion, + hRgnWindow, RGN_DIFF); + if (RgnType == ERROR) + { + NtGdiDeleteObject(hRgnNonClient); + return (HRGN)1; + } + else if (RgnType == NULLREGION) + { + NtGdiDeleteObject(hRgnNonClient); + return NULL; + } + + /* + * Remove the nonclient region from the standard update region if + * we were asked for it. + */ + + if (Validate) + { + if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion, + hRgnWindow, RGN_AND) == NULLREGION) { - INT OffsetX, OffsetY; - - /* - * We must offset the child region by the offset of the - * child rect in the parent. - */ - OffsetX = Child->WindowRect.left - ParentWindow->WindowRect.left; - OffsetY = Child->WindowRect.top - ParentWindow->WindowRect.top; - NtGdiOffsetRgn(ValidRegion, OffsetX, OffsetY); - NtGdiCombineRgn(ParentWindow->UpdateRegion, ParentWindow->UpdateRegion, - ValidRegion, RGN_DIFF); - /* FIXME: If the resulting region is empty, remove fake posted paint message */ - NtGdiOffsetRgn(ValidRegion, -OffsetX, -OffsetY); + GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); + NtGdiDeleteObject(Window->UpdateRegion); + Window->UpdateRegion = NULL; + if (!(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)) + MsqDecPaintCountQueue(Window->MessageQueue); } } - ParentWindow = ParentWindow->Parent; + NtGdiDeleteObject(hRgnWindow); + + return hRgnNonClient; } + else + { + return Window->UpdateRegion; + } } /* @@ -85,44 +227,37 @@ if (Flags & (RDW_ERASENOW | RDW_UPDATENOW)) { - if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) + if (Window->UpdateRegion) { - if (Window->NCUpdateRegion) + IntValidateParent(Window, Window->UpdateRegion); + } + + if (Flags & RDW_UPDATENOW) + { + if (Window->UpdateRegion != NULL || + Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) { - IntValidateParent(Window, Window->NCUpdateRegion); + co_IntSendMessage(hWnd, WM_PAINT, 0, 0); } - TempRegion = Window->NCUpdateRegion; - if ((HANDLE) 1 != TempRegion && NULL != TempRegion) + } + else + { + if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) { - GDIOBJ_SetOwnership(TempRegion, PsGetCurrentProcess()); + TempRegion = IntGetNCUpdateRgn(Window, TRUE); + Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT; + MsqDecPaintCountQueue(Window->MessageQueue); + co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0); + if ((HANDLE) 1 != TempRegion && NULL != TempRegion) + { + /* NOTE: The region can already be deleted! */ + GDIOBJ_FreeObj(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT); + } } - Window->NCUpdateRegion = NULL; - Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT; - MsqDecPaintCountQueue(Window->MessageQueue); - co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0); - if ((HANDLE) 1 != TempRegion && NULL != TempRegion) - { - /* NOTE: The region can already be deleted! */ - GDIOBJ_FreeObj(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT); - } - } - if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND) - { - if (Window->UpdateRegion) + if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND) { - /* - * This surely wrong! Why we would want to validate the parent? - * It breaks quite a few things including dummy WM_ERASEBKGND - * implementations that return only TRUE and have corresponding - * WM_PAINT that doesn't paint the whole client area. - * I left the code here so that no one will readd it again! - * - Filip - */ - /* IntValidateParent(Window, Window->UpdateRegion); */ - hDC = UserGetDCEx(Window, 0, DCX_CACHE | DCX_USESTYLE | - DCX_INTERSECTUPDATE); - if (hDC != NULL) + if (Window->UpdateRegion) { if (co_IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0)) { @@ -132,22 +267,12 @@ } } } - - if (Flags & RDW_UPDATENOW) - { - if (Window->UpdateRegion != NULL || - Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) - { - co_IntSendMessage(hWnd, WM_PAINT, 0, 0); - } - } } /* * Check that the window is still valid at this point */ - - if (! IntIsWindow(hWnd)) + if (!IntIsWindow(hWnd)) { return; } @@ -156,7 +281,7 @@ * Paint child windows. */ if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) && - ((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN))) + ((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN))) { HWND *List, *phWnd; @@ -164,13 +289,11 @@ { for (phWnd = List; *phWnd; ++phWnd) { - Window = UserGetWindowObject(*phWnd); + Window = IntGetWindowObject(*phWnd); if (Window && (Window->Style & WS_VISIBLE)) { - UserRefObjectCo(Window); co_IntPaintWindows(Window, Flags); - UserDerefObjectCo(Window); - + ObmDereferenceObject(Window); } } ExFreePool(List); @@ -200,15 +323,18 @@ HRGN hRgnWindow; hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); - NtGdiOffsetRgn(hRgnWindow, - -Window->WindowRect.left, - -Window->WindowRect.top); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND); NtGdiDeleteObject(hRgnWindow); } else { + NtGdiOffsetRgn(hRgn, + -Window->WindowRect.left, + -Window->WindowRect.top); RgnType = NtGdiCombineRgn(hRgn, hRgn, Window->WindowRegion, RGN_AND); + NtGdiOffsetRgn(hRgn, + Window->WindowRect.left, + Window->WindowRect.top); } /* @@ -279,60 +405,6 @@ } /* - * Split the nonclient update region. - */ - - if (NULL != Window->UpdateRegion) - { - HRGN hRgnWindow, hRgnNonClient; - - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); - NtGdiOffsetRgn(hRgnWindow, - -Window->WindowRect.left, - -Window->WindowRect.top); - - hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0); - if (NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion, - hRgnWindow, RGN_DIFF) == NULLREGION) - { - NtGdiDeleteObject(hRgnNonClient); - hRgnNonClient = NULL; - } - else - { - GDIOBJ_SetOwnership(hRgnNonClient, NULL); - } - - /* - * Remove the nonclient region from the standard update region. - */ - if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion, - hRgnWindow, RGN_AND) == NULLREGION) - { - GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); - NtGdiDeleteObject(Window->UpdateRegion); - Window->UpdateRegion = NULL; - } - - if (Window->NCUpdateRegion == NULL) - { - Window->NCUpdateRegion = hRgnNonClient; - } - else - { - if(NULL != hRgnNonClient) - { - NtGdiCombineRgn(Window->NCUpdateRegion, Window->NCUpdateRegion, - hRgnNonClient, RGN_OR); - GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess()); - NtGdiDeleteObject(hRgnNonClient); - } - } - - NtGdiDeleteObject(hRgnWindow); - } - - /* * Process children if needed */ @@ -358,9 +430,6 @@ */ HRGN hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0); NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY); - NtGdiOffsetRgn(hRgnTemp, - Window->WindowRect.left - Child->WindowRect.left, - Window->WindowRect.top - Child->WindowRect.top); IntInvalidateWindows(Child, hRgnTemp, Flags); NtGdiDeleteObject(hRgnTemp); } @@ -407,20 +476,16 @@ BOOL FASTCALL IntIsWindowDrawable(PWINDOW_OBJECT Window) { - PWINDOW_OBJECT Wnd = Window; + PWINDOW_OBJECT Wnd; - do + for (Wnd = Window; Wnd != NULL; Wnd = Wnd->Parent) { if (!(Wnd->Style & WS_VISIBLE) || ((Wnd->Style & WS_MINIMIZE) && (Wnd != Window))) { return FALSE; } - - Wnd = Wnd->Parent; - } - while(Wnd); return TRUE; } @@ -453,7 +518,7 @@ /* * Step 2. * Transform the parameters UpdateRgn and UpdateRect into - * a region hRgn specified in window coordinates. + * a region hRgn specified in screen coordinates. */ if (Flags & (RDW_INVALIDATE | RDW_VALIDATE)) @@ -461,35 +526,30 @@ if (UpdateRgn != NULL) { hRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - NtGdiCombineRgn(hRgn, UpdateRgn, NULL, RGN_COPY); - NtGdiOffsetRgn(hRgn, - Window->ClientRect.left - Window->WindowRect.left, - Window->ClientRect.top - Window->WindowRect.top); + if (NtGdiCombineRgn(hRgn, UpdateRgn, NULL, RGN_COPY) == NULLREGION) + NtGdiDeleteObject(hRgn); + else + NtGdiOffsetRgn(hRgn, Window->ClientRect.left, Window->ClientRect.top); } - else - if (UpdateRect != NULL) + else if (UpdateRect != NULL) + { + if (!IntGdiIsEmptyRect(UpdateRect)) { hRgn = UnsafeIntCreateRectRgnIndirect((RECT *)UpdateRect); - NtGdiOffsetRgn(hRgn, - Window->ClientRect.left - Window->WindowRect.left, - Window->ClientRect.top - Window->WindowRect.top); + NtGdiOffsetRgn(hRgn, Window->ClientRect.left, Window->ClientRect.top); } - else - if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) || - (Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME)) - { - hRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); - NtGdiOffsetRgn(hRgn, - -Window->WindowRect.left, - -Window->WindowRect.top); - } - else - { - hRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); - NtGdiOffsetRgn(hRgn, - -Window->WindowRect.left, - -Window->WindowRect.top); - } + } + else if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) || + (Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME)) + { + if (!IntGdiIsEmptyRect(&Window->WindowRect)) + hRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + } + else + { + if (!IntGdiIsEmptyRect(&Window->ClientRect)) + hRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + } } /* @@ -497,7 +557,8 @@ * Adjust the window update region depending on hRgn and flags. */ - if (Flags & (RDW_INVALIDATE | RDW_VALIDATE | RDW_INTERNALPAINT | RDW_NOINTERNALPAINT)) + if (Flags & (RDW_INVALIDATE | RDW_VALIDATE | RDW_INTERNALPAINT | RDW_NOINTERNALPAINT) && + hRgn != NULL) { IntInvalidateWindows(Window, hRgn, Flags); } @@ -534,84 +595,55 @@ (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)); } -HWND STDCALL -IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread) +HWND FASTCALL +IntFindWindowToRepaint(PWINDOW_OBJECT Window, PW32THREAD Thread) { - PWINDOW_OBJECT Window; - PWINDOW_OBJECT Child; - HWND hFoundWnd = NULL; + HWND hChild; - if (!(Window = UserGetWindowObject(hWnd))) - return NULL; - - if (IntIsWindowDirty(Window) && - IntWndBelongsToThread(Window, Thread)) + while (Window != NULL) { - return hWnd; - } - - for (Child = Window->FirstChild; Child; Child = Child->NextSibling) - { - if (IntIsWindowDirty(Child) && - IntWndBelongsToThread(Child, Thread)) + /* FIXME: Transparent windows. */ + if (IntIsWindowDirty(Window) && + IntWndBelongsToThread(Window, Thread)) { - hFoundWnd = Child->hSelf; - break; + return Window->hSelf; } - } - if (hFoundWnd == NULL) - { - HWND *List; - INT i; - - List = IntWinListChildren(Window); - if (List != NULL) + if (Window->FirstChild) { - for (i = 0; List[i]; i++) - { - hFoundWnd = IntFindWindowToRepaint(List[i], Thread); - if (hFoundWnd != NULL) - break; - } - ExFreePool(List); + hChild = IntFindWindowToRepaint(Window->FirstChild, Thread); + if (hChild != NULL) + return hChild; } + + Window = Window->NextSibling; } - return hFoundWnd; + return NULL; } BOOL FASTCALL IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, PW32THREAD Thread, MSG *Message, BOOL Remove) { - PWINDOW_OBJECT Window; PUSER_MESSAGE_QUEUE MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue; - if (!MessageQueue->PaintPosted) + if (!MessageQueue->PaintCount) return FALSE; if ((MsgFilterMin != 0 || MsgFilterMax != 0) && (MsgFilterMin > WM_PAINT || MsgFilterMax < WM_PAINT)) return FALSE; - if (hWnd) - Message->hwnd = IntFindWindowToRepaint(hWnd, PsGetWin32Thread()); - else - Message->hwnd = IntFindWindowToRepaint(IntGetDesktopWindow(), PsGetWin32Thread()); + Message->hwnd = IntFindWindowToRepaint(UserGetDesktopWindow(), PsGetWin32Thread()); if (Message->hwnd == NULL) { - if (NULL == hWnd) - { - DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n"); - MessageQueue->PaintPosted = 0; - MessageQueue->PaintCount = 0; - } + DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n"); return FALSE; } - if (!(Window = UserGetWindowObject(Message->hwnd))) + if (hWnd != NULL && Message->hwnd != hWnd) return FALSE; Message->message = WM_PAINT; @@ -700,14 +732,7 @@ { HRGN hRgn; - if (Window->NCUpdateRegion != (HANDLE)1 && - Window->NCUpdateRegion != NULL) - { - GDIOBJ_SetOwnership(Window->NCUpdateRegion, PsGetCurrentProcess()); - } - hRgn = Window->NCUpdateRegion; - IntValidateParent(Window, Window->NCUpdateRegion); - Window->NCUpdateRegion = NULL; + hRgn = IntGetNCUpdateRgn(Window, FALSE); Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT; MsqDecPaintCountQueue(Window->MessageQueue); co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)hRgn, 0); @@ -720,8 +745,7 @@ RtlZeroMemory(&Ps, sizeof(PAINTSTRUCT)); - Ps.hdc = UserGetDCEx(Window, 0, DCX_INTERSECTUPDATE | DCX_WINDOWPAINT | DCX_USESTYLE); - + Ps.hdc = UserGetDCEx(Window, Window->UpdateRegion, DCX_INTERSECTRGN | DCX_USESTYLE); if (!Ps.hdc) { RETURN( NULL); @@ -730,22 +754,20 @@ if (Window->UpdateRegion != NULL) { MsqDecPaintCountQueue(Window->MessageQueue); - IntValidateParent(Window, Window->UpdateRegion); Rgn = RGNDATA_LockRgn(Window->UpdateRegion); if (NULL != Rgn) { UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint); RGNDATA_UnlockRgn(Rgn); IntGdiOffsetRect(&Ps.rcPaint, - Window->WindowRect.left - Window->ClientRect.left, - Window->WindowRect.top - Window->ClientRect.top); + -Window->ClientRect.left, + -Window->ClientRect.top); } else { IntGetClientRect(Window, &Ps.rcPaint); } GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess()); - NtGdiDeleteObject(Window->UpdateRegion); Window->UpdateRegion = NULL; } else @@ -755,6 +777,7 @@ IntGetClientRect(Window, &Ps.rcPaint); } + Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT; if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND) @@ -898,10 +921,7 @@ else { RegionType = NtGdiCombineRgn(hRgn, Window->UpdateRegion, hRgn, RGN_COPY); - NtGdiOffsetRgn( - hRgn, - Window->WindowRect.left - Window->ClientRect.left, - Window->WindowRect.top - Window->ClientRect.top); + NtGdiOffsetRgn(hRgn, -Window->ClientRect.left, -Window->ClientRect.top); } if (bErase && RegionType != NULLREGION && RegionType != ERROR) _____ Modified: trunk/reactos/subsys/win32k/ntuser/vis.c --- trunk/reactos/subsys/win32k/ntuser/vis.c 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/ntuser/vis.c 2005-09-19 10:39:26 UTC (rev 17931) @@ -38,37 +38,30 @@ BOOLEAN ClipSiblings) { HRGN VisRgn, ClipRgn; - INT LeftOffset, TopOffset; PWINDOW_OBJECT PreviousWindow, CurrentWindow, CurrentSibling; if (!(Window->Style & WS_VISIBLE)) { - return NtGdiCreateRectRgn(0, 0, 0, 0); + return NULL; } if (ClientArea) { - if(!(ClipRgn = VIS_ComputeVisibleRegion(Window, FALSE, ClipChildren, ClipSiblings))) + if (!(ClipRgn = VIS_ComputeVisibleRegion(Window, FALSE, ClipChildren, ClipSiblings))) { - return NtGdiCreateRectRgn(0, 0, 0, 0); + return NULL; } - if(!(VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect))) + if (!(VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect))) { NtGdiDeleteObject(VisRgn); - return NtGdiCreateRectRgn(0, 0, 0, 0); + return NULL; } - LeftOffset = Window->ClientRect.left - Window->WindowRect.left; - TopOffset = Window->ClientRect.top - Window->WindowRect.top; - NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); NtGdiDeleteObject(ClipRgn); - NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset); return VisRgn; } VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); - LeftOffset = Window->WindowRect.left; - TopOffset = Window->WindowRect.top; /* * Walk through all parent windows and for each clip the visble region @@ -83,14 +76,15 @@ if (!(CurrentWindow->Style & WS_VISIBLE)) { NtGdiDeleteObject(VisRgn); - return NtGdiCreateRectRgn(0, 0, 0, 0); + return NULL; } + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->ClientRect); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); NtGdiDeleteObject(ClipRgn); if ((PreviousWindow->Style & WS_CLIPSIBLINGS) || - (PreviousWindow == Window && ClipSiblings)) + (PreviousWindow == Window && ClipSiblings)) { CurrentSibling = CurrentWindow->FirstChild; while (CurrentSibling != NULL && CurrentSibling != PreviousWindow) @@ -99,7 +93,7 @@ { ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSibling->WindowRect); /* Combine it with the window region if available */ - if(CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE)) + if (CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE)) { NtGdiOffsetRgn(ClipRgn, -CurrentSibling->WindowRect.left, -CurrentSibling->WindowRect.top); NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentSibling->WindowRegion, RGN_AND); @@ -125,7 +119,7 @@ { ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->WindowRect); /* Combine it with the window region if available */ - if(CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE)) + if (CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE)) { NtGdiOffsetRgn(ClipRgn, -CurrentWindow->WindowRect.left, -CurrentWindow->WindowRect.top); NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentWindow->WindowRegion, RGN_AND); @@ -138,15 +132,13 @@ } } - if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) + if (Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset); + NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); - return VisRgn; + NtGdiOffsetRgn(VisRgn, Window->WindowRect.left, Window->WindowRect.top); } - NtGdiOffsetRgn(VisRgn, -LeftOffset, -TopOffset); - return VisRgn; } _____ Modified: trunk/reactos/subsys/win32k/ntuser/windc.c --- trunk/reactos/subsys/win32k/ntuser/windc.c 2005-09-19 10:04:07 UTC (rev 17930) +++ trunk/reactos/subsys/win32k/ntuser/windc.c 2005-09-19 10:39:26 UTC (rev 17931) @@ -34,8 +34,6 @@ #define NDEBUG #include <debug.h> -#define DCX_USESTYLE 0x10000 - /* GLOBALS *******************************************************************/ /* NOTE - I think we should store this per window station (including gdi objects) */ @@ -187,7 +185,7 @@ STATIC VOID FASTCALL DceDeleteClipRgn(DCE* Dce) { - Dce->DCXFlags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN | DCX_WINDOWPAINT); + Dce->DCXFlags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN); if (Dce->DCXFlags & DCX_KEEPCLIPRGN ) { @@ -216,7 +214,7 @@ /* restore previous visible region */ if ((dce->DCXFlags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) && - (dce->DCXFlags & (DCX_CACHE | DCX_WINDOWPAINT)) ) + (dce->DCXFlags & DCX_CACHE) ) { DceDeleteClipRgn(dce); } @@ -273,23 +271,6 @@ { hRgnVisible = NtGdiCreateRectRgn(0, 0, 0, 0); } - else - { - if (0 == (Flags & DCX_WINDOW)) - { - NtGdiOffsetRgn( - hRgnVisible, - Parent->ClientRect.left - Window->ClientRect.left, - Parent->ClientRect.top - Window->ClientRect.top); - } - else - { - NtGdiOffsetRgn( - hRgnVisible, - Parent->WindowRect.left - Window->WindowRect.left, - Parent->WindowRect.top - Window->WindowRect.top); - } - } } else if (Window == NULL) { @@ -482,7 +463,7 @@ } Dce->hwndCurrent = (Window ? Window->hSelf : NULL); - Dce->DCXFlags = DcxFlags | (Flags & DCX_WINDOWPAINT) | DCX_DCEBUSY; + Dce->DCXFlags = DcxFlags | DCX_DCEBUSY; if (0 == (Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && NULL != ClipRegion) { @@ -498,21 +479,8 @@ if (0 != (Flags & DCX_INTERSECTUPDATE) && NULL == ClipRegion) { - Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - if (Dce->hClipRgn && Window->UpdateRegion) - { - GDIOBJ_SetOwnership(Dce->hClipRgn, NULL); - NtGdiCombineRgn(Dce->hClipRgn, Window->UpdateRegion, NULL, RGN_COPY); - if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) - NtGdiCombineRgn(Dce->hClipRgn, Dce->hClipRgn, Window->WindowRegion, RGN_AND); - if (!(Flags & DCX_WINDOW)) - { - NtGdiOffsetRgn(Dce->hClipRgn, - Window->WindowRect.left - Window->ClientRect.left, - Window->WindowRect.top - Window->ClientRect.top); - } - } - Flags |= DCX_INTERSECTRGN; + Flags |= DCX_INTERSECTRGN | DCX_KEEPCLIPRGN; + ClipRegion = Window->UpdateRegion; } if (ClipRegion == (HRGN) 1) @@ -521,40 +489,17 @@ { Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); GDIOBJ_SetOwnership(Dce->hClipRgn, NULL); - if(!Window->WindowRegion || (Window->Style & WS_MINIMIZE)) - { - NtGdiOffsetRgn(Dce->hClipRgn, -Window->ClientRect.left, -Window->ClientRect.top); - } - else - { - NtGdiOffsetRgn(Dce->hClipRgn, -Window->WindowRect.left, -Window->WindowRect.top); - NtGdiCombineRgn(Dce->hClipRgn, Dce->hClipRgn, Window->WindowRegion, RGN_AND); - NtGdiOffsetRgn(Dce->hClipRgn, -(Window->ClientRect.left - Window->WindowRect.left), - -(Window->ClientRect.top - Window->WindowRect.top)); - } } else { Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); GDIOBJ_SetOwnership(Dce->hClipRgn, NULL); - NtGdiOffsetRgn(Dce->hClipRgn, -Window->WindowRect.left, - -Window->WindowRect.top); - if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) - NtGdiCombineRgn(Dce->hClipRgn, Dce->hClipRgn, Window->WindowRegion, RGN_AND); } } - else if (NULL != ClipRegion) + else if (ClipRegion != NULL) { - Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); - if (Dce->hClipRgn) - { - GDIOBJ_SetOwnership(Dce->hClipRgn, NULL); - if(!Window->WindowRegion || (Window->Style & WS_MINIMIZE)) - NtGdiCombineRgn(Dce->hClipRgn, ClipRegion, NULL, RGN_COPY); - else - NtGdiCombineRgn(Dce->hClipRgn, ClipRegion, Window->WindowRegion, RGN_AND); - } - NtGdiDeleteObject(ClipRegion); + Dce->hClipRgn = ClipRegion; + GDIOBJ_SetOwnership(Dce->hClipRgn, NULL); } DceSetDrawable(Window, Dce->hDC, Flags, UpdateClipOrigin); @@ -705,9 +650,9 @@ } NtGdiDeleteDC(dce->hDC); + GDIOBJ_SetOwnership(dce->hClipRgn, PsGetCurrentProcess()); if (dce->hClipRgn && ! (dce->DCXFlags & DCX_KEEPCLIPRGN)) { - GDIOBJ_SetOwnership(dce->hClipRgn, PsGetCurrentProcess()); NtGdiDeleteObject(dce->hClipRgn); [truncated at 1000 lines; 106 more skipped]
19 years
1
0
0
0
[hpoussin] 17930: Implement IRP_MN_QUERY_CAPABILITIES, IRP_MN_QUERY_RESOURCES, IRP_MN_QUERY_RESOURCE_REQUIREMENTS, IRP_MN_QUERY_DEVICE_TEXT for USB devices
by hpoussin@svn.reactos.com
Implement IRP_MN_QUERY_CAPABILITIES, IRP_MN_QUERY_RESOURCES, IRP_MN_QUERY_RESOURCE_REQUIREMENTS, IRP_MN_QUERY_DEVICE_TEXT for USB devices Fix DeviceID and HardwareIDs identifiers returned for root hub (Vendor and Product IDs are still not initialized by Cromwell code) Fix handling of removal IRPs for USB controller Modified: trunk/reactos/bootdata/hivesys.inf Modified: trunk/reactos/drivers/usb/miniport/common/fdo.c Modified: trunk/reactos/drivers/usb/miniport/common/pdo.c Modified: trunk/reactos/drivers/usb/usbhub/pdo.c Modified: trunk/reactos/drivers/usb/usbport/usbport.def Modified: trunk/reactos/media/inf/usbport.inf _____ Modified: trunk/reactos/bootdata/hivesys.inf --- trunk/reactos/bootdata/hivesys.inf 2005-09-19 08:11:43 UTC (rev 17929) +++ trunk/reactos/bootdata/hivesys.inf 2005-09-19 10:04:07 UTC (rev 17930) @@ -630,6 +630,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","DisplayName",0x00000000 ,"ReactOS USB HUB cromwell-type driver" ;hard coded values HKLM,"SYSTEM\CurrentControlSet\Enum\USB\ROOT_HUB\0000","Service",0x00000 00,"usbhub" +HKLM,"SYSTEM\CurrentControlSet\Enum\USB\ROOT_HUB20\0000","Service",0x00 00000,"usbhub" ; ReactOS PCNet NIC driver ; To use the AMD supplied driver change the driver name to pcntn5m.sys _____ Modified: trunk/reactos/drivers/usb/miniport/common/fdo.c --- trunk/reactos/drivers/usb/miniport/common/fdo.c 2005-09-19 08:11:43 UTC (rev 17929) +++ trunk/reactos/drivers/usb/miniport/common/fdo.c 2005-09-19 10:04:07 UTC (rev 17930) @@ -190,7 +190,7 @@ switch (MinorFunction) { - case IRP_MN_START_DEVICE: + case IRP_MN_START_DEVICE: /* 0x00 */ { Status = ForwardIrpAndWait(DeviceObject, Irp); if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status)) @@ -198,12 +198,15 @@ break; } - case IRP_MN_REMOVE_DEVICE: - case IRP_MN_QUERY_REMOVE_DEVICE: - case IRP_MN_CANCEL_REMOVE_DEVICE: - case IRP_MN_SURPRISE_REMOVAL: + case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */ + case IRP_MN_CANCEL_REMOVE_DEVICE: /* 0x03 */ + { + return ForwardIrpAndForget(DeviceObject, Irp); + } - case IRP_MN_STOP_DEVICE: + case IRP_MN_REMOVE_DEVICE: /* 0x02 */ + case IRP_MN_STOP_DEVICE: /* 0x04 */ + case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */ { Status = ForwardIrpAndWait(DeviceObject, Irp); if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status)) @@ -211,8 +214,9 @@ IoDeleteDevice(DeviceObject); // just delete device for now break; } - case IRP_MN_QUERY_STOP_DEVICE: - case IRP_MN_CANCEL_STOP_DEVICE: + + case IRP_MN_QUERY_STOP_DEVICE: /* 0x05 */ + case IRP_MN_CANCEL_STOP_DEVICE: /* 0x06 */ { Status = STATUS_SUCCESS; break; @@ -244,7 +248,7 @@ default: { - DPRINT1("USBMP: unknown minor function 0x%lx\n", MinorFunction); + DPRINT1("USBMP: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction); return ForwardIrpAndForget(DeviceObject, Irp); } } _____ Modified: trunk/reactos/drivers/usb/miniport/common/pdo.c --- trunk/reactos/drivers/usb/miniport/common/pdo.c 2005-09-19 08:11:43 UTC (rev 17929) +++ trunk/reactos/drivers/usb/miniport/common/pdo.c 2005-09-19 10:04:07 UTC (rev 17930) @@ -80,36 +80,49 @@ ULONG IdType; UNICODE_STRING SourceString; UNICODE_STRING String; + struct usb_device *roothub; NTSTATUS Status = STATUS_SUCCESS; IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType; DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceObject->DeviceExtension; RtlInitUnicodeString(&String, NULL); + DeviceExtension = (PUSBMP_DEVICE_EXTENSION)DeviceExtension->FunctionalDeviceObject->Device Extension; + roothub = ((struct usb_hcd*)DeviceExtension->pdev->data)->self.root_hub; switch (IdType) { case BusQueryDeviceID: { DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n"); - RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB"); + if (roothub->speed == USB_SPEED_LOW || roothub->speed == USB_SPEED_FULL) + RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB"); /* USB 1.1 */ + else + RtlInitUnicodeString(&SourceString, L"USB\\ROOT_HUB20"); /* USB 2.0 */ break; } case BusQueryHardwareIDs: { - //CHAR Buffer[2][40]; + CHAR Buffer[2][40]; + PCHAR RootHubName; + USHORT Vendor, Product, Revision; + DPRINT("USBMP: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n"); - /*FIXME: sprintf(Buffer[0], "USB\\VID%04X&PID%04X&REV%04X", - VENDOR, - PRODUCT, - REV); + Vendor = DeviceExtension->pdev->vendor; + Product = DeviceExtension->pdev->device; + Revision = 0; /* FIXME */ + + sprintf(Buffer[0], "USB\\VID%04X&PID%04X&REV%04X", + Vendor, Product, Revision); sprintf(Buffer[1], "USB\\VID%04X&PID%04X", - VENDOR, - PRODUCT); + Vendor, Product); + if (roothub->speed == USB_SPEED_LOW || roothub->speed == USB_SPEED_FULL) + RootHubName = "USB\\ROOT_HUB"; /* USB 1.1 */ + else + RootHubName = "USB\\ROOT_HUB20"; /* USB 2.0 */ Status = UsbMpInitMultiSzString( &SourceString, - Buffer[0], Buffer[1], "USB\\ROOT_HUB", NULL);*/ - Status = UsbMpInitMultiSzString(&SourceString, "USB\\ROOT_HUB", NULL); + Buffer[0], Buffer[1], RootHubName, NULL); break; } case BusQueryCompatibleIDs: _____ Modified: trunk/reactos/drivers/usb/usbhub/pdo.c --- trunk/reactos/drivers/usb/usbhub/pdo.c 2005-09-19 08:11:43 UTC (rev 17929) +++ trunk/reactos/drivers/usb/usbhub/pdo.c 2005-09-19 10:04:07 UTC (rev 17930) @@ -133,6 +133,61 @@ return Status; } +static NTSTATUS +UsbhubPdoQueryDeviceText( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + OUT ULONG_PTR* Information) +{ + PHUB_DEVICE_EXTENSION DeviceExtension; + DEVICE_TEXT_TYPE DeviceTextType; + LCID LocaleId; + + DeviceTextType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.DeviceText Type; + LocaleId = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryDeviceText.LocaleId; + DeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + switch (DeviceTextType) + { + /*case DeviceTextDescription: + { + DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n"); + return STATUS_NOT_IMPLEMENTED; + }*/ + case DeviceTextLocationInformation: + { + int size; + char *buf; + + DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextLocationInformation\n"); + if (!DeviceExtension->dev->descriptor.iProduct) + return STATUS_NOT_SUPPORTED; + + size = usb_get_string(DeviceExtension->dev, LocaleId, DeviceExtension->dev->descriptor.iProduct, NULL, 0); + if (size < 2) + { + DPRINT("Usbhub: usb_get_string() failed\n"); + return STATUS_IO_DEVICE_ERROR; + } + buf = ExAllocatePool(PagedPool, size); + if (buf == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + size = usb_get_string(DeviceExtension->dev, LocaleId, DeviceExtension->dev->descriptor.iProduct, buf, size); + if (size < 0) + { + DPRINT("Usbhub: usb_get_string() failed\n"); + ExFreePool(buf); + return STATUS_IO_DEVICE_ERROR; + } + *Information = (ULONG_PTR)buf; + return STATUS_SUCCESS; + } + default: + DPRINT1("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown device text type 0x%lx\n", DeviceTextType); + return STATUS_NOT_SUPPORTED; + } +} + NTSTATUS STDCALL UsbhubPnpPdo( IN PDEVICE_OBJECT DeviceObject, @@ -154,6 +209,82 @@ Status = UsbhubPdoStartDevice(DeviceObject, Irp); break; } + case IRP_MN_QUERY_CAPABILITIES: /* 0x09 */ + { + PDEVICE_CAPABILITIES DeviceCapabilities; + ULONG i; + DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n"); + + DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities; + /* FIXME: capabilities can change with connected device */ + DeviceCapabilities->LockSupported = TRUE; + DeviceCapabilities->EjectSupported = FALSE; + DeviceCapabilities->Removable = FALSE; + DeviceCapabilities->DockDevice = FALSE; + DeviceCapabilities->UniqueID = FALSE; + DeviceCapabilities->SilentInstall = TRUE; + DeviceCapabilities->RawDeviceOK = FALSE; + DeviceCapabilities->SurpriseRemovalOK = FALSE; + DeviceCapabilities->HardwareDisabled = FALSE; /* FIXME */ + //DeviceCapabilities->NoDisplayInUI = FALSE; /* FIXME */ + DeviceCapabilities->DeviceState[0] = PowerDeviceD0; /* FIXME */ + for (i = 0; i < PowerSystemMaximum; i++) + DeviceCapabilities->DeviceState[i] = PowerDeviceD3; /* FIXME */ + //DeviceCapabilities->DeviceWake = PowerDeviceUndefined; /* FIXME */ + DeviceCapabilities->D1Latency = 0; /* FIXME */ + DeviceCapabilities->D2Latency = 0; /* FIXME */ + DeviceCapabilities->D3Latency = 0; /* FIXME */ + Status = STATUS_SUCCESS; + break; + } + case IRP_MN_QUERY_RESOURCES: /* 0x0a */ + { + PCM_RESOURCE_LIST ResourceList; + + DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n"); + ResourceList = ExAllocatePool(PagedPool, sizeof(CM_RESOURCE_LIST)); + if (!ResourceList) + { + DPRINT("Usbhub: ExAllocatePool() failed\n"); + Status = STATUS_INSUFFICIENT_RESOURCES; + } + else + { + ResourceList->Count = 0; + Information = (ULONG_PTR)ResourceList; + Status = STATUS_SUCCESS; + } + break; + } + case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0x0b */ + { + PIO_RESOURCE_REQUIREMENTS_LIST ResourceList; + + DPRINT("Usbhub: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n"); + ResourceList = ExAllocatePool(PagedPool, sizeof(IO_RESOURCE_REQUIREMENTS_LIST)); + if (!ResourceList) + { + DPRINT("Usbhub: ExAllocatePool() failed\n"); + Status = STATUS_INSUFFICIENT_RESOURCES; + } + else + { + RtlZeroMemory(ResourceList, sizeof(IO_RESOURCE_REQUIREMENTS_LIST)); + ResourceList->ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST); + ResourceList->AlternativeLists = 1; + ResourceList->List->Version = 1; + ResourceList->List->Revision = 1; + ResourceList->List->Count = 0; + Information = (ULONG_PTR)ResourceList; + Status = STATUS_SUCCESS; + } + break; + } + case IRP_MN_QUERY_DEVICE_TEXT: /* 0x0c */ + { + Status = UsbhubPdoQueryDeviceText(DeviceObject, Irp, &Information); + break; + } case IRP_MN_QUERY_ID: /* 0x13 */ { Status = UsbhubPdoQueryId(DeviceObject, Irp, &Information); _____ Modified: trunk/reactos/drivers/usb/usbport/usbport.def --- trunk/reactos/drivers/usb/usbport/usbport.def 2005-09-19 08:11:43 UTC (rev 17929) +++ trunk/reactos/drivers/usb/usbport/usbport.def 2005-09-19 10:04:07 UTC (rev 17930) @@ -7,6 +7,7 @@ usb_init_urb@4 usb_alloc_urb@8 usb_free_urb@4 +usb_get_string usb_get_urb@4 usb_get_dev@4 usb_submit_urb@8 _____ Modified: trunk/reactos/media/inf/usbport.inf --- trunk/reactos/media/inf/usbport.inf 2005-09-19 08:11:43 UTC (rev 17929) +++ trunk/reactos/media/inf/usbport.inf 2005-09-19 10:04:07 UTC (rev 17930) @@ -31,6 +31,7 @@ %PCI\CC_0C0310.DeviceDesc%=OHCI_Inst,PCI\CC_0C0310 %PCI\CC_0C0320.DeviceDesc%=EHCI_Inst,PCI\CC_0C0320 %USB\ROOT_HUB.DeviceDesc%=RootHub_Inst,USB\ROOT_HUB +%USB\ROOT_HUB.DeviceDesc%=RootHub_Inst,USB\ROOT_HUB20 [IntelMfg] %PCI\VEN_8086&DEV_7112&CC_0C0300.DeviceDesc%=UHCI_Inst,PCI\VEN_8086&DEV_ 7112&CC_0C0300 @@ -41,7 +42,7 @@ CopyFiles = UHCI_CopyFiles [UHCI_CopyFiles.NT] -usbcore.sys +usbport.sys usbuhci.sys [UHCI_Inst.NT.Services] @@ -60,7 +61,7 @@ CopyFiles = OHCI_CopyFiles [OHCI_CopyFiles.NT] -usbcore.sys +usbport.sys usbohci.sys [OHCI_Inst.NT.Services] @@ -79,7 +80,7 @@ CopyFiles = EHCI_CopyFiles [EHCI_CopyFiles.NT] -usbcore.sys +usbport.sys usbehci.sys [EHCI_Inst.NT.Services] @@ -98,6 +99,7 @@ CopyFiles = RootHub_CopyFiles [RootHub_CopyFiles.NT] +usbport.sys usbhub.sys [RootHub_Inst.NT.Services]
19 years
1
0
0
0
[hpoussin] 17929: Automagically select computer type (UP/MP) during first stage setup
by hpoussin@svn.reactos.com
Automagically select computer type (UP/MP) during first stage setup Modified: trunk/reactos/bootdata/txtsetup.sif Modified: trunk/reactos/subsys/system/usetup/settings.c _____ Modified: trunk/reactos/bootdata/txtsetup.sif --- trunk/reactos/bootdata/txtsetup.sif 2005-09-19 07:35:31 UTC (rev 17928) +++ trunk/reactos/bootdata/txtsetup.sif 2005-09-19 08:11:43 UTC (rev 17929) @@ -52,6 +52,11 @@ pci_up = "Standard-PC" pci_mp = "Standard-PC Multiprocessor" +[Map.Computer] +;<id> = <pnp id string> +pci_up = "PC UP" +pci_mp = "PC MP" + [Files.pci_up] ; <filename> = <directory_id>,<new name> hal.dll = 2 _____ Modified: trunk/reactos/subsys/system/usetup/settings.c --- trunk/reactos/subsys/system/usetup/settings.c 2005-09-19 07:35:31 UTC (rev 17928) +++ trunk/reactos/subsys/system/usetup/settings.c 2005-09-19 08:11:43 UTC (rev 17929) @@ -16,8 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id$ - * COPYRIGHT: See COPYING in the top level directory +/* COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup * FILE: subsys/system/usetup/settings.c * PURPOSE: Device settings support functions @@ -33,6 +32,90 @@ /* FUNCTIONS ****************************************************************/ +static BOOLEAN +GetComputerIdentifier(PWSTR Identifier, + ULONG IdentifierLength) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + LPCWSTR ComputerIdentifier; + HANDLE ProcessorsKey; + PKEY_FULL_INFORMATION pFullInfo; + ULONG Size, SizeNeeded; + NTSTATUS Status; + + DPRINT("GetComputerIdentifier() called\n"); + + Size = sizeof(KEY_FULL_INFORMATION); + pFullInfo = (PKEY_FULL_INFORMATION)RtlAllocateHeap(RtlGetProcessHeap(), 0, Size); + if (!pFullInfo) + { + DPRINT("RtlAllocateHeap() failed\n"); + return FALSE; + } + + /* Open the processors key */ + RtlInitUnicodeString(&KeyName, + L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor") ; + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&ProcessorsKey, + KEY_QUERY_VALUE , + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtOpenKey() failed (Status 0x%lx)\n", Status); + RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo); + return FALSE; + } + + /* Get number of subkeys */ + Status = NtQueryKey( + ProcessorsKey, + KeyFullInformation, + pFullInfo, + Size, + &Size); + NtClose(ProcessorsKey); + if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW) + { + DPRINT("NtQueryKey() failed (Status 0x%lx)\n", Status); + RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo); + return FALSE; + } + + /* Find computer identifier */ + if (pFullInfo->SubKeys == 0) + { + /* Something strange happened. No processor detected */ + RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo); + return FALSE; + } + + if (pFullInfo->SubKeys == 1) + { + /* Computer is mono-CPU */ + ComputerIdentifier = L"PC UP"; + } + else + { + /* Computer is multi-CPUs */ + ComputerIdentifier = L"PC MP"; + } + RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo); + + /* Copy computer identifier to return buffer */ + SizeNeeded = (wcslen(ComputerIdentifier) + 1) * sizeof(WCHAR); + if (SizeNeeded > IdentifierLength) + return FALSE; + RtlCopyMemory(Identifier, ComputerIdentifier, SizeNeeded); + return TRUE; +} + + PGENERIC_LIST CreateComputerTypeList(HINF InfFile) { @@ -42,7 +125,49 @@ PWCHAR KeyName; PWCHAR KeyValue; PWCHAR UserData; + WCHAR ComputerIdentifier[128]; + WCHAR ComputerKey[32]; + /* Get the computer identification */ + if (!GetComputerIdentifier(ComputerIdentifier, 128)) + { + ComputerIdentifier[0] = 0; + } + + DPRINT("Computer identifier: '%S'\n", ComputerIdentifier); + + /* Search for matching device identifier */ + if (!InfFindFirstLine(InfFile, L"Map.Computer", NULL, &Context)) + { + /* FIXME: error message */ + return NULL; + } + + do + { + if (!InfGetDataField(&Context, 1, &KeyValue)) + { + /* FIXME: Handle error! */ + DPRINT("InfGetDataField() failed\n"); + return NULL; + } + + DPRINT("KeyValue: %S\n", KeyValue); + if (wcsstr(ComputerIdentifier, KeyValue)) + { + if (!InfGetDataField(&Context, 0, &KeyName)) + { + /* FIXME: Handle error! */ + DPRINT("InfGetDataField() failed\n"); + return NULL; + } + + DPRINT("Computer key: %S\n", KeyName); + wcscpy(ComputerKey, KeyName); + } + } + while (InfFindNextLine(&Context, &Context)); + List = CreateGenericList(); if (List == NULL) return NULL; @@ -73,7 +198,8 @@ wcscpy(UserData, KeyName); sprintf(Buffer, "%S", KeyValue); - AppendGenericListEntry(List, Buffer, UserData, FALSE); + AppendGenericListEntry(List, Buffer, UserData, + _wcsicmp(KeyName, ComputerKey) ? FALSE : TRUE); } while (InfFindNextLine(&Context, &Context));
19 years
1
0
0
0
[navaraf] 17928: - Move the window showing/hiding notifications from co_WinPosShowWindow to co_WinPosSetWindowPos and fix up the top-level checks.
by navaraf@svn.reactos.com
- Move the window showing/hiding notifications from co_WinPosShowWindow to co_WinPosSetWindowPos and fix up the top-level checks. - Call the redraw routine on parent window if possible in co_WinPosSetWindowPos. Should fix bug #735. Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c _____ Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c --- trunk/reactos/subsys/win32k/ntuser/winpos.c 2005-09-19 05:42:01 UTC (rev 17927) +++ trunk/reactos/subsys/win32k/ntuser/winpos.c 2005-09-19 07:35:31 UTC (rev 17928) @@ -1064,10 +1064,20 @@ /* Clear the update region */ co_UserRedrawWindow(Window, NULL, 0, RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN); + if ((Window->Style & WS_VISIBLE) && + Window->Parent == UserGetDesktopWindow()) + { + co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf); + } Window->Style &= ~WS_VISIBLE; } else if (WinPos.flags & SWP_SHOWWINDOW) { + if (!(Window->Style & WS_VISIBLE) && + Window->Parent == UserGetDesktopWindow()) + { + co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf); + } Window->Style |= WS_VISIBLE; } @@ -1199,11 +1209,22 @@ } if (RgnType != ERROR && RgnType != NULLREGION) { - NtGdiOffsetRgn(DirtyRgn, - Window->WindowRect.left - Window->ClientRect.left, - Window->WindowRect.top - Window->ClientRect.top); - co_UserRedrawWindow(Window, NULL, DirtyRgn, - RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + if (Window->Parent) + { + NtGdiOffsetRgn(DirtyRgn, + Window->WindowRect.left - Window->Parent->ClientRect.left, + Window->WindowRect.top - Window->Parent->ClientRect.top); + co_UserRedrawWindow(Window->Parent, NULL, DirtyRgn, + RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + } + else + { + NtGdiOffsetRgn(DirtyRgn, + Window->WindowRect.left - Window->ClientRect.left, + Window->WindowRect.top - Window->ClientRect.top); + co_UserRedrawWindow(Window, NULL, DirtyRgn, + RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + } } NtGdiDeleteObject(DirtyRgn); } @@ -1363,14 +1384,6 @@ if (ShowFlag != WasVisible) { co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0); - /* - * FIXME: Need to check the window wasn't destroyed during the - * window procedure. - */ - if (!(Window->Parent)) - { - co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf); - } } /* We can't activate a child window */ @@ -1409,11 +1422,6 @@ //faxme: as long as we have ref on Window, we also, indirectly, have ref on parent... co_UserSetFocus(Window->Parent); } - - if (!(Window->Parent)) - { - co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf); - } } /* FIXME: Check for window destruction. */
19 years
1
0
0
0
[royce] 17927: fix if command to work more like expected. seta_test.cmd gets much further now.
by royce@svn.reactos.com
fix if command to work more like expected. seta_test.cmd gets much further now. fixed some msvc6 warnings while I was in here Modified: trunk/reactos/subsys/system/cmd/if.c _____ Modified: trunk/reactos/subsys/system/cmd/if.c --- trunk/reactos/subsys/system/cmd/if.c 2005-09-19 05:29:17 UTC (rev 17926) +++ trunk/reactos/subsys/system/cmd/if.c 2005-09-19 05:42:01 UTC (rev 17927) @@ -52,9 +52,16 @@ return 0; } - /* First check if param string begins with word 'not' */ - if (!_tcsnicmp (param, _T("not"), 3) && _istspace (*(param + 3))) + /* First check if param string begins with '!' or 'not' */ + if ( param[0] == _T('!') ) { + x_flag = X_EXEC; /* Remember '!' */ + ++param; /* Step over '!' */ + while (_istspace (*param)) /* And subsequent spaces */ + param++; + } + else if (!_tcsnicmp (param, _T("not"), 3) && _istspace (*(param + 3))) + { x_flag = X_EXEC; /* Remember 'NOT' */ param += 3; /* Step over 'NOT' */ while (_istspace (*param)) /* And subsequent spaces */ @@ -64,14 +71,15 @@ /* Check for 'exist' form */ if (!_tcsnicmp (param, _T("exist"), 5) && _istspace (*(param + 5))) { + UINT i; + BOOL bInside = FALSE; + param += 5; while (_istspace (*param)) param++; pp = param; - INT i; - BOOL bInside = FALSE; /* find the whole path to the file */ for(i = 0; i < _tcslen(param); i++) { @@ -155,38 +163,34 @@ x_flag |= X_EMPTY; /* Syntax error if comd empty */ } - else if (NULL == (pp = _tcsstr (param, _T("==")))) - { - /* Check that '==' is present, syntax error if not */ - error_syntax (NULL); - return 1; - } else { - /* Change first '='to space to terminate comparison loop */ - - *pp = _T(' '); /* Need a space to terminate comparison loop */ - pp += 2; /* over '==' */ + BOOL bInQuote = FALSE; + INT p1len; + pp = param; + while ( *pp && ( bInQuote || *pp != _T('=') ) ) + { + if ( *pp == _T('\"') ) + bInQuote = !bInQuote; + ++pp; + } + p1len = pp-param; + /* check for "==" */ + if ( *pp++ != _T('=') || *pp++ != _T('=') ) + { + error_syntax ( NULL ); + return 1; + } while (_istspace (*pp)) /* Skip subsequent spaces */ pp++; - _tcscat (pp, _T(" ")); /* Add one space to ensure comparison ends */ + /* are the two sides equal, and does the second end in the same place? */ + if ( !_tcsncmp(param,pp,p1len) && _tcschr(_T(" ("),pp[p1len]) ) + x_flag ^= X_EXEC; + pp += p1len; - while (*param == *pp) /* Comparison loop */ - { - if (_istspace (*param)) /* Terminates on space */ - break; - - param++, pp++; - } - - if (x_flag ^= (*param != *pp) ? 0 : X_EXEC) - { - while (*pp && !_istspace (*pp)) /* Find first space, */ - pp++; - + if ( x_flag ) x_flag |= X_EMPTY; - } } if (x_flag & X_EMPTY)
19 years
1
0
0
0
[royce] 17926: fixed mistakes, extra tests illustrating problems with if command
by royce@svn.reactos.com
fixed mistakes, extra tests illustrating problems with if command Modified: trunk/reactos/subsys/system/cmd/seta_test.cmd _____ Modified: trunk/reactos/subsys/system/cmd/seta_test.cmd --- trunk/reactos/subsys/system/cmd/seta_test.cmd 2005-09-19 01:14:36 UTC (rev 17925) +++ trunk/reactos/subsys/system/cmd/seta_test.cmd 2005-09-19 05:29:17 UTC (rev 17926) @@ -1,60 +1,67 @@ @echo off -if ("1"=="2") goto failure -if !("1"=="1") goto failure +@rem the next line illustrates a bug in our cmd +set /a a=5%2 +@rem the next two lines illustrate bug in existing if code +if not "=="=="==" goto failure +if "=="=="==" goto next1 +goto failure +:next1 +if "1"=="2" goto failure +if !"1"=="1" goto failure set /a a=1 -if !("%a%"=="1") goto failure +if !"%a%"=="1" goto failure set /a b=a -if !("%b%"=="1") goto failure +if !"%b%"=="1" goto failure set /a a=!5 -if !("%a%"=="0") goto failure +if !"%a%"=="0" goto failure set /a a=~5 -if !("%a%"=="-6") goto failure +if !"%a%"=="-6" goto failure set /a a=5,a=-a -if !("%a%"=="-5") goto failure +if !"%a%"=="-5" goto failure set /a a=5*7 -if !("%a%"=="35") goto failure +if !"%a%"=="35" goto failure set /a a=2000/10 -if !("%a%"=="200") goto failure +if !"%a%"=="200" goto failure set /a a=42%9 -if !("%a%"=="6") goto failure +if !"%a%"=="6" goto failure set /a a=7+9 -if !("%a%"=="16") goto failure +if !"%a%"=="16" goto failure set /a a=9-7 -if !("%a%"=="2") goto failure +if !"%a%"=="2" goto failure set /a a=9^<^<2 -if !("%a%"=="36") goto failure +if !"%a%"=="36" goto failure set /a a=36^>^>2 -if !("%a%"=="9") goto failure +if !"%a%"=="9" goto failure set /a a=42^&9 -if !("%a%"=="8") goto failure +if !"%a%"=="8" goto failure set /a a=32^^9 -if !("%a%"=="41") goto failure +if !"%a%"=="41" goto failure set /a a=10^|22 -if !("%a%"=="30") goto failure +if !"%a%"=="30" goto failure set /a a=2,a*=3 -if !("%a%"=="6") goto failure +if !"%a%"=="6" goto failure set /a a=11,a/=2 -if !("%a%"=="5") goto failure +if !"%a%"=="5" goto failure set /a a=42,a%=9 -if !("%a%"=="6") goto failure +if !"%a%"=="6" goto failure set /a a=7,a+=9 -if !("%a%"=="16") goto failure +if !"%a%"=="16" goto failure set /a a=9,a-=7 -if !("%a%"=="2") goto failure +if !"%a%"=="2" goto failure set /a a=42,a^&=9 -if !("%a%"=="8") goto failure +if !"%a%"=="8" goto failure set /a a=32,a^^=9 -if !("%a%"=="41") goto failure +if !"%a%"=="41" goto failure set /a a=10,a^|=22 -if !("%a%"=="30") goto failure +if !"%a%"=="30" goto failure set /a a=9,a^<^<=2 -if !("%a%"=="36") goto failure +if !"%a%"=="36" goto failure set /a a=36,a^>^>=2 -if !("%a%"=="9") goto failure -set /a a=(1,2) -if !("%a%"=="2") goto failure +if !"%a%"=="9" goto failure +set /a a=1,2 +if !"%a%"=="2" goto failure set /a a=(a=1,a+2) -if ("%a%"=="3") goto success +if "%a%"=="3" goto success goto failure :success @@ -62,6 +69,6 @@ goto done :failure -echo FAILURE! (remove the echo off and see the last formula that executed before this line) +echo FAILURE! remove the echo off and see the last formula that executed before this line :done
19 years
1
0
0
0
[royce] 17925: move hard-coded strings to En.rc before GreatLord shoots me
by royce@svn.reactos.com
move hard-coded strings to En.rc before GreatLord shoots me Modified: trunk/reactos/subsys/system/cmd/En.rc Modified: trunk/reactos/subsys/system/cmd/resource.h Modified: trunk/reactos/subsys/system/cmd/set.c _____ Modified: trunk/reactos/subsys/system/cmd/En.rc --- trunk/reactos/subsys/system/cmd/En.rc 2005-09-19 00:02:39 UTC (rev 17924) +++ trunk/reactos/subsys/system/cmd/En.rc 2005-09-19 01:14:36 UTC (rev 17925) @@ -635,4 +635,10 @@ STRING_SCREEN_COL, "invalid value for col" STRING_SCREEN_ROW, "invalid value for row" STRING_TIMER_TIME "Timer %d is %s: " + +STRING_INVALID_OPERAND, "Invalid operand.\n" +STRING_EXPECTED_CLOSE_PAREN, "Expected ')'.\n" +STRING_EXPECTED_NUMBER_OR_VARIABLE,"Expected number or variable name.\n" +STRING_SYNTAX_COMMAND_INCORRECT, "The syntax of the command is incorrect.\n" + } _____ Modified: trunk/reactos/subsys/system/cmd/resource.h --- trunk/reactos/subsys/system/cmd/resource.h 2005-09-19 00:02:39 UTC (rev 17924) +++ trunk/reactos/subsys/system/cmd/resource.h 2005-09-19 01:14:36 UTC (rev 17925) @@ -215,6 +215,11 @@ #define STRING_HELP1 718 #define STRING_HELP2 719 +#define STRING_INVALID_OPERAND 720 +#define STRING_EXPECTED_CLOSE_PAREN 721 +#define STRING_EXPECTED_NUMBER_OR_VARIABLE 722 +#define STRING_SYNTAX_COMMAND_INCORRECT 723 + /* These strings are language independent (cmd.rc) */ #define STRING_FREEDOS_DEV 800 #define STRING_REACTOS_DEV 801 _____ Modified: trunk/reactos/subsys/system/cmd/set.c --- trunk/reactos/subsys/system/cmd/set.c 2005-09-19 00:02:39 UTC (rev 17924) +++ trunk/reactos/subsys/system/cmd/set.c 2005-09-19 01:14:36 UTC (rev 17925) @@ -225,7 +225,7 @@ *lval |= rval; break; default: - ConErrPrintf ( _T("Invalid operand.\n") ); + ConErrResPuts ( STRING_INVALID_OPERAND ); return FALSE; } return TRUE; @@ -246,7 +246,7 @@ return FALSE; if ( *p != _T(')') ) { - ConErrPrintf ( _T("Expected ')'\n") ); + ConErrResPuts ( STRING_EXPECTED_CLOSE_PAREN ); return FALSE; } *result = rval; @@ -267,7 +267,7 @@ } else { - ConErrPrintf ( _T("Expected number or variable name\n") ); + ConErrResPuts ( STRING_EXPECTED_NUMBER_OR_VARIABLE ); return FALSE; } *p_ = p; @@ -369,7 +369,7 @@ lval >>= rval; break; default: - ConErrPrintf ( _T("Invalid operand.\n") ); + ConErrResPuts ( STRING_INVALID_OPERAND ); return FALSE; } } @@ -487,7 +487,7 @@ INT rval; if ( !*p ) { - ConErrPrintf ( _T("The syntax of the command is incorrect.\n") ); + ConErrResPuts ( STRING_SYNTAX_COMMAND_INCORRECT ); return FALSE; } if ( !seta_stmt ( &p, &rval ) )
19 years
1
0
0
0
[gdalsnes] 17924: -set last error (invalid handle) in cases where handle is NULL also
by gdalsnes@svn.reactos.com
-set last error (invalid handle) in cases where handle is NULL also -remove GvG's workaround Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c Modified: trunk/reactos/subsys/win32k/ntuser/hook.c Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c Modified: trunk/reactos/subsys/win32k/ntuser/menu.c Modified: trunk/reactos/subsys/win32k/ntuser/monitor.c Modified: trunk/reactos/subsys/win32k/ntuser/window.c _____ Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c --- trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -74,18 +74,20 @@ { PACCELERATOR_TABLE Accel; - if (!hAccel) return NULL; + if (!hAccel) + { + SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); + return NULL; + } Accel= UserGetObject(&gHandleTable, hAccel, otAccel); - - if (Accel) + if (!Accel) { - ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0); - } - else - { SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); + return NULL; } + + ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0); return Accel; } _____ Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c --- trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -77,7 +77,11 @@ { PCURICON_OBJECT CurIcon; - if (!hCurIcon) return NULL; + if (!hCurIcon) + { + SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE); + return NULL; + } CurIcon = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCurIcon, otCursorIcon); if (!CurIcon) _____ Modified: trunk/reactos/subsys/win32k/ntuser/hook.c --- trunk/reactos/subsys/win32k/ntuser/hook.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/hook.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -59,21 +59,28 @@ } -PHOOK FASTCALL IntGetHookObject(HHOOK hWnd) +PHOOK FASTCALL IntGetHookObject(HHOOK hHook) { - - PHOOK Window = (PHOOK)UserGetObject(&gHandleTable, hWnd, otHook); - if (!Window) + PHOOK Hook; + + if (!hHook) { SetLastWin32Error(ERROR_INVALID_HOOK_HANDLE); return NULL; } + + Hook = (PHOOK)UserGetObject(&gHandleTable, hHook, otHook); + if (!Hook) + { + SetLastWin32Error(ERROR_INVALID_HOOK_HANDLE); + return NULL; + } - ASSERT(USER_BODY_TO_HEADER(Window)->RefCount >= 0); + ASSERT(USER_BODY_TO_HEADER(Hook)->RefCount >= 0); - USER_BODY_TO_HEADER(Window)->RefCount++; + USER_BODY_TO_HEADER(Hook)->RefCount++; - return Window; + return Hook; } _____ Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c --- trunk/reactos/subsys/win32k/ntuser/hotkey.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/hotkey.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -154,6 +154,10 @@ } + +/* SYSCALLS *****************************************************************/ + + BOOL STDCALL NtUserRegisterHotKey(HWND hWnd, int id, _____ Modified: trunk/reactos/subsys/win32k/ntuser/menu.c --- trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -115,7 +115,15 @@ PMENU_OBJECT FASTCALL UserGetMenuObject(HMENU hMenu) { - PMENU_OBJECT Menu = (PMENU_OBJECT)UserGetObject(&gHandleTable, hMenu, otMenu); + PMENU_OBJECT Menu; + + if (!hMenu) + { + SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); + return NULL; + } + + Menu = (PMENU_OBJECT)UserGetObject(&gHandleTable, hMenu, otMenu); if (!Menu) { SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); _____ Modified: trunk/reactos/subsys/win32k/ntuser/monitor.c --- trunk/reactos/subsys/win32k/ntuser/monitor.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/monitor.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -124,7 +124,16 @@ PMONITOR_OBJECT FASTCALL UserGetMonitorObject(IN HMONITOR hMonitor) { - PMONITOR_OBJECT Monitor = (PMONITOR_OBJECT)UserGetObject(&gHandleTable, hMonitor, otMonitor); + PMONITOR_OBJECT Monitor; + + if (!hMonitor) + { + SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE); + return NULL; + } + + + Monitor = (PMONITOR_OBJECT)UserGetObject(&gHandleTable, hMonitor, otMonitor); if (!Monitor) { SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE); _____ Modified: trunk/reactos/subsys/win32k/ntuser/window.c --- trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-18 23:06:15 UTC (rev 17923) +++ trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-19 00:02:39 UTC (rev 17924) @@ -97,7 +97,11 @@ { PWINDOW_OBJECT Window; - if (!hWnd) return NULL; + if (!hWnd) + { + SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); + return NULL; + } Window = (PWINDOW_OBJECT)UserGetObject(&gHandleTable, hWnd, otWindow); if (!Window || 0 != (Window->Status & WINDOWSTATUS_DESTROYED)) @@ -3233,7 +3237,6 @@ if (!(Window = UserGetWindowObject(hWnd))) { - SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); return 0; }
19 years
1
0
0
0
[gdalsnes] 17923: -added better LIST_FOR_EACH macros (ripped from wine) and fix their usage
by gdalsnes@svn.reactos.com
-added better LIST_FOR_EACH macros (ripped from wine) and fix their usage -make hotkeys session global (they dont belong in winsta) Modified: trunk/reactos/include/reactos/helper.h Modified: trunk/reactos/ntoskrnl/fs/filelock.c Modified: trunk/reactos/ntoskrnl/fs/notify.c Modified: trunk/reactos/subsys/win32k/include/hotkey.h Modified: trunk/reactos/subsys/win32k/include/winsta.h Modified: trunk/reactos/subsys/win32k/main/dllmain.c Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c Modified: trunk/reactos/subsys/win32k/ntuser/input.c Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c _____ Modified: trunk/reactos/include/reactos/helper.h --- trunk/reactos/include/reactos/helper.h 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/include/reactos/helper.h 2005-09-18 23:06:15 UTC (rev 17923) @@ -17,12 +17,21 @@ #endif #define EXPORTED __declspec(dllexport) #define IMPORTED __declspec(dllimport) -#define LIST_FOR_EACH(entry, head) \ - for(entry = (head)->Flink; entry != (head); entry = entry->Flink) -#define LIST_FOR_EACH_SAFE(tmp_entry, head, ptr, type, field) \ - for ((tmp_entry)=(head)->Flink; (tmp_entry)!=(head) && \ - ((ptr) = CONTAINING_RECORD(tmp_entry,type,field)) && \ - ((tmp_entry) = (tmp_entry)->Flink); ) + +/* iterate through the list using a list entry */ +#define LIST_FOR_EACH(elem, list, type, field) \ + for ((elem) = CONTAINING_RECORD((list)->Flink, type, field); \ + &(elem)->field != (list); \ + (elem) = CONTAINING_RECORD((elem)->field.Flink, type, field)) + +/* iterate through the list using a list entry, with safety against removal */ +#define LIST_FOR_EACH_SAFE(cursor, cursor2, list, type, field) \ + for ((cursor) = CONTAINING_RECORD((list)->Flink, type, field), \ + (cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field); \ + &(cursor)->field != (list); \ + (cursor) = (cursor2), \ + (cursor2) = CONTAINING_RECORD((cursor)->field.Flink, type, field)) + #define OPTHDROFFSET(a) ((LPVOID)((BYTE *)a + \ ((PIMAGE_DOS_HEADER)a)->e_lfanew + \ sizeof (IMAGE_NT_SIGNATURE) + \ _____ Modified: trunk/reactos/ntoskrnl/fs/filelock.c --- trunk/reactos/ntoskrnl/fs/filelock.c 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/ntoskrnl/fs/filelock.c 2005-09-18 23:06:15 UTC (rev 17923) @@ -161,7 +161,6 @@ KIRQL oldirql; PFILE_LOCK_TOC LockToc; PFILE_LOCK_GRANTED Granted; - PLIST_ENTRY EnumEntry; LARGE_INTEGER EndOffset; ASSERT(FileLock); @@ -177,10 +176,8 @@ KeAcquireSpinLock(&LockToc->SpinLock, &oldirql); - LIST_FOR_EACH(EnumEntry, &LockToc->GrantedListHead) + LIST_FOR_EACH(Granted, &LockToc->GrantedListHead, FILE_LOCK_GRANTED, ListEntry) { - Granted = CONTAINING_RECORD(EnumEntry, FILE_LOCK_GRANTED, ListEntry); - //if overlapping if(IsOverlappingLock(&Granted->Lock, FileOffset, &EndOffset)) { @@ -358,12 +355,12 @@ { KIRQL oldirql; PFILE_LOCK_TOC LockToc; - PLIST_ENTRY EnumEntry; - PFILE_LOCK_GRANTED Granted; + PFILE_LOCK_GRANTED Granted, tmp; BOOLEAN Unlock = FALSE; //must make local copy since FILE_LOCK struct is allowed to be paged BOOLEAN GotUnlockRoutine; LIST_ENTRY UnlockedListHead; + PLIST_ENTRY EnumEntry; ASSERT(FileLock); LockToc = FileLock->LockInformation; @@ -377,7 +374,7 @@ GotUnlockRoutine = FileLock->UnlockRoutine != NULL; KeAcquireSpinLock(&LockToc->SpinLock, &oldirql); - LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->GrantedListHead, Granted, FILE_LOCK_GRANTED, ListEntry) + LIST_FOR_EACH_SAFE(Granted, tmp, &LockToc->GrantedListHead, FILE_LOCK_GRANTED, ListEntry) { if (Granted->Lock.Process == Process && @@ -506,17 +503,14 @@ IN PVOID Context ) { - PLIST_ENTRY EnumEntry; PFILE_LOCK_GRANTED Granted; LARGE_INTEGER EndOffset; EndOffset.QuadPart = FileOffset->QuadPart + Length->QuadPart - 1; //loop and try to find conflicking locks - LIST_FOR_EACH(EnumEntry, &LockToc->GrantedListHead) + LIST_FOR_EACH(Granted, &LockToc->GrantedListHead, FILE_LOCK_GRANTED, ListEntry) { - Granted = CONTAINING_RECORD(EnumEntry,FILE_LOCK_GRANTED, ListEntry); - if (IsOverlappingLock(&Granted->Lock, FileOffset, &EndOffset)) { //we found a locks that overlap with the new lock @@ -578,13 +572,13 @@ { //walk pending list, FIFO order, try 2 complete locks PLIST_ENTRY EnumEntry; - PIRP Irp; + PIRP Irp, tmp; PIO_STACK_LOCATION Stack; LIST_ENTRY CompletedListHead; InitializeListHead(&CompletedListHead); - LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->PendingListHead, Irp, IRP, Tail.Overlay.ListEntry) + LIST_FOR_EACH_SAFE(Irp, tmp, &LockToc->PendingListHead, IRP, Tail.Overlay.ListEntry) { Stack = IoGetCurrentIrpStackLocation(Irp); if (FsRtlpAddLock(LockToc, @@ -676,8 +670,7 @@ { KIRQL oldirql; PFILE_LOCK_TOC LockToc; - PFILE_LOCK_GRANTED Granted; - PLIST_ENTRY EnumEntry; + PFILE_LOCK_GRANTED Granted, tmp; ASSERT(FileLock); LockToc = FileLock->LockInformation; @@ -689,7 +682,7 @@ KeAcquireSpinLock(&LockToc->SpinLock, &oldirql ); - LIST_FOR_EACH_SAFE(EnumEntry, &LockToc->GrantedListHead, Granted,FILE_LOCK_GRANTED,ListEntry) + LIST_FOR_EACH_SAFE(Granted, tmp, &LockToc->GrantedListHead, FILE_LOCK_GRANTED,ListEntry) { //must be exact match @@ -778,7 +771,6 @@ PFILE_LOCK_TOC LockToc; PFILE_LOCK_GRANTED Granted; PIRP Irp; - PLIST_ENTRY EnumEntry; PIO_STACK_LOCATION Stack; ASSERT(FileLock); @@ -794,10 +786,8 @@ KeAcquireSpinLock(&LockToc->SpinLock, &oldirql); - LIST_FOR_EACH(EnumEntry, &LockToc->GrantedListHead) + LIST_FOR_EACH(Granted, &LockToc->GrantedListHead, FILE_LOCK_GRANTED , ListEntry) { - Granted = CONTAINING_RECORD(EnumEntry, FILE_LOCK_GRANTED , ListEntry); - DPRINT1("%s, start: %I64x, len: %I64x, end: %I64x, key: %i, proc: 0x%p, fob: 0x%p\n", Granted->Lock.ExclusiveLock ? "EXCL" : "SHRD", Granted->Lock.StartingByte.QuadPart, @@ -812,9 +802,8 @@ DPRINT1("Dumping pending file locks, FIFO order\n"); - LIST_FOR_EACH(EnumEntry, &LockToc->PendingListHead) + LIST_FOR_EACH(Irp, &LockToc->PendingListHead, IRP , Tail.Overlay.ListEntry) { - Irp = CONTAINING_RECORD(EnumEntry, IRP , Tail.Overlay.ListEntry); Stack = IoGetCurrentIrpStackLocation(Irp); DPRINT1("%s, start: %I64x, len: %I64x, end: %I64x, key: %i, proc: 0x%p, fob: 0x%p\n", _____ Modified: trunk/reactos/ntoskrnl/fs/notify.c --- trunk/reactos/ntoskrnl/fs/notify.c 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/ntoskrnl/fs/notify.c 2005-09-18 23:06:15 UTC (rev 17923) @@ -120,13 +120,10 @@ PVOID FsContext ) { - PLIST_ENTRY EnumEntry; PNOTIFY_ENTRY NotifyEntry; - LIST_FOR_EACH(EnumEntry, NotifyList) + LIST_FOR_EACH(NotifyEntry, NotifyList, NOTIFY_ENTRY, ListEntry) { - NotifyEntry = CONTAINING_RECORD(EnumEntry, NOTIFY_ENTRY, ListEntry); - if (NotifyEntry->FsContext == FsContext) { return NotifyEntry; @@ -310,15 +307,15 @@ ) { LIST_ENTRY CompletedListHead; - PLIST_ENTRY EnumEntry, TmpEntry; - PNOTIFY_ENTRY NotifyEntry; + PLIST_ENTRY TmpEntry; + PNOTIFY_ENTRY NotifyEntry, tmp; PIRP Irp; InitializeListHead(&CompletedListHead); ExAcquireFastMutex((PFAST_MUTEX)NotifySync); - LIST_FOR_EACH_SAFE(EnumEntry, NotifyList, NotifyEntry, NOTIFY_ENTRY, ListEntry ) + LIST_FOR_EACH_SAFE(NotifyEntry, tmp, NotifyList, NOTIFY_ENTRY, ListEntry ) { if (NotifyEntry->Fcb == Fcb) { @@ -654,8 +651,8 @@ { USHORT FullDirLen; STRING RelativeName; + PNOTIFY_ENTRY NotifyEntry, tmp; PLIST_ENTRY EnumEntry; - PNOTIFY_ENTRY NotifyEntry; PIRP Irp; LIST_ENTRY CompletedListHead; USHORT NameLenU; @@ -676,7 +673,7 @@ ExAcquireFastMutex((PFAST_MUTEX)NotifySync); - LIST_FOR_EACH_SAFE(EnumEntry, NotifyList, NotifyEntry, NOTIFY_ENTRY, ListEntry ) + LIST_FOR_EACH_SAFE(NotifyEntry, tmp, NotifyList, NOTIFY_ENTRY, ListEntry ) { ASSERT(NotifyEntry->Unicode == FsRtlpIsUnicodePath(FullTargetName)); _____ Modified: trunk/reactos/subsys/win32k/include/hotkey.h --- trunk/reactos/subsys/win32k/include/hotkey.h 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/subsys/win32k/include/hotkey.h 2005-09-18 23:06:15 UTC (rev 17923) @@ -15,23 +15,22 @@ } HOT_KEY_ITEM, *PHOT_KEY_ITEM; NTSTATUS FASTCALL -InitHotKeys(PWINSTATION_OBJECT WinStaObject); +InitHotkeyImpl(); -NTSTATUS FASTCALL -CleanupHotKeys(PWINSTATION_OBJECT WinStaObject); +//NTSTATUS FASTCALL +//CleanupHotKeys(PWINSTATION_OBJECT WinStaObject); -BOOL -GetHotKey (PWINSTATION_OBJECT WinStaObject, - UINT fsModifiers, +BOOL FASTCALL +GetHotKey (UINT fsModifiers, UINT vk, struct _ETHREAD **Thread, HWND *hWnd, int *id); -VOID +VOID FASTCALL UnregisterWindowHotKeys(PWINDOW_OBJECT Window); -VOID +VOID FASTCALL UnregisterThreadHotKeys(struct _ETHREAD *Thread); #endif /* _WIN32K_HOTKEY_H */ _____ Modified: trunk/reactos/subsys/win32k/include/winsta.h --- trunk/reactos/subsys/win32k/include/winsta.h 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/subsys/win32k/include/winsta.h 2005-09-18 23:06:15 UTC (rev 17923) @@ -41,7 +41,6 @@ ULONG Flags; struct _DESKTOP_OBJECT* ActiveDesktop; /* FIXME: Clipboard */ - LIST_ENTRY HotKeyListHead; } WINSTATION_OBJECT, *PWINSTATION_OBJECT; extern WINSTATION_OBJECT *InputWindowStation; _____ Modified: trunk/reactos/subsys/win32k/main/dllmain.c --- trunk/reactos/subsys/win32k/main/dllmain.c 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/subsys/win32k/main/dllmain.c 2005-09-18 23:06:15 UTC (rev 17923) @@ -352,6 +352,13 @@ return STATUS_UNSUCCESSFUL; } + Status = InitHotkeyImpl(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to initialize hotkey implementation!\n"); + return STATUS_UNSUCCESSFUL; + } + Status = InitWindowStationImpl(); if (!NT_SUCCESS(Status)) { _____ Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c --- trunk/reactos/subsys/win32k/ntuser/hotkey.c 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/subsys/win32k/ntuser/hotkey.c 2005-09-18 23:06:15 UTC (rev 17923) @@ -27,6 +27,18 @@ * 02-11-2003 EK Created */ + + +/* + +FIXME: Hotkey notifications are triggered by keyboard input (physical or programatically) +and since only desktops on WinSta0 can recieve input in seems very wrong to allow +windows/threads on destops not belonging to WinSta0 to set hotkeys (recieve notifications). + +-Gunnar +*/ + + /* INCLUDES ******************************************************************/ #include <w32k.h> @@ -36,47 +48,40 @@ /* GLOBALS *******************************************************************/ +LIST_ENTRY gHotkeyList; + /* FUNCTIONS *****************************************************************/ NTSTATUS FASTCALL -InitHotKeys(PWINSTATION_OBJECT WinStaObject) +InitHotkeyImpl() { - InitializeListHead(&WinStaObject->HotKeyListHead); + InitializeListHead(&gHotkeyList); return STATUS_SUCCESS; } +#if 0 //not used NTSTATUS FASTCALL -CleanupHotKeys(PWINSTATION_OBJECT WinStaObject) +CleanupHotKeys() { return STATUS_SUCCESS; } +#endif -BOOL -GetHotKey (PWINSTATION_OBJECT WinStaObject, - UINT fsModifiers, +BOOL FASTCALL +GetHotKey (UINT fsModifiers, UINT vk, struct _ETHREAD **Thread, HWND *hWnd, int *id) { - PLIST_ENTRY Entry; PHOT_KEY_ITEM HotKeyItem; - if(!WinStaObject) + LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry) { - return FALSE; - } - - Entry = WinStaObject->HotKeyListHead.Flink; - while (Entry != &WinStaObject->HotKeyListHead) - { - HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD(Entry, - HOT_KEY_ITEM, - ListEntry); if (HotKeyItem->fsModifiers == fsModifiers && HotKeyItem->vk == vk) { @@ -89,37 +94,21 @@ if (id != NULL) *id = HotKeyItem->id; - return TRUE; } - - Entry = Entry->Flink; } return FALSE; } -VOID +VOID FASTCALL UnregisterWindowHotKeys(PWINDOW_OBJECT Window) { - PLIST_ENTRY Entry; - PHOT_KEY_ITEM HotKeyItem; - PWINSTATION_OBJECT WinStaObject = NULL; - - if(Window->OwnerThread && Window->OwnerThread->ThreadsProcess) - WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation; - - if(!WinStaObject) - return; - - Entry = WinStaObject->HotKeyListHead.Flink; - while (Entry != &WinStaObject->HotKeyListHead) + PHOT_KEY_ITEM HotKeyItem, tmp; + + LIST_FOR_EACH_SAFE(HotKeyItem, tmp, &gHotkeyList, HOT_KEY_ITEM, ListEntry) { - HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry, - HOT_KEY_ITEM, - ListEntry); - Entry = Entry->Flink; if (HotKeyItem->hWnd == Window->hSelf) { RemoveEntryList (&HotKeyItem->ListEntry); @@ -130,26 +119,13 @@ } -VOID +VOID FASTCALL UnregisterThreadHotKeys(struct _ETHREAD *Thread) { - PLIST_ENTRY Entry; - PHOT_KEY_ITEM HotKeyItem; - PWINSTATION_OBJECT WinStaObject = NULL; + PHOT_KEY_ITEM HotKeyItem, tmp; - if(Thread->Tcb.Win32Thread && Thread->Tcb.Win32Thread->Desktop) - WinStaObject = Thread->Tcb.Win32Thread->Desktop->WindowStation; - - if(!WinStaObject) - return; - - Entry = WinStaObject->HotKeyListHead.Flink; - while (Entry != &WinStaObject->HotKeyListHead) + LIST_FOR_EACH_SAFE(HotKeyItem, tmp, &gHotkeyList, HOT_KEY_ITEM, ListEntry) { - HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry, - HOT_KEY_ITEM, - ListEntry); - Entry = Entry->Flink; if (HotKeyItem->Thread == Thread) { RemoveEntryList (&HotKeyItem->ListEntry); @@ -160,27 +136,18 @@ } -static BOOL -IsHotKey (PWINSTATION_OBJECT WinStaObject, - UINT fsModifiers, - UINT vk) +static +BOOL FASTCALL +IsHotKey (UINT fsModifiers, UINT vk) { - PLIST_ENTRY Entry; PHOT_KEY_ITEM HotKeyItem; - Entry = WinStaObject->HotKeyListHead.Flink; - while (Entry != &WinStaObject->HotKeyListHead) + LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry) { - HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry, - HOT_KEY_ITEM, - ListEntry); - if (HotKeyItem->fsModifiers == fsModifiers && - HotKeyItem->vk == vk) + if (HotKeyItem->fsModifiers == fsModifiers && HotKeyItem->vk == vk) { return TRUE; } - - Entry = Entry->Flink; } return FALSE; @@ -195,7 +162,6 @@ { PHOT_KEY_ITEM HotKeyItem; PWINDOW_OBJECT Window; - PWINSTATION_OBJECT WinStaObject = NULL; PETHREAD HotKeyThread; DECLARE_RETURN(BOOL); @@ -215,17 +181,8 @@ HotKeyThread = Window->OwnerThread; } - - if(HotKeyThread->ThreadsProcess && HotKeyThread->ThreadsProcess->Win32Process) - WinStaObject = HotKeyThread->Tcb.Win32Thread->Desktop->WindowStation; - - if(!WinStaObject) - { - RETURN( FALSE); - } - /* Check for existing hotkey */ - if (IsHotKey (WinStaObject, fsModifiers, vk)) + if (IsHotKey (fsModifiers, vk)) { RETURN( FALSE); } @@ -242,8 +199,7 @@ HotKeyItem->fsModifiers = fsModifiers; HotKeyItem->vk = vk; - InsertHeadList (&WinStaObject->HotKeyListHead, - &HotKeyItem->ListEntry); + InsertHeadList (&gHotkeyList, &HotKeyItem->ListEntry); RETURN( TRUE); @@ -255,13 +211,10 @@ BOOL STDCALL -NtUserUnregisterHotKey(HWND hWnd, - int id) +NtUserUnregisterHotKey(HWND hWnd, int id) { - PLIST_ENTRY Entry; PHOT_KEY_ITEM HotKeyItem; PWINDOW_OBJECT Window; - PWINSTATION_OBJECT WinStaObject = NULL; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserUnregisterHotKey\n"); @@ -272,30 +225,15 @@ RETURN( FALSE); } - if(Window->OwnerThread->ThreadsProcess && Window->OwnerThread->ThreadsProcess->Win32Process) - WinStaObject = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation; - - if(!WinStaObject) + LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry) { - RETURN( FALSE); - } - - Entry = WinStaObject->HotKeyListHead.Flink; - while (Entry != &WinStaObject->HotKeyListHead) - { - HotKeyItem = (PHOT_KEY_ITEM) CONTAINING_RECORD (Entry, - HOT_KEY_ITEM, - ListEntry); - if (HotKeyItem->hWnd == hWnd && - HotKeyItem->id == id) + if (HotKeyItem->hWnd == hWnd && HotKeyItem->id == id) { RemoveEntryList (&HotKeyItem->ListEntry); ExFreePool (HotKeyItem); RETURN( TRUE); } - - Entry = Entry->Flink; } RETURN( FALSE); _____ Modified: trunk/reactos/subsys/win32k/ntuser/input.c --- trunk/reactos/subsys/win32k/ntuser/input.c 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/subsys/win32k/ntuser/input.c 2005-09-18 23:06:15 UTC (rev 17923) @@ -642,6 +642,8 @@ if(NextKeyInput.MakeCode == 0x2E)/* Ctrl-C */ { DPRINT1("Ctrl-C pressed\n"); + /* FIXME: this seems wrong! this bypass hotkeys and all and the winhellos CRTL+C hotkey test + dont work (anymore) */ co_MsqPostKeyboardMessage(WM_COPY,0,0); continue; } @@ -697,8 +699,7 @@ KeyInput.Flags & KEY_E0 ? 0xE0 : (KeyInput.Flags & KEY_E1 ? 0xE1 : 0)); - if (GetHotKey(InputWindowStation, - ModifierState, + if (GetHotKey(ModifierState, msg.wParam, &Thread, &hWnd, _____ Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c --- trunk/reactos/subsys/win32k/ntuser/winsta.c 2005-09-18 21:48:56 UTC (rev 17922) +++ trunk/reactos/subsys/win32k/ntuser/winsta.c 2005-09-18 23:06:15 UTC (rev 17923) @@ -535,8 +535,6 @@ return 0; } - InitHotKeys(WindowStationObject); - CurInfo->Enabled = FALSE; CurInfo->ButtonsDown = 0; CurInfo->CursorClipInfo.IsClipped = FALSE;
19 years
1
0
0
0
[gvg] 17922: Set correct error code, IsWindow() depends on this
by gvg@svn.reactos.com
Set correct error code, IsWindow() depends on this Modified: trunk/reactos/subsys/win32k/ntuser/window.c _____ Modified: trunk/reactos/subsys/win32k/ntuser/window.c --- trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-18 18:59:59 UTC (rev 17921) +++ trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-18 21:48:56 UTC (rev 17922) @@ -3233,6 +3233,7 @@ if (!(Window = UserGetWindowObject(hWnd))) { + SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); return 0; }
19 years
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
59
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
51
52
53
54
55
56
57
58
59
Results per page:
10
25
50
100
200