From 4ab750a26fcbffcc50bc1ea76dbdbb3992d089fb Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 18 Sep 2007 05:07:49 +0000 Subject: [PATCH] - Implement NtUserValidateHandleSecure and most support functions moved from static and added to their respected headers. svn path=/trunk/; revision=29090 --- .../win32/win32k/include/accelerator.h | 1 + .../subsystems/win32/win32k/include/hook.h | 1 + .../subsystems/win32/win32k/include/monitor.h | 1 + .../win32/win32k/ntuser/accelerator.c | 1 - .../subsystems/win32/win32k/ntuser/monitor.c | 1 - .../subsystems/win32/win32k/ntuser/ntstubs.c | 11 --- .../subsystems/win32/win32k/ntuser/window.c | 79 +++++++++++++++++++ 7 files changed, 82 insertions(+), 13 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/accelerator.h b/reactos/subsystems/win32/win32k/include/accelerator.h index af8c482163a..98070ed476a 100644 --- a/reactos/subsystems/win32/win32k/include/accelerator.h +++ b/reactos/subsystems/win32/win32k/include/accelerator.h @@ -18,5 +18,6 @@ CleanupAcceleratorImpl(); VOID RegisterThreadAcceleratorTable(struct _ETHREAD *Thread); +PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL); #endif /* _WIN32K_ACCELERATOR_H */ diff --git a/reactos/subsystems/win32/win32k/include/hook.h b/reactos/subsystems/win32/win32k/include/hook.h index e0f6376ba68..1c160e0d768 100644 --- a/reactos/subsystems/win32/win32k/include/hook.h +++ b/reactos/subsystems/win32/win32k/include/hook.h @@ -25,6 +25,7 @@ typedef struct tagHOOKTABLE LRESULT FASTCALL co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam); VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread); +PHOOK FASTCALL IntGetHookObject(HHOOK); #endif /* _WIN32K_HOOK_H */ diff --git a/reactos/subsystems/win32/win32k/include/monitor.h b/reactos/subsystems/win32/win32k/include/monitor.h index ab0bf3c8755..281f2ef82af 100644 --- a/reactos/subsystems/win32/win32k/include/monitor.h +++ b/reactos/subsystems/win32/win32k/include/monitor.h @@ -22,6 +22,7 @@ NTSTATUS CleanupMonitorImpl(); NTSTATUS IntAttachMonitor(GDIDEVICE *pGdiDevice, ULONG DisplayNumber); NTSTATUS IntDetachMonitor(GDIDEVICE *pGdiDevice); +PMONITOR_OBJECT FASTCALL UserGetMonitorObject(IN HMONITOR); #endif /* _WIN32K_MONITOR_H */ diff --git a/reactos/subsystems/win32/win32k/ntuser/accelerator.c b/reactos/subsystems/win32/win32k/ntuser/accelerator.c index 8289768e8fc..3aec0418fa5 100644 --- a/reactos/subsystems/win32/win32k/ntuser/accelerator.c +++ b/reactos/subsystems/win32/win32k/ntuser/accelerator.c @@ -69,7 +69,6 @@ CleanupAcceleratorImpl(VOID) } -static PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel) { PACCELERATOR_TABLE Accel; diff --git a/reactos/subsystems/win32/win32k/ntuser/monitor.c b/reactos/subsystems/win32/win32k/ntuser/monitor.c index 1d89da5d643..9c2bbc5c2ea 100644 --- a/reactos/subsystems/win32/win32k/ntuser/monitor.c +++ b/reactos/subsystems/win32/win32k/ntuser/monitor.c @@ -120,7 +120,6 @@ IntDestroyMonitorObject(IN PMONITOR_OBJECT pMonitor) } -static PMONITOR_OBJECT FASTCALL UserGetMonitorObject(IN HMONITOR hMonitor) { diff --git a/reactos/subsystems/win32/win32k/ntuser/ntstubs.c b/reactos/subsystems/win32/win32k/ntuser/ntstubs.c index 3ccd58a9624..1b63f179863 100644 --- a/reactos/subsystems/win32/win32k/ntuser/ntstubs.c +++ b/reactos/subsystems/win32/win32k/ntuser/ntstubs.c @@ -637,17 +637,6 @@ NtUserUserHandleGrantAccess( return 0; } -BOOL -STDCALL -NtUserValidateHandleSecure( - HANDLE hHdl, - BOOL Restricted) -{ - UNIMPLEMENTED - - return 0; -} - DWORD STDCALL NtUserWaitForInputIdle( diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index e8f646cf028..6108bd0c472 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -4683,5 +4683,84 @@ IntShowOwnedPopups(PWINDOW_OBJECT OwnerWnd, BOOL fShow ) return TRUE; } +/* + * NtUserValidateHandleSecure + * + * Status + * @implemented + */ + +BOOL +STDCALL +NtUserValidateHandleSecure( + HANDLE handle, + BOOL Restricted) +{ + if(!Restricted) + { + UINT uType; + { + PUSER_HANDLE_ENTRY entry; + if (!(entry = handle_to_entry(gHandleTable, handle ))) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + uType = entry->type; + } + switch (uType) + { + case otWindow: + { + PWINDOW_OBJECT Window; + if ((Window = UserGetWindowObject((HWND) handle))) return TRUE; + return FALSE; + } + case otMenu: + { + PMENU_OBJECT Menu; + if ((Menu = UserGetMenuObject((HMENU) handle))) return TRUE; + return FALSE; + } + case otAccel: + { + PACCELERATOR_TABLE Accel; + if ((Accel = UserGetAccelObject((HACCEL) handle))) return TRUE; + return FALSE; + } + case otCursorIcon: + { + PCURICON_OBJECT Cursor; + if ((Cursor = UserGetCurIconObject((HCURSOR) handle))) return TRUE; + return FALSE; + } + case otHook: + { + PHOOK Hook; + if ((Hook = IntGetHookObject((HHOOK) handle))) return TRUE; + return FALSE; + } + case otMonitor: + { + PMONITOR_OBJECT Monitor; + if ((Monitor = UserGetMonitorObject((HMONITOR) handle))) return TRUE; + return FALSE; + } + case otCallProc: + { + WNDPROC_INFO Proc; + return UserGetCallProcInfo( handle, &Proc ); + } + default: + SetLastWin32Error(ERROR_INVALID_HANDLE); + } + } + else + { /* Is handle entry restricted? */ + UNIMPLEMENTED + } + return FALSE; +} + /* EOF */