mirror of
https://github.com/reactos/reactos.git
synced 2025-08-13 15:15:51 +00:00
[IMM32] Add ValidateHandle function (#4467)
Set the last error on failure of handle validation. CORE-11700
This commit is contained in:
parent
e9df3176f7
commit
b0b925d2b0
5 changed files with 23 additions and 17 deletions
|
@ -167,7 +167,7 @@ static PVOID FASTCALL DesktopPtrToUser(PVOID ptr)
|
|||
return (PVOID)NtUserCallOneParam((DWORD_PTR)ptr, ONEPARAM_ROUTINE_GETDESKTOPMAPPING);
|
||||
}
|
||||
|
||||
// Win: HMValidateHandle
|
||||
// Win: HMValidateHandleNoRip
|
||||
LPVOID FASTCALL ValidateHandleNoErr(HANDLE hObject, UINT uType)
|
||||
{
|
||||
UINT index;
|
||||
|
@ -203,14 +203,18 @@ LPVOID FASTCALL ValidateHandleNoErr(HANDLE hObject, UINT uType)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
PWND FASTCALL ValidateHwndNoErr(HWND hwnd)
|
||||
// Win: HMValidateHandle
|
||||
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
|
||||
{
|
||||
/* See if the window is cached */
|
||||
PCLIENTINFO ClientInfo = GetWin32ClientInfo();
|
||||
if (hwnd == ClientInfo->CallbackWnd.hWnd)
|
||||
return ClientInfo->CallbackWnd.pWnd;
|
||||
LPVOID pvObj = ValidateHandleNoErr(hObject, uType);
|
||||
if (pvObj)
|
||||
return pvObj;
|
||||
|
||||
return ValidateHandleNoErr(hwnd, TYPE_WINDOW);
|
||||
if (uType == TYPE_WINDOW)
|
||||
SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
||||
else
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Win: TestInputContextProcess
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue