Source code of Windows XP (NT5)
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.

43 lines
839 B

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. VOID TimerCallback(PVOID pv, BOOLEAN b)
  5. {
  6. DbgPrint("TimerCallback called!\n");
  7. }
  8. int main(int argc, char *argv[])
  9. {
  10. NTSTATUS st;
  11. HANDLE Q;
  12. HANDLE T;
  13. LARGE_INTEGER li;
  14. DbgPrint("Creating timer queue...\n");
  15. RtlCreateTimerQueue(&Q);
  16. DbgPrint("In main... setting a timer...\n");
  17. st = RtlSetTimer(Q,
  18. &T,
  19. TimerCallback,
  20. NULL,
  21. 500,
  22. 500,
  23. 0);
  24. DbgPrint("In main... sleeping...\n");
  25. li.QuadPart = -500*20*5000;
  26. NtDelayExecution(FALSE, &li);
  27. DbgPrint("In main... cancelling timer...\n");
  28. RtlCancelTimer(Q, T);
  29. DbgPrint("In main... deleting timer...\n");
  30. RtlDeleteTimerQueue(Q);
  31. return 1;
  32. }