mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
[WIN32K] - Formatting... No code change.
svn path=/trunk/; revision=54066
This commit is contained in:
parent
28e930a691
commit
b63c511bbf
2 changed files with 499 additions and 499 deletions
|
@ -20,157 +20,157 @@ DBG_DEFAULT_CHANNEL(UserAccel);
|
|||
|
||||
PACCELERATOR_TABLE FASTCALL UserGetAccelObject(HACCEL hAccel)
|
||||
{
|
||||
PACCELERATOR_TABLE Accel;
|
||||
PACCELERATOR_TABLE Accel;
|
||||
|
||||
if (!hAccel)
|
||||
{
|
||||
EngSetLastError(ERROR_INVALID_ACCEL_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
if (!hAccel)
|
||||
{
|
||||
EngSetLastError(ERROR_INVALID_ACCEL_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Accel= UserGetObject(gHandleTable, hAccel, otAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
EngSetLastError(ERROR_INVALID_ACCEL_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
Accel = UserGetObject(gHandleTable, hAccel, otAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
EngSetLastError(ERROR_INVALID_ACCEL_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return Accel;
|
||||
return Accel;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
BOOLEAN FASTCALL
|
||||
co_IntTranslateAccelerator(
|
||||
PWND Window,
|
||||
CONST MSG *pMsg,
|
||||
CONST ACCEL *pAccel)
|
||||
PWND Window,
|
||||
CONST MSG *pMsg,
|
||||
CONST ACCEL *pAccel)
|
||||
{
|
||||
BOOL bFound = FALSE;
|
||||
UINT Mask = 0, nPos;
|
||||
HWND hWnd;
|
||||
HMENU hMenu, hSubMenu;
|
||||
PMENU_OBJECT MenuObject, SubMenu;
|
||||
PMENU_ITEM MenuItem;
|
||||
BOOL bFound = FALSE;
|
||||
UINT Mask = 0, nPos;
|
||||
HWND hWnd;
|
||||
HMENU hMenu, hSubMenu;
|
||||
PMENU_OBJECT MenuObject, SubMenu;
|
||||
PMENU_ITEM MenuItem;
|
||||
|
||||
ASSERT_REFS_CO(Window);
|
||||
ASSERT_REFS_CO(Window);
|
||||
|
||||
hWnd = Window->head.h;
|
||||
hWnd = Window->head.h;
|
||||
|
||||
TRACE("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x)\n",
|
||||
hWnd, pMsg->message, pMsg->wParam, pMsg->lParam, pAccel->fVirt, pAccel->key, pAccel->cmd);
|
||||
TRACE("IntTranslateAccelerator(hwnd %x, message %x, wParam %x, lParam %x, fVirt %d, key %x, cmd %x)\n",
|
||||
hWnd, pMsg->message, pMsg->wParam, pMsg->lParam, pAccel->fVirt, pAccel->key, pAccel->cmd);
|
||||
|
||||
if (UserGetKeyState(VK_CONTROL) & 0x8000) Mask |= FCONTROL;
|
||||
if (UserGetKeyState(VK_MENU) & 0x8000) Mask |= FALT; // FIXME: VK_LMENU (msg winetest!)
|
||||
if (UserGetKeyState(VK_SHIFT) & 0x8000) Mask |= FSHIFT;
|
||||
TRACE("Mask 0x%x\n", Mask);
|
||||
if (UserGetKeyState(VK_CONTROL) & 0x8000) Mask |= FCONTROL;
|
||||
if (UserGetKeyState(VK_MENU) & 0x8000) Mask |= FALT; // FIXME: VK_LMENU (msg winetest!)
|
||||
if (UserGetKeyState(VK_SHIFT) & 0x8000) Mask |= FSHIFT;
|
||||
TRACE("Mask 0x%x\n", Mask);
|
||||
|
||||
if (pAccel->fVirt & FVIRTKEY)
|
||||
{
|
||||
/* This is a virtual key. Process WM_(SYS)KEYDOWN messages. */
|
||||
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
|
||||
{
|
||||
/* Check virtual key and SHIFT, CTRL, LALT state */
|
||||
if (pMsg->wParam == pAccel->key && Mask == (pAccel->fVirt & (FSHIFT | FCONTROL | FALT)))
|
||||
{
|
||||
bFound = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a char code. Process WM_(SYS)CHAR messages. */
|
||||
if (pMsg->message == WM_CHAR || pMsg->message == WM_SYSCHAR)
|
||||
{
|
||||
/* Check char code and LALT state only */
|
||||
if (pMsg->wParam == pAccel->key && (Mask & FALT) == (pAccel->fVirt & FALT))
|
||||
{
|
||||
bFound = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pAccel->fVirt & FVIRTKEY)
|
||||
{
|
||||
/* This is a virtual key. Process WM_(SYS)KEYDOWN messages. */
|
||||
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
|
||||
{
|
||||
/* Check virtual key and SHIFT, CTRL, LALT state */
|
||||
if (pMsg->wParam == pAccel->key && Mask == (pAccel->fVirt & (FSHIFT | FCONTROL | FALT)))
|
||||
{
|
||||
bFound = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a char code. Process WM_(SYS)CHAR messages. */
|
||||
if (pMsg->message == WM_CHAR || pMsg->message == WM_SYSCHAR)
|
||||
{
|
||||
/* Check char code and LALT state only */
|
||||
if (pMsg->wParam == pAccel->key && (Mask & FALT) == (pAccel->fVirt & FALT))
|
||||
{
|
||||
bFound = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFound)
|
||||
{
|
||||
/* Don't translate this msg */
|
||||
TRACE("IntTranslateAccelerator returns FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
if (!bFound)
|
||||
{
|
||||
/* Don't translate this msg */
|
||||
TRACE("IntTranslateAccelerator returns FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if accelerator is associated with menu command */
|
||||
hMenu = (Window->style & WS_CHILD) ? 0 : (HMENU)Window->IDMenu;
|
||||
hSubMenu = NULL;
|
||||
MenuObject = IntGetMenuObject(hMenu);
|
||||
if (MenuObject)
|
||||
{
|
||||
nPos = IntGetMenuItemByFlag(MenuObject,
|
||||
pAccel->cmd,
|
||||
MF_BYCOMMAND,
|
||||
&SubMenu,
|
||||
&MenuItem,
|
||||
NULL);
|
||||
if (nPos != (UINT)-1)
|
||||
hSubMenu = SubMenu->head.h;
|
||||
else
|
||||
hMenu = NULL;
|
||||
}
|
||||
if (!hMenu)
|
||||
{
|
||||
/* Check system menu now */
|
||||
hMenu = Window->SystemMenu;
|
||||
hSubMenu = hMenu; /* system menu is a popup menu */
|
||||
MenuObject = IntGetMenuObject(hMenu);
|
||||
if (MenuObject)
|
||||
{
|
||||
nPos = IntGetMenuItemByFlag(MenuObject,
|
||||
pAccel->cmd,
|
||||
MF_BYCOMMAND,
|
||||
&SubMenu,
|
||||
&MenuItem,
|
||||
NULL);
|
||||
if (nPos != (UINT)-1)
|
||||
hSubMenu = SubMenu->head.h;
|
||||
else
|
||||
hMenu = NULL;
|
||||
}
|
||||
}
|
||||
/* Check if accelerator is associated with menu command */
|
||||
hMenu = (Window->style & WS_CHILD) ? 0 : (HMENU)Window->IDMenu;
|
||||
hSubMenu = NULL;
|
||||
MenuObject = IntGetMenuObject(hMenu);
|
||||
if (MenuObject)
|
||||
{
|
||||
nPos = IntGetMenuItemByFlag(MenuObject,
|
||||
pAccel->cmd,
|
||||
MF_BYCOMMAND,
|
||||
&SubMenu,
|
||||
&MenuItem,
|
||||
NULL);
|
||||
if (nPos != (UINT) - 1)
|
||||
hSubMenu = SubMenu->head.h;
|
||||
else
|
||||
hMenu = NULL;
|
||||
}
|
||||
if (!hMenu)
|
||||
{
|
||||
/* Check system menu now */
|
||||
hMenu = Window->SystemMenu;
|
||||
hSubMenu = hMenu; /* system menu is a popup menu */
|
||||
MenuObject = IntGetMenuObject(hMenu);
|
||||
if (MenuObject)
|
||||
{
|
||||
nPos = IntGetMenuItemByFlag(MenuObject,
|
||||
pAccel->cmd,
|
||||
MF_BYCOMMAND,
|
||||
&SubMenu,
|
||||
&MenuItem,
|
||||
NULL);
|
||||
if (nPos != (UINT) - 1)
|
||||
hSubMenu = SubMenu->head.h;
|
||||
else
|
||||
hMenu = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is a menu item, there is no capturing enabled and
|
||||
window is not disabled, send WM_INITMENU */
|
||||
if (hMenu && !IntGetCaptureWindow())
|
||||
{
|
||||
co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
|
||||
if (hSubMenu)
|
||||
{
|
||||
nPos = IntFindSubMenu(&hMenu, hSubMenu);
|
||||
TRACE("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos);
|
||||
co_IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
|
||||
}
|
||||
}
|
||||
/* If this is a menu item, there is no capturing enabled and
|
||||
window is not disabled, send WM_INITMENU */
|
||||
if (hMenu && !IntGetCaptureWindow())
|
||||
{
|
||||
co_IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L);
|
||||
if (hSubMenu)
|
||||
{
|
||||
nPos = IntFindSubMenu(&hMenu, hSubMenu);
|
||||
TRACE("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos);
|
||||
co_IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't send any message if:
|
||||
- window is disabled
|
||||
- menu item is disabled
|
||||
- this is window menu and window is minimized */
|
||||
if (!(Window->style & WS_DISABLED) &&
|
||||
!(hMenu && IntGetMenuState(hMenu, pAccel->cmd, MF_BYCOMMAND) & (MF_DISABLED|MF_GRAYED)) &&
|
||||
!(hMenu && hMenu == (HMENU)Window->IDMenu && (Window->style & WS_MINIMIZED)))
|
||||
{
|
||||
/* If this is system menu item, send WM_SYSCOMMAND, otherwise send WM_COMMAND */
|
||||
if (hMenu && hMenu == Window->SystemMenu)
|
||||
{
|
||||
TRACE("Sending WM_SYSCOMMAND, wParam=%0x\n", pAccel->cmd);
|
||||
co_IntSendMessage(hWnd, WM_SYSCOMMAND, pAccel->cmd, 0x00010000L);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Sending WM_COMMAND, wParam=%0x\n", 0x10000 | pAccel->cmd);
|
||||
co_IntSendMessage(hWnd, WM_COMMAND, 0x10000 | pAccel->cmd, 0L);
|
||||
}
|
||||
}
|
||||
/* Don't send any message if:
|
||||
- window is disabled
|
||||
- menu item is disabled
|
||||
- this is window menu and window is minimized */
|
||||
if (!(Window->style & WS_DISABLED) &&
|
||||
!(hMenu && IntGetMenuState(hMenu, pAccel->cmd, MF_BYCOMMAND) & (MF_DISABLED | MF_GRAYED)) &&
|
||||
!(hMenu && hMenu == (HMENU)Window->IDMenu && (Window->style & WS_MINIMIZED)))
|
||||
{
|
||||
/* If this is system menu item, send WM_SYSCOMMAND, otherwise send WM_COMMAND */
|
||||
if (hMenu && hMenu == Window->SystemMenu)
|
||||
{
|
||||
TRACE("Sending WM_SYSCOMMAND, wParam=%0x\n", pAccel->cmd);
|
||||
co_IntSendMessage(hWnd, WM_SYSCOMMAND, pAccel->cmd, 0x00010000L);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Sending WM_COMMAND, wParam=%0x\n", 0x10000 | pAccel->cmd);
|
||||
co_IntSendMessage(hWnd, WM_COMMAND, 0x10000 | pAccel->cmd, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("IntTranslateAccelerator returns TRUE\n");
|
||||
return TRUE;
|
||||
TRACE("IntTranslateAccelerator returns TRUE\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -180,267 +180,267 @@ co_IntTranslateAccelerator(
|
|||
int
|
||||
APIENTRY
|
||||
NtUserCopyAcceleratorTable(
|
||||
HACCEL hAccel,
|
||||
LPACCEL Entries,
|
||||
int EntriesCount)
|
||||
HACCEL hAccel,
|
||||
LPACCEL Entries,
|
||||
int EntriesCount)
|
||||
{
|
||||
PACCELERATOR_TABLE Accel;
|
||||
int Ret;
|
||||
DECLARE_RETURN(int);
|
||||
PACCELERATOR_TABLE Accel;
|
||||
int Ret;
|
||||
DECLARE_RETURN(int);
|
||||
|
||||
TRACE("Enter NtUserCopyAcceleratorTable\n");
|
||||
UserEnterShared();
|
||||
TRACE("Enter NtUserCopyAcceleratorTable\n");
|
||||
UserEnterShared();
|
||||
|
||||
Accel = UserGetAccelObject(hAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
RETURN(0);
|
||||
}
|
||||
Accel = UserGetAccelObject(hAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
RETURN(0);
|
||||
}
|
||||
|
||||
/* If Entries is NULL return table size */
|
||||
if (!Entries)
|
||||
{
|
||||
RETURN(Accel->Count);
|
||||
}
|
||||
/* If Entries is NULL return table size */
|
||||
if (!Entries)
|
||||
{
|
||||
RETURN(Accel->Count);
|
||||
}
|
||||
|
||||
/* Don't overrun */
|
||||
if (Accel->Count < EntriesCount)
|
||||
EntriesCount = Accel->Count;
|
||||
/* Don't overrun */
|
||||
if (Accel->Count < EntriesCount)
|
||||
EntriesCount = Accel->Count;
|
||||
|
||||
Ret = 0;
|
||||
Ret = 0;
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForWrite(Entries, EntriesCount*sizeof(Entries[0]), 4);
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForWrite(Entries, EntriesCount*sizeof(Entries[0]), 4);
|
||||
|
||||
for (Ret = 0; Ret < EntriesCount; Ret++)
|
||||
{
|
||||
Entries[Ret].fVirt = Accel->Table[Ret].fVirt;
|
||||
Entries[Ret].key = Accel->Table[Ret].key;
|
||||
Entries[Ret].cmd = Accel->Table[Ret].cmd;
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
SetLastNtError(_SEH2_GetExceptionCode());
|
||||
Ret = 0;
|
||||
}
|
||||
_SEH2_END;
|
||||
for (Ret = 0; Ret < EntriesCount; Ret++)
|
||||
{
|
||||
Entries[Ret].fVirt = Accel->Table[Ret].fVirt;
|
||||
Entries[Ret].key = Accel->Table[Ret].key;
|
||||
Entries[Ret].cmd = Accel->Table[Ret].cmd;
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
SetLastNtError(_SEH2_GetExceptionCode());
|
||||
Ret = 0;
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
RETURN(Ret);
|
||||
RETURN(Ret);
|
||||
|
||||
CLEANUP:
|
||||
TRACE("Leave NtUserCopyAcceleratorTable, ret=%i\n", _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
TRACE("Leave NtUserCopyAcceleratorTable, ret=%i\n", _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
}
|
||||
|
||||
HACCEL
|
||||
APIENTRY
|
||||
NtUserCreateAcceleratorTable(
|
||||
LPACCEL Entries,
|
||||
SIZE_T EntriesCount)
|
||||
LPACCEL Entries,
|
||||
SIZE_T EntriesCount)
|
||||
{
|
||||
PACCELERATOR_TABLE Accel;
|
||||
HACCEL hAccel;
|
||||
INT Index;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
DECLARE_RETURN(HACCEL);
|
||||
PACCELERATOR_TABLE Accel;
|
||||
HACCEL hAccel;
|
||||
INT Index;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
DECLARE_RETURN(HACCEL);
|
||||
|
||||
TRACE("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n",
|
||||
TRACE("Enter NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d)\n",
|
||||
Entries, EntriesCount);
|
||||
UserEnterExclusive();
|
||||
UserEnterExclusive();
|
||||
|
||||
if (!Entries || EntriesCount <= 0)
|
||||
{
|
||||
SetLastNtError(STATUS_INVALID_PARAMETER);
|
||||
RETURN( (HACCEL) NULL );
|
||||
}
|
||||
if (!Entries || EntriesCount <= 0)
|
||||
{
|
||||
SetLastNtError(STATUS_INVALID_PARAMETER);
|
||||
RETURN( (HACCEL) NULL );
|
||||
}
|
||||
|
||||
Accel = UserCreateObject(gHandleTable, NULL, (PHANDLE)&hAccel, otAccel, sizeof(ACCELERATOR_TABLE));
|
||||
Accel = UserCreateObject(gHandleTable, NULL, (PHANDLE)&hAccel, otAccel, sizeof(ACCELERATOR_TABLE));
|
||||
|
||||
if (Accel == NULL)
|
||||
{
|
||||
SetLastNtError(STATUS_NO_MEMORY);
|
||||
RETURN( (HACCEL) NULL );
|
||||
}
|
||||
if (Accel == NULL)
|
||||
{
|
||||
SetLastNtError(STATUS_NO_MEMORY);
|
||||
RETURN( (HACCEL) NULL );
|
||||
}
|
||||
|
||||
Accel->Count = EntriesCount;
|
||||
Accel->Table = ExAllocatePoolWithTag(PagedPool, EntriesCount * sizeof(ACCEL), USERTAG_ACCEL);
|
||||
if (Accel->Table == NULL)
|
||||
{
|
||||
UserDereferenceObject(Accel);
|
||||
UserDeleteObject(hAccel, otAccel);
|
||||
SetLastNtError(STATUS_NO_MEMORY);
|
||||
RETURN( (HACCEL) NULL);
|
||||
}
|
||||
Accel->Count = EntriesCount;
|
||||
Accel->Table = ExAllocatePoolWithTag(PagedPool, EntriesCount * sizeof(ACCEL), USERTAG_ACCEL);
|
||||
if (Accel->Table == NULL)
|
||||
{
|
||||
UserDereferenceObject(Accel);
|
||||
UserDeleteObject(hAccel, otAccel);
|
||||
SetLastNtError(STATUS_NO_MEMORY);
|
||||
RETURN( (HACCEL) NULL);
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForRead(Entries, EntriesCount * sizeof(ACCEL), 4);
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForRead(Entries, EntriesCount * sizeof(ACCEL), 4);
|
||||
|
||||
for (Index = 0; Index < EntriesCount; Index++)
|
||||
{
|
||||
Accel->Table[Index].fVirt = Entries[Index].fVirt & FVIRT_MASK;
|
||||
if(Accel->Table[Index].fVirt & FVIRTKEY)
|
||||
{
|
||||
Accel->Table[Index].key = Entries[Index].key;
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlMultiByteToUnicodeN(&Accel->Table[Index].key,
|
||||
sizeof(WCHAR),
|
||||
NULL,
|
||||
(PCSTR)&Entries[Index].key,
|
||||
sizeof(CHAR));
|
||||
}
|
||||
for (Index = 0; Index < EntriesCount; Index++)
|
||||
{
|
||||
Accel->Table[Index].fVirt = Entries[Index].fVirt & FVIRT_MASK;
|
||||
if(Accel->Table[Index].fVirt & FVIRTKEY)
|
||||
{
|
||||
Accel->Table[Index].key = Entries[Index].key;
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlMultiByteToUnicodeN(&Accel->Table[Index].key,
|
||||
sizeof(WCHAR),
|
||||
NULL,
|
||||
(PCSTR)&Entries[Index].key,
|
||||
sizeof(CHAR));
|
||||
}
|
||||
|
||||
Accel->Table[Index].cmd = Entries[Index].cmd;
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
Accel->Table[Index].cmd = Entries[Index].cmd;
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Accel->Table, USERTAG_ACCEL);
|
||||
UserDereferenceObject(Accel);
|
||||
UserDeleteObject(hAccel, otAccel);
|
||||
SetLastNtError(Status);
|
||||
RETURN( (HACCEL) NULL);
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Accel->Table, USERTAG_ACCEL);
|
||||
UserDereferenceObject(Accel);
|
||||
UserDeleteObject(hAccel, otAccel);
|
||||
SetLastNtError(Status);
|
||||
RETURN( (HACCEL) NULL);
|
||||
}
|
||||
|
||||
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
|
||||
/* FIXME: Save HandleTable in a list somewhere so we can clean it up again */
|
||||
|
||||
RETURN(hAccel);
|
||||
RETURN(hAccel);
|
||||
|
||||
CLEANUP:
|
||||
TRACE("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) = %x\n",
|
||||
TRACE("Leave NtUserCreateAcceleratorTable(Entries %p, EntriesCount %d) = %x\n",
|
||||
Entries, EntriesCount, _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
APIENTRY
|
||||
NtUserDestroyAcceleratorTable(
|
||||
HACCEL hAccel)
|
||||
HACCEL hAccel)
|
||||
{
|
||||
PACCELERATOR_TABLE Accel;
|
||||
DECLARE_RETURN(BOOLEAN);
|
||||
PACCELERATOR_TABLE Accel;
|
||||
DECLARE_RETURN(BOOLEAN);
|
||||
|
||||
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
|
||||
usage count (and return TRUE).
|
||||
FIXME: Destroy only tables created using CreateAcceleratorTable.
|
||||
*/
|
||||
/* FIXME: If the handle table is from a call to LoadAcceleratorTable, decrement it's
|
||||
usage count (and return TRUE).
|
||||
FIXME: Destroy only tables created using CreateAcceleratorTable.
|
||||
*/
|
||||
|
||||
TRACE("NtUserDestroyAcceleratorTable(Table %x)\n", hAccel);
|
||||
UserEnterExclusive();
|
||||
TRACE("NtUserDestroyAcceleratorTable(Table %x)\n", hAccel);
|
||||
UserEnterExclusive();
|
||||
|
||||
if (!(Accel = UserGetAccelObject(hAccel)))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
if (!(Accel = UserGetAccelObject(hAccel)))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
|
||||
if (Accel->Table != NULL)
|
||||
{
|
||||
ExFreePoolWithTag(Accel->Table, USERTAG_ACCEL);
|
||||
Accel->Table = NULL;
|
||||
}
|
||||
if (Accel->Table != NULL)
|
||||
{
|
||||
ExFreePoolWithTag(Accel->Table, USERTAG_ACCEL);
|
||||
Accel->Table = NULL;
|
||||
}
|
||||
|
||||
UserDeleteObject(hAccel, otAccel);
|
||||
UserDeleteObject(hAccel, otAccel);
|
||||
|
||||
RETURN( TRUE);
|
||||
RETURN( TRUE);
|
||||
|
||||
CLEANUP:
|
||||
TRACE("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n", hAccel,_ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
TRACE("Leave NtUserDestroyAcceleratorTable(Table %x) = %i\n", hAccel, _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
}
|
||||
|
||||
int
|
||||
APIENTRY
|
||||
NtUserTranslateAccelerator(
|
||||
HWND hWnd,
|
||||
HACCEL hAccel,
|
||||
LPMSG pUnsafeMessage)
|
||||
HWND hWnd,
|
||||
HACCEL hAccel,
|
||||
LPMSG pUnsafeMessage)
|
||||
{
|
||||
PWND Window = NULL;
|
||||
PACCELERATOR_TABLE Accel = NULL;
|
||||
ULONG i;
|
||||
MSG Message;
|
||||
USER_REFERENCE_ENTRY AccelRef, WindowRef;
|
||||
DECLARE_RETURN(int);
|
||||
PWND Window = NULL;
|
||||
PACCELERATOR_TABLE Accel = NULL;
|
||||
ULONG i;
|
||||
MSG Message;
|
||||
USER_REFERENCE_ENTRY AccelRef, WindowRef;
|
||||
DECLARE_RETURN(int);
|
||||
|
||||
TRACE("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n",
|
||||
TRACE("NtUserTranslateAccelerator(hWnd %x, Table %x, Message %p)\n",
|
||||
hWnd, hAccel, pUnsafeMessage);
|
||||
UserEnterShared();
|
||||
UserEnterShared();
|
||||
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForRead(pUnsafeMessage, sizeof(MSG), 4);
|
||||
RtlCopyMemory(&Message, pUnsafeMessage, sizeof(MSG));
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
SetLastNtError(_SEH2_GetExceptionCode());
|
||||
_SEH2_YIELD(RETURN( 0));
|
||||
}
|
||||
_SEH2_END;
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForRead(pUnsafeMessage, sizeof(MSG), 4);
|
||||
RtlCopyMemory(&Message, pUnsafeMessage, sizeof(MSG));
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
SetLastNtError(_SEH2_GetExceptionCode());
|
||||
_SEH2_YIELD(RETURN( 0));
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if ((Message.message != WM_KEYDOWN) &&
|
||||
(Message.message != WM_SYSKEYDOWN) &&
|
||||
(Message.message != WM_SYSCHAR) &&
|
||||
(Message.message != WM_CHAR))
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
if ((Message.message != WM_KEYDOWN) &&
|
||||
(Message.message != WM_SYSKEYDOWN) &&
|
||||
(Message.message != WM_SYSCHAR) &&
|
||||
(Message.message != WM_CHAR))
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
|
||||
Accel = UserGetAccelObject(hAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
Accel = UserGetAccelObject(hAccel);
|
||||
if (!Accel)
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
|
||||
UserRefObjectCo(Accel, &AccelRef);
|
||||
UserRefObjectCo(Accel, &AccelRef);
|
||||
|
||||
Window = UserGetWindowObject(hWnd);
|
||||
if (!Window)
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
Window = UserGetWindowObject(hWnd);
|
||||
if (!Window)
|
||||
{
|
||||
RETURN( 0);
|
||||
}
|
||||
|
||||
UserRefObjectCo(Window, &WindowRef);
|
||||
UserRefObjectCo(Window, &WindowRef);
|
||||
|
||||
/* FIXME: Associate AcceleratorTable with the current thread */
|
||||
/* FIXME: Associate AcceleratorTable with the current thread */
|
||||
|
||||
for (i = 0; i < Accel->Count; i++)
|
||||
{
|
||||
if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i]))
|
||||
{
|
||||
RETURN( 1);
|
||||
}
|
||||
for (i = 0; i < Accel->Count; i++)
|
||||
{
|
||||
if (co_IntTranslateAccelerator(Window, &Message, &Accel->Table[i]))
|
||||
{
|
||||
RETURN( 1);
|
||||
}
|
||||
|
||||
/* Undocumented feature... */
|
||||
if (Accel->Table[i].fVirt & FVIRT_TBL_END)
|
||||
break;
|
||||
}
|
||||
/* Undocumented feature... */
|
||||
if (Accel->Table[i].fVirt & FVIRT_TBL_END)
|
||||
break;
|
||||
}
|
||||
|
||||
RETURN( 0);
|
||||
RETURN( 0);
|
||||
|
||||
CLEANUP:
|
||||
if (Window) UserDerefObjectCo(Window);
|
||||
if (Accel) UserDerefObjectCo(Accel);
|
||||
if (Window) UserDerefObjectCo(Window);
|
||||
if (Accel) UserDerefObjectCo(Accel);
|
||||
|
||||
TRACE("NtUserTranslateAccelerator returns %d\n", _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
TRACE("NtUserTranslateAccelerator returns %d\n", _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ NTSTATUS
|
|||
NTAPI
|
||||
InitHotkeyImpl(VOID)
|
||||
{
|
||||
InitializeListHead(&gHotkeyList);
|
||||
InitializeListHead(&gHotkeyList);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0 //not used
|
||||
|
@ -38,7 +38,7 @@ NTSTATUS FASTCALL
|
|||
CleanupHotKeys(VOID)
|
||||
{
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -53,7 +53,7 @@ UINT FASTCALL
|
|||
IntGetModifiers(PBYTE pKeyState)
|
||||
{
|
||||
UINT fModifiers = 0;
|
||||
|
||||
|
||||
if (IS_KEY_DOWN(pKeyState, VK_SHIFT))
|
||||
fModifiers |= MOD_SHIFT;
|
||||
|
||||
|
@ -72,48 +72,48 @@ IntGetModifiers(PBYTE pKeyState)
|
|||
VOID FASTCALL
|
||||
UnregisterWindowHotKeys(PWND Window)
|
||||
{
|
||||
PHOT_KEY_ITEM HotKeyItem, tmp;
|
||||
PHOT_KEY_ITEM HotKeyItem, tmp;
|
||||
|
||||
LIST_FOR_EACH_SAFE(HotKeyItem, tmp, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->hWnd == Window->head.h)
|
||||
{
|
||||
RemoveEntryList (&HotKeyItem->ListEntry);
|
||||
ExFreePool (HotKeyItem);
|
||||
}
|
||||
}
|
||||
LIST_FOR_EACH_SAFE(HotKeyItem, tmp, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->hWnd == Window->head.h)
|
||||
{
|
||||
RemoveEntryList(&HotKeyItem->ListEntry);
|
||||
ExFreePool(HotKeyItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID FASTCALL
|
||||
UnregisterThreadHotKeys(struct _ETHREAD *Thread)
|
||||
{
|
||||
PHOT_KEY_ITEM HotKeyItem, tmp;
|
||||
PHOT_KEY_ITEM HotKeyItem, tmp;
|
||||
|
||||
LIST_FOR_EACH_SAFE(HotKeyItem, tmp, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->Thread == Thread)
|
||||
{
|
||||
RemoveEntryList (&HotKeyItem->ListEntry);
|
||||
ExFreePool (HotKeyItem);
|
||||
}
|
||||
}
|
||||
LIST_FOR_EACH_SAFE(HotKeyItem, tmp, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->Thread == Thread)
|
||||
{
|
||||
RemoveEntryList(&HotKeyItem->ListEntry);
|
||||
ExFreePool(HotKeyItem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PHOT_KEY_ITEM FASTCALL
|
||||
IsHotKey(UINT fsModifiers, WORD wVk)
|
||||
{
|
||||
PHOT_KEY_ITEM pHotKeyItem;
|
||||
PHOT_KEY_ITEM pHotKeyItem;
|
||||
|
||||
LIST_FOR_EACH(pHotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (pHotKeyItem->fsModifiers == fsModifiers && pHotKeyItem->vk == wVk)
|
||||
{
|
||||
return pHotKeyItem;
|
||||
}
|
||||
}
|
||||
LIST_FOR_EACH(pHotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (pHotKeyItem->fsModifiers == fsModifiers && pHotKeyItem->vk == wVk)
|
||||
{
|
||||
return pHotKeyItem;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -177,106 +177,106 @@ co_UserProcessHotKeys(WORD wVk, BOOL bIsDown)
|
|||
// Get/SetHotKey message support.
|
||||
//
|
||||
UINT FASTCALL
|
||||
DefWndGetHotKey( HWND hwnd )
|
||||
DefWndGetHotKey(HWND hwnd)
|
||||
{
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
|
||||
ERR("DefWndGetHotKey\n");
|
||||
ERR("DefWndGetHotKey\n");
|
||||
|
||||
if (IsListEmpty(&gHotkeyList)) return 0;
|
||||
if (IsListEmpty(&gHotkeyList)) return 0;
|
||||
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if ( HotKeyItem->hWnd == hwnd &&
|
||||
HotKeyItem->id == IDHOT_REACTOS )
|
||||
{
|
||||
return MAKELONG(HotKeyItem->vk, HotKeyItem->fsModifiers);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->hWnd == hwnd &&
|
||||
HotKeyItem->id == IDHOT_REACTOS)
|
||||
{
|
||||
return MAKELONG(HotKeyItem->vk, HotKeyItem->fsModifiers);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT FASTCALL
|
||||
DefWndSetHotKey( PWND pWnd, WPARAM wParam )
|
||||
INT FASTCALL
|
||||
DefWndSetHotKey(PWND pWnd, WPARAM wParam)
|
||||
{
|
||||
UINT fsModifiers, vk;
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
HWND hWnd;
|
||||
BOOL HaveSameWnd = FALSE;
|
||||
INT Ret = 1;
|
||||
UINT fsModifiers, vk;
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
HWND hWnd;
|
||||
BOOL HaveSameWnd = FALSE;
|
||||
INT Ret = 1;
|
||||
|
||||
ERR("DefWndSetHotKey wParam 0x%x\n", wParam);
|
||||
ERR("DefWndSetHotKey wParam 0x%x\n", wParam);
|
||||
|
||||
// A hot key cannot be associated with a child window.
|
||||
if (pWnd->style & WS_CHILD) return 0;
|
||||
// A hot key cannot be associated with a child window.
|
||||
if (pWnd->style & WS_CHILD) return 0;
|
||||
|
||||
// VK_ESCAPE, VK_SPACE, and VK_TAB are invalid hot keys.
|
||||
if ( LOWORD(wParam) == VK_ESCAPE ||
|
||||
// VK_ESCAPE, VK_SPACE, and VK_TAB are invalid hot keys.
|
||||
if (LOWORD(wParam) == VK_ESCAPE ||
|
||||
LOWORD(wParam) == VK_SPACE ||
|
||||
LOWORD(wParam) == VK_TAB ) return -1;
|
||||
LOWORD(wParam) == VK_TAB) return -1;
|
||||
|
||||
vk = LOWORD(wParam);
|
||||
fsModifiers = HIWORD(wParam);
|
||||
hWnd = UserHMGetHandle(pWnd);
|
||||
vk = LOWORD(wParam);
|
||||
fsModifiers = HIWORD(wParam);
|
||||
hWnd = UserHMGetHandle(pWnd);
|
||||
|
||||
if (wParam)
|
||||
{
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if ( HotKeyItem->fsModifiers == fsModifiers &&
|
||||
HotKeyItem->vk == vk &&
|
||||
HotKeyItem->id == IDHOT_REACTOS )
|
||||
{
|
||||
if (HotKeyItem->hWnd != hWnd)
|
||||
Ret = 2; // Another window already has the same hot key.
|
||||
if (wParam)
|
||||
{
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->fsModifiers == fsModifiers &&
|
||||
HotKeyItem->vk == vk &&
|
||||
HotKeyItem->id == IDHOT_REACTOS)
|
||||
{
|
||||
if (HotKeyItem->hWnd != hWnd)
|
||||
Ret = 2; // Another window already has the same hot key.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->hWnd == hWnd &&
|
||||
HotKeyItem->id == IDHOT_REACTOS)
|
||||
{
|
||||
HaveSameWnd = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if ( HotKeyItem->hWnd == hWnd &&
|
||||
HotKeyItem->id == IDHOT_REACTOS )
|
||||
{
|
||||
HaveSameWnd = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (HaveSameWnd)
|
||||
{
|
||||
if (wParam == 0)
|
||||
{ // Setting wParam to NULL removes the hot key associated with a window.
|
||||
UnregisterWindowHotKeys(pWnd);
|
||||
}
|
||||
else
|
||||
{ /* A window can only have one hot key. If the window already has a hot key
|
||||
associated with it, the new hot key replaces the old one. */
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
HotKeyItem->vk = vk;
|
||||
}
|
||||
}
|
||||
else //
|
||||
{
|
||||
if (wParam == 0)
|
||||
return 1; // Do nothing, exit.
|
||||
|
||||
if (HaveSameWnd)
|
||||
{
|
||||
if (wParam == 0)
|
||||
{ // Setting wParam to NULL removes the hot key associated with a window.
|
||||
UnregisterWindowHotKeys(pWnd);
|
||||
}
|
||||
else
|
||||
{ /* A window can only have one hot key. If the window already has a hot key
|
||||
associated with it, the new hot key replaces the old one. */
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
HotKeyItem->vk = vk;
|
||||
}
|
||||
}
|
||||
else //
|
||||
{
|
||||
if (wParam == 0)
|
||||
return 1; // Do nothing, exit.
|
||||
HotKeyItem = ExAllocatePoolWithTag(PagedPool, sizeof(HOT_KEY_ITEM), USERTAG_HOTKEY);
|
||||
if (HotKeyItem == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
HotKeyItem = ExAllocatePoolWithTag (PagedPool, sizeof(HOT_KEY_ITEM), USERTAG_HOTKEY);
|
||||
if (HotKeyItem == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
HotKeyItem->Thread = pWnd->head.pti->pEThread;
|
||||
HotKeyItem->hWnd = hWnd;
|
||||
HotKeyItem->id = IDHOT_REACTOS; // Don't care, these hot keys are unrelated to the hot keys set by RegisterHotKey.
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
HotKeyItem->vk = vk;
|
||||
|
||||
HotKeyItem->Thread = pWnd->head.pti->pEThread;
|
||||
HotKeyItem->hWnd = hWnd;
|
||||
HotKeyItem->id = IDHOT_REACTOS; // Don't care, these hot keys are unrelated to the hot keys set by RegisterHotKey.
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
HotKeyItem->vk = vk;
|
||||
|
||||
InsertHeadList (&gHotkeyList, &HotKeyItem->ListEntry);
|
||||
}
|
||||
return Ret;
|
||||
InsertHeadList(&gHotkeyList, &HotKeyItem->ListEntry);
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/* SYSCALLS *****************************************************************/
|
||||
|
@ -288,88 +288,88 @@ NtUserRegisterHotKey(HWND hWnd,
|
|||
UINT fsModifiers,
|
||||
UINT vk)
|
||||
{
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
PWND Window;
|
||||
PETHREAD HotKeyThread;
|
||||
DECLARE_RETURN(BOOL);
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
PWND Window;
|
||||
PETHREAD HotKeyThread;
|
||||
DECLARE_RETURN(BOOL);
|
||||
|
||||
TRACE("Enter NtUserRegisterHotKey\n");
|
||||
UserEnterExclusive();
|
||||
TRACE("Enter NtUserRegisterHotKey\n");
|
||||
UserEnterExclusive();
|
||||
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
HotKeyThread = PsGetCurrentThread();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
HotKeyThread = Window->head.pti->pEThread;
|
||||
}
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
HotKeyThread = PsGetCurrentThread();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
HotKeyThread = Window->head.pti->pEThread;
|
||||
}
|
||||
|
||||
/* Check for existing hotkey */
|
||||
if (IsHotKey(fsModifiers, vk))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
/* Check for existing hotkey */
|
||||
if (IsHotKey(fsModifiers, vk))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
|
||||
HotKeyItem = ExAllocatePoolWithTag(PagedPool, sizeof(HOT_KEY_ITEM), USERTAG_HOTKEY);
|
||||
if (HotKeyItem == NULL)
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
HotKeyItem = ExAllocatePoolWithTag(PagedPool, sizeof(HOT_KEY_ITEM), USERTAG_HOTKEY);
|
||||
if (HotKeyItem == NULL)
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
|
||||
HotKeyItem->Thread = HotKeyThread;
|
||||
HotKeyItem->hWnd = hWnd;
|
||||
HotKeyItem->id = id;
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
HotKeyItem->vk = vk;
|
||||
HotKeyItem->Thread = HotKeyThread;
|
||||
HotKeyItem->hWnd = hWnd;
|
||||
HotKeyItem->id = id;
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
HotKeyItem->vk = vk;
|
||||
|
||||
InsertHeadList (&gHotkeyList, &HotKeyItem->ListEntry);
|
||||
InsertHeadList(&gHotkeyList, &HotKeyItem->ListEntry);
|
||||
|
||||
RETURN( TRUE);
|
||||
RETURN( TRUE);
|
||||
|
||||
CLEANUP:
|
||||
TRACE("Leave NtUserRegisterHotKey, ret=%i\n",_ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
TRACE("Leave NtUserRegisterHotKey, ret=%i\n", _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
}
|
||||
|
||||
|
||||
BOOL APIENTRY
|
||||
NtUserUnregisterHotKey(HWND hWnd, int id)
|
||||
{
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
PWND Window;
|
||||
DECLARE_RETURN(BOOL);
|
||||
PHOT_KEY_ITEM HotKeyItem;
|
||||
PWND Window;
|
||||
DECLARE_RETURN(BOOL);
|
||||
|
||||
TRACE("Enter NtUserUnregisterHotKey\n");
|
||||
UserEnterExclusive();
|
||||
TRACE("Enter NtUserUnregisterHotKey\n");
|
||||
UserEnterExclusive();
|
||||
|
||||
if(!(Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
if(!(Window = UserGetWindowObject(hWnd)))
|
||||
{
|
||||
RETURN( FALSE);
|
||||
}
|
||||
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->hWnd == hWnd && HotKeyItem->id == id)
|
||||
{
|
||||
RemoveEntryList (&HotKeyItem->ListEntry);
|
||||
ExFreePoolWithTag(HotKeyItem, USERTAG_HOTKEY);
|
||||
LIST_FOR_EACH(HotKeyItem, &gHotkeyList, HOT_KEY_ITEM, ListEntry)
|
||||
{
|
||||
if (HotKeyItem->hWnd == hWnd && HotKeyItem->id == id)
|
||||
{
|
||||
RemoveEntryList(&HotKeyItem->ListEntry);
|
||||
ExFreePoolWithTag(HotKeyItem, USERTAG_HOTKEY);
|
||||
|
||||
RETURN( TRUE);
|
||||
}
|
||||
}
|
||||
RETURN( TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
RETURN( FALSE);
|
||||
RETURN( FALSE);
|
||||
|
||||
CLEANUP:
|
||||
TRACE("Leave NtUserUnregisterHotKey, ret=%i\n",_ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
TRACE("Leave NtUserUnregisterHotKey, ret=%i\n", _ret_);
|
||||
UserLeave();
|
||||
END_CLEANUP;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue