ReactOS 0.4.16-dev-106-g10b08aa
timer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _TIMER
 

Macros

#define TMRF_READY   0x0001
 
#define TMRF_SYSTEM   0x0002
 
#define TMRF_RIT   0x0004
 
#define TMRF_INIT   0x0008
 
#define TMRF_ONESHOT   0x0010
 
#define TMRF_WAITING   0x0020
 
#define TMRF_TIFROMWND   0x0040
 
#define ID_EVENT_SYSTIMER_MOUSEHOVER   ID_TME_TIMER
 
#define ID_EVENT_SYSTIMER_FLASHWIN   (0xFFF8)
 
#define ID_EVENT_SYSTIMER_TRACKWIN   (0xFFF7)
 
#define ID_EVENT_SYSTIMER_ANIMATEDFADE   (0xFFF6)
 
#define ID_EVENT_SYSTIMER_INVALIDATEDCES   (0xFFF5)
 

Typedefs

typedef struct _TIMER TIMER
 
typedef struct _TIMERPTIMER
 

Functions

 CODE_SEG ("INIT") NTSTATUS NTAPI InitTimerImpl(VOID)
 
BOOL FASTCALL DestroyTimersForThread (PTHREADINFO pti)
 
BOOL FASTCALL DestroyTimersForWindow (PTHREADINFO pti, PWND Window)
 
BOOL FASTCALL IntKillTimer (PWND Window, UINT_PTR IDEvent, BOOL SystemTimer)
 
UINT_PTR FASTCALL IntSetTimer (PWND Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type)
 
PTIMER FASTCALL FindSystemTimer (PMSG)
 
BOOL FASTCALL ValidateTimerCallback (PTHREADINFO, LPARAM)
 
VOID CALLBACK SystemTimerProc (HWND, UINT, UINT_PTR, DWORD)
 
UINT_PTR FASTCALL SystemTimerSet (PWND, UINT_PTR, UINT, TIMERPROC)
 
BOOL FASTCALL PostTimerMessages (PWND)
 
VOID FASTCALL ProcessTimers (VOID)
 
VOID FASTCALL StartTheTimers (VOID)
 

Variables

PKTIMER MasterTimer
 

Macro Definition Documentation

◆ ID_EVENT_SYSTIMER_ANIMATEDFADE

#define ID_EVENT_SYSTIMER_ANIMATEDFADE   (0xFFF6)

Definition at line 30 of file timer.h.

◆ ID_EVENT_SYSTIMER_FLASHWIN

#define ID_EVENT_SYSTIMER_FLASHWIN   (0xFFF8)

Definition at line 28 of file timer.h.

◆ ID_EVENT_SYSTIMER_INVALIDATEDCES

#define ID_EVENT_SYSTIMER_INVALIDATEDCES   (0xFFF5)

Definition at line 31 of file timer.h.

◆ ID_EVENT_SYSTIMER_MOUSEHOVER

#define ID_EVENT_SYSTIMER_MOUSEHOVER   ID_TME_TIMER

Definition at line 27 of file timer.h.

◆ ID_EVENT_SYSTIMER_TRACKWIN

#define ID_EVENT_SYSTIMER_TRACKWIN   (0xFFF7)

Definition at line 29 of file timer.h.

◆ TMRF_INIT

#define TMRF_INIT   0x0008

Definition at line 22 of file timer.h.

◆ TMRF_ONESHOT

#define TMRF_ONESHOT   0x0010

Definition at line 23 of file timer.h.

◆ TMRF_READY

#define TMRF_READY   0x0001

Definition at line 19 of file timer.h.

◆ TMRF_RIT

#define TMRF_RIT   0x0004

Definition at line 21 of file timer.h.

◆ TMRF_SYSTEM

#define TMRF_SYSTEM   0x0002

Definition at line 20 of file timer.h.

◆ TMRF_TIFROMWND

#define TMRF_TIFROMWND   0x0040

Definition at line 25 of file timer.h.

◆ TMRF_WAITING

#define TMRF_WAITING   0x0020

Definition at line 24 of file timer.h.

Typedef Documentation

◆ PTIMER

typedef struct _TIMER * PTIMER

◆ TIMER

typedef struct _TIMER TIMER

Function Documentation

◆ CODE_SEG()

CODE_SEG ( "INIT"  )

