ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2005
----- 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
22 participants
582 discussions
Start a n
N
ew thread
[gdalsnes] 17711: prop: simplify refcounting, naming changes
by gdalsnes@svn.reactos.com
prop: simplify refcounting, naming changes Modified: trunk/reactos/subsys/win32k/include/prop.h Modified: trunk/reactos/subsys/win32k/ntuser/prop.c _____ Modified: trunk/reactos/subsys/win32k/include/prop.h --- trunk/reactos/subsys/win32k/include/prop.h 2005-09-06 23:21:40 UTC (rev 17710) +++ trunk/reactos/subsys/win32k/include/prop.h 2005-09-06 23:29:54 UTC (rev 17711) @@ -8,11 +8,5 @@ ATOM Atom; } PROPERTY, *PPROPERTY; -BOOL FASTCALL -IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data); - -PPROPERTY FASTCALL -IntGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom); - #endif /* _WIN32K_PROP_H */ _____ Modified: trunk/reactos/subsys/win32k/ntuser/prop.c --- trunk/reactos/subsys/win32k/ntuser/prop.c 2005-09-06 23:21:40 UTC (rev 17710) +++ trunk/reactos/subsys/win32k/ntuser/prop.c 2005-09-06 23:29:54 UTC (rev 17711) @@ -39,16 +39,20 @@ HANDLE Data; } PROPLISTITEM, *PPROPLISTITEM; + +/* STATIC FUNCTIONS **********************************************************/ + /* FUNCTIONS *****************************************************************/ +static PPROPERTY FASTCALL -IntGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom) +IntGetProp(PWINDOW_OBJECT Window, ATOM Atom) { PLIST_ENTRY ListEntry; PPROPERTY Property; - ListEntry = WindowObject->PropListHead.Flink; - while (ListEntry != &WindowObject->PropListHead) + ListEntry = Window->PropListHead.Flink; + while (ListEntry != &Window->PropListHead) { Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry); if (Property->Atom == Atom) @@ -66,7 +70,7 @@ DWORD BufferSize, DWORD *Count) { - PWINDOW_OBJECT WindowObject; + PWINDOW_OBJECT Window; PPROPERTY Property; PLIST_ENTRY ListEntry; PROPLISTITEM listitem, *li; @@ -77,7 +81,7 @@ DPRINT("Enter NtUserBuildPropList\n"); UserEnterShared(); - if (!(WindowObject = IntGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd))) { RETURN( STATUS_INVALID_HANDLE); } @@ -86,14 +90,13 @@ { if(!BufferSize || (BufferSize % sizeof(PROPLISTITEM) != 0)) { - IntReleaseWindowObject(WindowObject); RETURN( STATUS_INVALID_PARAMETER); } /* copy list */ li = (PROPLISTITEM *)Buffer; - ListEntry = WindowObject->PropListHead.Flink; - while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &WindowObject->PropListHead)) + ListEntry = Window->PropListHead.Flink; + while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &Window->PropListHead)) { Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry); listitem.Atom = Property->Atom; @@ -102,7 +105,6 @@ Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM)); if(!NT_SUCCESS(Status)) { - IntReleaseWindowObject(WindowObject); RETURN( Status); } @@ -115,11 +117,9 @@ } else { - Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM); + Cnt = Window->PropListItems * sizeof(PROPLISTITEM); } - IntReleaseWindowObject(WindowObject); - if(Count) { Status = MmCopyToCaller(Count, &Cnt, sizeof(DWORD)); @@ -140,7 +140,7 @@ HANDLE STDCALL NtUserRemoveProp(HWND hWnd, ATOM Atom) { - PWINDOW_OBJECT WindowObject; + PWINDOW_OBJECT Window; PPROPERTY Prop; HANDLE Data; DECLARE_RETURN(HANDLE); @@ -148,24 +148,22 @@ DPRINT("Enter NtUserRemoveProp\n"); UserEnterExclusive(); - if (!(WindowObject = IntGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd))) { - SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); RETURN( NULL); } - Prop = IntGetProp(WindowObject, Atom); + Prop = IntGetProp(Window, Atom); if (Prop == NULL) { - IntReleaseWindowObject(WindowObject); RETURN(NULL); } Data = Prop->Data; RemoveEntryList(&Prop->PropListEntry); ExFreePool(Prop); - WindowObject->PropListItems--; - IntReleaseWindowObject(WindowObject); + Window->PropListItems--; + RETURN(Data); CLEANUP: @@ -177,7 +175,7 @@ HANDLE STDCALL NtUserGetProp(HWND hWnd, ATOM Atom) { - PWINDOW_OBJECT WindowObject; + PWINDOW_OBJECT Window; PPROPERTY Prop; HANDLE Data = NULL; DECLARE_RETURN(HANDLE); @@ -185,18 +183,17 @@ DPRINT("Enter NtUserGetProp\n"); UserEnterShared(); - if (!(WindowObject = IntGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd))) { - SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); RETURN( FALSE); } - Prop = IntGetProp(WindowObject, Atom); + Prop = IntGetProp(Window, Atom); if (Prop != NULL) { Data = Prop->Data; } - IntReleaseWindowObject(WindowObject); + RETURN(Data); CLEANUP: @@ -205,6 +202,7 @@ END_CLEANUP; } +static BOOL FASTCALL IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data) { @@ -232,23 +230,18 @@ BOOL STDCALL NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data) { - PWINDOW_OBJECT WindowObject; - BOOL ret; + PWINDOW_OBJECT Window; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserSetProp\n"); UserEnterExclusive(); - if (!(WindowObject = IntGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd))) { - SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); RETURN( FALSE); } - ret = IntSetProp(WindowObject, Atom, Data); - - IntReleaseWindowObject(WindowObject); - RETURN( ret); + RETURN( IntSetProp(Window, Atom, Data)); CLEANUP: DPRINT("Leave NtUserSetProp, ret=%i\n",_ret_);
19 years, 3 months
1
0
0
0
[gdalsnes] 17710: menu: code cleanup, naming changes, simplify refcounting, make internal func take objects and not handles
by gdalsnes@svn.reactos.com
menu: code cleanup, naming changes, simplify refcounting, make internal func take objects and not handles Modified: trunk/reactos/subsys/win32k/include/menu.h Modified: trunk/reactos/subsys/win32k/include/userfuncs.h Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c Modified: trunk/reactos/subsys/win32k/ntuser/menu.c Modified: trunk/reactos/subsys/win32k/ntuser/window.c _____ Modified: trunk/reactos/subsys/win32k/include/menu.h --- trunk/reactos/subsys/win32k/include/menu.h 2005-09-06 23:16:18 UTC (rev 17709) +++ trunk/reactos/subsys/win32k/include/menu.h 2005-09-06 23:21:40 UTC (rev 17710) @@ -90,9 +90,6 @@ IntCheckMenuItem(PMENU_OBJECT MenuObject, UINT uIDCheckItem, UINT uCheck); BOOL FASTCALL -IntSetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT uItem, UINT fByPos); - -BOOL FASTCALL IntSetMenuItemRect(PMENU_OBJECT MenuObject, UINT Item, BOOL fByPos, RECT *rcRect); BOOL FASTCALL _____ Modified: trunk/reactos/subsys/win32k/include/userfuncs.h --- trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-06 23:16:18 UTC (rev 17709) +++ trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-06 23:21:40 UTC (rev 17710) @@ -86,7 +86,7 @@ /*************** WINDOW.C ***************/ -PWINDOW_OBJECT FASTCALL UserGetWindowObjectNoRef(HWND hWnd); +PWINDOW_OBJECT FASTCALL UserGetWindowObject(HWND hWnd); VOID FASTCALL co_DestroyThreadWindows(struct _ETHREAD *Thread); @@ -112,25 +112,14 @@ BOOL FASTCALL UserSetMenuDefaultItem( - HMENU hMenu, + PMENU_OBJECT Menu, UINT uItem, UINT fByPos); BOOL FASTCALL UserDestroyMenu(HMENU hMenu); -BOOL FASTCALL -UserMenuItemInfo( - HMENU Menu, - UINT Item, - BOOL ByPosition, - PROSMENUITEMINFO UnsafeItemInfo, - BOOL SetOrGet); -BOOL FASTCALL -UserMenuInfo( - HMENU Menu, - PROSMENUINFO UnsafeMenuInfo, - BOOL SetOrGet); + /*************** SCROLLBAR.C ***************/ _____ Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c --- trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-06 23:16:18 UTC (rev 17709) +++ trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-06 23:21:40 UTC (rev 17710) @@ -516,7 +516,7 @@ UserReferenceAccelObjectCo(Accel); - if (!(Window = UserGetWindowObjectNoRef(hWnd))) + if (!(Window = UserGetWindowObject(hWnd))) { RETURN( 0); } _____ Modified: trunk/reactos/subsys/win32k/ntuser/menu.c --- trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-06 23:16:18 UTC (rev 17709) +++ trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-06 23:21:40 UTC (rev 17710) @@ -33,6 +33,25 @@ #define NDEBUG #include <debug.h> + +/* STATIC FUNCTION ***********************************************************/ + +static +BOOL FASTCALL +UserMenuItemInfo( + PMENU_OBJECT Menu, + UINT Item, + BOOL ByPosition, + PROSMENUITEMINFO UnsafeItemInfo, + BOOL SetOrGet); + +static +BOOL FASTCALL +UserMenuInfo( + PMENU_OBJECT Menu, + PROSMENUINFO UnsafeMenuInfo, + BOOL SetOrGet); + /* INTERNAL ******************************************************************/ /* maximum number of menu items a menu can contain */ @@ -94,6 +113,23 @@ return(STATUS_SUCCESS); } +PMENU_OBJECT FASTCALL UserGetMenuObject(HMENU hMenu) +{ + PMENU_OBJECT Menu; + NTSTATUS Status; + + Status = ObmReferenceObjectByHandle(gHandleTable, + hMenu, otMenu, (PVOID*)&Menu); + if (!NT_SUCCESS(Status)) + { + SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); + return NULL; + } + ObmDereferenceObject(Menu); + return Menu; +} + + #if 0 void FASTCALL DumpMenuItemList(PMENU_ITEM MenuItem) @@ -152,23 +188,23 @@ } BOOL FASTCALL -IntFreeMenuItem(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, +IntFreeMenuItem(PMENU_OBJECT Menu, PMENU_ITEM MenuItem, BOOL RemoveFromList, BOOL bRecurse) { FreeMenuText(MenuItem); if(RemoveFromList) { /* FIXME - Remove from List */ - MenuObject->MenuInfo.MenuItemCount--; + Menu->MenuInfo.MenuItemCount--; } if(bRecurse && MenuItem->hSubMenu) { - PMENU_OBJECT SubMenuObject; - SubMenuObject = IntGetMenuObject(MenuItem->hSubMenu ); - if(SubMenuObject) + PMENU_OBJECT SubMenu; + SubMenu = IntGetMenuObject(MenuItem->hSubMenu ); + if(SubMenu) { - IntDestroyMenuObject(SubMenuObject, bRecurse, TRUE); - IntReleaseMenuObject(SubMenuObject); + IntDestroyMenuObject(SubMenu, bRecurse, TRUE); + IntReleaseMenuObject(SubMenu); } } @@ -179,11 +215,11 @@ } BOOL FASTCALL -IntRemoveMenuItem(PMENU_OBJECT MenuObject, UINT uPosition, UINT uFlags, +IntRemoveMenuItem(PMENU_OBJECT Menu, UINT uPosition, UINT uFlags, BOOL bRecurse) { PMENU_ITEM PrevMenuItem, MenuItem; - if(IntGetMenuItemByFlag(MenuObject, uPosition, uFlags, &MenuItem, + if(IntGetMenuItemByFlag(Menu, uPosition, uFlags, &MenuItem, &PrevMenuItem) > -1) { if(MenuItem) @@ -192,50 +228,50 @@ PrevMenuItem->Next = MenuItem->Next; else { - MenuObject->MenuItemList = MenuItem->Next; + Menu->MenuItemList = MenuItem->Next; } - return IntFreeMenuItem(MenuObject, MenuItem, TRUE, bRecurse); + return IntFreeMenuItem(Menu, MenuItem, TRUE, bRecurse); } } return FALSE; } UINT FASTCALL -IntDeleteMenuItems(PMENU_OBJECT MenuObject, BOOL bRecurse) +IntDeleteMenuItems(PMENU_OBJECT Menu, BOOL bRecurse) { UINT res = 0; PMENU_ITEM NextItem; - PMENU_ITEM CurItem = MenuObject->MenuItemList; + PMENU_ITEM CurItem = Menu->MenuItemList; while(CurItem) { NextItem = CurItem->Next; - IntFreeMenuItem(MenuObject, CurItem, FALSE, bRecurse); + IntFreeMenuItem(Menu, CurItem, FALSE, bRecurse); CurItem = NextItem; res++; } - MenuObject->MenuInfo.MenuItemCount = 0; - MenuObject->MenuItemList = NULL; + Menu->MenuInfo.MenuItemCount = 0; + Menu->MenuItemList = NULL; return res; } BOOL FASTCALL -IntDestroyMenuObject(PMENU_OBJECT MenuObject, +IntDestroyMenuObject(PMENU_OBJECT Menu, BOOL bRecurse, BOOL RemoveFromProcess) { - if(MenuObject) + if(Menu) { PWINSTATION_OBJECT WindowStation; NTSTATUS Status; /* remove all menu items */ - IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */ + IntDeleteMenuItems(Menu, bRecurse); /* do not destroy submenus */ if(RemoveFromProcess) { - RemoveEntryList(&MenuObject->ListEntry); + RemoveEntryList(&Menu->ListEntry); } - Status = ObReferenceObjectByHandle(MenuObject->Process->Win32WindowStation, + Status = ObReferenceObjectByHandle(Menu->Process->Win32WindowStation, 0, ExWindowStationObjectType, KernelMode, @@ -243,7 +279,7 @@ NULL); if(NT_SUCCESS(Status)) { - ObmCloseHandle(gHandleTable, MenuObject->MenuInfo.Self); + ObmCloseHandle(gHandleTable, Menu->MenuInfo.Self); ObDereferenceObject(WindowStation); return TRUE; } @@ -254,44 +290,44 @@ PMENU_OBJECT FASTCALL IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar) { - PMENU_OBJECT MenuObject; + PMENU_OBJECT Menu; - MenuObject = (PMENU_OBJECT)ObmCreateObject( + Menu = (PMENU_OBJECT)ObmCreateObject( gHandleTable, Handle, otMenu, sizeof(MENU_OBJECT)); - if(!MenuObject) + if(!Menu) { *Handle = 0; return NULL; } - MenuObject->Process = PsGetCurrentProcess(); - MenuObject->RtoL = FALSE; /* default */ - MenuObject->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */ - MenuObject->MenuInfo.fMask = 0; /* not used */ - MenuObject->MenuInfo.dwStyle = 0; /* FIXME */ - MenuObject->MenuInfo.cyMax = 0; /* default */ - MenuObject->MenuInfo.hbrBack = + Menu->Process = PsGetCurrentProcess(); + Menu->RtoL = FALSE; /* default */ + Menu->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */ + Menu->MenuInfo.fMask = 0; /* not used */ + Menu->MenuInfo.dwStyle = 0; /* FIXME */ + Menu->MenuInfo.cyMax = 0; /* default */ + Menu->MenuInfo.hbrBack = NtGdiCreateSolidBrush(RGB(192, 192, 192)); /* FIXME: default background color */ - MenuObject->MenuInfo.dwContextHelpID = 0; /* default */ - MenuObject->MenuInfo.dwMenuData = 0; /* default */ - MenuObject->MenuInfo.Self = *Handle; - MenuObject->MenuInfo.FocusedItem = NO_SELECTED_ITEM; - MenuObject->MenuInfo.Flags = (IsMenuBar ? 0 : MF_POPUP); - MenuObject->MenuInfo.Wnd = NULL; - MenuObject->MenuInfo.WndOwner = NULL; - MenuObject->MenuInfo.Height = 0; - MenuObject->MenuInfo.Width = 0; - MenuObject->MenuInfo.TimeToHide = FALSE; + Menu->MenuInfo.dwContextHelpID = 0; /* default */ + Menu->MenuInfo.dwMenuData = 0; /* default */ + Menu->MenuInfo.Self = *Handle; + Menu->MenuInfo.FocusedItem = NO_SELECTED_ITEM; + Menu->MenuInfo.Flags = (IsMenuBar ? 0 : MF_POPUP); + Menu->MenuInfo.Wnd = NULL; + Menu->MenuInfo.WndOwner = NULL; + Menu->MenuInfo.Height = 0; + Menu->MenuInfo.Width = 0; + Menu->MenuInfo.TimeToHide = FALSE; - MenuObject->MenuInfo.MenuItemCount = 0; - MenuObject->MenuItemList = NULL; + Menu->MenuInfo.MenuItemCount = 0; + Menu->MenuItemList = NULL; /* Insert menu item into process menu handle list */ - InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry); + InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry); - return MenuObject; + return Menu; } BOOL FASTCALL @@ -359,77 +395,78 @@ PMENU_OBJECT FASTCALL IntCloneMenu(PMENU_OBJECT Source) { - HANDLE Handle; - PMENU_OBJECT MenuObject; + HANDLE hMenu; + PMENU_OBJECT Menu; if(!Source) return NULL; - MenuObject = (PMENU_OBJECT)ObmCreateObject( - gHandleTable, &Handle, + Menu = (PMENU_OBJECT)ObmCreateObject( + gHandleTable, &hMenu, otMenu, sizeof(MENU_OBJECT)); - if(!MenuObject) + + if(!Menu) return NULL; - MenuObject->Process = PsGetCurrentProcess(); - MenuObject->RtoL = Source->RtoL; - MenuObject->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */ - MenuObject->MenuInfo.fMask = Source->MenuInfo.fMask; - MenuObject->MenuInfo.dwStyle = Source->MenuInfo.dwStyle; - MenuObject->MenuInfo.cyMax = Source->MenuInfo.cyMax; - MenuObject->MenuInfo.hbrBack = Source->MenuInfo.hbrBack; - MenuObject->MenuInfo.dwContextHelpID = Source->MenuInfo.dwContextHelpID; - MenuObject->MenuInfo.dwMenuData = Source->MenuInfo.dwMenuData; - MenuObject->MenuInfo.Self = Handle; - MenuObject->MenuInfo.FocusedItem = NO_SELECTED_ITEM; - MenuObject->MenuInfo.Wnd = NULL; - MenuObject->MenuInfo.WndOwner = NULL; - MenuObject->MenuInfo.Height = 0; - MenuObject->MenuInfo.Width = 0; - MenuObject->MenuInfo.TimeToHide = FALSE; + Menu->Process = PsGetCurrentProcess(); + Menu->RtoL = Source->RtoL; + Menu->MenuInfo.cbSize = sizeof(MENUINFO); /* not used */ + Menu->MenuInfo.fMask = Source->MenuInfo.fMask; + Menu->MenuInfo.dwStyle = Source->MenuInfo.dwStyle; + Menu->MenuInfo.cyMax = Source->MenuInfo.cyMax; + Menu->MenuInfo.hbrBack = Source->MenuInfo.hbrBack; + Menu->MenuInfo.dwContextHelpID = Source->MenuInfo.dwContextHelpID; + Menu->MenuInfo.dwMenuData = Source->MenuInfo.dwMenuData; + Menu->MenuInfo.Self = hMenu; + Menu->MenuInfo.FocusedItem = NO_SELECTED_ITEM; + Menu->MenuInfo.Wnd = NULL; + Menu->MenuInfo.WndOwner = NULL; + Menu->MenuInfo.Height = 0; + Menu->MenuInfo.Width = 0; + Menu->MenuInfo.TimeToHide = FALSE; - MenuObject->MenuInfo.MenuItemCount = 0; - MenuObject->MenuItemList = NULL; + Menu->MenuInfo.MenuItemCount = 0; + Menu->MenuItemList = NULL; /* Insert menu item into process menu handle list */ - InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry); + InsertTailList(&PsGetWin32Process()->MenuListHead, &Menu->ListEntry); - IntCloneMenuItems(MenuObject, Source); + IntCloneMenuItems(Menu, Source); - return MenuObject; + return Menu; } BOOL FASTCALL -IntSetMenuFlagRtoL(PMENU_OBJECT MenuObject) +IntSetMenuFlagRtoL(PMENU_OBJECT Menu) { - MenuObject->RtoL = TRUE; + Menu->RtoL = TRUE; return TRUE; } BOOL FASTCALL -IntSetMenuContextHelpId(PMENU_OBJECT MenuObject, DWORD dwContextHelpId) +IntSetMenuContextHelpId(PMENU_OBJECT Menu, DWORD dwContextHelpId) { - MenuObject->MenuInfo.dwContextHelpID = dwContextHelpId; + Menu->MenuInfo.dwContextHelpID = dwContextHelpId; return TRUE; } BOOL FASTCALL -IntGetMenuInfo(PMENU_OBJECT MenuObject, PROSMENUINFO lpmi) +IntGetMenuInfo(PMENU_OBJECT Menu, PROSMENUINFO lpmi) { if(lpmi->fMask & MIM_BACKGROUND) - lpmi->hbrBack = MenuObject->MenuInfo.hbrBack; + lpmi->hbrBack = Menu->MenuInfo.hbrBack; if(lpmi->fMask & MIM_HELPID) - lpmi->dwContextHelpID = MenuObject->MenuInfo.dwContextHelpID; + lpmi->dwContextHelpID = Menu->MenuInfo.dwContextHelpID; if(lpmi->fMask & MIM_MAXHEIGHT) - lpmi->cyMax = MenuObject->MenuInfo.cyMax; + lpmi->cyMax = Menu->MenuInfo.cyMax; if(lpmi->fMask & MIM_MENUDATA) - lpmi->dwMenuData = MenuObject->MenuInfo.dwMenuData; + lpmi->dwMenuData = Menu->MenuInfo.dwMenuData; if(lpmi->fMask & MIM_STYLE) - lpmi->dwStyle = MenuObject->MenuInfo.dwStyle; + lpmi->dwStyle = Menu->MenuInfo.dwStyle; if (sizeof(MENUINFO) < lpmi->cbSize) { RtlCopyMemory((char *) lpmi + sizeof(MENUINFO), - (char *) &MenuObject->MenuInfo + sizeof(MENUINFO), + (char *) &Menu->MenuInfo + sizeof(MENUINFO), lpmi->cbSize - sizeof(MENUINFO)); } @@ -452,30 +489,30 @@ BOOL FASTCALL -IntSetMenuInfo(PMENU_OBJECT MenuObject, PROSMENUINFO lpmi) +IntSetMenuInfo(PMENU_OBJECT Menu, PROSMENUINFO lpmi) { if(lpmi->fMask & MIM_BACKGROUND) - MenuObject->MenuInfo.hbrBack = lpmi->hbrBack; + Menu->MenuInfo.hbrBack = lpmi->hbrBack; if(lpmi->fMask & MIM_HELPID) - MenuObject->MenuInfo.dwContextHelpID = lpmi->dwContextHelpID; + Menu->MenuInfo.dwContextHelpID = lpmi->dwContextHelpID; if(lpmi->fMask & MIM_MAXHEIGHT) - MenuObject->MenuInfo.cyMax = lpmi->cyMax; + Menu->MenuInfo.cyMax = lpmi->cyMax; if(lpmi->fMask & MIM_MENUDATA) - MenuObject->MenuInfo.dwMenuData = lpmi->dwMenuData; + Menu->MenuInfo.dwMenuData = lpmi->dwMenuData; if(lpmi->fMask & MIM_STYLE) - MenuObject->MenuInfo.dwStyle = lpmi->dwStyle; + Menu->MenuInfo.dwStyle = lpmi->dwStyle; if(lpmi->fMask & MIM_APPLYTOSUBMENUS) { /* FIXME */ } if (sizeof(MENUINFO) < lpmi->cbSize) { - MenuObject->MenuInfo.FocusedItem = lpmi->FocusedItem; - MenuObject->MenuInfo.Height = lpmi->Height; - MenuObject->MenuInfo.Width = lpmi->Width; - MenuObject->MenuInfo.Wnd = lpmi->Wnd; - MenuObject->MenuInfo.WndOwner = lpmi->WndOwner; - MenuObject->MenuInfo.TimeToHide = lpmi->TimeToHide; + Menu->MenuInfo.FocusedItem = lpmi->FocusedItem; + Menu->MenuInfo.Height = lpmi->Height; + Menu->MenuInfo.Width = lpmi->Width; + Menu->MenuInfo.Wnd = lpmi->Wnd; + Menu->MenuInfo.WndOwner = lpmi->WndOwner; + Menu->MenuInfo.TimeToHide = lpmi->TimeToHide; } return TRUE; @@ -483,11 +520,11 @@ int FASTCALL -IntGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT fFlag, +IntGetMenuItemByFlag(PMENU_OBJECT Menu, UINT uSearchBy, UINT fFlag, PMENU_ITEM *MenuItem, PMENU_ITEM *PrevMenuItem) { PMENU_ITEM PrevItem = NULL; - PMENU_ITEM CurItem = MenuObject->MenuItemList; + PMENU_ITEM CurItem = Menu->MenuItemList; int p; int ret; @@ -527,18 +564,16 @@ } else if (0 != (CurItem->fType & MF_POPUP)) { - MenuObject = IntGetMenuObject(CurItem->hSubMenu); - if (NULL != MenuObject) + Menu = UserGetMenuObject(CurItem->hSubMenu); + if (NULL != Menu) { - ret = IntGetMenuItemByFlag(MenuObject, uSearchBy, fFlag, + ret = IntGetMenuItemByFlag(Menu, uSearchBy, fFlag, MenuItem, PrevMenuItem); if (-1 != ret) { - IntReleaseMenuObject(MenuObject); return ret; } } - IntReleaseMenuObject(MenuObject); } PrevItem = CurItem; CurItem = CurItem->Next; @@ -550,13 +585,13 @@ int FASTCALL -IntInsertMenuItemToList(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, int pos) +IntInsertMenuItemToList(PMENU_OBJECT Menu, PMENU_ITEM MenuItem, int pos) { PMENU_ITEM CurItem; PMENU_ITEM LastItem = NULL; UINT npos = 0; - CurItem = MenuObject->MenuItemList; + CurItem = Menu->MenuItemList; if(pos <= -1) { while(CurItem) @@ -588,7 +623,7 @@ else { /* insert at the beginning */ - MenuObject->MenuItemList = MenuItem; + Menu->MenuItemList = MenuItem; MenuItem->Next = CurItem; } } @@ -603,17 +638,18 @@ else { /* insert first item */ - MenuObject->MenuItemList = MenuItem; + Menu->MenuItemList = MenuItem; MenuItem->Next = NULL; } } - MenuObject->MenuInfo.MenuItemCount++; + Menu->MenuInfo.MenuItemCount++; return npos; } BOOL FASTCALL -IntGetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, PROSMENUITEMINFO lpmii) +IntGetMenuItemInfo(PMENU_OBJECT Menu, /* UNUSED PARAM!! */ + PMENU_ITEM MenuItem, PROSMENUITEMINFO lpmii) { NTSTATUS Status; @@ -722,7 +758,7 @@ /* remove MFS_DEFAULT flag from all other menu items if this item has the MFS_DEFAULT state */ if(lpmii->fState & MFS_DEFAULT) - IntSetMenuDefaultItem(MenuObject, -1, 0); + UserSetMenuDefaultItem(MenuObject, -1, 0); /* update the menu item state flags */ UpdateMenuItemState(MenuItem->fState, lpmii->fState); } @@ -1051,7 +1087,7 @@ } BOOL FASTCALL -IntSetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT uItem, UINT fByPos) +UserSetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT uItem, UINT fByPos) { BOOL ret = FALSE; PMENU_ITEM MenuItem = MenuObject->MenuItemList; @@ -1585,25 +1621,19 @@ UINT fByPos, UINT gmdiFlags) { - PMENU_OBJECT MenuObject; - UINT res = -1; + PMENU_OBJECT Menu; DWORD gismc = 0; DECLARE_RETURN(UINT); DPRINT("Enter NtUserGetMenuDefaultItem\n"); UserEnterExclusive(); - MenuObject = IntGetMenuObject(hMenu); - if(!MenuObject) + if(!(Menu = UserGetMenuObject(hMenu))) { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); - RETURN( res); + RETURN(-1); } - res = IntGetMenuDefaultItem(MenuObject, fByPos, gmdiFlags, &gismc); - - IntReleaseMenuObject(MenuObject); - RETURN(res); + RETURN( IntGetMenuDefaultItem(Menu, fByPos, gmdiFlags, &gismc)); CLEANUP: DPRINT("Leave NtUserGetMenuDefaultItem, ret=%i\n",_ret_); @@ -1661,19 +1691,25 @@ LONG XMove, YMove; ULONG i; NTSTATUS Status; + PMENU_OBJECT Menu; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserGetMenuItemRect\n"); UserEnterShared(); + + if (!(Menu = UserGetMenuObject(hMenu))) + { + RETURN(FALSE); + } - if(!UserMenuItemInfo(hMenu, uItem, MF_BYPOSITION, &mii, FALSE)) + if(!UserMenuItemInfo(Menu, uItem, MF_BYPOSITION, &mii, FALSE)) RETURN( FALSE); referenceHwnd = hWnd; if(!hWnd) { - if(!UserMenuInfo(hMenu, &mi, FALSE)) RETURN( FALSE); + if(!UserMenuInfo(Menu, &mi, FALSE)) RETURN( FALSE); if(mi.Wnd == 0) RETURN( FALSE); referenceHwnd = mi.Wnd; } @@ -1754,17 +1790,14 @@ } -/* - * @implemented - */ +static BOOL FASTCALL UserMenuInfo( - HMENU Menu, + PMENU_OBJECT Menu, PROSMENUINFO UnsafeMenuInfo, BOOL SetOrGet) { BOOL Res; - PMENU_OBJECT MenuObject; DWORD Size; NTSTATUS Status; ROSMENUINFO MenuInfo; @@ -1787,22 +1820,15 @@ return( FALSE); } - MenuObject = IntGetMenuObject(Menu); - if (NULL == MenuObject) - { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); - return( FALSE); - } - if(SetOrGet) { /* Set MenuInfo */ - Res = IntSetMenuInfo(MenuObject, &MenuInfo); + Res = IntSetMenuInfo(Menu, &MenuInfo); } else { /* Get MenuInfo */ - Res = IntGetMenuInfo(MenuObject, &MenuInfo); + Res = IntGetMenuInfo(Menu, &MenuInfo); if (Res) { Status = MmCopyToCaller(UnsafeMenuInfo, &MenuInfo, Size); @@ -1814,8 +1840,6 @@ } } - IntReleaseMenuObject(MenuObject); - return( Res); } @@ -1829,15 +1853,21 @@ BOOL STDCALL NtUserMenuInfo( - HMENU Menu, + HMENU hMenu, PROSMENUINFO UnsafeMenuInfo, BOOL SetOrGet) { + PMENU_OBJECT Menu; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserMenuInfo\n"); UserEnterShared(); + if (!(Menu = UserGetMenuObject(hMenu))) + { + RETURN(FALSE); + } + RETURN(UserMenuInfo(Menu, UnsafeMenuInfo, SetOrGet)); CLEANUP: @@ -1853,13 +1883,13 @@ */ int STDCALL NtUserMenuItemFromPoint( - HWND Wnd, - HMENU Menu, + HWND hWnd, + HMENU hMenu, DWORD X, DWORD Y) { - PMENU_OBJECT MenuObject; - PWINDOW_OBJECT WindowObject = NULL; + PMENU_OBJECT Menu; + PWINDOW_OBJECT Window = NULL; PMENU_ITEM mi; int i; DECLARE_RETURN(int); @@ -1867,24 +1897,20 @@ DPRINT("Enter NtUserMenuItemFromPoint\n"); UserEnterExclusive(); - MenuObject = IntGetMenuObject(Menu); - if (NULL == MenuObject) + if (!(Menu = UserGetMenuObject(hMenu))) { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( -1); } - WindowObject = IntGetWindowObject(MenuObject->MenuInfo.Wnd); - if (NULL == WindowObject) + if (!(Window = UserGetWindowObject(Menu->MenuInfo.Wnd))) { - SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); RETURN( -1); } - X -= WindowObject->WindowRect.left; - Y -= WindowObject->WindowRect.top; - IntReleaseWindowObject(WindowObject); + + X -= Window->WindowRect.left; + Y -= Window->WindowRect.top; - mi = MenuObject->MenuItemList; + mi = Menu->MenuItemList; for (i = 0; NULL != mi; i++) { if (InRect(mi->Rect, X, Y)) @@ -1894,8 +1920,6 @@ mi = mi->Next; } - IntReleaseMenuObject(MenuObject); - RETURN( (mi ? i : NO_SELECTED_ITEM)); CLEANUP: @@ -1906,33 +1930,24 @@ - - +static BOOL FASTCALL UserMenuItemInfo( - HMENU Menu, + PMENU_OBJECT Menu, UINT Item, BOOL ByPosition, PROSMENUITEMINFO UnsafeItemInfo, BOOL SetOrGet) { - PMENU_OBJECT MenuObject; PMENU_ITEM MenuItem; ROSMENUITEMINFO ItemInfo; NTSTATUS Status; UINT Size; BOOL Ret; - MenuObject = IntGetMenuObject(Menu); - if (NULL == MenuObject) - { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); - return( FALSE); - } Status = MmCopyFromCaller(&Size, &UnsafeItemInfo->cbSize, sizeof(UINT)); if (! NT_SUCCESS(Status)) { - IntReleaseMenuObject(MenuObject); SetLastNtError(Status); return( FALSE); } @@ -1940,14 +1955,12 @@ && sizeof(MENUITEMINFOW) - sizeof(HBITMAP) != Size && sizeof(ROSMENUITEMINFO) != Size) { - IntReleaseMenuObject(MenuObject); SetLastWin32Error(ERROR_INVALID_PARAMETER); return( FALSE); } Status = MmCopyFromCaller(&ItemInfo, UnsafeItemInfo, Size); if (! NT_SUCCESS(Status)) { - IntReleaseMenuObject(MenuObject); SetLastNtError(Status); return( FALSE); } @@ -1956,43 +1969,37 @@ if (sizeof(MENUITEMINFOW) - sizeof(HBITMAP) == Size && 0 != (ItemInfo.fMask & MIIM_BITMAP)) { - IntReleaseMenuObject(MenuObject); SetLastWin32Error(ERROR_INVALID_PARAMETER); return( FALSE); } - if (IntGetMenuItemByFlag(MenuObject, Item, + if (IntGetMenuItemByFlag(Menu, Item, (ByPosition ? MF_BYPOSITION : MF_BYCOMMAND), &MenuItem, NULL) < 0) { - IntReleaseMenuObject(MenuObject); SetLastWin32Error(ERROR_INVALID_PARAMETER); return( FALSE); } if (SetOrGet) { - Ret = IntSetMenuItemInfo(MenuObject, MenuItem, &ItemInfo); + Ret = IntSetMenuItemInfo(Menu, MenuItem, &ItemInfo); } else { - Ret = IntGetMenuItemInfo(MenuObject, MenuItem, &ItemInfo); + Ret = IntGetMenuItemInfo(Menu, MenuItem, &ItemInfo); if (Ret) { Status = MmCopyToCaller(UnsafeItemInfo, &ItemInfo, Size); if (! NT_SUCCESS(Status)) { - IntReleaseMenuObject(MenuObject); SetLastNtError(Status); return( FALSE); } } } - IntReleaseMenuObject(MenuObject); - return( Ret); - } @@ -2003,16 +2010,22 @@ BOOL STDCALL NtUserMenuItemInfo( - HMENU Menu, + HMENU hMenu, UINT Item, BOOL ByPosition, PROSMENUITEMINFO UnsafeItemInfo, BOOL SetOrGet) { + PMENU_OBJECT Menu; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserMenuItemInfo\n"); UserEnterExclusive(); + + if (!(Menu = UserGetMenuObject(hMenu))) + { + RETURN(FALSE); + } RETURN( UserMenuItemInfo(Menu, Item, ByPosition, UnsafeItemInfo, SetOrGet)); @@ -2033,24 +2046,18 @@ UINT uPosition, UINT uFlags) { - BOOL res; - PMENU_OBJECT MenuObject; + PMENU_OBJECT Menu; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserRemoveMenu\n"); UserEnterExclusive(); - MenuObject = IntGetMenuObject(hMenu); - if(!MenuObject) + if(!(Menu = UserGetMenuObject(hMenu))) { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( FALSE); } - res = IntRemoveMenuItem(MenuObject, uPosition, uFlags, FALSE); - IntReleaseMenuObject(MenuObject); - - RETURN( res); + RETURN(IntRemoveMenuItem(Menu, uPosition, uFlags, FALSE)); CLEANUP: DPRINT("Leave NtUserRemoveMenu, ret=%i\n",_ret_); @@ -2065,26 +2072,21 @@ */ BOOL STDCALL NtUserSetMenuContextHelpId( - HMENU hmenu, + HMENU hMenu, DWORD dwContextHelpId) { - BOOL res; - PMENU_OBJECT MenuObject; + PMENU_OBJECT Menu; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserSetMenuContextHelpId\n"); UserEnterExclusive(); - MenuObject = IntGetMenuObject(hmenu); - if(!MenuObject) + if(!(Menu = UserGetMenuObject(hMenu))) { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( FALSE); } - res = IntSetMenuContextHelpId(MenuObject, dwContextHelpId); - IntReleaseMenuObject(MenuObject); - RETURN( res); + RETURN(IntSetMenuContextHelpId(Menu, dwContextHelpId)); CLEANUP: DPRINT("Leave NtUserSetMenuContextHelpId, ret=%i\n",_ret_); @@ -2094,62 +2096,27 @@ - /* * @implemented */ -BOOL FASTCALL -UserSetMenuDefaultItem( - HMENU hMenu, - UINT uItem, - UINT fByPos) -{ - BOOL res = FALSE; - PMENU_OBJECT MenuObject; - - MenuObject = IntGetMenuObject(hMenu); - if(!MenuObject) - { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); - return( FALSE); - } - - res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); - - IntReleaseMenuObject(MenuObject); - - return( res); -} - - -/* - * @implemented - */ BOOL STDCALL NtUserSetMenuDefaultItem( HMENU hMenu, UINT uItem, UINT fByPos) { - BOOL res = FALSE; - PMENU_OBJECT MenuObject; + PMENU_OBJECT Menu; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserSetMenuDefaultItem\n"); UserEnterExclusive(); - MenuObject = IntGetMenuObject(hMenu); - if(!MenuObject) + if(!(Menu = UserGetMenuObject(hMenu))) { - SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( FALSE); } - res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); [truncated at 1000 lines; 145 more skipped]
19 years, 3 months
1
0
0
0
[gvg] 17709: Correct sizes if origin is not (0, 0)
by gvg@svn.reactos.com
Correct sizes if origin is not (0, 0) Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c Modified: trunk/reactos/subsys/win32k/dib/dib4bpp.c Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c _____ Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c --- trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-09-06 23:15:15 UTC (rev 17708) +++ trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-09-06 23:16:18 UTC (rev 17709) @@ -630,11 +630,11 @@ BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); - SrcSizeY = SourceRect->bottom; - SrcSizeX = SourceRect->right; + SrcSizeY = SourceRect->bottom - SourceRect->top; + SrcSizeX = SourceRect->right - SourceRect->left; - DesSizeY = DestRect->bottom; - DesSizeX = DestRect->right; + DesSizeY = DestRect->bottom - DestRect->top; + DesSizeX = DestRect->right - DestRect->left; zoomX = DesSizeX / SrcSizeX; if (zoomX==0) zoomX=1; _____ Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c --- trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-09-06 23:15:15 UTC (rev 17708) +++ trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-09-06 23:16:18 UTC (rev 17709) @@ -518,12 +518,12 @@ int saveY; BOOLEAN DesIsBiggerY=FALSE; - SrcSizeY = SourceRect->bottom; - SrcSizeX = SourceRect->right; - - DesSizeY = DestRect->bottom; - DesSizeX = DestRect->right; + SrcSizeY = SourceRect->bottom - SourceRect->top; + SrcSizeX = SourceRect->right - SourceRect->left; + DesSizeY = DestRect->bottom - DestRect->top; + DesSizeX = DestRect->right - DestRect->left; + zoomX = DesSizeX / SrcSizeX; if (zoomX==0) zoomX=1; _____ Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c --- trunk/reactos/subsys/win32k/dib/dib24bpp.c 2005-09-06 23:15:15 UTC (rev 17708) +++ trunk/reactos/subsys/win32k/dib/dib24bpp.c 2005-09-06 23:16:18 UTC (rev 17709) @@ -513,12 +513,12 @@ int saveY; BOOLEAN DesIsBiggerY=FALSE; - SrcSizeY = SourceRect->bottom; - SrcSizeX = SourceRect->right; - - DesSizeY = DestRect->bottom; - DesSizeX = DestRect->right; + SrcSizeY = SourceRect->bottom - SourceRect->top; + SrcSizeX = SourceRect->right - SourceRect->left; + DesSizeY = DestRect->bottom - DestRect->top; + DesSizeX = DestRect->right - DestRect->left; + zoomX = DesSizeX / SrcSizeX; if (zoomX==0) zoomX=1; _____ Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c --- trunk/reactos/subsys/win32k/dib/dib32bpp.c 2005-09-06 23:15:15 UTC (rev 17708) +++ trunk/reactos/subsys/win32k/dib/dib32bpp.c 2005-09-06 23:16:18 UTC (rev 17709) @@ -557,11 +557,11 @@ BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); - SrcSizeY = SourceRect->bottom; - SrcSizeX = SourceRect->right; + SrcSizeY = SourceRect->bottom - SourceRect->top; + SrcSizeX = SourceRect->right - SourceRect->left; - DesSizeY = DestRect->bottom; - DesSizeX = DestRect->right; + DesSizeY = DestRect->bottom - DestRect->top; + DesSizeX = DestRect->right - DestRect->left; zoomX = DesSizeX / SrcSizeX; if (zoomX==0) zoomX=1; _____ Modified: trunk/reactos/subsys/win32k/dib/dib4bpp.c --- trunk/reactos/subsys/win32k/dib/dib4bpp.c 2005-09-06 23:15:15 UTC (rev 17708) +++ trunk/reactos/subsys/win32k/dib/dib4bpp.c 2005-09-06 23:16:18 UTC (rev 17709) @@ -397,12 +397,11 @@ int saveY; BOOLEAN DesIsBiggerY=FALSE; + SrcSizeY = SourceRect->bottom - SourceRect->top; + SrcSizeX = SourceRect->right - SourceRect->left; - SrcSizeY = SourceRect->bottom; - SrcSizeX = SourceRect->right; - - DesSizeY = DestRect->bottom; - DesSizeX = DestRect->right; + DesSizeY = DestRect->bottom - DestRect->top; + DesSizeX = DestRect->right - DestRect->left; zoomX = DesSizeX / SrcSizeX; if (zoomX==0) zoomX=1; _____ Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c --- trunk/reactos/subsys/win32k/dib/dib8bpp.c 2005-09-06 23:15:15 UTC (rev 17708) +++ trunk/reactos/subsys/win32k/dib/dib8bpp.c 2005-09-06 23:16:18 UTC (rev 17709) @@ -480,12 +480,12 @@ BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); - SrcSizeY = SourceRect->bottom; - SrcSizeX = SourceRect->right; - - DesSizeY = DestRect->bottom; - DesSizeX = DestRect->right; + SrcSizeY = SourceRect->bottom - SourceRect->top; + SrcSizeX = SourceRect->right - SourceRect->left; + DesSizeY = DestRect->bottom - DestRect->top; + DesSizeX = DestRect->right - DestRect->left; + zoomX = DesSizeX / SrcSizeX; if (zoomX==0) zoomX=1;
19 years, 3 months
1
0
0
0
[ion] 17708: - One last build fix.
by ion@svn.reactos.com
- One last build fix. Modified: trunk/reactos/subsys/win32k/ntuser/window.c _____ Modified: trunk/reactos/subsys/win32k/ntuser/window.c --- trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-06 23:05:13 UTC (rev 17707) +++ trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-06 23:15:15 UTC (rev 17708) @@ -652,7 +652,7 @@ PMENU_OBJECT FASTCALL IntGetSystemMenu(PWINDOW_OBJECT Window, BOOL bRevert, BOOL RetMenu) { - PMENU_OBJECT Menu, NewMenu, SysMenu, ret = NULL; + PMENU_OBJECT Menu, NewMenu = NULL, SysMenu = NULL, ret = NULL; PW32THREAD W32Thread; HMENU hNewMenu, hSysMenu; ROSMENUITEMINFO ItemInfo;
19 years, 3 months
1
0
0
0
[ion] 17707: Fix win32k build errors so HEAD can build again, although most are caused by poor programming and will crash if called with unexpected parameters that aren't being properly handled.
by ion@svn.reactos.com
Fix win32k build errors so HEAD can build again, although most are caused by poor programming and will crash if called with unexpected parameters that aren't being properly handled. Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c Modified: trunk/reactos/subsys/win32k/eng/xlate.c Modified: trunk/reactos/subsys/win32k/ntuser/keyboard.c Modified: trunk/reactos/subsys/win32k/ntuser/menu.c Modified: trunk/reactos/subsys/win32k/objects/dc.c _____ Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c --- trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-09-06 22:11:37 UTC (rev 17706) +++ trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-09-06 23:05:13 UTC (rev 17707) @@ -514,7 +514,7 @@ int zoomX; int zoomY; int count; - int saveX; + int saveX = 0; int saveY; BOOLEAN DesIsBiggerY=FALSE; _____ Modified: trunk/reactos/subsys/win32k/eng/xlate.c --- trunk/reactos/subsys/win32k/eng/xlate.c 2005-09-06 22:11:37 UTC (rev 17706) +++ trunk/reactos/subsys/win32k/eng/xlate.c 2005-09-06 23:05:13 UTC (rev 17707) @@ -528,7 +528,10 @@ else if (PalOutType == XO_DESTPALETTE) hPalette = XlateGDI->DestPal; else + { UNIMPLEMENTED; + return 0; + } PalGDI = PALETTE_LockPalette(hPalette); if(PalGDI != NULL) _____ Modified: trunk/reactos/subsys/win32k/ntuser/keyboard.c --- trunk/reactos/subsys/win32k/ntuser/keyboard.c 2005-09-06 22:11:37 UTC (rev 17706) +++ trunk/reactos/subsys/win32k/ntuser/keyboard.c 2005-09-06 23:05:13 UTC (rev 17707) @@ -1024,7 +1024,7 @@ { VK_UP, VK_NUMPAD8 }, { VK_PRIOR, VK_NUMPAD9 }, { 0,0 } }; - PVSC_VK VscVkTable; + PVSC_VK VscVkTable = NULL; if( !KeyboardLayout || !Msg || (Msg->message != WM_KEYDOWN && Msg->message != WM_SYSKEYDOWN && _____ Modified: trunk/reactos/subsys/win32k/ntuser/menu.c --- trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-06 22:11:37 UTC (rev 17706) +++ trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-06 23:05:13 UTC (rev 17707) @@ -1656,7 +1656,7 @@ ROSMENUITEMINFO mii; HWND referenceHwnd; LPPOINT lpPoints; - LPRECT lpRect; + LPRECT lpRect = NULL; POINT FromOffset; LONG XMove, YMove; ULONG i; _____ Modified: trunk/reactos/subsys/win32k/objects/dc.c --- trunk/reactos/subsys/win32k/objects/dc.c 2005-09-06 22:11:37 UTC (rev 17706) +++ trunk/reactos/subsys/win32k/objects/dc.c 2005-09-06 23:05:13 UTC (rev 17707) @@ -1441,7 +1441,7 @@ INT FASTCALL IntGdiGetDeviceCaps(PDC dc, INT Index) { - INT ret; + INT ret = 0; POINT pt; /* Retrieve capability */
19 years, 3 months
1
0
0
0
[gdalsnes] 17706: remake refcounting
by gdalsnes@svn.reactos.com
remake refcounting naming changes convert internal function to page ptr and not handle Modified: trunk/reactos/subsys/win32k/include/userfuncs.h Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c _____ Modified: trunk/reactos/subsys/win32k/include/userfuncs.h --- trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-06 19:47:06 UTC (rev 17705) +++ trunk/reactos/subsys/win32k/include/userfuncs.h 2005-09-06 22:11:37 UTC (rev 17706) @@ -2,11 +2,14 @@ #define _WIN32K_USERFUNCS_H //currently unused -#define ASSERT_REFS(obj) +#define ASSERT_REFS(obj) ASSERT(ObmGetReferenceCount(obj) >= 2) #define UserReferenceWindowObjectCo(o) IntReferenceWindowObject(o) #define UserDereferenceWindowObjectCo(o) IntReleaseWindowObject(o) +#define UserReferenceAccelObjectCo(o) IntReferenceWindowObject(o) +#define UserDereferenceAccelObjectCo(o) IntReleaseWindowObject(o) + extern PUSER_HANDLE_TABLE gHandleTable; _____ Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c --- trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-06 19:47:06 UTC (rev 17705) +++ trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-06 22:11:37 UTC (rev 17706) @@ -68,15 +68,38 @@ return(STATUS_SUCCESS); } + +static +PACCELERATOR_TABLE FASTCALL UserGetAccelObjectNoRef(HACCEL hAccel) +{ + PACCELERATOR_TABLE Accel=NULL; + NTSTATUS Status = ObmReferenceObjectByHandle(gHandleTable, + hAccel, + otAcceleratorTable, + (PVOID*)&Accel); + + if (!NT_SUCCESS(Status)) + { + SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); + return NULL; + } + + ObmDereferenceObject(Accel); + return Accel; +} + + + + int STDCALL NtUserCopyAcceleratorTable( - HACCEL Table, + HACCEL hAccel, LPACCEL Entries, int EntriesCount) { PWINSTATION_OBJECT WindowStation; - PACCELERATOR_TABLE AcceleratorTable; + PACCELERATOR_TABLE Accel; NTSTATUS Status; int Ret; DECLARE_RETURN(int); @@ -88,31 +111,25 @@ UserMode, 0, &WindowStation); + if (!NT_SUCCESS(Status)) { SetLastNtError(STATUS_ACCESS_DENIED); RETURN(0); } - Status = ObmReferenceObjectByHandle(gHandleTable, - Table, - otAcceleratorTable, - (PVOID*)&AcceleratorTable); - - if (!NT_SUCCESS(Status)) + if (!(Accel = UserGetAccelObjectNoRef(hAccel))) { - SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); ObDereferenceObject(WindowStation); RETURN(0); } if(Entries) { - Ret = min(EntriesCount, AcceleratorTable->Count); - Status = MmCopyToCaller(Entries, AcceleratorTable->Table, Ret * sizeof(ACCEL)); + Ret = min(EntriesCount, Accel->Count); + Status = MmCopyToCaller(Entries, Accel->Table, Ret * sizeof(ACCEL)); if (!NT_SUCCESS(Status)) { - ObmDereferenceObject(AcceleratorTable); ObDereferenceObject(WindowStation); SetLastNtError(Status); RETURN(0); @@ -120,10 +137,9 @@ } else { - Ret = AcceleratorTable->Count; + Ret = Accel->Count; } - ObmDereferenceObject(AcceleratorTable); ObDereferenceObject(WindowStation); RETURN(Ret); @@ -141,9 +157,9 @@ SIZE_T EntriesCount) { PWINSTATION_OBJECT WindowStation; - PACCELERATOR_TABLE AcceleratorTable; + PACCELERATOR_TABLE Accel; NTSTATUS Status; - HACCEL Handle; + HACCEL hAccel; DECLARE_RETURN(HACCEL); DPRINT("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n", @@ -154,47 +170,45 @@ UserMode, 0, &WindowStation); + if (!NT_SUCCESS(Status)) { SetLastNtError(STATUS_ACCESS_DENIED); - DPRINT1("E1\n"); RETURN( FALSE ); } - AcceleratorTable = ObmCreateObject( + Accel = ObmCreateObject( gHandleTable, - (PHANDLE)&Handle, + (PHANDLE)&hAccel, otAcceleratorTable, sizeof(ACCELERATOR_TABLE)); - if (AcceleratorTable == NULL) + + if (Accel == NULL) { ObDereferenceObject(WindowStation); SetLastNtError(STATUS_NO_MEMORY); - DPRINT1("E2\n"); RETURN( (HACCEL) 0 ); } - AcceleratorTable->Count = EntriesCount; - if (AcceleratorTable->Count > 0) + Accel->Count = EntriesCount; + if (Accel->Count > 0) { - AcceleratorTable->Table = ExAllocatePoolWithTag(PagedPool, EntriesCount * sizeof(ACCEL), TAG_ACCEL); - if (AcceleratorTable->Table == NULL) + Accel->Table = ExAllocatePoolWithTag(PagedPool, EntriesCount * sizeof(ACCEL), TAG_ACCEL); + if (Accel->Table == NULL) { - ObmCloseHandle(gHandleTable, Handle); + ObmCloseHandle(gHandleTable, hAccel); ObDereferenceObject(WindowStation); SetLastNtError(Status); - DPRINT1("E3\n"); RETURN( (HACCEL) 0); } - Status = MmCopyFromCaller(AcceleratorTable->Table, Entries, EntriesCount * sizeof(ACCEL)); + Status = MmCopyFromCaller(Accel->Table, Entries, EntriesCount * sizeof(ACCEL)); if (!NT_SUCCESS(Status)) { - ExFreePool(AcceleratorTable->Table); - ObmCloseHandle(gHandleTable, Handle); + ExFreePool(Accel->Table); + ObmCloseHandle(gHandleTable, hAccel); ObDereferenceObject(WindowStation); SetLastNtError(Status); - DPRINT1("E4\n"); RETURN((HACCEL) 0); } } @@ -203,7 +217,7 @@ /* FIXME: Save HandleTable in a list somewhere so we can clean it up again */ - RETURN((HACCEL) Handle); + RETURN(hAccel); CLEANUP: DPRINT("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) = %x\n", @@ -212,13 +226,15 @@ END_CLEANUP; } + + BOOLEAN STDCALL NtUserDestroyAcceleratorTable( - HACCEL Table) + HACCEL hAccel) { PWINSTATION_OBJECT WindowStation; - PACCELERATOR_TABLE AcceleratorTable; + PACCELERATOR_TABLE Accel; NTSTATUS Status; DECLARE_RETURN(BOOLEAN); @@ -227,13 +243,14 @@ FIXME: Destroy only tables created using CreateAcceleratorTable. */ - DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n", Table); + DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n", hAccel); UserEnterExclusive(); Status = IntValidateWindowStationHandle(UserGetProcessWindowStation(), UserMode, 0, &WindowStation); + if (!NT_SUCCESS(Status)) { SetLastNtError(STATUS_ACCESS_DENIED); @@ -241,40 +258,33 @@ RETURN( FALSE); } - Status = ObmReferenceObjectByHandle(gHandleTable, - Table, - otAcceleratorTable, - (PVOID*)&AcceleratorTable); - if (!NT_SUCCESS(Status)) + if (!(Accel = UserGetAccelObjectNoRef(hAccel))) { - SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); ObDereferenceObject(WindowStation); - DPRINT1("E2\n"); RETURN( FALSE); } - ObmCloseHandle(gHandleTable, Table); + ObmCloseHandle(gHandleTable, hAccel); - if (AcceleratorTable->Table != NULL) + if (Accel->Table != NULL) { - ExFreePool(AcceleratorTable->Table); + ExFreePool(Accel->Table); } ObDereferenceObject(WindowStation); - DPRINT("NtUserDestroyAcceleratorTable(Table %x)\n", - Table); - RETURN( TRUE); CLEANUP: - DPRINT("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n", Table,_ret_); + DPRINT("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n", hAccel,_ret_); UserLeave(); END_CLEANUP; } -static BOOLEAN -co_IntTranslateAccelerator(HWND hWnd, +static +BOOLEAN FASTCALL +co_IntTranslateAccelerator( + PWINDOW_OBJECT Window, UINT message, WPARAM wParam, LPARAM lParam, @@ -284,9 +294,11 @@ { UINT mesg = 0; - DPRINT("IntTranslateAccelerator(hWnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x)\n", - hWnd, message, wParam, lParam, fVirt, key, cmd); + ASSERT_REFS(Window); + DPRINT("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x)\n", + Window->hSelf, message, wParam, lParam, fVirt, key, cmd); + if (wParam != key) { DPRINT("T0\n"); @@ -335,8 +347,8 @@ } } - DPRINT("IntTranslateAccelerator(hWnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = FALSE\n", - hWnd, message, wParam, lParam, fVirt, key, cmd); + DPRINT("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = FALSE\n", + Window->hSelf, message, wParam, lParam, fVirt, key, cmd); return FALSE; @@ -345,7 +357,7 @@ mesg = 1; else if (IntGetCaptureWindow()) mesg = 2; - else if (!IntIsWindowVisible(hWnd)) /* FIXME: WINE IsWindowEnabled == IntIsWindowVisible? */ + else if (!IntIsWindowVisible(Window->hSelf)) /* FIXME: WINE IsWindowEnabled == IntIsWindowVisible? */ mesg = 3; else { @@ -423,12 +435,12 @@ if (mesg == WM_COMMAND) { DPRINT(", sending WM_COMMAND, wParam=%0x\n", 0x10000 | cmd); - co_IntSendMessage(hWnd, mesg, 0x10000 | cmd, 0L); + co_IntSendMessage(Window->hSelf, mesg, 0x10000 | cmd, 0L); } else if (mesg == WM_SYSCOMMAND) { DPRINT(", sending WM_SYSCOMMAND, wParam=%0x\n", cmd); - co_IntSendMessage(hWnd, mesg, cmd, 0x00010000L); + co_IntSendMessage(Window->hSelf, mesg, cmd, 0x00010000L); } else { @@ -449,7 +461,7 @@ } DPRINT("IntTranslateAccelerator(hWnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x) = TRUE\n", - hWnd, message, wParam, lParam, fVirt, key, cmd); + Window->hSelf, message, wParam, lParam, fVirt, key, cmd); return TRUE; } @@ -458,34 +470,26 @@ STDCALL NtUserTranslateAccelerator( HWND hWnd, - HACCEL Table, + HACCEL hAccel, LPMSG Message) { - PWINSTATION_OBJECT WindowStation; - PACCELERATOR_TABLE AcceleratorTable; + PWINSTATION_OBJECT WindowStation = NULL; + PWINDOW_OBJECT Window = NULL; + PACCELERATOR_TABLE Accel = NULL; NTSTATUS Status; ULONG i; DECLARE_RETURN(int); DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n", - hWnd, Table, Message); + hWnd, hAccel, Message); UserEnterShared(); - if (hWnd == NULL) - RETURN( 0); - if (Message == NULL) { SetLastNtError(STATUS_INVALID_PARAMETER); RETURN( 0); } - if (Table == NULL) - { - SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); - RETURN( 0); - } - if ((Message->message != WM_KEYDOWN) && (Message->message != WM_SYSKEYDOWN) && (Message->message != WM_SYSCHAR) && @@ -498,49 +502,57 @@ UserMode, 0, &WindowStation); + if (!NT_SUCCESS(Status)) { SetLastNtError(STATUS_ACCESS_DENIED); RETURN( 0); } - Status = ObmReferenceObjectByHandle(gHandleTable, - Table, - otAcceleratorTable, - (PVOID*)&AcceleratorTable); - if (!NT_SUCCESS(Status)) + if (!(Accel = UserGetAccelObjectNoRef(hAccel))) { - SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE); - ObDereferenceObject(WindowStation); RETURN( 0); } + UserReferenceAccelObjectCo(Accel); + + if (!(Window = UserGetWindowObjectNoRef(hWnd))) + { + RETURN( 0); + } + + UserReferenceWindowObjectCo(Window); + + /* FIXME: Associate AcceleratorTable with the current thread */ - for (i = 0; i < AcceleratorTable->Count; i++) + for (i = 0; i < Accel->Count; i++) { - if (co_IntTranslateAccelerator(hWnd, Message->message, Message->wParam, Message->lParam, - AcceleratorTable->Table[i].fVirt, AcceleratorTable->Table[i].key, - AcceleratorTable->Table[i].cmd)) + if (co_IntTranslateAccelerator(Window, Message->message, Message->wParam, Message->lParam, + Accel->Table[i].fVirt, Accel->Table[i].key, + Accel->Table[i].cmd)) { - ObDereferenceObject(WindowStation); DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p) = %i end\n", - hWnd, Table, Message, 1); + hWnd, hAccel, Message, 1); RETURN( 1); } - if (((AcceleratorTable->Table[i].fVirt & 0x80) > 0)) + if (((Accel->Table[i].fVirt & 0x80) > 0)) { break; } } - ObDereferenceObject(WindowStation); - RETURN( 0); CLEANUP: + + if (Window) UserReferenceWindowObjectCo(Window); + if (Accel) UserReferenceAccelObjectCo(Accel); + + if (WindowStation) ObDereferenceObject(WindowStation); + DPRINT("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p) = %i end\n", - hWnd, Table, Message, 0); + hWnd, hAccel, Message, 0); UserLeave(); END_CLEANUP; }
19 years, 3 months
1
0
0
0
[ion] 17705: - Fix size functions to return the correct results in all cases.
by ion@svn.reactos.com
- Fix size functions to return the correct results in all cases. Modified: trunk/reactos/lib/rtl/nls.c Modified: trunk/reactos/lib/rtl/unicode.c _____ Modified: trunk/reactos/lib/rtl/nls.c --- trunk/reactos/lib/rtl/nls.c 2005-09-06 19:38:51 UTC (rev 17704) +++ trunk/reactos/lib/rtl/nls.c 2005-09-06 19:47:06 UTC (rev 17705) @@ -278,35 +278,50 @@ /* * @implemented */ -NTSTATUS STDCALL +NTSTATUS +STDCALL RtlMultiByteToUnicodeSize(PULONG UnicodeSize, PCSTR MbString, ULONG MbSize) { - ULONG Length; + ULONG Length = 0; - if (NlsMbCodePageTag == FALSE) - { - /* single-byte code page */ - *UnicodeSize = MbSize * sizeof (WCHAR); - } - else - { - /* multi-byte code page */ - for (Length = 0; MbSize; MbSize--, MbString++, Length++) - { - if (NlsLeadByteInfo[(UCHAR)*MbString] != 0) - { - if (!--MbSize) - break; /* partial char, ignore it */ - MbString++; - } - } + if (!NlsMbCodePageTag) + { + /* single-byte code page */ + *UnicodeSize = MbSize * sizeof (WCHAR); + } + else + { + /* multi-byte code page */ + while (MbSize--) + { + if (NlsLeadByteInfo[*(PUCHAR)MbString++]) + { + if (!MbSize) + { + /* partial char, ignore it */ + Length++; + break; + } + } + else + { + /* Move on */ + MbSize--; + MbString++; + } - *UnicodeSize = Length * sizeof(WCHAR); - } + /* Increase returned size */ + Length++; + } - return STATUS_SUCCESS; + /* Return final size */ + *UnicodeSize = Length * sizeof(WCHAR); + } + + /* Success */ + return STATUS_SUCCESS; } @@ -472,47 +487,45 @@ return STATUS_SUCCESS; } - /* * @implemented */ -NTSTATUS STDCALL +NTSTATUS +STDCALL RtlUnicodeToMultiByteSize(PULONG MbSize, PWCHAR UnicodeString, ULONG UnicodeSize) { - ULONG UnicodeLength; - ULONG MbLength; + ULONG UnicodeLength = UnicodeSize / sizeof(WCHAR); + ULONG MbLength = 0; - if (NlsMbCodePageTag == FALSE) - { - /* single-byte code page */ - *MbSize = UnicodeSize / sizeof (WCHAR); - } - else - { - /* multi-byte code page */ - UnicodeLength = UnicodeSize / sizeof(WCHAR); - MbLength = 0; - while (UnicodeLength > 0) - { - if (NlsLeadByteInfo[(USHORT)*UnicodeString] & 0xff00) - MbLength++; + if (!NlsMbCodePageTag) + { + /* single-byte code page */ + *MbSize = UnicodeLength; + } + else + { + /* multi-byte code page */ + while (UnicodeLength--) + { + if (HIBYTE(NlsUnicodeToAnsiTable[*UnicodeString++])) + { + MbLength += sizeof(WCHAR); + } + else + { + MbLength++; + } + } + + *MbSize = MbLength; + } - MbLength++; - UnicodeLength--; - UnicodeString++; - } - - *MbSize = MbLength; - } - - return(STATUS_SUCCESS); + /* Success */ + return STATUS_SUCCESS; } - - - /* * @unimplemented */ _____ Modified: trunk/reactos/lib/rtl/unicode.c --- trunk/reactos/lib/rtl/unicode.c 2005-09-06 19:38:51 UTC (rev 17704) +++ trunk/reactos/lib/rtl/unicode.c 2005-09-06 19:47:06 UTC (rev 17705) @@ -68,13 +68,15 @@ STDCALL RtlxAnsiStringToUnicodeSize(IN PCANSI_STRING AnsiString) { - ULONG Size; + ULONG Size; - RtlMultiByteToUnicodeSize(&Size, - AnsiString->Buffer, - AnsiString->Length); + /* Convert from Mb String to Unicode Size */ + RtlMultiByteToUnicodeSize(&Size, + AnsiString->Buffer, + AnsiString->Length); - return(Size); + /* Return the size plus the null-char */ + return(Size + sizeof(WCHAR)); } @@ -883,16 +885,17 @@ */ ULONG STDCALL -RtlxUnicodeStringToOemSize( - IN PCUNICODE_STRING UnicodeString) +RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString) { - ULONG Size; + ULONG Size; - RtlUnicodeToMultiByteSize (&Size, + /* Convert the Unicode String to Mb Size */ + RtlUnicodeToMultiByteSize(&Size, UnicodeString->Buffer, UnicodeString->Length); - return Size+1; //NB: incl. nullterm + /* Return the size + the null char */ + return (Size + sizeof(CHAR)); } /* @@ -1798,14 +1801,15 @@ STDCALL RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString) { - ULONG Size; + ULONG Size; - //this function returns size including nullterm - RtlMultiByteToUnicodeSize(&Size, - OemString->Buffer, - OemString->Length); + /* Convert the Mb String to Unicode Size */ + RtlMultiByteToUnicodeSize(&Size, + OemString->Buffer, + OemString->Length); - return(Size); + /* Return the size + null-char */ + return (Size + sizeof(WCHAR)); } @@ -1859,17 +1863,17 @@ */ ULONG STDCALL -RtlxUnicodeStringToAnsiSize( - IN PCUNICODE_STRING UnicodeString) +RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString) { - ULONG Size; + ULONG Size; - //this function return size without nullterm! - RtlUnicodeToMultiByteSize (&Size, + /* Convert the Unicode String to Mb Size */ + RtlUnicodeToMultiByteSize(&Size, UnicodeString->Buffer, UnicodeString->Length); - return Size + sizeof(CHAR); //NB: incl. nullterm + /* Return the size + null-char */ + return (Size + sizeof(CHAR)); }
19 years, 3 months
1
0
0
0
[ion] 17704: - Use Rtl macros instead of manually handling the cases.
by ion@svn.reactos.com
- Use Rtl macros instead of manually handling the cases. Modified: trunk/reactos/lib/rtl/unicode.c _____ Modified: trunk/reactos/lib/rtl/unicode.c --- trunk/reactos/lib/rtl/unicode.c 2005-09-06 19:37:38 UTC (rev 17703) +++ trunk/reactos/lib/rtl/unicode.c 2005-09-06 19:38:51 UTC (rev 17704) @@ -913,13 +913,7 @@ NTSTATUS Status = STATUS_SUCCESS; ULONG Length; /* including nullterm */ - if (NlsMbCodePageTag == TRUE) - { - Length = RtlUnicodeStringToAnsiSize((PUNICODE_STRING)UniSource); - } - else - Length = (UniSource->Length / sizeof(WCHAR)) + sizeof(CHAR); - + Length = RtlUnicodeStringToAnsiSize(UniSource); AnsiDest->Length = Length - sizeof(CHAR); if (AllocateDestinationString) @@ -974,11 +968,7 @@ NTSTATUS Status; ULONG Length; /* including nullterm */ - if (NlsMbOemCodePageTag == TRUE) - Length = RtlOemStringToUnicodeSize((POEM_STRING)OemSource); - else - Length = (OemSource->Length * sizeof(WCHAR)) + sizeof(WCHAR); - + Length = RtlOemStringToUnicodeSize(OemSource); if (Length > 0xffff) return STATUS_INVALID_PARAMETER_2; @@ -1035,11 +1025,7 @@ NTSTATUS Status = STATUS_SUCCESS; ULONG Length; //including nullterm - if (NlsMbOemCodePageTag == TRUE) - Length = RtlUnicodeStringToAnsiSize ((PUNICODE_STRING)UniSource); - else - Length = (UniSource->Length / sizeof(WCHAR)) + sizeof(CHAR); - + Length = RtlUnicodeStringToAnsiSize(UniSource); if (Length > 0x0000FFFF) return STATUS_INVALID_PARAMETER_2; @@ -1158,11 +1144,7 @@ NTSTATUS Status; ULONG Length; /* excluding nullterm */ - if (NlsMbCodePageTag == TRUE) - Length = RtlOemStringToUnicodeSize((POEM_STRING)OemSource) - sizeof(WCHAR); - else - Length = OemSource->Length * sizeof(WCHAR); - + Length = RtlOemStringToCountedUnicodeSize(OemSource); if (Length > 65535) return STATUS_INVALID_PARAMETER_2; @@ -1498,11 +1480,7 @@ NTSTATUS Status; ULONG Length; //excluding nullterm - if (NlsMbOemCodePageTag == TRUE) - Length = RtlUnicodeStringToAnsiSize(UniSource) - sizeof(CHAR); - else - Length = (UniSource->Length / sizeof(WCHAR)); - + Length = RtlUnicodeStringToCountedOemSize(UniSource); if (Length > 0x0000FFFF) return STATUS_INVALID_PARAMETER_2; @@ -1648,11 +1626,7 @@ NTSTATUS Status; ULONG Length; /* including nullterm */ - if (NlsMbCodePageTag == TRUE) - Length = RtlUnicodeStringToAnsiSize(UniSource); - else - Length = (UniSource->Length / sizeof(WCHAR)) + sizeof(CHAR); - + Length = RtlUnicodeStringToAnsiSize(UniSource); if (Length > 0x0000FFFF) return STATUS_INVALID_PARAMETER_2; @@ -1713,11 +1687,7 @@ NTSTATUS Status; ULONG Length; /* excluding nullterm */ - if (NlsMbCodePageTag == TRUE) - Length = RtlUnicodeStringToAnsiSize((PUNICODE_STRING)UniSource) - sizeof(CHAR); - else - Length = UniSource->Length / sizeof(WCHAR); - + Length = RtlUnicodeStringToCountedOemSize(UniSource); if (Length > 0x0000FFFF) return(STATUS_INVALID_PARAMETER_2); @@ -1775,11 +1745,7 @@ NTSTATUS Status; ULONG Length; /* including nullterm */ - if (NlsMbOemCodePageTag == TRUE) - Length = RtlUnicodeStringToAnsiSize((PUNICODE_STRING)UniSource); - else - Length = (UniSource->Length / sizeof(WCHAR)) + sizeof(CHAR); - + Length = RtlUnicodeStringToAnsiSize(UniSource); if (Length > 0x0000FFFF) return STATUS_INVALID_PARAMETER_2; @@ -2148,11 +2114,7 @@ NTSTATUS Status; ULONG Length; //including nullterm - if (NlsMbCodePageTag == TRUE) - Length = RtlAnsiStringToUnicodeSize(AnsiSource); - else - Length = (AnsiSource->Length * sizeof(WCHAR)) + sizeof(WCHAR); - + Length = RtlAnsiStringToUnicodeSize(AnsiSource); if (Length > 0xffff) return STATUS_INVALID_PARAMETER_2;
19 years, 3 months
1
0
0
0
[ion] 17703: - Fix the sad sad definition of sizeof(ANSI_NULL) which returned 4...
by ion@svn.reactos.com
- Fix the sad sad definition of sizeof(ANSI_NULL) which returned 4... Modified: trunk/reactos/w32api/include/winnt.h _____ Modified: trunk/reactos/w32api/include/winnt.h --- trunk/reactos/w32api/include/winnt.h 2005-09-06 19:21:42 UTC (rev 17702) +++ trunk/reactos/w32api/include/winnt.h 2005-09-06 19:37:38 UTC (rev 17703) @@ -156,8 +156,8 @@ #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b)) #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b)) #endif -#define ANSI_NULL '\0' -#define UNICODE_NULL L'\0' +#define ANSI_NULL ((CHAR)0) +#define UNICODE_NULL ((WCHAR)0) typedef BYTE BOOLEAN,*PBOOLEAN; #endif typedef BYTE FCHAR;
19 years, 3 months
1
0
0
0
[gvg] 17702: Fix release build
by gvg@svn.reactos.com
Fix release build Modified: trunk/reactos/tools/winebuild/spec32.c _____ Modified: trunk/reactos/tools/winebuild/spec32.c --- trunk/reactos/tools/winebuild/spec32.c 2005-09-06 18:07:46 UTC (rev 17701) +++ trunk/reactos/tools/winebuild/spec32.c 2005-09-06 19:21:42 UTC (rev 17702) @@ -318,6 +318,7 @@ { int i; +#if 0 for (i = 0; i < spec->nb_entry_points; i++) { ORDDEF *odp = &spec->entry_points[i]; @@ -329,6 +330,7 @@ fprintf( outfile, "#endif\n\n" ); break; } +#endif for (i = 0; i < spec->nb_entry_points; i++) {
19 years, 3 months
1
0
0
0
← Newer
1
...
45
46
47
48
49
50
51
...
59
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Results per page:
10
25
50
100
200