mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 21:46:05 +00:00
cleanup
svn path=/trunk/; revision=8527
This commit is contained in:
parent
3c737e0e68
commit
cdd8158e28
1 changed files with 44 additions and 184 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: timer.c,v 1.24 2004/02/24 13:27:03 weiden Exp $
|
/* $Id: timer.c,v 1.25 2004/03/04 01:30:00 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -48,15 +48,14 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
//windows 2000 has room for 32768 handle-less timers
|
//windows 2000 has room for 32768 window-less timers
|
||||||
#define NUM_HANDLE_LESS_TIMERS 1024
|
#define NUM_WINDOW_LESS_TIMERS 1024
|
||||||
|
|
||||||
static FAST_MUTEX Mutex;
|
static FAST_MUTEX Mutex;
|
||||||
static LIST_ENTRY TimerListHead;
|
static LIST_ENTRY TimerListHead;
|
||||||
static LIST_ENTRY SysTimerListHead;
|
|
||||||
static KTIMER Timer;
|
static KTIMER Timer;
|
||||||
static RTL_BITMAP HandleLessTimersBitMap;
|
static RTL_BITMAP WindowLessTimersBitMap;
|
||||||
static PVOID HandleLessTimersBitMapBuffer;
|
static PVOID WindowLessTimersBitMapBuffer;
|
||||||
static ULONG HintIndex = 0;
|
static ULONG HintIndex = 0;
|
||||||
static HANDLE MsgTimerThreadHandle;
|
static HANDLE MsgTimerThreadHandle;
|
||||||
static CLIENT_ID MsgTimerThreadId;
|
static CLIENT_ID MsgTimerThreadId;
|
||||||
|
@ -74,21 +73,19 @@ static CLIENT_ID MsgTimerThreadId;
|
||||||
//return true if the new timer became the first entry
|
//return true if the new timer became the first entry
|
||||||
//must hold mutex while calling this
|
//must hold mutex while calling this
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntInsertTimerAscendingOrder(PMSG_TIMER_ENTRY NewTimer, BOOL SysTimer)
|
IntInsertTimerAscendingOrder(PMSG_TIMER_ENTRY NewTimer)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY ListHead;
|
|
||||||
|
|
||||||
ListHead = SysTimer ? &SysTimerListHead : &TimerListHead;
|
InsertAscendingList(&TimerListHead,
|
||||||
|
|
||||||
InsertAscendingList(ListHead,
|
|
||||||
MSG_TIMER_ENTRY,
|
MSG_TIMER_ENTRY,
|
||||||
ListEntry,
|
ListEntry,
|
||||||
NewTimer,
|
NewTimer,
|
||||||
Timeout.QuadPart);
|
Timeout.QuadPart);
|
||||||
|
|
||||||
return IsFirstEntry(ListHead, &NewTimer->ListEntry);
|
return IsFirstEntry(&TimerListHead, &NewTimer->ListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//must hold mutex while calling this
|
//must hold mutex while calling this
|
||||||
PMSG_TIMER_ENTRY FASTCALL
|
PMSG_TIMER_ENTRY FASTCALL
|
||||||
IntRemoveTimer(HWND hWnd, UINT_PTR IDEvent, HANDLE ThreadID, BOOL SysTimer)
|
IntRemoveTimer(HWND hWnd, UINT_PTR IDEvent, HANDLE ThreadID, BOOL SysTimer)
|
||||||
|
@ -96,8 +93,6 @@ IntRemoveTimer(HWND hWnd, UINT_PTR IDEvent, HANDLE ThreadID, BOOL SysTimer)
|
||||||
PMSG_TIMER_ENTRY MsgTimer;
|
PMSG_TIMER_ENTRY MsgTimer;
|
||||||
PLIST_ENTRY EnumEntry;
|
PLIST_ENTRY EnumEntry;
|
||||||
|
|
||||||
if(!SysTimer)
|
|
||||||
{
|
|
||||||
//remove timer if already in the queue
|
//remove timer if already in the queue
|
||||||
EnumEntry = TimerListHead.Flink;
|
EnumEntry = TimerListHead.Flink;
|
||||||
while (EnumEntry != &TimerListHead)
|
while (EnumEntry != &TimerListHead)
|
||||||
|
@ -107,38 +102,20 @@ IntRemoveTimer(HWND hWnd, UINT_PTR IDEvent, HANDLE ThreadID, BOOL SysTimer)
|
||||||
|
|
||||||
if (MsgTimer->Msg.hwnd == hWnd &&
|
if (MsgTimer->Msg.hwnd == hWnd &&
|
||||||
MsgTimer->Msg.wParam == (WPARAM)IDEvent &&
|
MsgTimer->Msg.wParam == (WPARAM)IDEvent &&
|
||||||
MsgTimer->ThreadID == ThreadID)
|
MsgTimer->ThreadID == ThreadID &&
|
||||||
|
(MsgTimer->Msg.message == WM_SYSTIMER) == SysTimer)
|
||||||
{
|
{
|
||||||
RemoveEntryList(&MsgTimer->ListEntry);
|
RemoveEntryList(&MsgTimer->ListEntry);
|
||||||
return MsgTimer;
|
return MsgTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//remove timer if already in the queue
|
|
||||||
EnumEntry = SysTimerListHead.Flink;
|
|
||||||
while (EnumEntry != &SysTimerListHead)
|
|
||||||
{
|
|
||||||
MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
EnumEntry = EnumEntry->Flink;
|
|
||||||
|
|
||||||
if (MsgTimer->Msg.hwnd == hWnd &&
|
|
||||||
MsgTimer->Msg.wParam == (WPARAM)IDEvent &&
|
|
||||||
MsgTimer->ThreadID == ThreadID)
|
|
||||||
{
|
|
||||||
RemoveEntryList(&MsgTimer->ListEntry);
|
|
||||||
return MsgTimer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: It doesn't kill timers. It just removes them from the list.
|
* NOTE: It doesn't kill the timer. It just removes them from the list.
|
||||||
*/
|
*/
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
RemoveTimersThread(HANDLE ThreadID)
|
RemoveTimersThread(HANDLE ThreadID)
|
||||||
|
@ -148,19 +125,6 @@ RemoveTimersThread(HANDLE ThreadID)
|
||||||
|
|
||||||
IntLockTimerList;
|
IntLockTimerList;
|
||||||
|
|
||||||
EnumEntry = SysTimerListHead.Flink;
|
|
||||||
while (EnumEntry != &SysTimerListHead)
|
|
||||||
{
|
|
||||||
MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
EnumEntry = EnumEntry->Flink;
|
|
||||||
|
|
||||||
if (MsgTimer->ThreadID == ThreadID)
|
|
||||||
{
|
|
||||||
RemoveEntryList(&MsgTimer->ListEntry);
|
|
||||||
ExFreePool(MsgTimer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EnumEntry = TimerListHead.Flink;
|
EnumEntry = TimerListHead.Flink;
|
||||||
while (EnumEntry != &TimerListHead)
|
while (EnumEntry != &TimerListHead)
|
||||||
{
|
{
|
||||||
|
@ -171,7 +135,7 @@ RemoveTimersThread(HANDLE ThreadID)
|
||||||
{
|
{
|
||||||
if (MsgTimer->Msg.hwnd == NULL)
|
if (MsgTimer->Msg.hwnd == NULL)
|
||||||
{
|
{
|
||||||
RtlClearBits(&HandleLessTimersBitMap, ((UINT_PTR)MsgTimer->Msg.wParam) - 1, 1);
|
RtlClearBits(&WindowLessTimersBitMap, ((UINT_PTR)MsgTimer->Msg.wParam) - 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryList(&MsgTimer->ListEntry);
|
RemoveEntryList(&MsgTimer->ListEntry);
|
||||||
|
@ -182,13 +146,13 @@ RemoveTimersThread(HANDLE ThreadID)
|
||||||
IntUnLockTimerList;
|
IntUnLockTimerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINT_PTR FASTCALL
|
UINT_PTR FASTCALL
|
||||||
IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, BOOL SystemTimer)
|
IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, BOOL SystemTimer)
|
||||||
{
|
{
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
PMSG_TIMER_ENTRY MsgTimer2, MsgTimer = NULL;
|
PMSG_TIMER_ENTRY MsgTimer = NULL;
|
||||||
PMSG_TIMER_ENTRY NewTimer;
|
PMSG_TIMER_ENTRY NewTimer;
|
||||||
PLIST_ENTRY EnumEntry;
|
|
||||||
LARGE_INTEGER CurrentTime;
|
LARGE_INTEGER CurrentTime;
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT WindowObject;
|
||||||
HANDLE ThreadID;
|
HANDLE ThreadID;
|
||||||
|
@ -200,8 +164,8 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
|
||||||
|
|
||||||
if((hWnd == NULL) && !SystemTimer)
|
if((hWnd == NULL) && !SystemTimer)
|
||||||
{
|
{
|
||||||
/* find a free, handle-less timer id */
|
/* find a free, window-less timer id */
|
||||||
Index = RtlFindClearBitsAndSet(&HandleLessTimersBitMap, 1, HintIndex);
|
Index = RtlFindClearBitsAndSet(&WindowLessTimersBitMap, 1, HintIndex);
|
||||||
|
|
||||||
if(Index == (ULONG) -1)
|
if(Index == (ULONG) -1)
|
||||||
{
|
{
|
||||||
|
@ -285,54 +249,18 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
|
||||||
|
|
||||||
Ret = nIDEvent; // FIXME - return lpTimerProc if it's not a system timer
|
Ret = nIDEvent; // FIXME - return lpTimerProc if it's not a system timer
|
||||||
|
|
||||||
if(SystemTimer)
|
if(IntInsertTimerAscendingOrder(NewTimer))
|
||||||
{
|
|
||||||
if(IntInsertTimerAscendingOrder(NewTimer, TRUE))
|
|
||||||
{
|
|
||||||
EnumEntry = TimerListHead.Flink;
|
|
||||||
if(EnumEntry != &TimerListHead)
|
|
||||||
{
|
|
||||||
MsgTimer2 = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
if (NewTimer->Timeout.QuadPart < MsgTimer2->Timeout.QuadPart)
|
|
||||||
{
|
{
|
||||||
/* new timer is first in queue and expires first */
|
/* new timer is first in queue and expires first */
|
||||||
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* new timer is first in queue and expires first */
|
|
||||||
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(IntInsertTimerAscendingOrder(NewTimer, FALSE))
|
|
||||||
{
|
|
||||||
EnumEntry = SysTimerListHead.Flink;
|
|
||||||
if(EnumEntry != &SysTimerListHead)
|
|
||||||
{
|
|
||||||
MsgTimer2 = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
if (NewTimer->Timeout.QuadPart < MsgTimer2->Timeout.QuadPart)
|
|
||||||
{
|
|
||||||
/* new timer is first in queue and expires first */
|
|
||||||
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* new timer is first in queue and expires first */
|
|
||||||
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IntUnLockTimerList;
|
IntUnLockTimerList;
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
|
IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
|
||||||
{
|
{
|
||||||
|
@ -341,10 +269,10 @@ IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
|
||||||
|
|
||||||
IntLockTimerList;
|
IntLockTimerList;
|
||||||
|
|
||||||
/* handle-less timer? */
|
/* window-less timer? */
|
||||||
if((hWnd == NULL) && !SystemTimer)
|
if((hWnd == NULL) && !SystemTimer)
|
||||||
{
|
{
|
||||||
if(!RtlAreBitsSet(&HandleLessTimersBitMap, uIDEvent - 1, 1))
|
if(!RtlAreBitsSet(&WindowLessTimersBitMap, uIDEvent - 1, 1))
|
||||||
{
|
{
|
||||||
IntUnLockTimerList;
|
IntUnLockTimerList;
|
||||||
/* bit was not set */
|
/* bit was not set */
|
||||||
|
@ -352,7 +280,7 @@ IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlClearBits(&HandleLessTimersBitMap, uIDEvent - 1, 1);
|
RtlClearBits(&WindowLessTimersBitMap, uIDEvent - 1, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -397,7 +325,7 @@ TimerThreadMain(PVOID StartContext)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
LARGE_INTEGER CurrentTime;
|
LARGE_INTEGER CurrentTime;
|
||||||
PLIST_ENTRY EnumEntry;
|
PLIST_ENTRY EnumEntry;
|
||||||
PMSG_TIMER_ENTRY MsgTimer, MsgTimer2;
|
PMSG_TIMER_ENTRY MsgTimer;
|
||||||
PETHREAD Thread;
|
PETHREAD Thread;
|
||||||
PETHREAD *ThreadsToDereference;
|
PETHREAD *ThreadsToDereference;
|
||||||
ULONG ThreadsToDereferenceCount, ThreadsToDereferencePos, i;
|
ULONG ThreadsToDereferenceCount, ThreadsToDereferencePos, i;
|
||||||
|
@ -432,16 +360,6 @@ TimerThreadMain(PVOID StartContext)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (EnumEntry = SysTimerListHead.Flink;
|
|
||||||
EnumEntry != &SysTimerListHead;
|
|
||||||
EnumEntry = EnumEntry->Flink)
|
|
||||||
{
|
|
||||||
MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
if (CurrentTime.QuadPart >= MsgTimer->Timeout.QuadPart)
|
|
||||||
++ThreadsToDereferenceCount;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadsToDereference = (PETHREAD *)ExAllocatePoolWithTag(
|
ThreadsToDereference = (PETHREAD *)ExAllocatePoolWithTag(
|
||||||
NonPagedPool, ThreadsToDereferenceCount * sizeof(PETHREAD), TAG_TIMERTD);
|
NonPagedPool, ThreadsToDereferenceCount * sizeof(PETHREAD), TAG_TIMERTD);
|
||||||
|
@ -473,12 +391,13 @@ TimerThreadMain(PVOID StartContext)
|
||||||
++ThreadsToDereferencePos;
|
++ThreadsToDereferencePos;
|
||||||
|
|
||||||
//set up next periodic timeout
|
//set up next periodic timeout
|
||||||
|
//FIXME: is this calculation really necesary (and correct)? -Gunnar
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
MsgTimer->Timeout.QuadPart += (MsgTimer->Period * 10000);
|
MsgTimer->Timeout.QuadPart += (MsgTimer->Period * 10000);
|
||||||
}
|
}
|
||||||
while (MsgTimer->Timeout.QuadPart <= CurrentTime.QuadPart);
|
while (MsgTimer->Timeout.QuadPart <= CurrentTime.QuadPart);
|
||||||
IntInsertTimerAscendingOrder(MsgTimer, FALSE);
|
IntInsertTimerAscendingOrder(MsgTimer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -487,75 +406,17 @@ TimerThreadMain(PVOID StartContext)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumEntry = SysTimerListHead.Flink;
|
|
||||||
while (EnumEntry != &SysTimerListHead)
|
|
||||||
{
|
|
||||||
MsgTimer2 = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
|
|
||||||
if (CurrentTime.QuadPart >= MsgTimer2->Timeout.QuadPart)
|
|
||||||
{
|
|
||||||
EnumEntry = EnumEntry->Flink;
|
|
||||||
|
|
||||||
RemoveEntryList(&MsgTimer2->ListEntry);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: 1) Find a faster way of getting the thread message queue? (lookup by id is slow)
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(PsLookupThreadByThreadId(MsgTimer2->ThreadID, &Thread)))
|
|
||||||
{
|
|
||||||
ExFreePool(MsgTimer2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
MsqPostMessage(((PW32THREAD)Thread->Win32Thread)->MessageQueue, MsqCreateMessage(&MsgTimer2->Msg));
|
|
||||||
|
|
||||||
ThreadsToDereference[ThreadsToDereferencePos] = Thread;
|
|
||||||
++ThreadsToDereferencePos;
|
|
||||||
|
|
||||||
//set up next periodic timeout
|
|
||||||
do
|
|
||||||
{
|
|
||||||
MsgTimer2->Timeout.QuadPart += (MsgTimer2->Period * 10000);
|
|
||||||
}
|
|
||||||
while (MsgTimer2->Timeout.QuadPart <= CurrentTime.QuadPart);
|
|
||||||
IntInsertTimerAscendingOrder(MsgTimer2, TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//set up next timeout from first entry (if any)
|
//set up next timeout from first entry (if any)
|
||||||
if (!IsListEmpty(&TimerListHead))
|
if (!IsListEmpty(&TimerListHead))
|
||||||
{
|
{
|
||||||
MsgTimer = CONTAINING_RECORD( TimerListHead.Flink, MSG_TIMER_ENTRY, ListEntry);
|
MsgTimer = CONTAINING_RECORD( TimerListHead.Flink, MSG_TIMER_ENTRY, ListEntry);
|
||||||
if(!IsListEmpty(&SysTimerListHead))
|
|
||||||
{
|
|
||||||
MsgTimer2 = CONTAINING_RECORD( SysTimerListHead.Flink, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
if(MsgTimer->Timeout.QuadPart <= MsgTimer2->Timeout.QuadPart)
|
|
||||||
KeSetTimer(&Timer, MsgTimer->Timeout, NULL);
|
|
||||||
else
|
|
||||||
KeSetTimer(&Timer, MsgTimer2->Timeout, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KeSetTimer(&Timer, MsgTimer->Timeout, NULL);
|
KeSetTimer(&Timer, MsgTimer->Timeout, NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!IsListEmpty(&SysTimerListHead))
|
/* cancel timer, this reset the state of the timer event on which we wait */
|
||||||
{
|
KeCancelTimer(&Timer);
|
||||||
MsgTimer2 = CONTAINING_RECORD( SysTimerListHead.Flink, MSG_TIMER_ENTRY, ListEntry);
|
|
||||||
KeSetTimer(&Timer, MsgTimer2->Timeout, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Reinitialize the timer, this reset the state of the timer event on which we wait */
|
|
||||||
KeInitializeTimer(&Timer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IntUnLockTimerList;
|
IntUnLockTimerList;
|
||||||
|
@ -573,20 +434,19 @@ InitTimerImpl(VOID)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG BitmapBytes;
|
ULONG BitmapBytes;
|
||||||
|
|
||||||
BitmapBytes = ROUND_UP(NUM_HANDLE_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
|
BitmapBytes = ROUND_UP(NUM_WINDOW_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
|
||||||
|
|
||||||
InitializeListHead(&TimerListHead);
|
InitializeListHead(&TimerListHead);
|
||||||
InitializeListHead(&SysTimerListHead);
|
|
||||||
KeInitializeTimer(&Timer);
|
KeInitializeTimer(&Timer);
|
||||||
ExInitializeFastMutex(&Mutex);
|
ExInitializeFastMutex(&Mutex);
|
||||||
|
|
||||||
HandleLessTimersBitMapBuffer = ExAllocatePoolWithTag(PagedPool, BitmapBytes, TAG_TIMERBMP);
|
WindowLessTimersBitMapBuffer = ExAllocatePoolWithTag(PagedPool, BitmapBytes, TAG_TIMERBMP);
|
||||||
RtlInitializeBitMap(&HandleLessTimersBitMap,
|
RtlInitializeBitMap(&WindowLessTimersBitMap,
|
||||||
HandleLessTimersBitMapBuffer,
|
WindowLessTimersBitMapBuffer,
|
||||||
BitmapBytes * 8);
|
BitmapBytes * 8);
|
||||||
|
|
||||||
//yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory
|
//yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory
|
||||||
RtlClearAllBits(&HandleLessTimersBitMap);
|
RtlClearAllBits(&WindowLessTimersBitMap);
|
||||||
|
|
||||||
Status = PsCreateSystemThread(&MsgTimerThreadHandle,
|
Status = PsCreateSystemThread(&MsgTimerThreadHandle,
|
||||||
THREAD_ALL_ACCESS,
|
THREAD_ALL_ACCESS,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue