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
2025
January
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
November 2007
----- 2025 -----
January 2025
----- 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
20 participants
888 discussions
Start a n
N
ew thread
[weiden] 30519: Optimize IsChild() to use the desktop heap instead of calling win32k
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 09:50:23 2007 New Revision: 30519 URL:
http://svn.reactos.org/svn/reactos?rev=30519&view=rev
Log: Optimize IsChild() to use the desktop heap instead of calling win32k Modified: trunk/reactos/dll/win32/user32/windows/window.c Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 09:50:23 2007 @@ -1252,18 +1252,40 @@ IsChild(HWND hWndParent, HWND hWnd) { - if (! IsWindow(hWndParent) || ! IsWindow(hWnd)) - { - return FALSE; - } - - do - { - hWnd = (HWND)NtUserGetWindowLong(hWnd, GWL_HWNDPARENT, FALSE); - } - while (hWnd != NULL && hWnd != hWndParent); - - return hWnd == hWndParent; + PWINDOW WndParent, Wnd; + BOOL Ret = FALSE; + + WndParent = ValidateHwnd(hWndParent); + if (!WndParent) + return FALSE; + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return FALSE; + + _SEH_TRY + { + while (Wnd != NULL) + { + if (Wnd->Parent != NULL) + { + Wnd = DesktopPtrToUser(Wnd->Parent); + if (Wnd == WndParent) + { + Ret = TRUE; + break; + } + } + else + break; + } + } + _SEH_HANDLE + { + /* Do nothing */ + } + _SEH_END; + + return Ret; }
17 years, 1 month
1
0
0
0
[weiden] 30518: Optimize GetAncestor for the most common case GA_PARENT (for now)
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 09:22:39 2007 New Revision: 30518 URL:
http://svn.reactos.org/svn/reactos?rev=30518&view=rev
Log: Optimize GetAncestor for the most common case GA_PARENT (for now) Modified: trunk/reactos/dll/win32/user32/windows/window.c Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 09:22:39 2007 @@ -842,7 +842,42 @@ HWND STDCALL GetAncestor(HWND hwnd, UINT gaFlags) { - return(NtUserGetAncestor(hwnd, gaFlags)); + HWND Ret = NULL; + PWINDOW Ancestor, Wnd; + + Wnd = ValidateHwnd(hwnd); + if (!Wnd) + return NULL; + + _SEH_TRY + { + Ancestor = NULL; + switch (gaFlags) + { + case GA_PARENT: + if (Wnd->Parent != NULL) + Ancestor = DesktopPtrToUser(Wnd->Parent); + break; + + default: + /* FIXME: Call win32k for now */ + Wnd = NULL; + break; + } + + if (Ancestor != NULL) + Ret = UserHMGetHandle(Ancestor); + } + _SEH_HANDLE + { + /* Do nothing */ + } + _SEH_END; + + if (!Wnd) /* Fall back */ + Ret = NtUserGetAncestor(hwnd, gaFlags); + + return Ret; }
17 years, 1 month
1
0
0
0
[weiden] 30517: Optimize GetParent() to read the information from the desktop heap
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 09:12:48 2007 New Revision: 30517 URL:
http://svn.reactos.org/svn/reactos?rev=30517&view=rev
Log: Optimize GetParent() to read the information from the desktop heap Modified: trunk/reactos/dll/win32/user32/windows/class.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/dll/win32/user32/windows/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/class.c (original) +++ trunk/reactos/dll/win32/user32/windows/class.c Sat Nov 17 09:12:48 2007 @@ -527,6 +527,7 @@ return Wnd->UserData; case GWL_HWNDPARENT: + DbgPrint("GWL_HWNDPARENT\n"); /* FIXME: Implement in user32 */ case GWL_WNDPROC: /* Call win32k for this as a callproc handle may need @@ -580,6 +581,7 @@ return Wnd->UserData; case GWL_HWNDPARENT: + DbgPrint("GWL_HWNDPARENT\n"); /* FIXME: Implement in user32 */ case GWL_WNDPROC: /* Call win32k for this as a callproc handle may need Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 09:12:48 2007 @@ -893,7 +893,37 @@ HWND STDCALL GetParent(HWND hWnd) { - return NtUserGetParent(hWnd); + PWINDOW Wnd, WndParent; + HWND Ret = NULL; + + Wnd = ValidateHwnd(hWnd); + if (Wnd != NULL) + { + _SEH_TRY + { + WndParent = NULL; + if (Wnd->Style & WS_CHILD) + { + if (Wnd->Parent != NULL) + WndParent = DesktopPtrToUser(Wnd->Parent); + } + else if (Wnd->Style & WS_POPUP) + { + if (Wnd->Owner != NULL) + WndParent = DesktopPtrToUser(Wnd->Owner); + } + + if (WndParent != NULL) + Ret = UserHMGetHandle(WndParent); + } + _SEH_HANDLE + { + /* Do nothing */ + } + _SEH_END; + } + + return Ret; } Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h Sat Nov 17 09:12:48 2007 @@ -4,6 +4,9 @@ struct _W32PROCESSINFO; struct _W32THREADINFO; struct _WINDOW; + +/* FIXME: UserHMGetHandle needs to be updated once the new handle manager is implemented */ +#define UserHMGetHandle(obj) ((obj)->hdr.Handle) typedef struct _REGISTER_SYSCLASS { @@ -19,6 +22,12 @@ UINT ClassId; } REGISTER_SYSCLASS, *PREGISTER_SYSCLASS; +typedef struct _USER_OBJHDR +{ + /* This is the common header for all user handle objects */ + HANDLE Handle; +} USER_OBJHDR, PUSER_OBJHDR; + typedef struct _DESKTOP { HANDLE hKernelHeap; @@ -32,6 +41,7 @@ typedef struct _CALLPROC { + USER_OBJHDR hdr; /* FIXME: Move out of the structure once new handle manager is implemented */ struct _W32PROCESSINFO *pi; WNDPROC WndProc; struct _CALLPROC *Next; @@ -92,6 +102,8 @@ typedef struct _WINDOW { + USER_OBJHDR hdr; /* FIXME: Move out of the structure once new handle manager is implemented */ + /* NOTE: This structure is located in the desktop heap and will eventually replace WINDOW_OBJECT. Right now WINDOW_OBJECT keeps a reference to this structure until all the information @@ -109,6 +121,9 @@ /* Extra Wnd proc (windows of system classes) */ WNDPROC WndProcExtra; }; + + struct _WINDOW *Parent; + struct _WINDOW *Owner; /* Size of the extra data associated with the window. */ ULONG ExtraDataSize; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c Sat Nov 17 09:12:48 2007 @@ -67,6 +67,7 @@ sizeof(CALLPROC)); if (NewCallProc != NULL) { + NewCallProc->hdr.Handle = Handle; /* FIXME: Remove hack */ NewCallProc->pi = CallProc->pi; NewCallProc->WndProc = CallProc->WndProc; NewCallProc->Unicode = CallProc->Unicode; @@ -92,6 +93,7 @@ sizeof(CALLPROC)); if (NewCallProc != NULL) { + NewCallProc->hdr.Handle = Handle; /* FIXME: Remove hack */ NewCallProc->pi = pi; NewCallProc->WndProc = WndProc; NewCallProc->Unicode = Unicode; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Sat Nov 17 09:12:48 2007 @@ -908,6 +908,7 @@ PWINDOW_OBJECT Parent; Wnd->Parent = WndParent; + Wnd->Wnd->Parent = WndParent ? WndParent->Wnd : NULL; if ((Wnd->PrevSibling = WndPrevSibling)) { /* link after WndPrevSibling */ @@ -964,9 +965,13 @@ if((WndNewOwner = UserGetWindowObject(hWndNewOwner))) { Wnd->hOwner = hWndNewOwner; + Wnd->Wnd->Owner = WndNewOwner->Wnd; } else + { Wnd->hOwner = NULL; + Wnd->Wnd->Owner = NULL; + } UserDerefObject(Wnd); return ret; @@ -1109,6 +1114,7 @@ WndParent->FirstChild = Wnd->NextSibling; Wnd->PrevSibling = Wnd->NextSibling = Wnd->Parent = NULL; + Wnd->Wnd->Parent = NULL; } BOOL FASTCALL @@ -1575,10 +1581,11 @@ sizeof(WINDOW) + Class->WndExtra); if (!Window->Wnd) goto AllocErr; - Wnd = Window->Wnd; - RtlZeroMemory(Window->Wnd, sizeof(WINDOW) + Class->WndExtra); + Window->Wnd->hdr.Handle = hWnd; /* FIXME: Remove hack */ + Wnd = Window->Wnd; + Wnd->ti = ti; Wnd->pi = ti->kpi; } @@ -1631,15 +1638,18 @@ Window->MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue; IntReferenceMessageQueue(Window->MessageQueue); Window->Parent = ParentWindow; + Wnd->Parent = ParentWindow ? ParentWindow->Wnd : NULL; if((OwnerWindow = UserGetWindowObject(OwnerWindowHandle))) { Window->hOwner = OwnerWindowHandle; + Wnd->Owner = OwnerWindow->Wnd; HasOwner = TRUE; } else { Window->hOwner = NULL; + Wnd->Owner = NULL; HasOwner = FALSE; } @@ -2336,6 +2346,7 @@ if (Child->hOwner != NULL) { Child->hOwner = NULL; + Child->Wnd->Owner = NULL; } }
17 years, 1 month
1
0
0
0
[weiden] 30516: Optimize DispatchMessageA/W to avoid calls to win32k
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 08:08:13 2007 New Revision: 30516 URL:
http://svn.reactos.org/svn/reactos?rev=30516&view=rev
Log: Optimize DispatchMessageA/W to avoid calls to win32k Modified: trunk/reactos/dll/win32/user32/windows/message.c Modified: trunk/reactos/dll/win32/user32/windows/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/message.c (original) +++ trunk/reactos/dll/win32/user32/windows/message.c Sat Nov 17 08:08:13 2007 @@ -1328,26 +1328,38 @@ LRESULT STDCALL DispatchMessageA(CONST MSG *lpmsg) { - NTUSERDISPATCHMESSAGEINFO Info; - LRESULT Result; - - Info.Ansi = TRUE; - Info.Msg = *lpmsg; - Result = NtUserDispatchMessage(&Info); - if (! Info.HandledByKernel) - { - /* We need to send the message ourselves */ - SPY_EnterMessage(SPY_DISPATCHMESSAGE, Info.Msg.hwnd, Info.Msg.message, - Info.Msg.wParam, Info.Msg.lParam); - Result = IntCallWindowProcA(Info.Ansi, Info.Proc, Info.Msg.hwnd, - Info.Msg.message, Info.Msg.wParam, Info.Msg.lParam); - SPY_ExitMessage(SPY_RESULT_OK, Info.Msg.hwnd, Info.Msg.message, Result, - Info.Msg.wParam, Info.Msg.lParam); - } - MsgConversionCleanup(lpmsg, TRUE, TRUE, &Result); - - return Result; -} + LRESULT Ret = 0; + PWINDOW Wnd; + + if (lpmsg->hwnd != NULL) + { + Wnd = ValidateHwnd(lpmsg->hwnd); + if (!Wnd || SharedPtrToUser(Wnd->ti) != GetW32ThreadInfo()) + return 0; + } + else + Wnd = NULL; + + if ((lpmsg->message == WM_TIMER || lpmsg->message == WM_SYSTIMER) && lpmsg->lParam != 0) + { + WNDPROC WndProc = (WNDPROC)lpmsg->lParam; + Ret = WndProc(lpmsg->hwnd, + lpmsg->message, + lpmsg->wParam, + GetTickCount()); + } + else if (Wnd != NULL) + { + /* FIXME: WM_PAINT needs special handling */ + Ret = IntCallMessageProc(Wnd, + lpmsg->hwnd, + lpmsg->message, + lpmsg->wParam, + lpmsg->lParam, + TRUE); + } + + return Ret;} /* @@ -1356,25 +1368,38 @@ LRESULT STDCALL DispatchMessageW(CONST MSG *lpmsg) { - NTUSERDISPATCHMESSAGEINFO Info; - LRESULT Result; - - Info.Ansi = FALSE; - Info.Msg = *lpmsg; - Result = NtUserDispatchMessage(&Info); - if (! Info.HandledByKernel) - { - /* We need to send the message ourselves */ - SPY_EnterMessage(SPY_DISPATCHMESSAGE, Info.Msg.hwnd, Info.Msg.message, - Info.Msg.wParam, Info.Msg.lParam); - Result = IntCallWindowProcW(Info.Ansi, Info.Proc, Info.Msg.hwnd, - Info.Msg.message, Info.Msg.wParam, Info.Msg.lParam); - SPY_ExitMessage(SPY_RESULT_OK, Info.Msg.hwnd, Info.Msg.message, Result, - Info.Msg.wParam, Info.Msg.lParam); - } - MsgConversionCleanup(lpmsg, FALSE, TRUE, &Result); - - return Result; + LRESULT Ret = 0; + PWINDOW Wnd; + + if (lpmsg->hwnd != NULL) + { + Wnd = ValidateHwnd(lpmsg->hwnd); + if (!Wnd || SharedPtrToUser(Wnd->ti) != GetW32ThreadInfo()) + return 0; + } + else + Wnd = NULL; + + if ((lpmsg->message == WM_TIMER || lpmsg->message == WM_SYSTIMER) && lpmsg->lParam != 0) + { + WNDPROC WndProc = (WNDPROC)lpmsg->lParam; + Ret = WndProc(lpmsg->hwnd, + lpmsg->message, + lpmsg->wParam, + GetTickCount()); + } + else if (Wnd != NULL) + { + /* FIXME: WM_PAINT needs special handling */ + Ret = IntCallMessageProc(Wnd, + lpmsg->hwnd, + lpmsg->message, + lpmsg->wParam, + lpmsg->lParam, + FALSE); + } + + return Ret; }
17 years, 1 month
1
0
0
0
[weiden] 30515: Allow selecting disabled menu items
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 05:24:50 2007 New Revision: 30515 URL:
http://svn.reactos.org/svn/reactos?rev=30515&view=rev
Log: Allow selecting disabled menu items Modified: trunk/reactos/dll/win32/user32/windows/menu.c Modified: trunk/reactos/dll/win32/user32/windows/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/menu.c (original) +++ trunk/reactos/dll/win32/user32/windows/menu.c Sat Nov 17 05:24:50 2007 @@ -2081,8 +2081,7 @@ } /* If this is a good candidate; */ if (MenuGetRosMenuItemInfo(MenuInfo->Self, i, &ItemInfo) && - 0 == (ItemInfo.fType & MF_SEPARATOR) && - 0 == (ItemInfo.fState & (MFS_DISABLED | MFS_GRAYED)) ) + 0 == (ItemInfo.fType & MF_SEPARATOR)) { MenuSelectItem(WndOwner, MenuInfo, i, TRUE, NULL); MenuCleanupRosMenuItemInfo(&ItemInfo); @@ -2638,11 +2637,11 @@ { MenuInitRosMenuItemInfo(&ItemInfo); if (MenuGetRosMenuItemInfo(MenuInfo.Self, Index, &ItemInfo) && - !(ItemInfo.fType & MF_SEPARATOR) && - !(ItemInfo.fState & (MFS_DISABLED | MFS_GRAYED)) ) + !(ItemInfo.fType & MF_SEPARATOR)) { MenuSwitchTracking(Mt, &MenuInfo, Index); - Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &MenuInfo, FALSE, Flags); + if (!(ItemInfo.fState & (MFS_DISABLED | MFS_GRAYED))) + Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &MenuInfo, FALSE, Flags); } MenuCleanupRosMenuItemInfo(&ItemInfo); }
17 years, 1 month
1
0
0
0
[weiden] 30514: Optimize SendMessageA/W to allow certain messages be sent without calling win32k
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 03:40:22 2007 New Revision: 30514 URL:
http://svn.reactos.org/svn/reactos?rev=30514&view=rev
Log: Optimize SendMessageA/W to allow certain messages be sent without calling win32k Modified: trunk/reactos/dll/win32/user32/include/user32.h trunk/reactos/dll/win32/user32/windows/message.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/include/win32.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/hook.c trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/dll/win32/user32/include/user32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32.h (original) +++ trunk/reactos/dll/win32/user32/include/user32.h Sat Nov 17 03:40:22 2007 @@ -85,6 +85,12 @@ return (PVOID)((ULONG_PTR)Ptr + g_pi->UserHeapDelta); } +static __inline BOOL +IsThreadHooked(PW32THREADINFO ti) +{ + return ti->Hooks != 0; +} + PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc); PWINDOW FASTCALL ValidateHwnd(HWND hwnd); PWINDOW FASTCALL ValidateHwndOrDesk(HWND hwnd); Modified: trunk/reactos/dll/win32/user32/windows/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/message.c (original) +++ trunk/reactos/dll/win32/user32/windows/message.c Sat Nov 17 03:40:22 2007 @@ -1298,6 +1298,30 @@ } +static LRESULT WINAPI +IntCallMessageProc(IN PWINDOW Wnd, IN HWND hWnd, IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam, IN BOOL Ansi) +{ + WNDPROC WndProc; + BOOL IsAnsi; + + if (Wnd->IsSystem) + { + WndProc = (Ansi ? Wnd->WndProcExtra : Wnd->WndProc); + IsAnsi = Ansi; + } + else + { + WndProc = Wnd->WndProc; + IsAnsi = !Wnd->Unicode; + } + + if (!Ansi) + return IntCallWindowProcW(IsAnsi, WndProc, hWnd, Msg, wParam, lParam); + else + return IntCallWindowProcA(IsAnsi, WndProc, hWnd, Msg, wParam, lParam); +} + + /* * @implemented */ @@ -1651,6 +1675,25 @@ NTUSERSENDMESSAGEINFO Info; LRESULT Result; + if (Wnd != HWND_BROADCAST && (Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST)) + { + PWINDOW Window; + PW32THREADINFO ti = GetW32ThreadInfo(); + + Window = ValidateHwnd(Wnd); + if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(ti)) + { + /* NOTE: We can directly send messages to the window procedure + if *all* the following conditions are met: + + * Window belongs to calling thread + * The calling thread is not being hooked + */ + + return IntCallMessageProc(Window, Wnd, Msg, wParam, lParam, FALSE); + } + } + UMMsg.hwnd = Wnd; UMMsg.message = Msg; UMMsg.wParam = wParam; @@ -1688,6 +1731,25 @@ MSG KMMsg; LRESULT Result; NTUSERSENDMESSAGEINFO Info; + + if (Wnd != HWND_BROADCAST && (Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST)) + { + PWINDOW Window; + PW32THREADINFO ti = GetW32ThreadInfo(); + + Window = ValidateHwnd(Wnd); + if (Window != NULL && SharedPtrToUser(Window->ti) == ti && !IsThreadHooked(ti)) + { + /* NOTE: We can directly send messages to the window procedure + if *all* the following conditions are met: + + * Window belongs to calling thread + * The calling thread is not being hooked + */ + + return IntCallMessageProc(Window, Wnd, Msg, wParam, lParam, TRUE); + } + } AnsiMsg.hwnd = Wnd; AnsiMsg.message = Msg; Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h Sat Nov 17 03:40:22 2007 @@ -100,6 +100,16 @@ struct _W32THREADINFO *ti; RECT WindowRect; RECT ClientRect; + + WNDPROC WndProc; + union + { + /* Pointer to a call procedure handle */ + PCALLPROC CallProc; + /* Extra Wnd proc (windows of system classes) */ + WNDPROC WndProcExtra; + }; + /* Size of the extra data associated with the window. */ ULONG ExtraDataSize; /* Style. */ @@ -117,6 +127,8 @@ UNICODE_STRING WindowName; UINT Unicode : 1; + /* Indicates whether the window is derived from a system class */ + UINT IsSystem : 1; } WINDOW, *PWINDOW; typedef struct _W32PROCESSINFO @@ -141,6 +153,8 @@ PVOID DesktopHeapBase; ULONG_PTR DesktopHeapLimit; ULONG_PTR DesktopHeapDelta; + /* A mask of what hooks are currently active */ + ULONG Hooks; } W32THREADINFO, *PW32THREADINFO; /* Window Client Information structure */ Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32.h Sat Nov 17 03:40:22 2007 @@ -14,7 +14,7 @@ DWORD MessagePumpHookValue; BOOLEAN IsExiting; SINGLE_LIST_ENTRY ReferencesList; - + ULONG Hooks; PW32THREADINFO ThreadInfo; } W32THREAD, *PW32THREAD; Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h Sat Nov 17 03:40:22 2007 @@ -36,15 +36,6 @@ PW32THREADINFO ti; /* Pointer to the desktop */ PDESKTOP Desktop; - union - { - /* Pointer to a call procedure handle */ - PCALLPROC CallProc; - /* Extra Wnd proc (windows of system classes) */ - WNDPROC WndProcExtra; - }; - /* Indicates whether the window is derived from a system class */ - BOOL IsSystem; /* Context help id */ DWORD ContextHelpId; /* system menu handle. */ @@ -78,7 +69,6 @@ ULONG PropListItems; /* Scrollbar info */ PWINDOW_SCROLLINFO Scroll; - WNDPROC WndProc; PETHREAD OwnerThread; HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/ PINTERNALPOS InternalPos; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c Sat Nov 17 03:40:22 2007 @@ -35,6 +35,7 @@ #include <debug.h> #define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK) +#define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1)) static PHOOKTABLE GlobalHooks; @@ -89,6 +90,7 @@ static PHOOK IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinStaObj) { + PW32THREAD W32Thread; PHOOK Hook; PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue); HANDLE Handle; @@ -119,6 +121,13 @@ Hook->Self = Handle; Hook->Thread = Thread; Hook->HookId = HookId; + + W32Thread = ((PW32THREAD)Thread->Tcb.Win32Thread); + ASSERT(W32Thread != NULL); + W32Thread->Hooks |= HOOKID_TO_FLAG(HookId); + if (W32Thread->ThreadInfo != NULL) + W32Thread->ThreadInfo->Hooks = W32Thread->Hooks; + RtlInitUnicodeString(&Hook->ModuleName, NULL); InsertHeadList(&Table->Hooks[HOOKID_TO_INDEX(HookId)], &Hook->Chain); @@ -213,6 +222,7 @@ static VOID IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj, BOOL TableAlreadyLocked) { + PW32THREAD W32Thread; PHOOKTABLE Table = IntGetTable(Hook); ASSERT(NULL != Table); @@ -220,6 +230,12 @@ { return; } + + W32Thread = ((PW32THREAD)Hook->Thread->Tcb.Win32Thread); + ASSERT(W32Thread != NULL); + W32Thread->Hooks &= ~HOOKID_TO_FLAG(Hook->HookId); + if (W32Thread->ThreadInfo != NULL) + W32Thread->ThreadInfo->Hooks = W32Thread->Hooks; if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)]) { Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c Sat Nov 17 03:40:22 2007 @@ -379,14 +379,14 @@ MsgInfo.HandledByKernel = FALSE; Result = 0; - if (Window->IsSystem) + if (Window->Wnd->IsSystem) { - MsgInfo.Proc = (!MsgInfo.Ansi ? Window->WndProc : Window->WndProcExtra); + MsgInfo.Proc = (!MsgInfo.Ansi ? Window->Wnd->WndProc : Window->Wnd->WndProcExtra); } else { MsgInfo.Ansi = !Window->Wnd->Unicode; - MsgInfo.Proc = Window->WndProc; + MsgInfo.Proc = Window->Wnd->WndProc; } } } @@ -1390,7 +1390,7 @@ RETURN( FALSE); } - Result = (ULONG_PTR)co_IntCallWindowProc(Window->WndProc, !Window->Wnd->Unicode, hWnd, Msg, wParam, + Result = (ULONG_PTR)co_IntCallWindowProc(Window->Wnd->WndProc, !Window->Wnd->Unicode, hWnd, Msg, wParam, lParamPacked,lParamBufferSize); if(uResult) @@ -1569,14 +1569,14 @@ Info.Ansi = ! Window->Wnd->Unicode; } - if (Window->IsSystem) - { - Info.Proc = (!Info.Ansi ? Window->WndProc : Window->WndProcExtra); + if (Window->Wnd->IsSystem) + { + Info.Proc = (!Info.Ansi ? Window->Wnd->WndProc : Window->Wnd->WndProcExtra); } else { Info.Ansi = !Window->Wnd->Unicode; - Info.Proc = Window->WndProc; + Info.Proc = Window->Wnd->WndProc; } } else Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Sat Nov 17 03:40:22 2007 @@ -2585,6 +2585,7 @@ /* initialize it */ ti->kpi = GetW32ProcessInfo(); ti->pi = UserHeapAddressToUser(ti->kpi); + ti->Hooks = W32Thread->Hooks; if (W32Thread->Desktop != NULL) { ti->Desktop = W32Thread->Desktop->DesktopInfo; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Sat Nov 17 03:40:22 2007 @@ -519,33 +519,33 @@ ASSERT(UserIsEnteredExclusive() == TRUE); - if (Window->IsSystem) + if (Wnd->IsSystem) { - return (Ansi ? Window->WndProcExtra : Window->WndProc); + return (Ansi ? Wnd->WndProcExtra : Wnd->WndProc); } else { if (!Ansi == Wnd->Unicode) { - return Window->WndProc; + return Wnd->WndProc; } else { - if (Window->CallProc != NULL) + if (Wnd->CallProc != NULL) { - return GetCallProcHandle(Window->CallProc); + return GetCallProcHandle(Wnd->CallProc); } else { PCALLPROC NewCallProc, CallProc; NewCallProc = UserFindCallProc(Wnd->Class, - Window->WndProc, + Wnd->WndProc, Wnd->Unicode); if (NewCallProc == NULL) { NewCallProc = CreateCallProc(Wnd->ti->Desktop, - Window->WndProc, + Wnd->WndProc, Wnd->Unicode, Wnd->ti->kpi); if (NewCallProc == NULL) @@ -558,8 +558,8 @@ NewCallProc); } - CallProc = Window->CallProc; - Window->CallProc = NewCallProc; + CallProc = Wnd->CallProc; + Wnd->CallProc = NewCallProc; return GetCallProcHandle((CallProc == NULL ? NewCallProc : CallProc)); } @@ -1645,19 +1645,19 @@ Wnd->UserData = 0; - Window->IsSystem = Wnd->Class->System; + Wnd->IsSystem = Wnd->Class->System; if (Wnd->Class->System) { /* NOTE: Always create a unicode window for system classes! */ Wnd->Unicode = TRUE; - Window->WndProc = Wnd->Class->WndProc; - Window->WndProcExtra = Wnd->Class->WndProcExtra; + Wnd->WndProc = Wnd->Class->WndProc; + Wnd->WndProcExtra = Wnd->Class->WndProcExtra; } else { Wnd->Unicode = Wnd->Class->Unicode; - Window->WndProc = Wnd->Class->WndProc; - Window->CallProc = NULL; + Wnd->WndProc = Wnd->Class->WndProc; + Wnd->CallProc = NULL; } Window->OwnerThread = PsGetCurrentThread(); @@ -3608,25 +3608,25 @@ } /* attempt to get the previous window proc */ - if (Window->IsSystem) + if (Wnd->IsSystem) { - Ret = (Ansi ? Window->WndProcExtra : Window->WndProc); + Ret = (Ansi ? Wnd->WndProcExtra : Wnd->WndProc); } else { if (!Ansi == Wnd->Unicode) { - Ret = Window->WndProc; + Ret = Wnd->WndProc; } else { CallProc = UserFindCallProc(Wnd->Class, - Window->WndProc, + Wnd->WndProc, Wnd->Unicode); if (CallProc == NULL) { CallProc = CreateCallProc(NULL, - Window->WndProc, + Wnd->WndProc, Wnd->Unicode, Wnd->ti->kpi); if (CallProc == NULL) @@ -3639,9 +3639,9 @@ CallProc); } - Window->CallProc = CallProc; - - Ret = GetCallProcHandle(Window->CallProc); + Wnd->CallProc = CallProc; + + Ret = GetCallProcHandle(Wnd->CallProc); } } @@ -3649,22 +3649,22 @@ { /* check if the new procedure matches with the one in the window class. If so, we need to restore both procedures! */ - Window->IsSystem = (NewWndProc == Wnd->Class->WndProc || - NewWndProc == Wnd->Class->WndProcExtra); - - if (Window->IsSystem) + Wnd->IsSystem = (NewWndProc == Wnd->Class->WndProc || + NewWndProc == Wnd->Class->WndProcExtra); + + if (Wnd->IsSystem) { - Window->WndProc = Wnd->Class->WndProc; - Window->WndProcExtra = Wnd->Class->WndProcExtra; + Wnd->WndProc = Wnd->Class->WndProc; + Wnd->WndProcExtra = Wnd->Class->WndProcExtra; Wnd->Unicode = !Ansi; return Ret; } } - ASSERT(!Window->IsSystem); + ASSERT(!Wnd->IsSystem); /* update the window procedure */ - Window->WndProc = NewWndProc; + Wnd->WndProc = NewWndProc; Wnd->Unicode = !Ansi; return Ret;
17 years, 1 month
1
0
0
0
[weiden] 30513: Protect GetClassLong() and GetWindowText() with SEH as they're following pointers in the desktop heap
by weiden@svn.reactos.org
Author: weiden Date: Sat Nov 17 00:56:23 2007 New Revision: 30513 URL:
http://svn.reactos.org/svn/reactos?rev=30513&view=rev
Log: Protect GetClassLong() and GetWindowText() with SEH as they're following pointers in the desktop heap Modified: trunk/reactos/dll/win32/user32/user32.rbuild trunk/reactos/dll/win32/user32/windows/class.c trunk/reactos/dll/win32/user32/windows/window.c Modified: trunk/reactos/dll/win32/user32/user32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/user32.rb…
============================================================================== --- trunk/reactos/dll/win32/user32/user32.rbuild (original) +++ trunk/reactos/dll/win32/user32/user32.rbuild Sat Nov 17 00:56:23 2007 @@ -14,6 +14,7 @@ <library>advapi32</library> <library>imm32</library> <library>win32ksys</library> + <library>pseh</library> <directory name="include"> <pch>user32.h</pch> Modified: trunk/reactos/dll/win32/user32/windows/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/class.c (original) +++ trunk/reactos/dll/win32/user32/windows/class.c Sat Nov 17 00:56:23 2007 @@ -199,80 +199,101 @@ if (!Wnd) return 0; - Class = DesktopPtrToUser(Wnd->Class); - ASSERT(Class != NULL); - - if (nIndex >= 0) - { - if (nIndex + sizeof(ULONG_PTR) < nIndex || - nIndex + sizeof(ULONG_PTR) > Class->ClsExtra) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - Ret = *(PULONG_PTR)((ULONG_PTR)(Class + 1) + nIndex); - } - else - { - switch (nIndex) - { - case GCL_CBWNDEXTRA: - Ret = (ULONG_PTR)Class->WndExtra; - break; - - case GCL_CBCLSEXTRA: - Ret = (ULONG_PTR)Class->ClsExtra; - break; - - case GCL_HBRBACKGROUND: - Ret = (ULONG_PTR)Class->hbrBackground; - if (Ret != 0 && Ret < 0x4000) - Ret = (ULONG_PTR)GetSysColorBrush((ULONG)Ret - 1); - break; - - case GCL_HMODULE: - Ret = (ULONG_PTR)Class->hInstance; - break; - - case GCL_MENUNAME: - Ret = (ULONG_PTR)Class->AnsiMenuName; - break; - - case GCL_STYLE: - Ret = (ULONG_PTR)Class->Style; - break; - - case GCW_ATOM: - Ret = (ULONG_PTR)Class->Atom; - break; - - case GCLP_HCURSOR: - /* FIXME - get handle from pointer to CURSOR object */ - Ret = (ULONG_PTR)Class->hCursor; - break; - - case GCLP_HICON: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIcon; - break; - - case GCLP_HICONSM: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIconSm; - break; - - case GCLP_WNDPROC: - /* We need to make a call to win32k as it may be required to - create a callproc handle */ - return NtUserGetClassLong(hWnd, nIndex, TRUE); - - default: - SetLastError(ERROR_INVALID_INDEX); - } - } - - return Ret; + _SEH_TRY + { + Class = DesktopPtrToUser(Wnd->Class); + if (Class != NULL) + { + if (nIndex >= 0) + { + if (nIndex + sizeof(ULONG_PTR) < nIndex || + nIndex + sizeof(ULONG_PTR) > Class->ClsExtra) + { + SetLastError(ERROR_INVALID_PARAMETER); + } + else + Ret = *(PULONG_PTR)((ULONG_PTR)(Class + 1) + nIndex); + } + else + { + switch (nIndex) + { + case GCL_CBWNDEXTRA: + Ret = (ULONG_PTR)Class->WndExtra; + break; + + case GCL_CBCLSEXTRA: + Ret = (ULONG_PTR)Class->ClsExtra; + break; + + case GCL_HBRBACKGROUND: + Ret = (ULONG_PTR)Class->hbrBackground; + if (Ret != 0 && Ret < 0x4000) + Ret = (ULONG_PTR)GetSysColorBrush((ULONG)Ret - 1); + break; + + case GCL_HMODULE: + Ret = (ULONG_PTR)Class->hInstance; + break; + + case GCL_MENUNAME: + Ret = (ULONG_PTR)Class->AnsiMenuName; + break; + + case GCL_STYLE: + Ret = (ULONG_PTR)Class->Style; + break; + + case GCW_ATOM: + Ret = (ULONG_PTR)Class->Atom; + break; + + case GCLP_HCURSOR: + /* FIXME - get handle from pointer to CURSOR object */ + Ret = (ULONG_PTR)Class->hCursor; + break; + + case GCLP_HICON: + /* FIXME - get handle from pointer to ICON object */ + Ret = (ULONG_PTR)Class->hIcon; + break; + + case GCLP_HICONSM: + /* FIXME - get handle from pointer to ICON object */ + Ret = (ULONG_PTR)Class->hIconSm; + break; + + case GCLP_WNDPROC: + /* We need to make a call to win32k as it may be required to + create a callproc handle */ + Wnd = NULL; + break; + + default: + SetLastError(ERROR_INVALID_INDEX); + break; + } + } + } + else + { + /* This is a race condition! Call win32k to make sure we're getting + the correct result */ + Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + + WARN("Invalid class for hwnd 0x%p!\n", hWnd); + } + } + _SEH_HANDLE + { + Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + } + _SEH_END; + + if (Wnd == NULL) + Ret = NtUserGetClassLong(hWnd, nIndex, TRUE); + + return Ret; } /* @@ -291,80 +312,101 @@ if (!Wnd) return 0; - Class = DesktopPtrToUser(Wnd->Class); - ASSERT(Class != NULL); - - if (nIndex >= 0) - { - if (nIndex + sizeof(ULONG_PTR) < nIndex || - nIndex + sizeof(ULONG_PTR) > Class->ClsExtra) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - Ret = *(PULONG_PTR)((ULONG_PTR)(Class + 1) + nIndex); - } - else - { - switch (nIndex) - { - case GCL_CBWNDEXTRA: - Ret = (ULONG_PTR)Class->WndExtra; - break; - - case GCL_CBCLSEXTRA: - Ret = (ULONG_PTR)Class->ClsExtra; - break; - - case GCL_HBRBACKGROUND: - Ret = (ULONG_PTR)Class->hbrBackground; - if (Ret != 0 && Ret < 0x4000) - Ret = (ULONG_PTR)GetSysColorBrush((ULONG)Ret - 1); - break; - - case GCL_HMODULE: - Ret = (ULONG_PTR)Class->hInstance; - break; - - case GCL_MENUNAME: - Ret = (ULONG_PTR)Class->MenuName; - break; - - case GCL_STYLE: - Ret = (ULONG_PTR)Class->Style; - break; - - case GCW_ATOM: - Ret = (ULONG_PTR)Class->Atom; - break; - - case GCLP_HCURSOR: - /* FIXME - get handle from pointer to CURSOR object */ - Ret = (ULONG_PTR)Class->hCursor; - break; - - case GCLP_HICON: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIcon; - break; - - case GCLP_HICONSM: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIconSm; - break; - - case GCLP_WNDPROC: - /* We need to make a call to win32k as it may be required to - create a callproc handle */ - return NtUserGetClassLong(hWnd, nIndex, FALSE); - - default: - SetLastError(ERROR_INVALID_INDEX); - } - } - - return Ret; + _SEH_TRY + { + Class = DesktopPtrToUser(Wnd->Class); + if (Class != NULL) + { + if (nIndex >= 0) + { + if (nIndex + sizeof(ULONG_PTR) < nIndex || + nIndex + sizeof(ULONG_PTR) > Class->ClsExtra) + { + SetLastError(ERROR_INVALID_PARAMETER); + } + else + Ret = *(PULONG_PTR)((ULONG_PTR)(Class + 1) + nIndex); + } + else + { + switch (nIndex) + { + case GCL_CBWNDEXTRA: + Ret = (ULONG_PTR)Class->WndExtra; + break; + + case GCL_CBCLSEXTRA: + Ret = (ULONG_PTR)Class->ClsExtra; + break; + + case GCL_HBRBACKGROUND: + Ret = (ULONG_PTR)Class->hbrBackground; + if (Ret != 0 && Ret < 0x4000) + Ret = (ULONG_PTR)GetSysColorBrush((ULONG)Ret - 1); + break; + + case GCL_HMODULE: + Ret = (ULONG_PTR)Class->hInstance; + break; + + case GCL_MENUNAME: + Ret = (ULONG_PTR)Class->MenuName; + break; + + case GCL_STYLE: + Ret = (ULONG_PTR)Class->Style; + break; + + case GCW_ATOM: + Ret = (ULONG_PTR)Class->Atom; + break; + + case GCLP_HCURSOR: + /* FIXME - get handle from pointer to CURSOR object */ + Ret = (ULONG_PTR)Class->hCursor; + break; + + case GCLP_HICON: + /* FIXME - get handle from pointer to ICON object */ + Ret = (ULONG_PTR)Class->hIcon; + break; + + case GCLP_HICONSM: + /* FIXME - get handle from pointer to ICON object */ + Ret = (ULONG_PTR)Class->hIconSm; + break; + + case GCLP_WNDPROC: + /* We need to make a call to win32k as it may be required to + create a callproc handle */ + Wnd = NULL; + break; + + default: + SetLastError(ERROR_INVALID_INDEX); + break; + } + } + } + else + { + /* This is a race condition! Call win32k to make sure we're getting + the correct result */ + Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + + WARN("Invalid class for hwnd 0x%p!\n", hWnd); + } + } + _SEH_HANDLE + { + Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + } + _SEH_END; + + if (Wnd == NULL) + Ret = NtUserGetClassLong(hWnd, nIndex, FALSE); + + return Ret; } Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 00:56:23 2007 @@ -1027,55 +1027,67 @@ int STDCALL GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount) { - PWINDOW Wnd; - PCWSTR Buffer; - - if (lpString == NULL) - return 0; - - Wnd = ValidateHwnd(hWnd); - if (!Wnd) - return 0; - - if (Wnd->pi != g_kpi) - { - INT Length; - - if (nMaxCount <= 0) - return 0; - - /* do not send WM_GETTEXT messages to other processes */ - Length = Wnd->WindowName.Length / sizeof(WCHAR); - if (Length != 0) - { - Buffer = DesktopPtrToUser(Wnd->WindowName.Buffer); - if (Buffer != NULL) - { - if (!WideCharToMultiByte(CP_ACP, - 0, - Buffer, - Length + 1, - lpString, - nMaxCount, - NULL, - NULL)) - { - lpString[nMaxCount - 1] = '\0'; - } - } - else - { - Length = 0; - lpString[0] = '\0'; - } - } - else - lpString[0] = '\0'; - - return (LRESULT)Length; - } - - return SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString); + PWINDOW Wnd; + PCWSTR Buffer; + INT Length = 0; + + if (lpString == NULL) + return 0; + + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return 0; + + _SEH_TRY + { + if (Wnd->pi != g_kpi) + { + if (nMaxCount > 0) + { + /* do not send WM_GETTEXT messages to other processes */ + Length = Wnd->WindowName.Length / sizeof(WCHAR); + if (Length != 0) + { + Buffer = DesktopPtrToUser(Wnd->WindowName.Buffer); + if (Buffer != NULL) + { + if (!WideCharToMultiByte(CP_ACP, + 0, + Buffer, + Length + 1, + lpString, + nMaxCount, + NULL, + NULL)) + { + lpString[nMaxCount - 1] = '\0'; + } + } + else + { + Length = 0; + lpString[0] = '\0'; + } + } + else + lpString[0] = '\0'; + } + + Wnd = NULL; /* Don't send a message */ + } + } + _SEH_HANDLE + { + lpString[0] = '\0'; + Length = 0; + Wnd = NULL; /* Don't send a message */ + } + _SEH_END; + + if (Wnd != NULL) + Length = SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString); + + return Length; } @@ -1105,47 +1117,59 @@ int STDCALL GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount) { - PWINDOW Wnd; - PCWSTR Buffer; - - if (lpString == NULL) - return 0; - - Wnd = ValidateHwnd(hWnd); - if (!Wnd) - return 0; - - if (Wnd->pi != g_kpi) - { - INT Length; - - if (nMaxCount <= 0) - return 0; - - /* do not send WM_GETTEXT messages to other processes */ - Length = Wnd->WindowName.Length / sizeof(WCHAR); - if (Length != 0) - { - Buffer = DesktopPtrToUser(Wnd->WindowName.Buffer); - if (Buffer != NULL) - { - RtlCopyMemory(lpString, - Buffer, - (Length + 1) * sizeof(WCHAR)); - } - else - { - Length = 0; - lpString[0] = L'\0'; - } - } - else - lpString[0] = L'\0'; - - return (LRESULT)Length; - } - - return SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString); + PWINDOW Wnd; + PCWSTR Buffer; + INT Length = 0; + + if (lpString == NULL) + return 0; + + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return 0; + + _SEH_TRY + { + if (Wnd->pi != g_kpi) + { + if (nMaxCount > 0) + { + /* do not send WM_GETTEXT messages to other processes */ + Length = Wnd->WindowName.Length / sizeof(WCHAR); + if (Length != 0) + { + Buffer = DesktopPtrToUser(Wnd->WindowName.Buffer); + if (Buffer != NULL) + { + RtlCopyMemory(lpString, + Buffer, + (Length + 1) * sizeof(WCHAR)); + } + else + { + Length = 0; + lpString[0] = '\0'; + } + } + else + lpString[0] = '\0'; + } + + Wnd = NULL; /* Don't send a message */ + } + } + _SEH_HANDLE + { + lpString[0] = '\0'; + Length = 0; + Wnd = NULL; /* Don't send a message */ + } + _SEH_END; + + if (Wnd != NULL) + Length = SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString); + + return Length; } DWORD STDCALL @@ -1187,9 +1211,7 @@ PWINDOW Wnd = ValidateHwnd(hWnd); if (Wnd != NULL) - { return (Wnd->Style & WS_MINIMIZE) != 0; - } return FALSE; }
17 years, 1 month
1
0
0
0
[mpiulachs] 30512: - Add the "families" target that will print the available build families from buildfamilies.rbuild - fix some typos
by mpiulachs@svn.reactos.org
Author: mpiulachs Date: Sat Nov 17 00:11:25 2007 New Revision: 30512 URL:
http://svn.reactos.org/svn/reactos?rev=30512&view=rev
Log: - Add the "families" target that will print the available build families from buildfamilies.rbuild - fix some typos Modified: branches/rbuild/reactos/Makefile branches/rbuild/reactos/buildfamilies.rbuild branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h Modified: branches/rbuild/reactos/Makefile URL:
http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/Makefile?rev=305…
============================================================================== --- branches/rbuild/reactos/Makefile (original) +++ branches/rbuild/reactos/Makefile Sat Nov 17 00:11:25 2007 @@ -46,6 +46,8 @@ # This is faster than the depends target which does a complete dependency # check of the ReactOS codebase. # +# families +# A list will be shown with all available build families. # # Accepted environment variables: # Modified: branches/rbuild/reactos/buildfamilies.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/buildfamilies.rb…
============================================================================== --- branches/rbuild/reactos/buildfamilies.rbuild (original) +++ branches/rbuild/reactos/buildfamilies.rbuild Sat Nov 17 00:11:25 2007 @@ -10,18 +10,18 @@ <buildfamily name="applications" /> <buildfamily name="guiapplications" description="Win32 GUI applications" /> <buildfamily name="cuiapplications" description="Win32 console applications" /> - <buildfamily name="nativeapplications" description="Native console applications"/> + <buildfamily name="nativeapplications" description="Native console applications"/> <!-- By functionality --> <buildfamily name="games" /> <buildfamily name="screensavers" /> <buildfamily name="services" /> <buildfamily name="shells" /> - <buildfamily name="cpapplets" /> + <buildfamily name="cplapplets" /> <!-- Drivers --> <buildfamily name="drivers" /> - <buildfamily name="fsdrivers" description="File system drivers" /> + <buildfamily name="fsdrivers" description="File system drivers" /> <buildfamily name="hardwaredrivers" description="Hardware drivers" /> <buildfamily name="displaydrivers" description="Hardware display drivers" /> <buildfamily name="inputdrivers" description="I/O device drivers" /> Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp URL:
http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/bac…
============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.cpp Sat Nov 17 00:11:25 2007 @@ -337,6 +337,7 @@ GenerateXmlBuildFilesMacro (); UnpackWineResources (); ProcessModules (); + GenerateFamiliesTargetsInfo (); GenerateInstallTarget (); GenerateTestTarget (); GenerateDirectoryTargets (); @@ -577,40 +578,35 @@ } fprintf ( fMakefile, "\n\t\n\n" ); } -/* -void -MingwBackend::GenerateFamiliesTarget () const -{ + +void +MingwBackend::GenerateFamiliesTargetsInfo () const +{ + fprintf ( fMakefile, "families:\n"); + fprintf ( fMakefile, "\t@echo=================== Available Build Families ===================\n\n" ); + for ( size_t i = 0; i < ProjectNode.buildfamilies.size (); i++ ) { BuildFamily& buildfamily = *ProjectNode.buildfamilies[i]; + + if ( buildfamily.description.length () > 0 ) + { fprintf ( fMakefile, - "%s:", - buildfamily.name.c_str () ); - - for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) - { - Module& module = *ProjectNode.modules[i]; - if ( !module.enabled ) - continue; - - for ( size_t i = 0; i < module.families.size (); i++ ) - { - Family& family = *module.families[i]; - - if (family.name == buildfamily.name) - { - fprintf ( fMakefile, - " %s", - GetTargetMacro(module).c_str () ); - } - } - } + "\t@echo %s (%s)\n", + buildfamily.name.c_str () , + buildfamily.description.c_str()); + } + else + { + fprintf ( fMakefile, + "\t@echo %s\n", + buildfamily.name.c_str ()); + } } fprintf ( fMakefile, "\n\t\n\n" ); } -*/ + string MingwBackend::GetBuildToolDependencies () const { Modified: branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h URL:
http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/bac…
============================================================================== --- branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h (original) +++ branches/rbuild/reactos/tools/rbuild/backend/mingw/mingw.h Sat Nov 17 00:11:25 2007 @@ -76,7 +76,7 @@ bool IncludeInAllTarget ( const Module& module ) const; void GenerateAllTarget ( const std::vector<MingwModuleHandler*>& handlers ) const; std::string GetBuildToolDependencies () const; - void GenerateFamiliesTarget() const; + void GenerateFamiliesTargetsInfo() const; void GenerateInitTarget () const; void GenerateRegTestsRunTarget () const; void GenerateXmlBuildFilesMacro() const;
17 years, 1 month
1
0
0
0
[fireball] 30511: - Fix a typo.
by fireball@svn.reactos.org
Author: fireball Date: Fri Nov 16 22:49:09 2007 New Revision: 30511 URL:
http://svn.reactos.org/svn/reactos?rev=30511&view=rev
Log: - Fix a typo. Modified: trunk/reactos/ntoskrnl/ntoskrnl.mc Modified: trunk/reactos/ntoskrnl/ntoskrnl.mc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.mc?rev=3…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.mc (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.mc Fri Nov 16 22:49:09 2007 @@ -1168,6 +1168,7 @@ SymbolicName=ATTEMPTED_WRITE_TO_READONLY_MEMORY Language=English ATTEMPTED_WRITE_TO_READONLY_MEMORY +. MessageId=0xC2 Severity=Success
17 years, 1 month
1
0
0
0
[cwittich] 30510: sync to wine
by cwittich@svn.reactos.org
Author: cwittich Date: Fri Nov 16 20:50:54 2007 New Revision: 30510 URL:
http://svn.reactos.org/svn/reactos?rev=30510&view=rev
Log: sync to wine Modified: trunk/reactos/dll/win32/user32/controls/listbox.c Modified: trunk/reactos/dll/win32/user32/controls/listbox.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/listbox.c (original) +++ trunk/reactos/dll/win32/user32/controls/listbox.c Fri Nov 16 20:50:54 2007 @@ -72,10 +72,10 @@ /* Item structure */ typedef struct { - LPWSTR str; /* Item text */ - BOOL selected; /* Is item selected? */ - UINT height; /* Item height (only for OWNERDRAWVARIABLE) */ - DWORD data; /* User data */ + LPWSTR str; /* Item text */ + BOOL selected; /* Is item selected? */ + UINT height; /* Item height (only for OWNERDRAWVARIABLE) */ + ULONG_PTR data; /* User data */ } LB_ITEMDATA; /* Listbox structure */ @@ -929,7 +929,7 @@ /* note that some application (MetaStock) expects the second item * to be in the listbox */ cis.itemID1 = -1; - cis.itemData1 = (DWORD)str; + cis.itemData1 = (ULONG_PTR)str; cis.itemID2 = index; cis.itemData2 = descr->items[index].data; cis.dwLocaleId = descr->locale; @@ -1604,7 +1604,7 @@ * LISTBOX_InsertItem */ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index, - LPWSTR str, DWORD data ) + LPWSTR str, ULONG_PTR data ) { LB_ITEMDATA *item; INT max_items; @@ -2815,8 +2815,9 @@ SetLastError(ERROR_INVALID_INDEX); return LB_ERR; } - descr->items[wParam].data = (DWORD)lParam; - return LB_OKAY; + descr->items[wParam].data = lParam; + /* undocumented: returns TRUE, not LB_OKAY (0) */ + return TRUE; #ifndef __REACTOS__ case LB_GETCOUNT16:
17 years, 1 month
1
0
0
0
← Newer
1
...
38
39
40
41
42
43
44
...
89
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Results per page:
10
25
50
100
200