Definition at line 1810 of file Interface.c.

1817{
1818 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\"DRIVER_NAME);
1819 PDEVICE_OBJECT RawDeviceObject;
1821 PFILE_OBJECT RawFileObject;
1823 UNICODE_STRING SymLink;
1824
1826
1829
1830 /* Save the registry key for this driver */
1834 RegistryPath->MaximumLength,
1838
1839 /* Do some initialization */
1841
1842 /* Create the main filter manager device object */
1844 0,
1845 &DeviceName,
1848 FALSE,
1849 &DeviceObject);
1850 if (!NT_SUCCESS(Status))
1851 {
1852 DPRINT1("fltmgr IoCreateDevice failed. Status = %X\n", Status);
1853 goto Cleanup;
1854 }
1855
1856 /* Store a global reference so we can access from callbacks */
1858
1859 /* Generate the symbolic link name */
1860 RtlInitUnicodeString(&SymLink, L"\\??\\"DRIVER_NAME);
1862 if (!NT_SUCCESS(Status)) goto Cleanup;
1863
1864 /* Create the callbacks for the dispatch table, FastIo and FS callbacks */
1866 if (!NT_SUCCESS(Status)) goto Cleanup;
1867
1868 /* Initialize the comms objects */
1870 if (!NT_SUCCESS(Status)) goto Cleanup;
1871
1872 /* Register for notifications when a new file system is loaded. This also enumerates any existing file systems */
1874 FLT_ASSERT(Status != STATUS_DEVICE_ALREADY_ATTACHED); // Windows checks for this, I'm not sure how it can happen. Needs investigation??
1875 if (!NT_SUCCESS(Status)) goto Cleanup;
1876
1879
1880 /* IoRegisterFsRegistrationChange isn't notified about the raw file systems, so we attach to them manually */
1881 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawDisk");
1884 &RawFileObject,
1885 &RawDeviceObject);
1886 if (NT_SUCCESS(Status))
1887 {
1888 FltpFsNotification(RawDeviceObject, TRUE);
1889 ObDereferenceObject(RawFileObject);
1890 }
1891
1892 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawCdRom");
1895 &RawFileObject,
1896 &RawDeviceObject);
1897 if (NT_SUCCESS(Status))
1898 {
1899 FltpFsNotification(RawDeviceObject, TRUE);
1900 ObDereferenceObject(RawFileObject);
1901 }
1902
1903 /* We're done, clear the initializing flag */
1906
1907Cleanup:
1908
1909 if (!NT_SUCCESS(Status))
1910 {
1912 {
1913 DriverObject->FastIoDispatch = NULL;
1915 }
1916
1917 IoDeleteSymbolicLink(&SymLink);
1918
1919 if (DeviceObject)
1921
1924 }
1925
1926 return Status;
1927}
LIST_ENTRY FilterList
Definition: Filter.c:24
DRIVER_FS_NOTIFICATION FltpFsNotification
Definition: Interface.c:1699
ERESOURCE FilterListLock
Definition: Filter.c:25
static NTSTATUS SetupDispatchAndCallbacksTables(_In_ PDRIVER_OBJECT DriverObject)
Definition: Interface.c:1739
DRIVER_DATA DriverData
Definition: Interface.c:35
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static const WCHAR Cleanup[]
Definition: register.c:80
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define DRIVER_NAME
Definition: ext2fs.h:136
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define FM_TAG_REGISTRY_DATA
Definition: fltmgr.h:18
#define FM_TAG_DISPATCH_TABLE
Definition: fltmgr.h:17
NTSTATUS FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject)
Definition: Messaging.c:377
Status
Definition: gdiplustypes.h:25
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
NTSTATUS NTAPI IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine)
Definition: volume.c:1089
#define STATUS_DEVICE_ALREADY_ATTACHED
Definition: ntstatus.h:292
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:53
#define STATUS_SUCCESS
Definition: shellext.h:65
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
UNICODE_STRING ServiceKey
Definition: fltmgr.h:33
PFAST_IO_DISPATCH FastIoDispatch
Definition: fltmgr.h:37
FAST_MUTEX FilterAttachLock
Definition: fltmgr.h:39
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ DestroyTimersForThread()

BOOL FASTCALL DestroyTimersForThread ( PTHREADINFO  pti)

