mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
-set last error (invalid handle) in cases where handle is NULL also
-remove GvG's workaround svn path=/trunk/; revision=17924
This commit is contained in:
parent
5eaa4fda83
commit
acd5c47c18
7 changed files with 58 additions and 21 deletions
|
@ -74,18 +74,20 @@ PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel)
|
|||
{
|
||||
PACCELERATOR_TABLE Accel;
|
||||
|
||||
if (!hAccel) return NULL;
|
||||
|
||||
Accel= UserGetObject(&gHandleTable, hAccel, otAccel);
|
||||
|
||||
if (Accel)
|
||||
{
|
||||
ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0);
|
||||
}
|
||||
else
|
||||
if (!hAccel)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Accel= UserGetObject(&gHandleTable, hAccel, otAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0);
|
||||
|
||||
return Accel;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,11 @@ PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
|
|||
{
|
||||
PCURICON_OBJECT CurIcon;
|
||||
|
||||
if (!hCurIcon) return NULL;
|
||||
if (!hCurIcon)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CurIcon = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCurIcon, otCursorIcon);
|
||||
if (!CurIcon)
|
||||
|
|
|
@ -59,21 +59,28 @@ IntAllocHookTable(void)
|
|||
}
|
||||
|
||||
|
||||
PHOOK FASTCALL IntGetHookObject(HHOOK hWnd)
|
||||
PHOOK FASTCALL IntGetHookObject(HHOOK hHook)
|
||||
{
|
||||
|
||||
PHOOK Window = (PHOOK)UserGetObject(&gHandleTable, hWnd, otHook);
|
||||
if (!Window)
|
||||
PHOOK Hook;
|
||||
|
||||
if (!hHook)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HOOK_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Hook = (PHOOK)UserGetObject(&gHandleTable, hHook, otHook);
|
||||
if (!Hook)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HOOK_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASSERT(USER_BODY_TO_HEADER(Window)->RefCount >= 0);
|
||||
ASSERT(USER_BODY_TO_HEADER(Hook)->RefCount >= 0);
|
||||
|
||||
USER_BODY_TO_HEADER(Window)->RefCount++;
|
||||
USER_BODY_TO_HEADER(Hook)->RefCount++;
|
||||
|
||||
return Window;
|
||||
return Hook;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -154,6 +154,10 @@ IsHotKey (UINT fsModifiers, UINT vk)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* SYSCALLS *****************************************************************/
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
NtUserRegisterHotKey(HWND hWnd,
|
||||
int id,
|
||||
|
|
|
@ -115,7 +115,15 @@ CleanupMenuImpl(VOID)
|
|||
|
||||
PMENU_OBJECT FASTCALL UserGetMenuObject(HMENU hMenu)
|
||||
{
|
||||
PMENU_OBJECT Menu = (PMENU_OBJECT)UserGetObject(&gHandleTable, hMenu, otMenu);
|
||||
PMENU_OBJECT Menu;
|
||||
|
||||
if (!hMenu)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Menu = (PMENU_OBJECT)UserGetObject(&gHandleTable, hMenu, otMenu);
|
||||
if (!Menu)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
|
||||
|
|
|
@ -124,7 +124,16 @@ static
|
|||
PMONITOR_OBJECT FASTCALL
|
||||
UserGetMonitorObject(IN HMONITOR hMonitor)
|
||||
{
|
||||
PMONITOR_OBJECT Monitor = (PMONITOR_OBJECT)UserGetObject(&gHandleTable, hMonitor, otMonitor);
|
||||
PMONITOR_OBJECT Monitor;
|
||||
|
||||
if (!hMonitor)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Monitor = (PMONITOR_OBJECT)UserGetObject(&gHandleTable, hMonitor, otMonitor);
|
||||
if (!Monitor)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
|
||||
|
|
|
@ -97,7 +97,11 @@ PWINDOW_OBJECT FASTCALL UserGetWindowObject(HWND hWnd)
|
|||
{
|
||||
PWINDOW_OBJECT Window;
|
||||
|
||||
if (!hWnd) return NULL;
|
||||
if (!hWnd)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Window = (PWINDOW_OBJECT)UserGetObject(&gHandleTable, hWnd, otWindow);
|
||||
if (!Window || 0 != (Window->Status & WINDOWSTATUS_DESTROYED))
|
||||
|
@ -3233,7 +3237,6 @@ UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
|
|||
|
||||
if (!(Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue