/* * NtUserActivateKeyboardLayout * * Activates specified layout for thread or process */ HKL APIENTRY NtUserActivateKeyboardLayout( HKL hKl, ULONG Flags) { PKL pKl = NULL; HKL hkl = NULL; PTHREADINFO pti; UserEnterExclusive(); pti = PsGetCurrentThreadWin32Thread(); /* hKl can have special value HKL_NEXT or HKL_PREV */ if (hKl == (HKL)HKL_NEXT) { /* Get next keyboard layout starting with current */ if (pti->KeyboardLayout) pKl = pti->KeyboardLayout->pklNext; } else if (hKl == (HKL)HKL_PREV) { /* Get previous keyboard layout starting with current */ if (pti->KeyboardLayout) pKl = pti->KeyboardLayout->pklNext; } else pKl = UserHklToKbl(hKl); if (!pKl) { ERR("Invalid HKL %p!\n", hKl); goto cleanup; } hkl = pKl->hkl; /* FIXME: KLF_RESET KLF_SHIFTLOCK */ if (Flags & KLF_REORDER) gspklBaseLayout = pKl; if (pKl != pti->KeyboardLayout) { /* Activate layout for current thread */ pKl = co_UserActivateKbl(pti, pKl, Flags); /* Send shell message */ if (!(Flags & KLF_NOTELLSHELL)) co_IntShellHookNotify(HSHELL_LANGUAGE, 0, (LPARAM)hkl); } cleanup: UserLeave(); return hkl; }
BOOL FASTCALL co_IntSendActivateMessages(PWND WindowPrev, PWND Window, BOOL MouseActivate, BOOL Async) { USER_REFERENCE_ENTRY Ref, RefPrev; HANDLE OldTID, NewTID; PTHREADINFO pti, ptiOld, ptiNew; BOOL InAAPM = FALSE; if (Window) { pti = PsGetCurrentThreadWin32Thread(); UserRefObjectCo(Window, &Ref); if (WindowPrev) UserRefObjectCo(WindowPrev, &RefPrev); /* Send palette messages */ if (gpsi->PUSIFlags & PUSIF_PALETTEDISPLAY && //co_IntPostOrSendMessage(UserHMGetHandle(Window), WM_QUERYNEWPALETTE, 0, 0)) co_IntSendMessage(UserHMGetHandle(Window), WM_QUERYNEWPALETTE, 0, 0)) { UserSendNotifyMessage( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)UserHMGetHandle(Window), 0); } //// Fixes bug 7089. if (!(Window->style & WS_CHILD)) { PWND pwndTemp = co_GetDesktopWindow(Window)->spwndChild; while (pwndTemp && !(pwndTemp->style & WS_VISIBLE)) pwndTemp = pwndTemp->spwndNext; if (Window != pwndTemp || (WindowPrev && !IntIsWindowVisible(WindowPrev))) { if (!Async || pti->MessageQueue == gpqForeground) { UINT flags = SWP_NOSIZE | SWP_NOMOVE; if (Window == pwndTemp) flags |= SWP_NOACTIVATE; //ERR("co_IntSendActivateMessages SetWindowPos! Async %d pti Q == FGQ %d\n",Async,pti->MessageQueue == gpqForeground); co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, flags); } } } //// //// CORE-1161 and CORE-6651 if (Window->spwndPrev) { HWND *phwndTopLevel, *phwndCurrent; PWND pwndCurrent, pwndDesktop; pwndDesktop = UserGetDesktopWindow(); if (Window->spwndParent == pwndDesktop ) { phwndTopLevel = IntWinListChildren(pwndDesktop); phwndCurrent = phwndTopLevel; while(*phwndCurrent) { pwndCurrent = UserGetWindowObject(*phwndCurrent); if (pwndCurrent && pwndCurrent->spwndOwner == Window ) { co_WinPosSetWindowPos(pwndCurrent, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); } phwndCurrent++; } ExFreePool(phwndTopLevel); } } //// OldTID = WindowPrev ? IntGetWndThreadId(WindowPrev) : NULL; NewTID = IntGetWndThreadId(Window); ptiOld = WindowPrev ? WindowPrev->head.pti : NULL; ptiNew = Window->head.pti; //ERR("SendActivateMessage Old -> %x, New -> %x\n", OldTID, NewTID); if (!(pti->TIF_flags & TIF_INACTIVATEAPPMSG) && (!WindowPrev || OldTID != NewTID) ) { PWND cWindow; HWND *List, *phWnd; List = IntWinListChildren(UserGetDesktopWindow()); if ( List ) { if ( OldTID ) { ptiOld->TIF_flags |= TIF_INACTIVATEAPPMSG; // Note: Do not set pci flags, this does crash! for (phWnd = List; *phWnd; ++phWnd) { cWindow = ValidateHwndNoErr(*phWnd); if (cWindow && cWindow->head.pti == ptiOld) { // FALSE if the window is being deactivated, // ThreadId that owns the window being activated. co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID); } } ptiOld->TIF_flags &= ~TIF_INACTIVATEAPPMSG; } if ( NewTID ) { //// Prevents a resource crash due to reentrance! InAAPM = TRUE; pti->TIF_flags |= TIF_INACTIVATEAPPMSG; //// for (phWnd = List; *phWnd; ++phWnd) { cWindow = ValidateHwndNoErr(*phWnd); if (cWindow && cWindow->head.pti == ptiNew) { // TRUE if the window is being activated, // ThreadId that owns the window being deactivated. co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID); } } } ExFreePoolWithTag(List, USERTAG_WINDOWLIST); } } if (WindowPrev) UserDerefObjectCo(WindowPrev); // Now allow the previous window to die. if (Window->state & WNDS_ACTIVEFRAME) { // If already active frame do not allow NCPaint. //ERR("SendActivateMessage Is Active Frame!\n"); Window->state |= WNDS_NONCPAINT; } if (Window->style & WS_MINIMIZE) { TRACE("Widow was minimized\n"); } co_IntMakeWindowActive(Window); /* FIXME: IntIsWindow */ co_IntSendMessageNoWait( UserHMGetHandle(Window), WM_NCACTIVATE, (WPARAM)(Window == (gpqForeground ? gpqForeground->spwndActive : NULL)), 0); //(LPARAM)hWndPrev); co_IntSendMessageNoWait( UserHMGetHandle(Window), WM_ACTIVATE, MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE, Window->style & WS_MINIMIZE), (LPARAM)(WindowPrev ? UserHMGetHandle(WindowPrev) : 0)); if (!Window->spwndOwner && !IntGetParent(Window)) { // FIXME lParam; The value is TRUE if the window is in full-screen mode, or FALSE otherwise. co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (WPARAM) UserHMGetHandle(Window), FALSE); } Window->state &= ~WNDS_NONCPAINT; UserDerefObjectCo(Window); } return InAAPM; }
/* * @unimplemented */ BOOL APIENTRY NtUserCallHwndLock( HWND hWnd, DWORD Routine) { BOOL Ret = 0; PWND Window; USER_REFERENCE_ENTRY Ref; DECLARE_RETURN(BOOLEAN); TRACE("Enter NtUserCallHwndLock\n"); UserEnterExclusive(); if (!(Window = UserGetWindowObject(hWnd))) { RETURN( FALSE); } UserRefObjectCo(Window, &Ref); /* FIXME: Routine can be 0x53 - 0x5E */ switch (Routine) { case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS: co_WinPosArrangeIconicWindows(Window); break; case HWNDLOCK_ROUTINE_DRAWMENUBAR: { TRACE("HWNDLOCK_ROUTINE_DRAWMENUBAR\n"); Ret = TRUE; if ((Window->style & (WS_CHILD | WS_POPUP)) != WS_CHILD) co_WinPosSetWindowPos( Window, HWND_DESKTOP, 0,0,0,0, SWP_NOSIZE| SWP_NOMOVE| SWP_NOZORDER| SWP_NOACTIVATE| SWP_FRAMECHANGED ); break; } case HWNDLOCK_ROUTINE_REDRAWFRAME: co_WinPosSetWindowPos( Window, HWND_DESKTOP, 0,0,0,0, SWP_NOSIZE| SWP_NOMOVE| SWP_NOZORDER| SWP_NOACTIVATE| SWP_FRAMECHANGED ); Ret = TRUE; break; case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK: co_WinPosSetWindowPos( Window, HWND_DESKTOP, 0,0,0,0, SWP_NOSIZE| SWP_NOMOVE| SWP_NOZORDER| SWP_NOACTIVATE| SWP_FRAMECHANGED ); if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); } Ret = TRUE; break; case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW: Ret = co_IntSetForegroundWindow(Window); break; case HWNDLOCK_ROUTINE_UPDATEWINDOW: Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN); break; } UserDerefObjectCo(Window); RETURN( Ret); CLEANUP: TRACE("Leave NtUserCallHwndLock, ret=%i\n",_ret_); UserLeave(); END_CLEANUP; }
/* Win32k counterpart of User DefWindowProc */ LRESULT FASTCALL IntDefWindowProc( PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi) { LRESULT lResult = 0; USER_REFERENCE_ENTRY Ref; if (Msg > WM_USER) return 0; switch (Msg) { case WM_SYSCOMMAND: { ERR("hwnd %p WM_SYSCOMMAND %lx %lx\n", Wnd->head.h, wParam, lParam ); lResult = DefWndHandleSysCommand(Wnd, wParam, lParam); break; } case WM_SHOWWINDOW: { if ((Wnd->style & WS_VISIBLE) && wParam) break; if (!(Wnd->style & WS_VISIBLE) && !wParam) break; if (!Wnd->spwndOwner) break; if (LOWORD(lParam)) { if (wParam) { if (!(Wnd->state & WNDS_HIDDENPOPUP)) break; Wnd->state &= ~WNDS_HIDDENPOPUP; } else Wnd->state |= WNDS_HIDDENPOPUP; co_WinPosShowWindow(Wnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE); } } break; case WM_CLIENTSHUTDOWN: return IntClientShutdown(Wnd, wParam, lParam); case WM_APPCOMMAND: ERR("WM_APPCOMMAND\n"); if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD && Wnd != co_GetDesktopWindow(Wnd) ) { if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam)) co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam); break; } UserRefObjectCo(Wnd->spwndParent, &Ref); lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam); UserDerefObjectCo(Wnd->spwndParent); break; case WM_CTLCOLORMSGBOX: case WM_CTLCOLOREDIT: case WM_CTLCOLORLISTBOX: case WM_CTLCOLORBTN: case WM_CTLCOLORDLG: case WM_CTLCOLORSTATIC: case WM_CTLCOLORSCROLLBAR: return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX); case WM_CTLCOLOR: return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam)); case WM_GETHOTKEY: return DefWndGetHotKey(Wnd); case WM_SETHOTKEY: return DefWndSetHotKey(Wnd, wParam); case WM_NCHITTEST: { POINT Point; Point.x = GET_X_LPARAM(lParam); Point.y = GET_Y_LPARAM(lParam); return GetNCHitEx(Wnd, Point); } case WM_SYNCPAINT: { HRGN hRgn; Wnd->state &= ~WNDS_SYNCPAINTPENDING; ERR("WM_SYNCPAINT\n"); hRgn = IntSysCreateRectRgn(0, 0, 0, 0); if (co_UserGetUpdateRgn(Wnd, hRgn, FALSE) != NULLREGION) { if (!wParam) wParam = (RDW_ERASENOW | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN); co_UserRedrawWindow(Wnd, NULL, hRgn, wParam); } GreDeleteObject(hRgn); return 0; } case WM_SETREDRAW: if (wParam) { if (!(Wnd->style & WS_VISIBLE)) { IntSetStyle( Wnd, WS_VISIBLE, 0 ); Wnd->state |= WNDS_SENDNCPAINT; } } else { if (Wnd->style & WS_VISIBLE) { co_UserRedrawWindow( Wnd, NULL, NULL, RDW_ALLCHILDREN | RDW_VALIDATE ); IntSetStyle( Wnd, 0, WS_VISIBLE ); } } return 0; /* ReactOS only. */ case WM_CBT: { switch (wParam) { case HCBT_MOVESIZE: { RECTL rt; if (lParam) { _SEH2_TRY { ProbeForRead((PVOID)lParam, sizeof(RECT), 1); RtlCopyMemory(&rt, (PVOID)lParam, sizeof(RECT)); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { lResult = 1; } _SEH2_END; } if (!lResult) lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)Wnd->head.h, lParam ? (LPARAM)&rt : 0); } break; } break; } break; } return lResult; }
/* * NtUserLoadKeyboardLayoutEx * * Loads keyboard layout with given locale id */ HKL APIENTRY NtUserLoadKeyboardLayoutEx( IN HANDLE Handle, // hFile (See downloads.securityfocus.com/vulnerabilities/exploits/43774.c) IN DWORD offTable, // Offset to KbdTables IN PUNICODE_STRING puszKeyboardName, // Not used? IN HKL hklUnload, IN PUNICODE_STRING pustrKLID, IN DWORD hkl, IN UINT Flags) { HKL hklRet = NULL; PKL pKl = NULL, pklLast; WCHAR Buffer[9]; UNICODE_STRING ustrSafeKLID; if (Flags & ~(KLF_ACTIVATE|KLF_NOTELLSHELL|KLF_REORDER|KLF_REPLACELANG| KLF_SUBSTITUTE_OK|KLF_SETFORPROCESS|KLF_UNLOADPREVIOUS| KLF_RESET|KLF_SETFORPROCESS|KLF_SHIFTLOCK)) { ERR("Invalid flags: %x\n", Flags); EngSetLastError(ERROR_INVALID_FLAGS); return NULL; } /* FIXME: It seems KLF_RESET is only supported for WINLOGON */ RtlInitEmptyUnicodeString(&ustrSafeKLID, Buffer, sizeof(Buffer)); _SEH2_TRY { ProbeForRead(pustrKLID, sizeof(*pustrKLID), 1); ProbeForRead(pustrKLID->Buffer, sizeof(pustrKLID->Length), 1); RtlCopyUnicodeString(&ustrSafeKLID, pustrKLID); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { SetLastNtError(_SEH2_GetExceptionCode()); _SEH2_YIELD(return NULL); } _SEH2_END; UserEnterExclusive(); /* If hklUnload is specified, unload it and load new layput as default */ if (hklUnload && hklUnload != (HKL)hkl) { pKl = UserHklToKbl(hklUnload); if (pKl) UserUnloadKbl(pKl); } /* Let's see if layout was already loaded. */ pKl = UserHklToKbl((HKL)hkl); if (!pKl) { /* It wasn't, so load it. */ pKl = UserLoadKbdLayout(&ustrSafeKLID, (HKL)hkl); if (!pKl) goto cleanup; if (gspklBaseLayout) { /* Find last not unloaded layout */ pklLast = gspklBaseLayout->pklPrev; while (pklLast != gspklBaseLayout && pklLast->dwKL_Flags & KLF_UNLOAD) pklLast = pklLast->pklPrev; /* Add new layout to the list */ pKl->pklNext = pklLast->pklNext; pKl->pklPrev = pklLast; pKl->pklNext->pklPrev = pKl; pKl->pklPrev->pklNext = pKl; } else { /* This is the first layout */ pKl->pklNext = pKl; pKl->pklPrev = pKl; gspklBaseLayout = pKl; } } /* If this layout was prepared to unload, undo it */ pKl->dwKL_Flags &= ~KLF_UNLOAD; /* Activate this layout in current thread */ if (Flags & KLF_ACTIVATE) co_UserActivateKbl(PsGetCurrentThreadWin32Thread(), pKl, Flags); /* Send shell message */ if (!(Flags & KLF_NOTELLSHELL)) co_IntShellHookNotify(HSHELL_LANGUAGE, 0, (LPARAM)hkl); /* Return hkl on success */ hklRet = (HKL)hkl; /* FIXME: KLF_REPLACELANG KLF_REORDER */ cleanup: UserLeave(); return hklRet; }
/* * co_UserProcessHotKeys * * Sends WM_HOTKEY message if given keys are hotkey */ BOOL NTAPI co_UserProcessHotKeys(WORD wVk, BOOL bIsDown) { UINT fModifiers; PHOT_KEY pHotKey; PWND pWnd; BOOL DoNotPostMsg = FALSE; BOOL IsModifier = FALSE; if (wVk == VK_SHIFT || wVk == VK_CONTROL || wVk == VK_MENU || wVk == VK_LWIN || wVk == VK_RWIN) { /* Remember that this was a modifier */ IsModifier = TRUE; } fModifiers = IntGetModifiers(gafAsyncKeyState); if (bIsDown) { if (IsModifier) { /* Modifier key down -- no hotkey trigger, but remember this */ gfsModOnlyCandidate = fModifiers; return FALSE; } else { /* Regular key down -- check for hotkey, and reset mod candidates */ pHotKey = IsHotKey(fModifiers, wVk); gfsModOnlyCandidate = 0; } } else { if (IsModifier) { /* Modifier key up -- modifier-only keys are triggered here */ pHotKey = IsHotKey(gfsModOnlyCandidate, 0); gfsModOnlyCandidate = 0; } else { /* Regular key up -- no hotkey, but reset mod-only candidates */ gfsModOnlyCandidate = 0; return FALSE; } } if (pHotKey) { TRACE("Hot key pressed (pWnd %p, id %d)\n", pHotKey->pWnd, pHotKey->id); /* FIXME: See comment about "UserDebuggerHotKey" on top of this file. */ if (pHotKey->id == IDHK_SHIFTF12 || pHotKey->id == IDHK_F12) { if (bIsDown) { ERR("Hot key pressed for Debug Activation! ShiftF12 = %d or F12 = %d\n",pHotKey->id == IDHK_SHIFTF12 , pHotKey->id == IDHK_F12); //DoNotPostMsg = co_ActivateDebugger(); // FIXME } return DoNotPostMsg; } /* WIN and F12 keys are not hardcoded here. See comments on top of this file. */ if (pHotKey->id == IDHK_WINKEY) { ASSERT(!bIsDown); pWnd = ValidateHwndNoErr(InputWindowStation->ShellWindow); if (pWnd) { TRACE("System Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); co_IntShellHookNotify(HSHELL_TASKMAN, 0, 0); return FALSE; } } if (pHotKey->id == IDHK_SNAP_LEFT || pHotKey->id == IDHK_SNAP_RIGHT || pHotKey->id == IDHK_SNAP_UP || pHotKey->id == IDHK_SNAP_DOWN) { HWND topWnd = UserGetForegroundWindow(); if (topWnd) { UserPostMessage(topWnd, WM_KEYDOWN, wVk, 0); } return TRUE; } if (!pHotKey->pWnd) { TRACE("UPTM Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostThreadMessage(pHotKey->pti, WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); //ptiLastInput = pHotKey->pti; return TRUE; /* Don't send any message */ } else { pWnd = pHotKey->pWnd; if (pWnd == PWND_BOTTOM) { if (gpqForeground == NULL) return FALSE; pWnd = gpqForeground->spwndFocus; } if (pWnd) { // pWnd->head.rpdesk->pDeskInfo->spwndShell needs testing. if (pWnd == ValidateHwndNoErr(InputWindowStation->ShellWindow) && pHotKey->id == SC_TASKLIST) { UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); co_IntShellHookNotify(HSHELL_TASKMAN, 0, 0); } else { TRACE("UPM Hot key Id %d Key %u\n", pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); } //ptiLastInput = pWnd->head.pti; return TRUE; /* Don't send any message */ } } } return FALSE; }
VOID FASTCALL co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate) { USER_REFERENCE_ENTRY Ref, RefPrev; PWND Window, WindowPrev = NULL; if ((Window = UserGetWindowObject(hWnd))) { UserRefObjectCo(Window, &Ref); WindowPrev = UserGetWindowObject(hWndPrev); if (WindowPrev) UserRefObjectCo(WindowPrev, &RefPrev); /* Send palette messages */ if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0)) { UserSendNotifyMessage( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hWnd, 0); } if (Window->spwndPrev != NULL) co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING); if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (LPARAM) hWnd); } if (Window) { // Set last active for window and it's owner. Window->hWndLastActive = hWnd; if (Window->spwndOwner) Window->spwndOwner->hWndLastActive = hWnd; Window->state |= WNDS_ACTIVEFRAME; } if (WindowPrev) WindowPrev->state &= ~WNDS_ACTIVEFRAME; if (Window && WindowPrev) { PWND cWindow; HWND *List, *phWnd; HANDLE OldTID = IntGetWndThreadId(WindowPrev); HANDLE NewTID = IntGetWndThreadId(Window); TRACE("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); if (Window->style & WS_MINIMIZE) { TRACE("Widow was minimized\n"); } if (OldTID != NewTID) { List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow())); if (List) { for (phWnd = List; *phWnd; ++phWnd) { cWindow = UserGetWindowObject(*phWnd); if (cWindow && (IntGetWndThreadId(cWindow) == OldTID)) { // FALSE if the window is being deactivated, // ThreadId that owns the window being activated. co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID); } } for (phWnd = List; *phWnd; ++phWnd) { cWindow = UserGetWindowObject(*phWnd); if (cWindow && (IntGetWndThreadId(cWindow) == NewTID)) { // TRUE if the window is being activated, // ThreadId that owns the window being deactivated. co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID); } } ExFreePool(List); } } UserDerefObjectCo(WindowPrev); // Now allow the previous window to die. } UserDerefObjectCo(Window); /* FIXME: IntIsWindow */ co_IntSendMessageNoWait(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0); /* FIXME: WA_CLICKACTIVE */ co_IntSendMessageNoWait(hWnd, WM_ACTIVATE, MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE, Window->style & WS_MINIMIZE), (LPARAM)hWndPrev); } }
/* * co_UserProcessHotKeys * * Sends WM_HOTKEY message if given keys are hotkey */ BOOL NTAPI co_UserProcessHotKeys(WORD wVk, BOOL bIsDown) { UINT fModifiers; PHOT_KEY pHotKey; PWND pWnd; BOOL DoNotPostMsg = FALSE; if (wVk == VK_SHIFT || wVk == VK_CONTROL || wVk == VK_MENU || wVk == VK_LWIN || wVk == VK_RWIN) { /* Those keys are specified by modifiers */ wVk = 0; } fModifiers = IntGetModifiers(gafAsyncKeyState); /* Check if it is a hotkey */ pHotKey = IsHotKey(fModifiers, wVk); if (pHotKey) { TRACE("Hot key pressed (pWnd %p, id %d)\n", pHotKey->pWnd, pHotKey->id); /* FIXME: See comment about "UserDebuggerHotKey" on top of this file. */ if (pHotKey->id == IDHK_SHIFTF12 || pHotKey->id == IDHK_F12) { if (bIsDown) { ERR("Hot key pressed for Debug Activation! ShiftF12 = %d or F12 = %d\n",pHotKey->id == IDHK_SHIFTF12 , pHotKey->id == IDHK_F12); //DoNotPostMsg = co_ActivateDebugger(); // FIXME } return DoNotPostMsg; } /* Process hotkey if it is key up event */ if (!bIsDown) { /* WIN and F12 keys are not hardcoded here. See comments on top of this file. */ if (pHotKey->id == IDHK_WINKEY && bWinHotkeyActive) { pWnd = ValidateHwndNoErr(InputWindowStation->ShellWindow); if (pWnd) { TRACE("System Hot key Id %d Key %d\n",pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); co_IntShellHookNotify(HSHELL_TASKMAN, 0, 0); bWinHotkeyActive = FALSE; return FALSE; } } } else { /* The user pressed the win key */ if (pHotKey->id == IDHK_WINKEY) { bWinHotkeyActive = TRUE; return FALSE; } } if (bIsDown) { if (!pHotKey->pWnd) { TRACE("UPTM Hot key Id %d Key %d\n",pHotKey->id, wVk ); UserPostThreadMessage(pHotKey->pti, WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); //ptiLastInput = pHotKey->pti; return TRUE; /* Don't send any message */ } else { if (pHotKey->pWnd == PWND_BOTTOM) { if (gpqForeground != NULL) { pWnd = gpqForeground->spwndFocus; } else return FALSE; } else { pWnd = pHotKey->pWnd; } if (pWnd) { // pWnd->head.rpdesk->pDeskInfo->spwndShell needs testing. if (pWnd == ValidateHwndNoErr(InputWindowStation->ShellWindow) && pHotKey->id == SC_TASKLIST) { ERR("Sending to shell window w/o IDHK_WINKEY..\n"); UserPostMessage(UserHMGetHandle(pWnd), WM_SYSCOMMAND, SC_TASKLIST, 0); } else { TRACE("UPM Hot key Id %d Key %d\n",pHotKey->id, wVk ); UserPostMessage(UserHMGetHandle(pWnd), WM_HOTKEY, pHotKey->id, MAKELONG(fModifiers, wVk)); } //ptiLastInput = pWnd->head.pti; return TRUE; /* Don't send any message */ } } } } return FALSE; }