Definition at line 556 of file timer.c.

557{
559 PTIMER pTmr;
560 BOOL TimersRemoved = FALSE;
561
563
564 while(pLE != &TimersListHead)
565 {
566 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
567 pLE = pLE->Flink; /* get next timer list entry before current timer is removed */
568 if ((pTmr) && (pTmr->pti == pti))
569 {
570 TimersRemoved = RemoveTimer(pTmr);
571 }
572 }
573
574 TimerLeave();
575
576 return TimersRemoved;
577}
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: timer.h:4
PTHREADINFO pti
Definition: timer.h:7
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define TimerLeave()
Definition: timer.c:43
static LIST_ENTRY TimersListHead
Definition: timer.c:16
static BOOL FASTCALL RemoveTimer(PTIMER pTmr)
Definition: timer.c:72
#define TimerEnterExclusive()
Definition: timer.c:37

Referenced by ExitThreadCallback().

◆ DestroyTimersForWindow()

BOOL FASTCALL DestroyTimersForWindow ( PTHREADINFO  pti,
PWND  Window 
)

Definition at line 529 of file timer.c.

530{
531 PLIST_ENTRY pLE;
532 PTIMER pTmr;
533 BOOL TimersRemoved = FALSE;
534
535 if (Window == NULL)
536 return FALSE;
537
539 pLE = TimersListHead.Flink;
540 while(pLE != &TimersListHead)
541 {
542 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
543 pLE = pLE->Flink; /* get next timer list entry before current timer is removed */
544 if ((pTmr) && (pTmr->pti == pti) && (pTmr->pWnd == Window))
545 {
546 TimersRemoved = RemoveTimer(pTmr);
547 }
548 }
549
550 TimerLeave();
551
552 return TimersRemoved;
553}
Definition: window.c:28
PWND pWnd
Definition: timer.h:8

Referenced by co_UserFreeWindow(), and IntClientShutdown().

◆ FindSystemTimer()

PTIMER FASTCALL FindSystemTimer ( PMSG  pMsg)

Definition at line 128 of file timer.c.

129{
130 PLIST_ENTRY pLE;
131 PTIMER pTmr = NULL;
132
134 pLE = TimersListHead.Flink;
135 while (pLE != &TimersListHead)
136 {
137 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
138
139 if ( pMsg->lParam == (LPARAM)pTmr->pfn &&
140 (pTmr->flags & TMRF_SYSTEM) )
141 break;
142
143 pLE = pLE->Flink;
144 }
145 TimerLeave();
146
147 return pTmr;
148}
TIMERPROC pfn
Definition: timer.h:13
FLONG flags
Definition: timer.h:12
LPARAM lParam
Definition: winuser.h:3120
#define TMRF_SYSTEM
Definition: timer.h:20
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by IntDispatchMessage().

◆ IntKillTimer()

BOOL FASTCALL IntKillTimer ( PWND  Window,
UINT_PTR  IDEvent,
BOOL  SystemTimer 
)

Definition at line 580 of file timer.c.

581{
582 PTIMER pTmr = NULL;
583 TRACE("IntKillTimer Window %p id %uI systemtimer %s\n",
584 Window, IDEvent, SystemTimer ? "TRUE" : "FALSE");
585
587 pTmr = FindTimer(Window, IDEvent, SystemTimer ? TMRF_SYSTEM : 0);
588
589 if (pTmr)
590 {
591 RemoveTimer(pTmr);
592 }
593 TimerLeave();
594
595 return pTmr ? TRUE : FALSE;
596}
#define TRACE(s)
Definition: solgame.cpp:4
PTIMER FASTCALL FindTimer(PWND Window, UINT_PTR nID, UINT flags)
Definition: timer.c:98

Referenced by co_UserHideCaret(), IntFlashWindowEx(), IntRemoveTrackMouseEvent(), IntTrackMouseEvent(), IntTrackMouseMove(), NtUserCallHwndParam(), NtUserCreateCaret(), NtUserKillTimer(), and SystemTimerProc().

◆ IntSetTimer()

UINT_PTR FASTCALL IntSetTimer ( PWND  Window,
UINT_PTR  IDEvent,
UINT  Elapse,
TIMERPROC  TimerFunc,
INT  Type 
)

Definition at line 179 of file timer.c.

