windows-nt/Source/XPSP1/NT/drivers/smartcrd/gempc430/wdmtimer.cpp

43 lines
849 B
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
#include "wdmtimer.h"
#pragma PAGEDCODE
CTimer* CWDMTimer::create(TIMER_TYPE Type)
{
return new (NonPagedPool) CWDMTimer(Type);
}
#pragma PAGEDCODE
CWDMTimer::CWDMTimer(TIMER_TYPE Type)
{
KeInitializeTimerEx(&Timer, Type);
};
#pragma PAGEDCODE
CWDMTimer::~CWDMTimer()
{
KeCancelTimer(&Timer);
};
#pragma PAGEDCODE
BOOL CWDMTimer::set(LARGE_INTEGER DueTime,LONG Period,PKDPC Dpc)
{
return KeSetTimerEx(&Timer,DueTime, Period, Dpc);
};
#pragma PAGEDCODE
BOOL CWDMTimer::cancel()
{
return KeCancelTimer(&Timer);
};
#pragma PAGEDCODE
VOID CWDMTimer::delay(ULONG Delay)
{
LARGE_INTEGER duetime;
// Waits for the Timeout to be elapsed.
ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
duetime.QuadPart = -(LONGLONG)(Delay * 10L * 1000L);
set(duetime,0,NULL);
KeWaitForSingleObject(&Timer, Executive, KernelMode, FALSE, NULL);
}