Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
891 B

  1. #include "wdmtimer.h"
  2. #pragma PAGEDCODE
  3. CTimer* CWDMTimer::create(TIMER_TYPE Type)
  4. {
  5. return new (NonPagedPool) CWDMTimer(Type);
  6. }
  7. #pragma PAGEDCODE
  8. CWDMTimer::CWDMTimer(TIMER_TYPE Type)
  9. {
  10. KeInitializeTimerEx(&Timer, Type);
  11. };
  12. #pragma PAGEDCODE
  13. CWDMTimer::~CWDMTimer()
  14. {
  15. KeCancelTimer(&Timer);
  16. };
  17. #pragma PAGEDCODE
  18. BOOL CWDMTimer::set(LARGE_INTEGER DueTime,LONG Period,PKDPC Dpc)
  19. {
  20. return KeSetTimerEx(&Timer,DueTime, Period, Dpc);
  21. };
  22. #pragma PAGEDCODE
  23. BOOL CWDMTimer::cancel()
  24. {
  25. return KeCancelTimer(&Timer);
  26. };
  27. #pragma PAGEDCODE
  28. VOID CWDMTimer::delay(ULONG Delay)
  29. {
  30. LARGE_INTEGER duetime;
  31. // Waits for the Timeout to be elapsed.
  32. ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
  33. duetime.QuadPart = -(LONGLONG)(Delay * 10L * 1000L);
  34. set(duetime,0,NULL);
  35. KeWaitForSingleObject(&Timer, Executive, KernelMode, FALSE, NULL);
  36. }