184{
185 PTIMER pTmr;
186 UINT_PTR Ret = IDEvent;
187 ULONG ulBitmapIndex;
189 DueTime.QuadPart = (LONGLONG)(-97656); // 1024hz .9765625 ms set to 10.0 ms
190
191#if 0
192 /* Windows NT/2k/XP behaviour */
193 if (Elapse > USER_TIMER_MAXIMUM)
194 {
195 TRACE("Adjusting uElapse\n");
196 Elapse = 1;
197 }
198#else
199 /* Windows XP SP2 and Windows Server 2003 behaviour */
200 if (Elapse > USER_TIMER_MAXIMUM)
201 {
202 TRACE("Adjusting uElapse\n");
203 Elapse = USER_TIMER_MAXIMUM;
204 }
205#endif
206
207 /* Windows 2k/XP and Windows Server 2003 SP1 behaviour */
208 if (Elapse < USER_TIMER_MINIMUM)
209 {
210 TRACE("Adjusting uElapse\n");
211 Elapse = USER_TIMER_MINIMUM; // 1024hz .9765625 ms, set to 10.0 ms (+/-)1 ms
212 }
213
214 /* Passing an IDEvent of 0 and the SetTimer returns 1.
215 It will create the timer with an ID of 0 */
216 if ((Window) && (IDEvent == 0))
217 Ret = 1;
218
219 pTmr = FindTimer(Window, IDEvent, Type);
220
221 if ((!pTmr) && (Window == NULL) && (!(Type & TMRF_SYSTEM)))
222 {
224
226 if (ulBitmapIndex == ULONG_MAX)
227 {
230 }
231 if (ulBitmapIndex == ULONG_MAX)
232 {
234 ERR("Unable to find a free window-less timer id\n");
236 return 0;
237 }
238
239 ASSERT(ulBitmapIndex < NUM_WINDOW_LESS_TIMERS);
240 IDEvent = NUM_WINDOW_LESS_TIMERS - ulBitmapIndex;
241 Ret = IDEvent;
242
244 }
245
246 if (!pTmr)
247 {
248 pTmr = CreateTimer();
249 if (!pTmr) return 0;
250
251 if (Window && (Type & TMRF_TIFROMWND))
252 pTmr->pti = Window->head.pti->pEThread->Tcb.Win32Thread;
253 else
254 {
255 if (Type & TMRF_RIT)
256 pTmr->pti = ptiRawInput;
257 else
259 }
260
261 pTmr->pWnd = Window;
262 pTmr->cmsCountdown = Elapse;
263 pTmr->cmsRate = Elapse;
264 pTmr->pfn = TimerFunc;
265 pTmr->nID = IDEvent;
266 pTmr->flags = Type|TMRF_INIT;
267 }
268 else
269 {
270 pTmr->cmsCountdown = Elapse;
271 pTmr->cmsRate = Elapse;
272 }
273
275 // Start the timer thread!
276 if (TimersListHead.Flink == TimersListHead.Blink) // There is only one timer
278
279 return Ret;
280}
Type
Definition: Type.h:7
#define ERR(fmt,...)
Definition: precomp.h:57
#define RtlFindClearBitsAndSet
Definition: dbgbitmap.h:333
return pRequest CreateTimer()
#define ULONG_MAX
Definition: limits.h:44
#define ASSERT(a)
Definition: mode.c:44
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
INT cmsRate
Definition: timer.h:11
UINT_PTR nID
Definition: timer.h:9
INT cmsCountdown
Definition: timer.h:10
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
int64_t LONGLONG
Definition: typedefs.h:68
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190
PTHREADINFO ptiRawInput
Definition: input.c:15
PKTIMER MasterTimer
Definition: input.c:16
#define HINTINDEX_BEGIN_VALUE
Definition: timer.c:22
#define IntLockWindowlessTimerBitmap()
Definition: timer.c:31
#define IntUnlockWindowlessTimerBitmap()
Definition: timer.c:34
static ULONG HintIndex
Definition: timer.c:27
#define NUM_WINDOW_LESS_TIMERS
Definition: timer.c:20
static RTL_BITMAP WindowLessTimersBitMap
Definition: timer.c:25
#define TMRF_INIT
Definition: timer.h:22
#define TMRF_RIT
Definition: timer.h:21
#define TMRF_TIFROMWND
Definition: timer.h:25
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
#define ERROR_NO_SYSTEM_RESOURCES
Definition: winerror.h:931
#define USER_TIMER_MAXIMUM
Definition: winuser.h:908
#define USER_TIMER_MINIMUM
Definition: winuser.h:909

Referenced by co_IntSetCaretPos(), co_UserShowCaret(), IntFlashWindowEx(), IntTrackMouseEvent(), IntTrackMouseMove(), NtUserCreateCaret(), NtUserSetSystemTimer(), NtUserSetTimer(), StartTheTimers(), and SystemTimerSet().

◆ PostTimerMessages()

BOOL FASTCALL PostTimerMessages ( PWND  Window)

Definition at line 402 of file timer.c.

403{
404 PLIST_ENTRY pLE;
405 MSG Msg;
406 PTHREADINFO pti;
407 BOOL Hit = FALSE;
408 PTIMER pTmr;
409
411
413 pLE = TimersListHead.Flink;
414 while(pLE != &TimersListHead)
415 {
416 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
417 if ( (pTmr->flags & TMRF_READY) &&
418 (pTmr->pti == pti) &&
419 ((pTmr->pWnd == Window) || (Window == NULL)) )
420 {
421 Msg.hwnd = (pTmr->pWnd ? UserHMGetHandle(pTmr->pWnd) : NULL);
422 Msg.message = (pTmr->flags & TMRF_SYSTEM) ? WM_SYSTIMER : WM_TIMER;
423 Msg.wParam = (WPARAM) pTmr->nID;
424 Msg.lParam = (LPARAM) pTmr->pfn;
425 Msg.time = EngGetTickCount32();
426 // Fix all wine win:test_GetMessagePos WM_TIMER tests. See CORE-10867.
427 Msg.pt = gpsi->ptCursor;
428
430 pTmr->flags &= ~TMRF_READY;
432 Hit = TRUE;
433 // Now move this entry to the end of the list so it will not be
434 // called again in the next msg loop.
435 if (pLE != &TimersListHead)
436 {
439 }
440 break;
441 }
442
443 pLE = pLE->Flink;
444 }
445
446 TimerLeave();
447
448 return Hit;
449}
struct @1636 Msg[]
#define WM_SYSTIMER
Definition: comctl32.h:125
PSERVERINFO gpsi
Definition: imm.c:18
#define EngGetTickCount32()
Definition: eng.h:43
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
VOID FASTCALL ClearMsgBitsMask(PTHREADINFO pti, UINT MessageBits)
Definition: msgqueue.c:445
VOID FASTCALL MsqPostMessage(PTHREADINFO pti, MSG *Msg, BOOLEAN HardwareMessage, DWORD MessageBits, DWORD dwQEvent, LONG_PTR ExtraInfo)
Definition: msgqueue.c:1337
LIST_ENTRY ptmrList
Definition: timer.h:6
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define TMRF_READY
Definition: timer.h:19
UINT_PTR WPARAM
Definition: windef.h:207
#define QS_TIMER
Definition: winuser.h:881
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:885
#define WM_TIMER
Definition: winuser.h:1745
#define QS_POSTMESSAGE
Definition: winuser.h:880

Referenced by co_IntPeekMessage().

◆ ProcessTimers()

VOID FASTCALL ProcessTimers ( VOID  )

Definition at line 453 of file timer.c.

