Adding rostests as part of the tree restructure
[reactos.git] / rostests / tests / apc2 / apc2.c
1
2 #include <windows.h>
3 #include <stdio.h>
4
5 VOID CALLBACK TimerApcProc(
6 LPVOID lpArg,
7 DWORD dwTimerLowValue,
8 DWORD dwTimerHighValue )
9 {
10 printf("APC Callback %lu\n", *(PDWORD)lpArg);
11 }
12
13
14 int main()
15 {
16 HANDLE hTimer;
17 BOOL bSuccess;
18 LARGE_INTEGER DueTime;
19 DWORD value = 1;
20
21 hTimer = CreateWaitableTimer(NULL, FALSE, NULL );
22
23 if (!hTimer)
24 {
25 printf("CreateWaitableTimer failed!\n");
26 return 0;
27 }
28
29 DueTime.QuadPart = -(LONGLONG)(5 * 10000000);
30
31 bSuccess = SetWaitableTimer(
32 hTimer,
33 &DueTime,
34 2001 /*interval (using an odd number to be able to find it easy in kmode) */,
35 TimerApcProc,
36 &value /*callback argument*/,
37 FALSE );
38
39 if (!bSuccess)
40 {
41 printf("SetWaitableTimer failed!\n");
42 return 0;
43 }
44
45 for (;value <= 10; value++ )
46 {
47 SleepEx(INFINITE, TRUE /*alertable*/ );
48 }
49
50 CloseHandle( hTimer );
51 return 0;
52 }
53