2 * Unit test suite for timer functions
4 * Copyright 2004 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 static void test_timer(void)
25 HANDLE (WINAPI
*pCreateWaitableTimerA
)( SECURITY_ATTRIBUTES
*, BOOL
, LPSTR
);
26 BOOL (WINAPI
*pSetWaitableTimer
)(HANDLE
, LARGE_INTEGER
*, LONG
, PTIMERAPCROUTINE
, LPVOID
, BOOL
);
27 HMODULE hker
= GetModuleHandleA("kernel32.dll");
32 pCreateWaitableTimerA
= (void*)GetProcAddress( hker
, "CreateWaitableTimerA");
33 if( !pCreateWaitableTimerA
)
35 win_skip("CreateWaitableTimerA is not available\n");
39 pSetWaitableTimer
= (void*)GetProcAddress( hker
, "SetWaitableTimer");
40 if( !pSetWaitableTimer
)
42 win_skip("SetWaitableTimer is not available\n");
46 /* try once with a positive number */
47 handle
= pCreateWaitableTimerA( NULL
, 0, NULL
);
48 ok( handle
!= NULL
, "failed to create waitable timer with no name\n" );
51 r
= pSetWaitableTimer( handle
, &due
, 0x1f4, NULL
, NULL
, FALSE
);
52 ok( r
, "failed to set timer\n");
54 CloseHandle( handle
);
56 /* try once with a negative number */
57 handle
= pCreateWaitableTimerA( NULL
, 0, NULL
);
58 ok( handle
!= NULL
, "failed to create waitable timer with no name\n" );
60 due
.QuadPart
= -10000;
61 r
= pSetWaitableTimer( handle
, &due
, 0x1f4, NULL
, NULL
, FALSE
);
62 ok( r
, "failed to set timer\n");
64 CloseHandle( handle
);