454{
456 LONG Time;
457 PLIST_ENTRY pLE;
458 PTIMER pTmr;
459 LONG TimerCount = 0;
460
462 pLE = TimersListHead.Flink;
464
465 DueTime.QuadPart = (LONGLONG)(-97656); // 1024hz .9765625 ms set to 10.0 ms
466
467 while(pLE != &TimersListHead)
468 {
469 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
470 TimerCount++;
471 if (pTmr->flags & TMRF_WAITING)
472 {
473 pLE = pTmr->ptmrList.Flink;
474 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
475 continue;
476 }
477
478 if (pTmr->flags & TMRF_INIT)
479 {
480 pTmr->flags &= ~TMRF_INIT; // Skip this run.
481 }
482 else
483 {
484 if (pTmr->cmsCountdown < 0)
485 {
486 ASSERT(pTmr->pti);
487 if ((!(pTmr->flags & TMRF_READY)) && (!(pTmr->pti->TIF_flags & TIF_INCLEANUP)))
488 {
489 if (pTmr->flags & TMRF_ONESHOT)
490 pTmr->flags |= TMRF_WAITING;
491
492 if (pTmr->flags & TMRF_RIT)
493 {
494 // Hard coded call here, inside raw input thread.
495 pTmr->pfn(NULL, WM_SYSTIMER, pTmr->nID, (LPARAM)pTmr);
496 }
497 else
498 {
499 pTmr->flags |= TMRF_READY; // Set timer ready to be ran.
500 // Set thread message queue for this timer.
501 if (pTmr->pti)
502 { // Wakeup thread
503 pTmr->pti->cTimersReady++;
504 ASSERT(pTmr->pti->pEventQueueServer != NULL);
505 MsqWakeQueue(pTmr->pti, QS_TIMER, TRUE);
506 }
507 }
508 }
509 pTmr->cmsCountdown = pTmr->cmsRate;
510 }
511 else
512 pTmr->cmsCountdown -= Time - TimeLast;
513 }
514
515 pLE = pLE->Flink;
516 }
517
518 // Restart the timer thread!
521
522 TimeLast = Time;
523
524 TimerLeave();
525 TRACE("TimerCount = %d\n", TimerCount);
526}
#define TIF_INCLEANUP
Definition: ntuser.h:263
static PLARGE_INTEGER Time
Definition: time.c:105
VOID FASTCALL MsqWakeQueue(PTHREADINFO pti, DWORD MessageBits, BOOL KeyEvent)
Definition: msgqueue.c:412
long LONG
Definition: pedump.c:60
PKEVENT pEventQueueServer
Definition: win32.h:125
UINT cTimersReady
Definition: win32.h:110
FLONG TIF_flags
Definition: win32.h:95
static LONG TimeLast
Definition: timer.c:17
#define TMRF_WAITING
Definition: timer.h:24
#define TMRF_ONESHOT
Definition: timer.h:23

Referenced by RawInputThreadMain().

◆ StartTheTimers()

VOID FASTCALL StartTheTimers ( VOID  )

Definition at line 375 of file timer.c.

376{
377 // Need to start gdi syncro timers then start timer with Hang App proc
378 // that calles Idle process so the screen savers will know to run......
380// Test Timers
381// IntSetTimer(NULL, 0, 1000, SystemTimerProc, TMRF_RIT);
382}
VOID CALLBACK HungAppSysTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: msgqueue.c:2187
UINT_PTR FASTCALL IntSetTimer(PWND Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type)
Definition: timer.c:179

Referenced by RawInputThreadMain().

◆ SystemTimerProc()

VOID CALLBACK SystemTimerProc ( HWND  hwnd,
UINT  uMsg,
UINT_PTR  idEvent,
DWORD  dwTime 
)

Definition at line 287 of file timer.c.

