BOOL FASTCALL co_IntSetCaretPos(int X, int Y) { PTHREADINFO pti; PWND pWnd; PUSER_MESSAGE_QUEUE ThreadQueue; pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; if(ThreadQueue->CaretInfo->hWnd) { pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd); if(ThreadQueue->CaretInfo->Pos.x != X || ThreadQueue->CaretInfo->Pos.y != Y) { co_IntHideCaret(ThreadQueue->CaretInfo); ThreadQueue->CaretInfo->Showing = 0; ThreadQueue->CaretInfo->Pos.x = X; ThreadQueue->CaretInfo->Pos.y = Y; IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM); IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF, 0); } return TRUE; } return FALSE; }
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL) { PTHREADINFO pti; PUSER_MESSAGE_QUEUE ThreadQueue; PWND pWnd = NULL; if (Window) ASSERT_REFS_CO(Window); if(Window && Window->head.pti->pEThread != PsGetCurrentThread()) { EngSetLastError(ERROR_ACCESS_DENIED); return FALSE; } pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h) { EngSetLastError(ERROR_ACCESS_DENIED); return FALSE; } if (!ThreadQueue->CaretInfo->Visible) { ThreadQueue->CaretInfo->Visible = 1; pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo->hWnd); if (!ThreadQueue->CaretInfo->Showing && pWnd) { IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0); } IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM); } return TRUE; }
UINT_PTR APIENTRY NtUserSetTimer ( HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc ) { PWND Window; DECLARE_RETURN(UINT_PTR); TRACE("Enter NtUserSetTimer\n"); UserEnterExclusive(); Window = UserGetWindowObject(hWnd); UserLeave(); RETURN(IntSetTimer(Window, nIDEvent, uElapse, lpTimerFunc, TMRF_TIFROMWND)); CLEANUP: TRACE("Leave NtUserSetTimer, ret=%i\n", _ret_); END_CLEANUP; }
VOID FASTCALL StartTheTimers(VOID) { // Need to start gdi syncro timers then start timer with Hang App proc // that calles Idle process so the screen savers will know to run...... IntSetTimer(NULL, 0, 1000, HungAppSysTimerProc, TMRF_RIT); // Test Timers // IntSetTimer(NULL, 0, 1000, SystemTimerProc, TMRF_RIT); }
UINT_PTR FASTCALL SystemTimerSet( PWND Window, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc) { if (Window && Window->head.pti->pEThread->ThreadsProcess != PsGetCurrentProcess()) { EngSetLastError(ERROR_ACCESS_DENIED); TRACE("SysemTimerSet: Access Denied!\n"); return 0; } return IntSetTimer( Window, nIDEvent, uElapse, lpTimerFunc, TMRF_SYSTEM); }
UINT_PTR APIENTRY NtUserSetSystemTimer( HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc ) { DECLARE_RETURN(UINT_PTR); TRACE("Enter NtUserSetSystemTimer\n"); RETURN(IntSetTimer(UserGetWindowObject(hWnd), nIDEvent, uElapse, NULL, TMRF_SYSTEM)); CLEANUP: TRACE("Leave NtUserSetSystemTimer, ret=%i\n", _ret_); END_CLEANUP; }
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL) { PTHREADINFO pti; PWND pWnd; PUSER_MESSAGE_QUEUE ThreadQueue; if (Window) ASSERT_REFS_CO(Window); if(Window && Window->head.pti->pEThread != PsGetCurrentThread()) { EngSetLastError(ERROR_ACCESS_DENIED); return FALSE; } pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h) { EngSetLastError(ERROR_ACCESS_DENIED); return FALSE; } if(!ThreadQueue->CaretInfo->Visible) { ThreadQueue->CaretInfo->Visible = 1; if(!ThreadQueue->CaretInfo->Showing) { pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd); co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0); } IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM); } return TRUE; }
BOOL APIENTRY NtUserCreateCaret( HWND hWnd, HBITMAP hBitmap, int nWidth, int nHeight) { PWND Window; PTHREADINFO pti; PUSER_MESSAGE_QUEUE ThreadQueue; DECLARE_RETURN(BOOL); TRACE("Enter NtUserCreateCaret\n"); UserEnterExclusive(); if(!(Window = UserGetWindowObject(hWnd))) { RETURN(FALSE); } if(Window->head.pti->pEThread != PsGetCurrentThread()) { EngSetLastError(ERROR_ACCESS_DENIED); RETURN(FALSE); } pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; if (ThreadQueue->CaretInfo->Visible) { IntKillTimer(Window, IDCARETTIMER, TRUE); co_IntHideCaret(ThreadQueue->CaretInfo); } ThreadQueue->CaretInfo->hWnd = hWnd; if(hBitmap) { ThreadQueue->CaretInfo->Bitmap = hBitmap; ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0; } else { if (nWidth == 0) { nWidth = UserGetSystemMetrics(SM_CXBORDER); } if (nHeight == 0) { nHeight = UserGetSystemMetrics(SM_CYBORDER); } ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0; ThreadQueue->CaretInfo->Size.cx = nWidth; ThreadQueue->CaretInfo->Size.cy = nHeight; } ThreadQueue->CaretInfo->Visible = 0; ThreadQueue->CaretInfo->Showing = 0; IntSetTimer( Window, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM ); IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_CARET, CHILDID_SELF, 0); RETURN(TRUE); CLEANUP: TRACE("Leave NtUserCreateCaret, ret=%i\n",_ret_); UserLeave(); END_CLEANUP; }