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
[hpoussin] 30499: Enable mouse before resetting it
by hpoussin@svn.reactos.org
Author: hpoussin Date: Fri Nov 16 14:05:22 2007 New Revision: 30499 URL:
http://svn.reactos.org/svn/reactos?rev=30499&view=rev
Log: Enable mouse before resetting it Modified: trunk/reactos/drivers/input/i8042prt/pnp.c Modified: trunk/reactos/drivers/input/i8042prt/pnp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/i8042prt/pnp…
============================================================================== --- trunk/reactos/drivers/input/i8042prt/pnp.c (original) +++ trunk/reactos/drivers/input/i8042prt/pnp.c Fri Nov 16 14:05:22 2007 @@ -333,7 +333,21 @@ i8042Flush(DeviceExtension); - /* First, reset the mouse (if any) to start the detection */ + /* Select the devices we have */ + if (DeviceExtension->Flags & KEYBOARD_PRESENT) + { + FlagsToDisable |= CCB_KBD_DISAB; + FlagsToEnable |= CCB_KBD_INT_ENAB; + } + if (DeviceExtension->Flags & MOUSE_PRESENT) + { + FlagsToDisable |= CCB_MOUSE_DISAB; + FlagsToEnable |= CCB_MOUSE_INT_ENAB; + } + if (!i8042ChangeMode(DeviceExtension, FlagsToDisable, FlagsToEnable)) + return STATUS_UNSUCCESSFUL; + + /* Reset the mouse (if any) to start the detection */ if (DeviceExtension->Flags & MOUSE_PRESENT) { KIRQL Irql; @@ -345,20 +359,6 @@ KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql); } - - /* Select the devices we have */ - if (DeviceExtension->Flags & KEYBOARD_PRESENT) - { - FlagsToDisable |= CCB_KBD_DISAB; - FlagsToEnable |= CCB_KBD_INT_ENAB; - } - if (DeviceExtension->Flags & MOUSE_PRESENT) - { - FlagsToDisable |= CCB_MOUSE_DISAB; - FlagsToEnable |= CCB_MOUSE_INT_ENAB; - } - if (!i8042ChangeMode(DeviceExtension, FlagsToDisable, FlagsToEnable)) - return STATUS_UNSUCCESSFUL; return STATUS_SUCCESS; }
17 years, 1 month
1
0
0
0
[cwittich] 30498: fix some bugs in GetTimeZoneListIndex
by cwittich@svn.reactos.org
Author: cwittich Date: Fri Nov 16 13:22:01 2007 New Revision: 30498 URL:
http://svn.reactos.org/svn/reactos?rev=30498&view=rev
Log: fix some bugs in GetTimeZoneListIndex Modified: trunk/reactos/dll/win32/syssetup/wizard.c Modified: trunk/reactos/dll/win32/syssetup/wizard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/wizard.…
============================================================================== --- trunk/reactos/dll/win32/syssetup/wizard.c (original) +++ trunk/reactos/dll/win32/syssetup/wizard.c Fri Nov 16 13:22:01 2007 @@ -1116,7 +1116,8 @@ LPTSTR Buffer; LPTSTR Ptr; LPTSTR End; - BOOL bFound; + BOOL bFound = FALSE; + int iLanguageID; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), @@ -1137,6 +1138,7 @@ return FALSE; } + iLanguageID = _ttoi(szLanguageIdString); RegCloseKey(hKey); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, @@ -1183,22 +1185,21 @@ while (*Ptr != 0) { Length = _tcslen(Ptr); - if (_tcsicmp(Ptr, szLanguageIdString) == 0) + if (_ttoi(Ptr) == iLanguageID) bFound = TRUE; Ptr = Ptr + Length + 1; if (*Ptr == 0) break; - Length = _tcslen(Ptr); - if (bFound) { *lpIndex = _tcstoul(Ptr, &End, 10); HeapFree(GetProcessHeap(), 0, Buffer); - return FALSE; - } - + return TRUE; + } + + Length = _tcslen(Ptr); Ptr = Ptr + Length + 1; }
17 years, 1 month
1
0
0
0
[weiden] 30497: Optimize IsWindow() and IsWindowUnicode()
by weiden@svn.reactos.org
Author: weiden Date: Fri Nov 16 12:03:51 2007 New Revision: 30497 URL:
http://svn.reactos.org/svn/reactos?rev=30497&view=rev
Log: Optimize IsWindow() and IsWindowUnicode() Modified: trunk/reactos/dll/win32/user32/include/user32.h trunk/reactos/dll/win32/user32/misc/misc.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/include/window.h 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 Fri Nov 16 12:03:51 2007 @@ -89,3 +89,5 @@ PWINDOW FASTCALL ValidateHwnd(HWND hwnd); PWINDOW FASTCALL ValidateHwndOrDesk(HWND hwnd); PWINDOW FASTCALL GetThreadDesktopWnd(VOID); +PVOID FASTCALL ValidateHandleNoErr(HANDLE handle, UINT uType); +PWINDOW FASTCALL ValidateHwndNoErr(HWND hwnd); Modified: trunk/reactos/dll/win32/user32/misc/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/misc.c (original) +++ trunk/reactos/dll/win32/user32/misc/misc.c Fri Nov 16 12:03:51 2007 @@ -422,6 +422,35 @@ } // +// Validate Handle and return the pointer to the object. +// +PVOID +FASTCALL +ValidateHandleNoErr(HANDLE handle, UINT uType) +{ + PVOID ret; + PUSER_HANDLE_ENTRY pEntry; + + ASSERT(uType <= VALIDATE_TYPE_MONITOR); + + pEntry = GetUser32Handle(handle); + + if (pEntry && uType == 0) + uType = pEntry->type; + +// Must have an entry and must be the same type! + if ( (!pEntry) || (pEntry->type != uType) || !pEntry->ptr ) + return NULL; + + if (g_ObjectHeapTypeShared[uType]) + ret = SharedPtrToUser(pEntry->ptr); + else + ret = DesktopPtrToUser(pEntry->ptr); + + return ret; +} + +// // Validate a callproc handle and return the pointer to the object. // PCALLPROC @@ -474,6 +503,45 @@ return NULL; } +// +// Validate a window handle and return the pointer to the object. +// +PWINDOW +FASTCALL +ValidateHwndNoErr(HWND hwnd) +{ + PWINDOW Wnd; + PW32CLIENTINFO ClientInfo = GetWin32ClientInfo(); + ASSERT(ClientInfo != NULL); + + /* See if the window is cached */ + if (hwnd == ClientInfo->hWND) + return ClientInfo->pvWND; + + Wnd = ValidateHandleNoErr((HANDLE)hwnd, VALIDATE_TYPE_WIN); + if (Wnd != NULL) + { + /* FIXME: Check if handle table entry is marked as deleting and + return NULL in this case! */ + +#if 0 + return Wnd; +#else + /* HACK HACK HACK! This needs to be done until WINDOW_OBJECT is completely + superseded by the WINDOW structure. We *ASSUME* a pointer to the WINDOW + structure to be at the beginning of the WINDOW_OBJECT structure!!! + + !!! REMOVE AS SOON AS WINDOW_OBJECT NO LONGER EXISTS !!! + */ + + if (*((PVOID*)Wnd) != NULL) + return DesktopPtrToUser(*((PVOID*)Wnd)); +#endif + } + + return NULL; +} + PWINDOW FASTCALL GetThreadDesktopWnd(VOID) 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 Fri Nov 16 12:03:51 2007 @@ -1201,8 +1201,14 @@ BOOL STDCALL IsWindow(HWND hWnd) { - DWORD WndProc = NtUserGetWindowLong(hWnd, GWL_WNDPROC, FALSE); - return (0 != WndProc || ERROR_INVALID_WINDOW_HANDLE != GetLastError()); + PWINDOW Wnd = ValidateHwndNoErr(hWnd); + if (Wnd != NULL) + { + /* FIXME: If window is being destroyed return FALSE! */ + return TRUE; + } + + return FALSE; } @@ -1212,7 +1218,12 @@ BOOL STDCALL IsWindowUnicode(HWND hWnd) { - return NtUserIsWindowUnicode(hWnd); + PWINDOW Wnd = ValidateHwnd(hWnd); + + if (Wnd != NULL) + return Wnd->Unicode; + + return FALSE; } 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 Fri Nov 16 12:03:51 2007 @@ -115,6 +115,8 @@ PWINDOWCLASS Class; /* Window name. */ UNICODE_STRING WindowName; + + UINT Unicode : 1; } WINDOW, *PWINDOW; typedef struct _W32PROCESSINFO 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 Fri Nov 16 12:03:51 2007 @@ -78,7 +78,6 @@ ULONG PropListItems; /* Scrollbar info */ PWINDOW_SCROLLINFO Scroll; - BOOL Unicode; WNDPROC WndProc; PETHREAD OwnerThread; HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/ 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 Fri Nov 16 12:03:51 2007 @@ -385,7 +385,7 @@ } else { - MsgInfo.Ansi = !Window->Unicode; + MsgInfo.Ansi = !Window->Wnd->Unicode; MsgInfo.Proc = Window->WndProc; } } @@ -1390,7 +1390,7 @@ RETURN( FALSE); } - Result = (ULONG_PTR)co_IntCallWindowProc(Window->WndProc, !Window->Unicode, hWnd, Msg, wParam, + Result = (ULONG_PTR)co_IntCallWindowProc(Window->WndProc, !Window->Wnd->Unicode, hWnd, Msg, wParam, lParamPacked,lParamBufferSize); if(uResult) @@ -1566,7 +1566,7 @@ sizeof(BOOL)); if (! NT_SUCCESS(Status)) { - Info.Ansi = ! Window->Unicode; + Info.Ansi = ! Window->Wnd->Unicode; } if (Window->IsSystem) @@ -1575,7 +1575,7 @@ } else { - Info.Ansi = !Window->Unicode; + Info.Ansi = !Window->Wnd->Unicode; Info.Proc = Window->WndProc; } } 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 Fri Nov 16 12:03:51 2007 @@ -283,7 +283,7 @@ { RETURN( FALSE); } - Result = Window->Unicode; + Result = Window->Wnd->Unicode; RETURN( Result); } 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 Fri Nov 16 12:03:51 2007 @@ -525,7 +525,7 @@ } else { - if (!Ansi == Window->Unicode) + if (!Ansi == Wnd->Unicode) { return Window->WndProc; } @@ -541,12 +541,12 @@ NewCallProc = UserFindCallProc(Wnd->Class, Window->WndProc, - Window->Unicode); + Wnd->Unicode); if (NewCallProc == NULL) { NewCallProc = CreateCallProc(Wnd->ti->Desktop, Window->WndProc, - Window->Unicode, + Wnd->Unicode, Wnd->ti->kpi); if (NewCallProc == NULL) { @@ -1649,13 +1649,13 @@ if (Wnd->Class->System) { /* NOTE: Always create a unicode window for system classes! */ - Window->Unicode = TRUE; + Wnd->Unicode = TRUE; Window->WndProc = Wnd->Class->WndProc; Window->WndProcExtra = Wnd->Class->WndProcExtra; } else { - Window->Unicode = Wnd->Class->Unicode; + Wnd->Unicode = Wnd->Class->Unicode; Window->WndProc = Wnd->Class->WndProc; Window->CallProc = NULL; } @@ -3614,7 +3614,7 @@ } else { - if (!Ansi == Window->Unicode) + if (!Ansi == Wnd->Unicode) { Ret = Window->WndProc; } @@ -3622,12 +3622,12 @@ { CallProc = UserFindCallProc(Wnd->Class, Window->WndProc, - Window->Unicode); + Wnd->Unicode); if (CallProc == NULL) { CallProc = CreateCallProc(NULL, Window->WndProc, - Window->Unicode, + Wnd->Unicode, Wnd->ti->kpi); if (CallProc == NULL) { @@ -3656,7 +3656,7 @@ { Window->WndProc = Wnd->Class->WndProc; Window->WndProcExtra = Wnd->Class->WndProcExtra; - Window->Unicode = !Ansi; + Wnd->Unicode = !Ansi; return Ret; } } @@ -3665,7 +3665,7 @@ /* update the window procedure */ Window->WndProc = NewWndProc; - Window->Unicode = !Ansi; + Wnd->Unicode = !Ansi; return Ret; }
17 years, 1 month
1
0
0
0
[weiden] 30496: Use correct buffer size in GetClassNameW()
by weiden@svn.reactos.org
Author: weiden Date: Fri Nov 16 11:43:50 2007 New Revision: 30496 URL:
http://svn.reactos.org/svn/reactos?rev=30496&view=rev
Log: Use correct buffer size in GetClassNameW() Modified: trunk/reactos/dll/win32/user32/windows/class.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 Fri Nov 16 11:43:50 2007 @@ -409,7 +409,7 @@ UNICODE_STRING ClassName; int Result; - ClassName.MaximumLength = nMaxCount; + ClassName.MaximumLength = nMaxCount * sizeof(WCHAR); ClassName.Buffer = lpClassName; Result = NtUserGetClassName(hWnd,
17 years, 1 month
1
0
0
0
[weiden] 30495: Optimize ClientToScreen(), ScreenToClient() and MapWindowPoints()
by weiden@svn.reactos.org
Author: weiden Date: Fri Nov 16 11:03:04 2007 New Revision: 30495 URL:
http://svn.reactos.org/svn/reactos?rev=30495&view=rev
Log: Optimize ClientToScreen(), ScreenToClient() and MapWindowPoints() Modified: trunk/reactos/dll/win32/user32/include/user32.h trunk/reactos/dll/win32/user32/misc/misc.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h 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 Fri Nov 16 11:03:04 2007 @@ -87,3 +87,5 @@ PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc); PWINDOW FASTCALL ValidateHwnd(HWND hwnd); +PWINDOW FASTCALL ValidateHwndOrDesk(HWND hwnd); +PWINDOW FASTCALL GetThreadDesktopWnd(VOID); Modified: trunk/reactos/dll/win32/user32/misc/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/misc.c (original) +++ trunk/reactos/dll/win32/user32/misc/misc.c Fri Nov 16 11:03:04 2007 @@ -146,6 +146,19 @@ } return pi; +} + +static PDESKTOP +GetThreadDesktopInfo(VOID) +{ + PW32THREADINFO ti; + PDESKTOP di = NULL; + + ti = GetW32ThreadInfo(); + if (ti != NULL) + di = DesktopPtrToUser(ti->Desktop); + + return di; } @@ -429,6 +442,7 @@ FASTCALL ValidateHwnd(HWND hwnd) { + PWINDOW Wnd; PW32CLIENTINFO ClientInfo = GetWin32ClientInfo(); ASSERT(ClientInfo != NULL); @@ -436,7 +450,7 @@ if (hwnd == ClientInfo->hWND) return ClientInfo->pvWND; - PWINDOW Wnd = ValidateHandle((HANDLE)hwnd, VALIDATE_TYPE_WIN); + Wnd = ValidateHandle((HANDLE)hwnd, VALIDATE_TYPE_WIN); if (Wnd != NULL) { /* FIXME: Check if handle table entry is marked as deleting and @@ -459,3 +473,26 @@ return NULL; } + +PWINDOW +FASTCALL +GetThreadDesktopWnd(VOID) +{ + PWINDOW Wnd = GetThreadDesktopInfo()->Wnd; + if (Wnd != NULL) + Wnd = DesktopPtrToUser(Wnd); + return Wnd; +} + +// +// Validate a window handle and return the pointer to the object. +// +PWINDOW +FASTCALL +ValidateHwndOrDesk(HWND hwnd) +{ + if (hwnd == HWND_DESKTOP) + return GetThreadDesktopWnd(); + + return ValidateHwnd(hwnd); +} 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 Fri Nov 16 11:03:04 2007 @@ -1577,36 +1577,28 @@ int STDCALL MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints) { - POINT FromOffset, ToOffset; - LONG XMove, YMove; - ULONG i; - - if (hWndFrom == NULL) - { - FromOffset.x = FromOffset.y = 0; - } else - if(!NtUserGetClientOrigin(hWndFrom, &FromOffset)) - { - return 0; - } - - if (hWndTo == NULL) - { - ToOffset.x = ToOffset.y = 0; - } else - if(!NtUserGetClientOrigin(hWndTo, &ToOffset)) - { - return 0; - } - XMove = FromOffset.x - ToOffset.x; - YMove = FromOffset.y - ToOffset.y; - - for (i = 0; i < cPoints; i++) - { - lpPoints[i].x += XMove; - lpPoints[i].y += YMove; - } - return(MAKELONG(LOWORD(XMove), LOWORD(YMove))); + PWINDOW FromWnd, ToWnd; + POINT Delta; + UINT i; + + FromWnd = ValidateHwndOrDesk(hWndFrom); + if (!FromWnd) + return 0; + + ToWnd = ValidateHwndOrDesk(hWndTo); + if (!ToWnd) + return 0; + + Delta.x = FromWnd->ClientRect.left - ToWnd->ClientRect.left; + Delta.y = FromWnd->ClientRect.top - ToWnd->ClientRect.top; + + for (i = 0; i != cPoints; i++) + { + lpPoints[i].x += Delta.x; + lpPoints[i].y += Delta.y; + } + + return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y)); } @@ -1616,7 +1608,18 @@ BOOL STDCALL ScreenToClient(HWND hWnd, LPPOINT lpPoint) { - return(MapWindowPoints(NULL, hWnd, lpPoint, 1) != 0); + PWINDOW Wnd, DesktopWnd; + + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return FALSE; + + DesktopWnd = GetThreadDesktopWnd(); + + lpPoint->x += DesktopWnd->ClientRect.left - Wnd->ClientRect.left; + lpPoint->y += DesktopWnd->ClientRect.top - Wnd->ClientRect.top; + + return TRUE; } @@ -1626,7 +1629,18 @@ BOOL STDCALL ClientToScreen(HWND hWnd, LPPOINT lpPoint) { - return (MapWindowPoints( hWnd, NULL, lpPoint, 1 ) != 0); + PWINDOW Wnd, DesktopWnd; + + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return FALSE; + + DesktopWnd = GetThreadDesktopWnd(); + + lpPoint->x += Wnd->ClientRect.left - DesktopWnd->ClientRect.left; + lpPoint->y += Wnd->ClientRect.top - DesktopWnd->ClientRect.top; + + return TRUE; } 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 Fri Nov 16 11:03:04 2007 @@ -3,6 +3,7 @@ struct _W32PROCESSINFO; struct _W32THREADINFO; +struct _WINDOW; typedef struct _REGISTER_SYSCLASS { @@ -22,9 +23,11 @@ { HANDLE hKernelHeap; ULONG_PTR HeapLimit; - WCHAR szDesktopName[1]; HWND hTaskManWindow; HWND hProgmanWindow; + struct _WINDOW *Wnd; + + WCHAR szDesktopName[1]; } DESKTOP, *PDESKTOP; typedef struct _CALLPROC 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 Fri Nov 16 11:03:04 2007 @@ -1600,6 +1600,7 @@ { /* If there is no desktop window yet, we must be creating it */ PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow = hWnd; + PsGetCurrentThreadWin32Thread()->Desktop->DesktopInfo->Wnd = Wnd; } /*
17 years, 1 month
1
0
0
0
[arty] 30494: hpoussin pointed out that these aren't needed anymore.
by arty@svn.reactos.org
Author: arty Date: Fri Nov 16 10:54:40 2007 New Revision: 30494 URL:
http://svn.reactos.org/svn/reactos?rev=30494&view=rev
Log: hpoussin pointed out that these aren't needed anymore. Removed: trunk/tools/RosBE/RosBE-PPC/mingw-crt-headers/
17 years, 1 month
1
0
0
0
[cwittich] 30493: sync to wine Author: Alexandre Julliard <julliard at winehq.org> Don't wait for the command to terminate in ShellLink_InvokeCommand.
by cwittich@svn.reactos.org
Author: cwittich Date: Fri Nov 16 10:36:46 2007 New Revision: 30493 URL:
http://svn.reactos.org/svn/reactos?rev=30493&view=rev
Log: sync to wine Author: Alexandre Julliard <julliard at
winehq.org
> Don't wait for the command to terminate in ShellLink_InvokeCommand. Modified: trunk/reactos/dll/win32/shell32/shelllink.c Modified: trunk/reactos/dll/win32/shell32/shelllink.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shelllin…
============================================================================== --- trunk/reactos/dll/win32/shell32/shelllink.c (original) +++ trunk/reactos/dll/win32/shell32/shelllink.c Fri Nov 16 10:36:46 2007 @@ -2835,14 +2835,7 @@ sei.lpVerb = szOpen; if( ShellExecuteExW( &sei ) ) - { - if ( sei.hProcess ) - { - WaitForSingleObject( sei.hProcess, 10000 ); - CloseHandle( sei.hProcess ); - } r = S_OK; - } else r = E_FAIL;
17 years, 1 month
1
0
0
0
[weiden] 30492: Make registration of system window classes a bit more robust
by weiden@svn.reactos.org
Author: weiden Date: Fri Nov 16 10:12:59 2007 New Revision: 30492 URL:
http://svn.reactos.org/svn/reactos?rev=30492&view=rev
Log: Make registration of system window classes a bit more robust Modified: trunk/reactos/dll/win32/user32/controls/regcontrol.c trunk/reactos/dll/win32/user32/include/regcontrol.h trunk/reactos/dll/win32/user32/include/user32p.h trunk/reactos/dll/win32/user32/misc/dllmain.c 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/include/class.h trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Modified: trunk/reactos/dll/win32/user32/controls/regcontrol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/regcontrol.c (original) +++ trunk/reactos/dll/win32/user32/controls/regcontrol.c Fri Nov 16 10:12:59 2007 @@ -13,110 +13,51 @@ #include <wine/debug.h> -static void RegisterBuiltinClass(const struct builtin_class_descr *Descr) +static const struct { - WNDCLASSEXW wc; - UNICODE_STRING ClassName; - UNICODE_STRING MenuName; + const struct builtin_class_descr *desc; + UINT ClsId; +} g_SysClasses[] = +{ + { &DIALOG_builtin_class, CLASS_DIALOG }, + { &POPUPMENU_builtin_class, CLASS_POPUPMENU }, + { &COMBO_builtin_class, CLASS_COMBO }, + { &COMBOLBOX_builtin_class, CLASS_COMBOLBOX }, + { &DESKTOP_builtin_class, CLASS_DESKTOP }, + { &MDICLIENT_builtin_class, CLASS_MDICLIENT }, +#if 0 + { &MENU_builtin_class, CLASS_MENU }, +#endif + { &SCROLL_builtin_class, CLASS_SCROLL }, + { &BUTTON_builtin_class, CLASS_BUTTON }, + { &LISTBOX_builtin_class, CLASS_LISTBOX }, + { &EDIT_builtin_class, CLASS_EDIT }, + { &ICONTITLE_builtin_class, CLASS_ICONTITLE }, + { &STATIC_builtin_class, CLASS_STATIC }, +}; - wc.cbSize = sizeof(WNDCLASSEXW); - wc.lpszClassName = Descr->name; - wc.lpfnWndProc = Descr->procW; - wc.style = Descr->style; - wc.hInstance = User32Instance; - wc.hIcon = NULL; - wc.hIconSm = NULL; - wc.hCursor = LoadCursorW(NULL, Descr->cursor); - wc.hbrBackground = Descr->brush; - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = Descr->extra; +BOOL WINAPI RegisterSystemControls(VOID) +{ + REGISTER_SYSCLASS cls[sizeof(g_SysClasses) / sizeof(g_SysClasses[0])]; + UINT i; - MenuName.Length = - MenuName.MaximumLength = 0; - MenuName.Buffer = NULL; + ZeroMemory(cls, sizeof(cls)); - if (IS_ATOM(Descr->name)) - { - ClassName.Length = - ClassName.MaximumLength = 0; - ClassName.Buffer = (LPWSTR)Descr->name; - } else - { - RtlInitUnicodeString(&ClassName, Descr->name); - } + for (i = 0; i != sizeof(cls) / sizeof(cls[0]); i++) + { + if (IS_ATOM(g_SysClasses[i].desc->name)) + cls[i].ClassName.Buffer = (PWSTR)((ULONG_PTR)g_SysClasses[i].desc->name); + else + RtlInitUnicodeString(&cls[i].ClassName, g_SysClasses[i].desc->name); - NtUserRegisterClassEx( - &wc, - &ClassName, - &MenuName, - Descr->procA, - REGISTERCLASS_SYSTEM, - NULL); -} - -/*********************************************************************** - * ControlsInit - * - * Register the classes for the builtin controls - */ -BOOL FASTCALL -ControlsInit(LPCWSTR ClassName) -{ - static const struct builtin_class_descr *ClassDescriptions[] = - { - &DIALOG_builtin_class, - &POPUPMENU_builtin_class, - &COMBO_builtin_class, - &COMBOLBOX_builtin_class, - &DESKTOP_builtin_class, - &MDICLIENT_builtin_class, -#if 0 - &MENU_builtin_class, -#endif - &SCROLL_builtin_class, - &BUTTON_builtin_class, - &LISTBOX_builtin_class, - &EDIT_builtin_class, - &ICONTITLE_builtin_class, - &STATIC_builtin_class - }; - unsigned i; - BOOL Register; - - Register = FALSE; - if (IS_ATOM(ClassName)) - { - for (i = 0; - ! Register && i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); - i++) - { - if (IS_ATOM(ClassDescriptions[i]->name)) - { - Register = (ClassName == ClassDescriptions[i]->name); - } - } - } - else - { - for (i = 0; - ! Register && i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); - i++) - { - if (! IS_ATOM(ClassDescriptions[i]->name)) - { - Register = (0 == _wcsicmp(ClassName, ClassDescriptions[i]->name)); - } - } + cls[i].Style = g_SysClasses[i].desc->style; + cls[i].ProcW = g_SysClasses[i].desc->procW; + cls[i].ProcA = g_SysClasses[i].desc->procA; + cls[i].ExtraBytes = g_SysClasses[i].desc->extra; + cls[i].hCursor = LoadCursorW(NULL, g_SysClasses[i].desc->cursor); + cls[i].hBrush = g_SysClasses[i].desc->brush; + cls[i].ClassId = g_SysClasses[i].ClsId; } - if (Register) - { - for (i = 0; i < sizeof(ClassDescriptions) / sizeof(ClassDescriptions[0]); i++) - { - RegisterBuiltinClass(ClassDescriptions[i]); - } - } - - return Register; + return NtUserRegisterSystemClasses(sizeof(cls) / sizeof(cls[0]), cls); } Modified: trunk/reactos/dll/win32/user32/include/regcontrol.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/r…
============================================================================== --- trunk/reactos/dll/win32/user32/include/regcontrol.h (original) +++ trunk/reactos/dll/win32/user32/include/regcontrol.h Fri Nov 16 10:12:59 2007 @@ -26,7 +26,7 @@ HBRUSH brush; /* brush or system color */ }; -extern BOOL FASTCALL ControlsInit(LPCWSTR ClassName); +BOOL WINAPI RegisterSystemControls(VOID); extern const struct builtin_class_descr BUTTON_builtin_class; extern const struct builtin_class_descr COMBO_builtin_class; Modified: trunk/reactos/dll/win32/user32/include/user32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32p.h (original) +++ trunk/reactos/dll/win32/user32/include/user32p.h Fri Nov 16 10:12:59 2007 @@ -129,6 +129,8 @@ #define HideCaret(hwnd) \ NtUserHideCaret(hwnd) +#define NtUserRegisterSystemClasses(Count,SysClasses) \ + (BOOL)NtUserCallTwoParam((DWORD)Count, (DWORD)SysClasses, TWOPARAM_ROUTINE_ROS_REGSYSCLASSES) /* Internal Thread Data */ extern HINSTANCE User32Instance; Modified: trunk/reactos/dll/win32/user32/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/dllm…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/dllmain.c (original) +++ trunk/reactos/dll/win32/user32/misc/dllmain.c Fri Nov 16 10:12:59 2007 @@ -105,8 +105,11 @@ { case DLL_PROCESS_ATTACH: User32Instance = hInstanceDll; - if (!NtUserRegisterUserModule(hInstanceDll)) + if (!NtUserRegisterUserModule(hInstanceDll) || + !RegisterSystemControls()) + { return FALSE; + } hProcessHeap = RtlGetProcessHeap(); if (!Init()) 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 Fri Nov 16 10:12:59 2007 @@ -14,8 +14,6 @@ #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(user32); -extern BOOL ControlsInitialized; - /* * @implemented */ @@ -62,12 +60,6 @@ } } - /* Register built-in controls if not already done */ - if (! ControlsInitialized) - { - ControlsInitialized = ControlsInit(ClassName.Buffer); - } - Ret = NtUserGetClassInfo(hInstance, &ClassName, (LPWNDCLASSEXW)lpwcx, @@ -121,12 +113,6 @@ { RtlInitUnicodeString(&ClassName, lpszClass); - } - - /* Register built-in controls if not already done */ - if (! ControlsInitialized) - { - ControlsInitialized = ControlsInit(ClassName.Buffer); } return NtUserGetClassInfo(hInstance, 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 Fri Nov 16 10:12:59 2007 @@ -15,8 +15,6 @@ #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(user32); - -BOOL ControlsInitialized = FALSE; LRESULT DefWndNCPaint(HWND hWnd, HRGN hRgn, BOOL Active); void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ); @@ -185,12 +183,6 @@ return (HWND)0; } } - } - - /* Register built-in controls if not already done */ - if (! ControlsInitialized) - { - ControlsInitialized = ControlsInit(ClassName.Buffer); } if (Unicode) 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 Fri Nov 16 10:12:59 2007 @@ -3,6 +3,20 @@ struct _W32PROCESSINFO; struct _W32THREADINFO; + +typedef struct _REGISTER_SYSCLASS +{ + /* This is a reactos specific class used to initialize the + system window classes during user32 initialization */ + UNICODE_STRING ClassName; + UINT Style; + WNDPROC ProcW; + WNDPROC ProcA; + UINT ExtraBytes; + HICON hCursor; + HBRUSH hBrush; + UINT ClassId; +} REGISTER_SYSCLASS, *PREGISTER_SYSCLASS; typedef struct _DESKTOP { @@ -54,6 +68,23 @@ UINT System : 1; UINT Global : 1; UINT MenuNameIsString : 1; + +#define CLASS_DEFAULT 0x0 +#define CLASS_DESKTOP 0x1 +#define CLASS_DIALOG 0x2 +#define CLASS_POPUPMENU 0x3 +#define CLASS_COMBO 0x4 +#define CLASS_COMBOLBOX 0x5 +#define CLASS_MDICLIENT 0x6 +#define CLASS_MENU 0x7 +#define CLASS_SCROLL 0x8 +#define CLASS_BUTTON 0x9 +#define CLASS_LISTBOX 0xA +#define CLASS_EDIT 0xB +#define CLASS_ICONTITLE 0xC +#define CLASS_STATIC 0xD + UINT ClassId : 4; + } WINDOWCLASS, *PWINDOWCLASS; typedef struct _WINDOW @@ -92,6 +123,9 @@ PWINDOWCLASS LocalClassList; PWINDOWCLASS GlobalClassList; PWINDOWCLASS SystemClassList; + + UINT RegisteredSysClasses : 1; + } W32PROCESSINFO, *PW32PROCESSINFO; typedef struct _W32THREADINFO @@ -590,6 +624,7 @@ #define TWOPARAM_ROUTINE_ROS_SHOWWINDOW 0x1000 #define TWOPARAM_ROUTINE_ROS_ISACTIVEICON 0x1001 #define TWOPARAM_ROUTINE_ROS_NCDESTROY 0x1002 +#define TWOPARAM_ROUTINE_ROS_REGSYSCLASSES 0x1003 DWORD NTAPI NtUserCallTwoParam( @@ -1761,8 +1796,7 @@ /* FIXME: These flag constans aren't what Windows uses. */ #define REGISTERCLASS_ANSI 2 -#define REGISTERCLASS_SYSTEM 4 -#define REGISTERCLASS_ALL (REGISTERCLASS_ANSI | REGISTERCLASS_SYSTEM) +#define REGISTERCLASS_ALL (REGISTERCLASS_ANSI) RTL_ATOM NTAPI NtUserRegisterClassEx( Modified: trunk/reactos/subsystems/win32/win32k/include/class.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/class.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/class.h Fri Nov 16 10:12:59 2007 @@ -74,6 +74,10 @@ IN WNDPROC WndProc, IN BOOL bUnicode); +BOOL +UserRegisterSystemClasses(IN ULONG Count, + IN PREGISTER_SYSCLASS SystemClasses); + VOID UserAddCallProcToClass(IN OUT PWINDOWCLASS Class, IN PCALLPROC CallProc); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c Fri Nov 16 10:12:59 2007 @@ -38,6 +38,8 @@ /* WINDOWCLASS ***************************************************************/ +#define REGISTERCLASS_SYSTEM 0x4 + static VOID IntFreeClassMenuName(IN OUT PWINDOWCLASS Class) { @@ -1042,9 +1044,11 @@ { RTL_ATOM Atom = (RTL_ATOM)0; + ASSERT(BaseClass != NULL); + if (IntGetAtomFromStringOrAtom(ClassName, &Atom) && - BaseClass != NULL && Atom != (RTL_ATOM)0) + Atom != (RTL_ATOM)0) { PWINDOWCLASS Class; @@ -1098,7 +1102,6 @@ NULL, &pi->SystemClassList, Link); - if (Class == NULL) { SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST); @@ -1129,7 +1132,7 @@ /* NOTE: Accessing the buffers in ClassName and MenuName may raise exceptions! */ ti = GetW32ThreadInfo(); - if (ti == NULL) + if (ti == NULL || !ti->kpi->RegisteredSysClasses) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return (RTL_ATOM)0; @@ -1792,6 +1795,74 @@ lpwcx->hIconSm = Class->hIconSm; /* FIXME - get handle from pointer */ return TRUE; +} + +BOOL +UserRegisterSystemClasses(IN ULONG Count, + IN PREGISTER_SYSCLASS SystemClasses) +{ + /* NOTE: This routine may raise exceptions! */ + UINT i; + UNICODE_STRING ClassName, MenuName; + PW32PROCESSINFO pi = GetW32ProcessInfo(); + WNDCLASSEXW wc; + PWINDOWCLASS Class; + BOOL Ret = TRUE; + + if (pi->RegisteredSysClasses || pi->hModUser == NULL) + return FALSE; + + RtlZeroMemory(&MenuName, sizeof(MenuName)); + + for (i = 0; i != Count; i++) + { + ClassName = ProbeForReadUnicodeString(&SystemClasses[i].ClassName); + if (ClassName.Length != 0) + { + ProbeForRead(ClassName.Buffer, + ClassName.Length, + sizeof(WCHAR)); + } + + wc.cbSize = sizeof(wc); + wc.style = SystemClasses[i].Style; + wc.lpfnWndProc = SystemClasses[i].ProcW; + wc.cbClsExtra = 0; + wc.cbWndExtra = SystemClasses[i].ExtraBytes; + wc.hInstance = pi->hModUser; + wc.hIcon = NULL; + wc.hCursor = SystemClasses[i].hCursor; + wc.hbrBackground = SystemClasses[i].hBrush; + wc.lpszMenuName = NULL; + wc.lpszClassName = ClassName.Buffer; + wc.hIconSm = NULL; + + Class = IntCreateClass(&wc, + &ClassName, + &MenuName, + SystemClasses[i].ProcA, + REGISTERCLASS_SYSTEM, + NULL, + pi); + if (Class != NULL) + { + Class->ClassId = SystemClasses[i].ClassId; + + ASSERT(Class->System); + Class->Next = pi->SystemClassList; + (void)InterlockedExchangePointer(&pi->SystemClassList, + Class); + } + else + { + WARN("!!! Registering system class failed!\n"); + Ret = FALSE; + } + } + + if (Ret) + pi->RegisteredSysClasses = TRUE; + return Ret; } /* SYSCALLS *****************************************************************/ @@ -2179,9 +2250,9 @@ else { if (CapturedClassName.Length == 0) - WARN("Tried to get information of a non-existing class atom 0x%p\n", CapturedClassName.Buffer); + WARN("Tried to get information of a non-existing class atom 0x%p process 0x%p init: 0x%x\n", CapturedClassName.Buffer, PsGetCurrentProcessId(), pi->RegisteredSysClasses); else - WARN("Tried to get information of a non-existing class \"%wZ\"\n", &CapturedClassName); + WARN("Tried to get information of a non-existing class \"%wZ\" process 0x%p init: 0x%x\n", &CapturedClassName, PsGetCurrentProcessId(), pi->RegisteredSysClasses); SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST); } } 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 Fri Nov 16 10:12:59 2007 @@ -765,6 +765,33 @@ RETURN( Ret); } + case TWOPARAM_ROUTINE_ROS_REGSYSCLASSES: + { + DWORD Ret = 0; + DWORD Count = Param1; + PREGISTER_SYSCLASS RegSysClassArray = (PREGISTER_SYSCLASS)Param2; + + if (Count != 0 && RegSysClassArray != NULL) + { + _SEH_TRY + { + ProbeArrayForRead(RegSysClassArray, + sizeof(RegSysClassArray[0]), + Count, + 2); + + Ret = (DWORD)UserRegisterSystemClasses(Count, + RegSysClassArray); + } + _SEH_HANDLE + { + SetLastNtError(_SEH_GetExceptionCode()); + } + _SEH_END; + } + + RETURN( Ret); + } } DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n", Routine, Param1, Param2);
17 years, 1 month
1
0
0
0
[weiden] 30491: Optimize GetClassLongA/W to read most information from the desktop heap
by weiden@svn.reactos.org
Author: weiden Date: Fri Nov 16 06:02:38 2007 New Revision: 30491 URL:
http://svn.reactos.org/svn/reactos?rev=30491&view=rev
Log: Optimize GetClassLongA/W to read most information from the desktop heap Modified: trunk/reactos/dll/win32/user32/windows/class.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 Fri Nov 16 06:02:38 2007 @@ -203,21 +203,90 @@ DWORD STDCALL GetClassLongA(HWND hWnd, int nIndex) { - TRACE("%p %d\n", hWnd, nIndex); - - switch (nIndex) - { - case GCL_HBRBACKGROUND: - { - DWORD hBrush = NtUserGetClassLong(hWnd, GCL_HBRBACKGROUND, TRUE); - if (hBrush != 0 && hBrush < 0x4000) - hBrush = (DWORD)GetSysColorBrush((ULONG)hBrush - 1); - return hBrush; - } - - default: - return NtUserGetClassLong(hWnd, nIndex, TRUE); - } + PWINDOW Wnd; + PWINDOWCLASS Class; + ULONG_PTR Ret = 0; + + TRACE("%p %d\n", hWnd, nIndex); + + Wnd = ValidateHwnd(hWnd); + 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; } /* @@ -226,21 +295,90 @@ DWORD STDCALL GetClassLongW ( HWND hWnd, int nIndex ) { - TRACE("%p %d\n", hWnd, nIndex); - - switch (nIndex) - { - case GCL_HBRBACKGROUND: - { - DWORD hBrush = NtUserGetClassLong(hWnd, GCL_HBRBACKGROUND, TRUE); - if (hBrush != 0 && hBrush < 0x4000) - hBrush = (DWORD)GetSysColorBrush((ULONG)hBrush - 1); - return hBrush; - } - - default: - return NtUserGetClassLong(hWnd, nIndex, FALSE); - } + PWINDOW Wnd; + PWINDOWCLASS Class; + ULONG_PTR Ret = 0; + + TRACE("%p %d\n", hWnd, nIndex); + + Wnd = ValidateHwnd(hWnd); + 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; }
17 years, 1 month
1
0
0
0
[weiden] 30490: Optimize GetWindowText(Length)A/W and WM_GETTEXT(LENGTH)
by weiden@svn.reactos.org
Author: weiden Date: Fri Nov 16 05:37:14 2007 New Revision: 30490 URL:
http://svn.reactos.org/svn/reactos?rev=30490&view=rev
Log: Optimize GetWindowText(Length)A/W and WM_GETTEXT(LENGTH) Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c Fri Nov 16 05:37:14 2007 @@ -1602,6 +1602,7 @@ LPARAM lParam) { LRESULT Result = 0; + PWINDOW Wnd; SPY_EnterMessage(SPY_DEFWNDPROC, hWnd, Msg, wParam, lParam); switch (Msg) @@ -1630,33 +1631,57 @@ case WM_GETTEXTLENGTH: { - Result = (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); + PWSTR buf; + ULONG len; + + Wnd = ValidateHwnd(hWnd); + if (Wnd != NULL && Wnd->WindowName.Length != 0) + { + buf = DesktopPtrToUser(Wnd->WindowName.Buffer); + if (buf != NULL && + NT_SUCCESS(RtlUnicodeToMultiByteSize(&len, + buf, + Wnd->WindowName.Length))) + { + Result = (LRESULT)len; + } + } break; } case WM_GETTEXT: { - LPWSTR Buffer; - LPSTR AnsiBuffer = (LPSTR)lParam; - INT Length; - - Buffer = HeapAlloc(GetProcessHeap(), 0, wParam * sizeof(WCHAR)); - if (!Buffer) - { - Result = 0; - break; - } - Length = NtUserInternalGetWindowText(hWnd, Buffer, wParam); - if (Length > 0 && wParam > 0 && - !WideCharToMultiByte(CP_ACP, 0, Buffer, -1, - AnsiBuffer, wParam, NULL, NULL)) - { - AnsiBuffer[0] = '\0'; - } - - HeapFree(GetProcessHeap(), 0, Buffer); - - Result = (LRESULT)Length; + PWSTR buf = NULL; + PSTR outbuf = (PSTR)lParam; + UINT copy; + + Wnd = ValidateHwnd(hWnd); + if (Wnd != NULL && wParam != 0) + { + if (Wnd->WindowName.Buffer != NULL) + buf = DesktopPtrToUser(Wnd->WindowName.Buffer); + else + outbuf[0] = L'\0'; + + if (buf != NULL) + { + if (Wnd->WindowName.Length != 0) + { + copy = min(Wnd->WindowName.Length / sizeof(WCHAR), wParam - 1); + Result = WideCharToMultiByte(CP_ACP, + 0, + buf, + copy, + outbuf, + wParam, + NULL, + NULL); + outbuf[Result] = '\0'; + } + else + outbuf[0] = '\0'; + } + } break; } @@ -1711,6 +1736,7 @@ LPARAM lParam) { LRESULT Result = 0; + PWINDOW Wnd; SPY_EnterMessage(SPY_DEFWNDPROC, hWnd, Msg, wParam, lParam); switch (Msg) @@ -1732,13 +1758,51 @@ case WM_GETTEXTLENGTH: { - Result = (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); + PWSTR buf; + ULONG len; + + Wnd = ValidateHwnd(hWnd); + if (Wnd != NULL && Wnd->WindowName.Length != 0) + { + buf = DesktopPtrToUser(Wnd->WindowName.Buffer); + if (buf != NULL && + NT_SUCCESS(RtlUnicodeToMultiByteSize(&len, + buf, + Wnd->WindowName.Length))) + { + Result = (LRESULT)len; + } + } break; } case WM_GETTEXT: { - Result = (LRESULT)NtUserInternalGetWindowText(hWnd, (PWSTR)lParam, wParam); + PWSTR buf = NULL; + PWSTR outbuf = (PWSTR)lParam; + + Wnd = ValidateHwnd(hWnd); + if (Wnd != NULL && wParam != 0) + { + if (Wnd->WindowName.Buffer != NULL) + buf = DesktopPtrToUser(Wnd->WindowName.Buffer); + else + outbuf[0] = L'\0'; + + if (buf != NULL) + { + if (Wnd->WindowName.Length != 0) + { + Result = min(Wnd->WindowName.Length / sizeof(WCHAR), wParam - 1); + RtlCopyMemory(outbuf, + buf, + Result * sizeof(WCHAR)); + outbuf[Result] = L'\0'; + } + else + outbuf[0] = L'\0'; + } + } break; } 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 Fri Nov 16 05:37:14 2007 @@ -1035,31 +1035,50 @@ int STDCALL GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount) { - DWORD ProcessId; + PWINDOW Wnd; + PCWSTR Buffer; if (lpString == NULL) return 0; - if (!NtUserGetWindowThreadProcessId(hWnd, &ProcessId)) - return 0; - - if (ProcessId != GetCurrentProcessId()) + 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 */ - LPWSTR Buffer; - INT Length; - - Buffer = HeapAlloc(GetProcessHeap(), 0, nMaxCount * sizeof(WCHAR)); - if (!Buffer) - return FALSE; - Length = NtUserInternalGetWindowText(hWnd, Buffer, nMaxCount); - if (Length > 0 && nMaxCount > 0 && - !WideCharToMultiByte(CP_ACP, 0, Buffer, -1, - lpString, nMaxCount, NULL, NULL)) + Length = Wnd->WindowName.Length / sizeof(WCHAR); + if (Length != 0) { - lpString[0] = '\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'; + } } - HeapFree(GetProcessHeap(), 0, Buffer); + else + lpString[0] = '\0'; return (LRESULT)Length; } @@ -1074,19 +1093,7 @@ int STDCALL GetWindowTextLengthA(HWND hWnd) { - DWORD ProcessId; - if(!NtUserGetWindowThreadProcessId(hWnd, &ProcessId)) - { - return 0; - } - - if(ProcessId == GetCurrentProcessId()) - { return(SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0)); - } - - /* do not send WM_GETTEXT messages to other processes */ - return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); } @@ -1096,19 +1103,7 @@ int STDCALL GetWindowTextLengthW(HWND hWnd) { - DWORD ProcessId; - if(!NtUserGetWindowThreadProcessId(hWnd, &ProcessId)) - { - return 0; - } - - if(ProcessId == GetCurrentProcessId()) - { return(SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0)); - } - - /* do not send WM_GETTEXT messages to other processes */ - return (LRESULT)NtUserInternalGetWindowText(hWnd, NULL, 0); } @@ -1118,18 +1113,47 @@ int STDCALL GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount) { - DWORD ProcessId; + PWINDOW Wnd; + PCWSTR Buffer; if (lpString == NULL) return 0; - if (!NtUserGetWindowThreadProcessId(hWnd, &ProcessId)) - return 0; - - if (ProcessId == GetCurrentProcessId()) - return SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString); - - return NtUserInternalGetWindowText(hWnd, lpString, nMaxCount); + 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); } DWORD STDCALL @@ -1643,7 +1667,10 @@ STDCALL InternalGetWindowText(HWND hWnd, LPWSTR lpString, int nMaxCount) { - return NtUserInternalGetWindowText(hWnd, lpString, nMaxCount); + INT Ret = NtUserInternalGetWindowText(hWnd, lpString, nMaxCount); + if (Ret == 0) + *lpString = L'\0'; + 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 Fri Nov 16 05:37:14 2007 @@ -77,6 +77,10 @@ /* Window menu handle or window id */ UINT IDMenu; LONG UserData; + /* Pointer to the window class. */ + PWINDOWCLASS Class; + /* Window name. */ + UNICODE_STRING WindowName; } WINDOW, *PWINDOW; typedef struct _W32PROCESSINFO 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 Fri Nov 16 05:37:14 2007 @@ -45,10 +45,6 @@ }; /* Indicates whether the window is derived from a system class */ BOOL IsSystem; - /* Pointer to the window class. */ - PWINDOWCLASS Class; - /* Window name. */ - UNICODE_STRING WindowName; /* Context help id */ DWORD ContextHelpId; /* system menu handle. */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c Fri Nov 16 05:37:14 2007 @@ -1927,11 +1927,11 @@ Window = UserGetWindowObject(hWnd); if (Window != NULL) { - Ret = UserGetClassLongPtr(Window->Class, + Ret = UserGetClassLongPtr(Window->Wnd->Class, Offset, Ansi); - if (Ret != 0 && Offset == GCLP_MENUNAME && Window->Class->MenuNameIsString) + if (Ret != 0 && Offset == GCLP_MENUNAME && Window->Wnd->Class->MenuNameIsString) { Ret = (ULONG_PTR)UserHeapAddressToUser((PVOID)Ret); } @@ -2005,7 +2005,7 @@ dwNewLong = (ULONG_PTR)&Value; } - Ret = UserSetClassLongPtr(Window->Class, + Ret = UserSetClassLongPtr(Window->Wnd->Class, Offset, dwNewLong, Ansi); @@ -2218,7 +2218,7 @@ CapturedClassName = *ClassName; /* get the class name */ - Ret = UserGetClassName(Window->Class, + Ret = UserGetClassName(Window->Wnd->Class, &CapturedClassName, Ansi); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c Fri Nov 16 05:37:14 2007 @@ -1357,7 +1357,7 @@ RETURN(FALSE); } - DesktopBrush = (HBRUSH)UserGetClassLongPtr(WndDesktop->Class, GCL_HBRBACKGROUND, FALSE); + DesktopBrush = (HBRUSH)UserGetClassLongPtr(WndDesktop->Wnd->Class, GCL_HBRBACKGROUND, FALSE); /* Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c Fri Nov 16 05:37:14 2007 @@ -152,7 +152,6 @@ ASSERT_REFS_CO(Window); DPRINT("IntSetForegroundAndFocusWindow(%x, %x, %s)\n", hWnd, hWndFocus, MouseActivate ? "TRUE" : "FALSE"); - DPRINT("(%wZ)\n", &Window->WindowName); Wnd = Window->Wnd; @@ -426,8 +425,6 @@ RETURN( 0); } - DPRINT("(%wZ)\n", &Window->WindowName); - ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue; if (Window->MessageQueue != ThreadQueue) 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 Fri Nov 16 05:37:14 2007 @@ -603,7 +603,7 @@ { /* generate double click messages, if necessary */ if ((((*HitTest) != HTCLIENT) || - (Window->Class->Style & CS_DBLCLKS)) && + (Window->Wnd->Class->Style & CS_DBLCLKS)) && MsqIsDblClk(Msg, Remove)) { Msg->message += WM_LBUTTONDBLCLK - WM_LBUTTONDOWN; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Fri Nov 16 05:37:14 2007 @@ -1528,12 +1528,12 @@ /* Get the icon to draw. We don't care about WM_GETICON here. */ - hIcon = pWnd->Class->hIconSm; + hIcon = pWnd->Wnd->Class->hIconSm; if(!hIcon) { DPRINT("Wnd class has no small icon.\n"); - hIcon = pWnd->Class->hIcon; + hIcon = pWnd->Wnd->Class->hIcon; } if(!hIcon) @@ -1864,7 +1864,7 @@ if (str) UserDrawCaptionText(hMemDc, str, &r, uFlags); else if (pWnd != NULL) - UserDrawCaptionText(hMemDc, &pWnd->WindowName, &r, uFlags); + UserDrawCaptionText(hMemDc, &pWnd->Wnd->WindowName, &r, uFlags); } if(!NtGdiBitBlt(hDc, lpRc->left, lpRc->top, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Fri Nov 16 05:37:14 2007 @@ -401,7 +401,7 @@ if (!(Flags & DCX_WINDOW)) { - if (Window->Class->Style & CS_PARENTDC) + if (Wnd->Class->Style & CS_PARENTDC) { Flags |= DCX_PARENTCLIP; } @@ -739,7 +739,7 @@ { if (pDCE == Window->Dce) /* owned or Class DCE*/ { - if (Window->Class->Style & CS_OWNDC) /* owned DCE*/ + if (Window->Wnd->Class->Style & CS_OWNDC) /* owned DCE*/ { pDCE = DceFreeDCE(pDCE, FALSE); Window->Dce = NULL; 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 Fri Nov 16 05:37:14 2007 @@ -296,6 +296,7 @@ UserFreeWindowInfo(PW32THREADINFO ti, PWINDOW_OBJECT WindowObject) { PW32CLIENTINFO ClientInfo = GetWin32ClientInfo(); + PWINDOW Wnd = WindowObject->Wnd; if (ClientInfo->pvWND == DesktopHeapAddressToUser(WindowObject->Wnd)) { @@ -303,7 +304,16 @@ ClientInfo->pvWND = NULL; } - DesktopHeapFree(ti->Desktop, WindowObject->Wnd); + if (Wnd->WindowName.Buffer != NULL) + { + Wnd->WindowName.Length = 0; + Wnd->WindowName.MaximumLength = 0; + DesktopHeapFree(Wnd->ti->Desktop, + Wnd->WindowName.Buffer); + Wnd->WindowName.Buffer = NULL; + } + + DesktopHeapFree(ti->Desktop, Wnd); WindowObject->Wnd = NULL; } @@ -453,17 +463,15 @@ IntDestroyScrollBars(Window); /* dereference the class */ - IntDereferenceClass(Window->Class, + IntDereferenceClass(Wnd->Class, Window->ti->Desktop, Window->ti->kpi); - Window->Class = NULL; + Wnd->Class = NULL; if(Window->WindowRegion) { NtGdiDeleteObject(Window->WindowRegion); } - - RtlFreeUnicodeString(&Window->WindowName); ASSERT(Window->Wnd != NULL); UserFreeWindowInfo(Window->ti, Window); @@ -507,6 +515,8 @@ IntGetWindowProc(IN PWINDOW_OBJECT Window, IN BOOL Ansi) { + PWINDOW Wnd = Window->Wnd; + ASSERT(UserIsEnteredExclusive() == TRUE); if (Window->IsSystem) @@ -529,22 +539,22 @@ { PCALLPROC NewCallProc, CallProc; - NewCallProc = UserFindCallProc(Window->Class, + NewCallProc = UserFindCallProc(Wnd->Class, Window->WndProc, Window->Unicode); if (NewCallProc == NULL) { - NewCallProc = CreateCallProc(Window->ti->Desktop, + NewCallProc = CreateCallProc(Wnd->ti->Desktop, Window->WndProc, Window->Unicode, - Window->ti->kpi); + Wnd->ti->kpi); if (NewCallProc == NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return NULL; } - UserAddCallProcToClass(Window->Class, + UserAddCallProcToClass(Wnd->Class, NewCallProc); } @@ -569,7 +579,7 @@ pwi->dwExStyle = Wnd->ExStyle; pwi->dwWindowStatus = (UserGetForegroundWindow() == Window->hSelf); /* WS_ACTIVECAPTION */ IntGetWindowBorderMeasures(Window, &pwi->cxWindowBorders, &pwi->cyWindowBorders); - pwi->atomWindowType = (Window->Class ? Window->Class->Atom : 0); + pwi->atomWindowType = (Wnd->Class ? Wnd->Class->Atom : 0); pwi->wCreatorVersion = 0x400; /* FIXME - return a real version number */ return TRUE; } @@ -1596,7 +1606,7 @@ * Fill out the structure describing it. */ Window->ti = ti; - Window->Class = Class; + Wnd->Class = Class; Class = NULL; Window->SystemMenu = (HMENU)0; @@ -1606,7 +1616,7 @@ Window->hSelf = hWnd; if (!hMenu) - hMenu = Window->Class->hMenu; + hMenu = Wnd->Class->hMenu; if (0 != (dwStyle & WS_CHILD)) { @@ -1634,18 +1644,18 @@ Wnd->UserData = 0; - Window->IsSystem = Window->Class->System; - if (Window->Class->System) + Window->IsSystem = Wnd->Class->System; + if (Wnd->Class->System) { /* NOTE: Always create a unicode window for system classes! */ Window->Unicode = TRUE; - Window->WndProc = Window->Class->WndProc; - Window->WndProcExtra = Window->Class->WndProcExtra; + Window->WndProc = Wnd->Class->WndProc; + Window->WndProcExtra = Wnd->Class->WndProcExtra; } else { - Window->Unicode = Window->Class->Unicode; - Window->WndProc = Window->Class->WndProc; + Window->Unicode = Wnd->Class->Unicode; + Window->WndProc = Wnd->Class->WndProc; Window->CallProc = NULL; } @@ -1654,28 +1664,35 @@ Window->LastChild = NULL; Window->PrevSibling = NULL; Window->NextSibling = NULL; - Wnd->ExtraDataSize = Window->Class->WndExtra; + Wnd->ExtraDataSize = Wnd->Class->WndExtra; InitializeListHead(&Window->PropListHead); InitializeListHead(&Window->WndObjListHead); - if (NULL != WindowName->Buffer) - { - Window->WindowName.MaximumLength = WindowName->MaximumLength; - Window->WindowName.Length = WindowName->Length; - Window->WindowName.Buffer = ExAllocatePoolWithTag(PagedPool, WindowName->MaximumLength, - TAG_STRING); - if (NULL == Window->WindowName.Buffer) - { - DPRINT1("Failed to allocate mem for window name\n"); - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - RETURN( NULL); - } - RtlCopyMemory(Window->WindowName.Buffer, WindowName->Buffer, WindowName->MaximumLength); - } - else - { - RtlInitUnicodeString(&Window->WindowName, NULL); + if (NULL != WindowName->Buffer && WindowName->Length > 0) + { + Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->ti->Desktop, + WindowName->Length + sizeof(UNICODE_NULL)); + if (Wnd->WindowName.Buffer == NULL) + { + SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); + RETURN( (HWND)0); + } + + Wnd->WindowName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0'; + _SEH_TRY + { + RtlCopyMemory(Wnd->WindowName.Buffer, + WindowName->Buffer, + WindowName->Length); + Wnd->WindowName.Length = WindowName->Length; + } + _SEH_HANDLE + { + WindowName->Length = 0; + Wnd->WindowName.Buffer[0] = L'\0'; + } + _SEH_END; } /* @@ -2459,8 +2476,8 @@ /* Do not send WM_GETTEXT messages in the kernel mode version! The user mode version however calls GetWindowText() which will send WM_GETTEXT messages to windows belonging to its processes */ - if((!CheckWindowName || !RtlCompareUnicodeString(WindowName, &(Child->WindowName), TRUE)) && - (!ClassAtom || Child->Class->Atom == ClassAtom)) + if((!CheckWindowName || !RtlCompareUnicodeString(WindowName, &(Child->Wnd->WindowName), TRUE)) && + (!ClassAtom || Child->Wnd->Class->Atom == ClassAtom)) { Ret = Child->hSelf; break; @@ -2633,9 +2650,9 @@ The user mode version however calls GetWindowText() which will send WM_GETTEXT messages to windows belonging to its processes */ WindowMatches = !CheckWindowName || !RtlCompareUnicodeString( - &WindowName, &TopLevelWindow->WindowName, TRUE); + &WindowName, &TopLevelWindow->Wnd->WindowName, TRUE); ClassMatches = (ClassAtom == (RTL_ATOM)0) || - ClassAtom == TopLevelWindow->Class->Atom; + ClassAtom == TopLevelWindow->Wnd->Class->Atom; if (WindowMatches && ClassMatches) { @@ -3574,6 +3591,7 @@ { WNDPROC Ret; PCALLPROC CallProc; + PWINDOW Wnd = Window->Wnd; /* resolve any callproc handle if possible */ if (IsCallProcHandle(NewWndProc)) @@ -3601,7 +3619,7 @@ } else { - CallProc = UserFindCallProc(Window->Class, + CallProc = UserFindCallProc(Wnd->Class, Window->WndProc, Window->Unicode); if (CallProc == NULL) @@ -3609,14 +3627,14 @@ CallProc = CreateCallProc(NULL, Window->WndProc, Window->Unicode, - Window->ti->kpi); + Wnd->ti->kpi); if (CallProc == NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return NULL; } - UserAddCallProcToClass(Window->Class, + UserAddCallProcToClass(Wnd->Class, CallProc); } @@ -3626,17 +3644,17 @@ } } - if (Window->Class->System) + if (Wnd->Class->System) { /* check if the new procedure matches with the one in the window class. If so, we need to restore both procedures! */ - Window->IsSystem = (NewWndProc == Window->Class->WndProc || - NewWndProc == Window->Class->WndProcExtra); + Window->IsSystem = (NewWndProc == Wnd->Class->WndProc || + NewWndProc == Wnd->Class->WndProcExtra); if (Window->IsSystem) { - Window->WndProc = Window->Class->WndProc; - Window->WndProcExtra = Window->Class->WndProcExtra; + Window->WndProc = Wnd->Class->WndProc; + Window->WndProcExtra = Wnd->Class->WndProcExtra; Window->Unicode = !Ansi; return Ret; } @@ -4622,36 +4640,97 @@ NtUserDefSetText(HWND hWnd, PUNICODE_STRING WindowText) { PWINDOW_OBJECT Window; + PWINDOW Wnd; UNICODE_STRING SafeText; - NTSTATUS Status; - DECLARE_RETURN(INT); + BOOL Ret = TRUE; DPRINT("Enter NtUserDefSetText\n"); + + RtlInitUnicodeString(&SafeText, NULL); + if (WindowText != NULL) + { + _SEH_TRY + { + SafeText = ProbeForReadUnicodeString(WindowText); + } + _SEH_HANDLE + { + Ret = FALSE; + SetLastNtError(_SEH_GetExceptionCode()); + } + _SEH_END; + + if (!Ret) + return FALSE; + } + UserEnterExclusive(); if(!(Window = UserGetWindowObject(hWnd))) { - RETURN( FALSE); - } - - if(WindowText) - { - Status = IntSafeCopyUnicodeString(&SafeText, WindowText); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( FALSE); - } + UserLeave(); + return FALSE; + } + Wnd = Window->Wnd; + + if(SafeText.Length != 0) + { + _SEH_TRY + { + if (Wnd->WindowName.MaximumLength > 0 && + SafeText.Length <= Wnd->WindowName.MaximumLength - sizeof(UNICODE_NULL)) + { + ASSERT(Wnd->WindowName.Buffer != NULL); + + Wnd->WindowName.Length = SafeText.Length; + Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0'; + RtlCopyMemory(Wnd->WindowName.Buffer, + SafeText.Buffer, + SafeText.Length); + } + else + { + PWCHAR buf; + Wnd->WindowName.MaximumLength = Wnd->WindowName.Length = 0; + buf = Wnd->WindowName.Buffer; + Wnd->WindowName.Buffer = NULL; + if (buf != NULL) + { + DesktopHeapFree(Wnd->ti->Desktop, + buf); + } + + Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->ti->Desktop, + SafeText.Length + sizeof(UNICODE_NULL)); + if (Wnd->WindowName.Buffer != NULL) + { + Wnd->WindowName.Buffer[SafeText.Length / sizeof(WCHAR)] = L'\0'; + RtlCopyMemory(Wnd->WindowName.Buffer, + SafeText.Buffer, + SafeText.Length); + Wnd->WindowName.MaximumLength = SafeText.Length + sizeof(UNICODE_NULL); + Wnd->WindowName.Length = SafeText.Length; + } + else + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + Ret = FALSE; + } + } + } + _SEH_HANDLE + { + SetLastNtError(_SEH_GetExceptionCode()); + Ret = FALSE; + } + _SEH_END; } else { - RtlInitUnicodeString(&SafeText, NULL); - } - - /* FIXME - do this thread-safe! otherwise one could crash here! */ - RtlFreeUnicodeString(&Window->WindowName); - - Window->WindowName = SafeText; + Wnd->WindowName.Length = 0; + if (Wnd->WindowName.Buffer != NULL) + Wnd->WindowName.Buffer[0] = L'\0'; + } /* Send shell notifications */ if (!IntGetOwner(Window) && !IntGetParent(Window)) @@ -4659,12 +4738,11 @@ co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); } - RETURN( TRUE); - -CLEANUP: - DPRINT("Leave NtUserDefSetText, ret=%i\n",_ret_); + Ret = TRUE; + + DPRINT("Leave NtUserDefSetText, ret=%i\n", Ret); UserLeave(); - END_CLEANUP; + return Ret; } /* @@ -4678,6 +4756,7 @@ NtUserInternalGetWindowText(HWND hWnd, LPWSTR lpString, INT nMaxCount) { PWINDOW_OBJECT Window; + PWINDOW Wnd; NTSTATUS Status; INT Result; DECLARE_RETURN(INT); @@ -4695,9 +4774,9 @@ { RETURN( 0); } - - /* FIXME - do this thread-safe! otherwise one could crash here! */ - Result = Window->WindowName.Length / sizeof(WCHAR); + Wnd = Window->Wnd; + + Result = Wnd->WindowName.Length / sizeof(WCHAR); if(lpString) { const WCHAR Terminator = L'\0'; @@ -4707,7 +4786,7 @@ Copy = min(nMaxCount - 1, Result); if(Copy > 0) { - Status = MmCopyToCaller(Buffer, Window->WindowName.Buffer, Copy * sizeof(WCHAR)); + Status = MmCopyToCaller(Buffer, Wnd->WindowName.Buffer, Copy * sizeof(WCHAR)); if(!NT_SUCCESS(Status)) { SetLastNtError(Status);
17 years, 1 month
1
0
0
0
← Newer
1
...
40
41
42
43
44
45
46
...
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