-set last error (invalid handle) in cases where handle is NULL also
-remove GvG's workaround
Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c
Modified: trunk/reactos/subsys/win32k/ntuser/menu.c
Modified: trunk/reactos/subsys/win32k/ntuser/monitor.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
_____
Modified: trunk/reactos/subsys/win32k/ntuser/accelerator.c
--- trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-18
23:06:15 UTC (rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/accelerator.c 2005-09-19
00:02:39 UTC (rev 17924)
@@ -74,18 +74,20 @@
{
PACCELERATOR_TABLE Accel;
- if (!hAccel) return NULL;
+ if (!hAccel)
+ {
+ SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
+ return NULL;
+ }
Accel= UserGetObject(&gHandleTable, hAccel, otAccel);
-
- if (Accel)
+ if (!Accel)
{
- ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0);
- }
- else
- {
SetLastWin32Error(ERROR_INVALID_ACCEL_HANDLE);
+ return NULL;
}
+
+ ASSERT(USER_BODY_TO_HEADER(Accel)->RefCount >= 0);
return Accel;
}
_____
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
--- trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-09-18
23:06:15 UTC (rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/cursoricon.c 2005-09-19
00:02:39 UTC (rev 17924)
@@ -77,7 +77,11 @@
{
PCURICON_OBJECT CurIcon;
- if (!hCurIcon) return NULL;
+ if (!hCurIcon)
+ {
+ SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE);
+ return NULL;
+ }
CurIcon = (PCURICON_OBJECT)UserGetObject(&gHandleTable, hCurIcon,
otCursorIcon);
if (!CurIcon)
_____
Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
--- trunk/reactos/subsys/win32k/ntuser/hook.c 2005-09-18 23:06:15 UTC
(rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/hook.c 2005-09-19 00:02:39 UTC
(rev 17924)
@@ -59,21 +59,28 @@
}
-PHOOK FASTCALL IntGetHookObject(HHOOK hWnd)
+PHOOK FASTCALL IntGetHookObject(HHOOK hHook)
{
-
- PHOOK Window = (PHOOK)UserGetObject(&gHandleTable, hWnd, otHook);
- if (!Window)
+ PHOOK Hook;
+
+ if (!hHook)
{
SetLastWin32Error(ERROR_INVALID_HOOK_HANDLE);
return NULL;
}
+
+ Hook = (PHOOK)UserGetObject(&gHandleTable, hHook, otHook);
+ if (!Hook)
+ {
+ SetLastWin32Error(ERROR_INVALID_HOOK_HANDLE);
+ return NULL;
+ }
- ASSERT(USER_BODY_TO_HEADER(Window)->RefCount >= 0);
+ ASSERT(USER_BODY_TO_HEADER(Hook)->RefCount >= 0);
- USER_BODY_TO_HEADER(Window)->RefCount++;
+ USER_BODY_TO_HEADER(Hook)->RefCount++;
- return Window;
+ return Hook;
}
_____
Modified: trunk/reactos/subsys/win32k/ntuser/hotkey.c
--- trunk/reactos/subsys/win32k/ntuser/hotkey.c 2005-09-18 23:06:15 UTC
(rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/hotkey.c 2005-09-19 00:02:39 UTC
(rev 17924)
@@ -154,6 +154,10 @@
}
+
+/* SYSCALLS
*****************************************************************/
+
+
BOOL STDCALL
NtUserRegisterHotKey(HWND hWnd,
int id,
_____
Modified: trunk/reactos/subsys/win32k/ntuser/menu.c
--- trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-18 23:06:15 UTC
(rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/menu.c 2005-09-19 00:02:39 UTC
(rev 17924)
@@ -115,7 +115,15 @@
PMENU_OBJECT FASTCALL UserGetMenuObject(HMENU hMenu)
{
- PMENU_OBJECT Menu = (PMENU_OBJECT)UserGetObject(&gHandleTable,
hMenu, otMenu);
+ PMENU_OBJECT Menu;
+
+ if (!hMenu)
+ {
+ SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
+ return NULL;
+ }
+
+ Menu = (PMENU_OBJECT)UserGetObject(&gHandleTable, hMenu, otMenu);
if (!Menu)
{
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
_____
Modified: trunk/reactos/subsys/win32k/ntuser/monitor.c
--- trunk/reactos/subsys/win32k/ntuser/monitor.c 2005-09-18
23:06:15 UTC (rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/monitor.c 2005-09-19
00:02:39 UTC (rev 17924)
@@ -124,7 +124,16 @@
PMONITOR_OBJECT FASTCALL
UserGetMonitorObject(IN HMONITOR hMonitor)
{
- PMONITOR_OBJECT Monitor =
(PMONITOR_OBJECT)UserGetObject(&gHandleTable, hMonitor, otMonitor);
+ PMONITOR_OBJECT Monitor;
+
+ if (!hMonitor)
+ {
+ SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
+ return NULL;
+ }
+
+
+ Monitor = (PMONITOR_OBJECT)UserGetObject(&gHandleTable, hMonitor,
otMonitor);
if (!Monitor)
{
SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
_____
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
--- trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-18 23:06:15 UTC
(rev 17923)
+++ trunk/reactos/subsys/win32k/ntuser/window.c 2005-09-19 00:02:39 UTC
(rev 17924)
@@ -97,7 +97,11 @@
{
PWINDOW_OBJECT Window;
- if (!hWnd) return NULL;
+ if (!hWnd)
+ {
+ SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
+ return NULL;
+ }
Window = (PWINDOW_OBJECT)UserGetObject(&gHandleTable, hWnd,
otWindow);
if (!Window || 0 != (Window->Status & WINDOWSTATUS_DESTROYED))
@@ -3233,7 +3237,6 @@
if (!(Window = UserGetWindowObject(hWnd)))
{
- SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return 0;
}
Show replies by date