291{
292 PDESKTOP pDesk;
293 PWND pWnd = NULL;
294
295 if (hwnd)
296 {
298 if (!pWnd)
299 {
300 ERR("System Timer Proc has invalid window handle! %p Id: %u\n", hwnd, idEvent);
301 return;
302 }
303 }
304 else
305 {
306 TRACE( "Windowless Timer Running!\n" );
307 return;
308 }
309
310 switch (idEvent)
311 {
312/*
313 Used in NtUserTrackMouseEvent.
314 */
316 {
317 POINT Point;
318 UINT Msg;
320
321 pDesk = pWnd->head.rpdesk;
322 if ( pDesk->dwDTFlags & DF_TME_HOVER &&
323 pWnd == pDesk->spwndTrack )
324 {
325 Point = gpsi->ptCursor;
326 if ( RECTL_bPointInRect(&pDesk->rcMouseHover, Point.x, Point.y) )
327 {
328 if (pDesk->htEx == HTCLIENT) // In a client area.
329 {
330 wParam = MsqGetDownKeyState(pWnd->head.pti->MessageQueue);
332
333 if (pWnd->ExStyle & WS_EX_LAYOUTRTL)
334 {
335 Point.x = pWnd->rcClient.right - Point.x - 1;
336 }
337 else
338 Point.x -= pWnd->rcClient.left;
339 Point.y -= pWnd->rcClient.top;
340 }
341 else
342 {
343 wParam = pDesk->htEx; // Need to support all HTXYZ hits.
345 }
346 TRACE("Generating WM_NCMOUSEHOVER\n");
348 pDesk->dwDTFlags &= ~DF_TME_HOVER;
349 break; // Kill this timer.
350 }
351 }
352 }
353 return; // Not this window so just return.
354
356 {
357 FLASHWINFO fwi =
358 {sizeof(FLASHWINFO),
359 UserHMGetHandle(pWnd),
360 FLASHW_SYSTIMER,0,0};
361
362 IntFlashWindowEx(pWnd, &fwi);
363 }
364 return;
365
366 default:
367 ERR("System Timer Proc invalid id %u!\n", idEvent);
368 break;
369 }
370 IntKillTimer(pWnd, idEvent, TRUE);
371}
WPARAM wParam
Definition: combotst.c:138
WPARAM FASTCALL MsqGetDownKeyState(PUSER_MESSAGE_QUEUE MessageQueue)
Definition: msgqueue.c:338
unsigned int UINT
Definition: ndis.h:50
#define FLASHW_SYSTIMER
Definition: painting.h:4
#define WM_MOUSEHOVER
Definition: commctrl.h:4979
PWND spwndTrack
Definition: desktop.h:31
DWORD htEx
Definition: desktop.h:32
RECT rcMouseHover
Definition: desktop.h:33
DWORD dwDTFlags
Definition: desktop.h:12
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
Definition: ntuser.h:694
DWORD ExStyle
Definition: ntuser.h:704
THRDESKHEAD head
Definition: ntuser.h:695
RECT rcClient
Definition: ntuser.h:717
LONG right
Definition: windef.h:308
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1310
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
#define DF_TME_HOVER
Definition: desktop.h:47
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1395
BOOL FASTCALL IntKillTimer(PWND Window, UINT_PTR IDEvent, BOOL SystemTimer)
Definition: timer.c:580
#define ID_EVENT_SYSTIMER_MOUSEHOVER
Definition: timer.h:27
#define ID_EVENT_SYSTIMER_FLASHWIN
Definition: timer.h:28
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define HTCLIENT
Definition: winuser.h:2478
#define WM_NCMOUSEHOVER
Definition: winuser.h:1844

Referenced by IntFlashWindowEx(), IntTrackMouseEvent(), and IntTrackMouseMove().

◆ SystemTimerSet()

UINT_PTR FASTCALL SystemTimerSet ( PWND  Window,
UINT_PTR  nIDEvent,
UINT  uElapse,
TIMERPROC  lpTimerFunc 
)

Definition at line 386 of file timer.c.

390{
391 if (Window && Window->head.pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
392 {
394 TRACE("SysemTimerSet: Access Denied!\n");
395 return 0;
396 }
397 return IntSetTimer( Window, nIDEvent, uElapse, lpTimerFunc, TMRF_SYSTEM);
398}
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define PsGetCurrentProcess
Definition: psfuncs.h:17

◆ ValidateTimerCallback()

BOOL FASTCALL ValidateTimerCallback ( PTHREADINFO  pti,
LPARAM  lParam 
)

Definition at line 152 of file timer.c.

154{
155 PLIST_ENTRY pLE;
156 BOOL Ret = FALSE;
157 PTIMER pTmr;
158
160 pLE = TimersListHead.Flink;
161 while (pLE != &TimersListHead)
162 {
163 pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
164 if ( (lParam == (LPARAM)pTmr->pfn) &&
165 !(pTmr->flags & (TMRF_SYSTEM|TMRF_RIT)) &&
166 (pTmr->pti->ppi == pti->ppi) )
167 {
168 Ret = TRUE;
169 break;
170 }
171 pLE = pLE->Flink;
172 }
173 TimerLeave();
174
175 return Ret;
176}
LPARAM lParam
Definition: combotst.c:139
PPROCESSINFO ppi
Definition: win32.h:88

Referenced by IntDispatchMessage(), and NtUserValidateTimerCallback().

Variable Documentation

◆ MasterTimer

PKTIMER MasterTimer
extern

Definition at line 16 of file input.c.

Referenced by InitInputImpl(), IntSetTimer(), ProcessTimers(), and RawInputThreadMain().