Add AppDefaults app selection to control panel
[wine/gsoc-2012-control.git] / dlls / kernel32 / tests / timer.c
bloba06217a1886e81cf5a545b69f50c97ab88e11783
1 /*
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
21 #define _WIN32_WINNT 0x0501
23 #include "wine/test.h"
24 #include "winbase.h"
27 static void test_timer(void)
29 HANDLE (WINAPI *pCreateWaitableTimerA)( SECURITY_ATTRIBUTES*, BOOL, LPSTR );
30 BOOL (WINAPI *pSetWaitableTimer)(HANDLE, LARGE_INTEGER*, LONG, PTIMERAPCROUTINE, LPVOID, BOOL);
31 HMODULE hker = GetModuleHandle("kernel32");
32 HANDLE handle;
33 BOOL r;
34 LARGE_INTEGER due;
36 pCreateWaitableTimerA = (void*)GetProcAddress( hker, "CreateWaitableTimerA");
37 if( !pCreateWaitableTimerA )
39 win_skip("CreateWaitableTimerA is not available\n");
40 return;
43 pSetWaitableTimer = (void*)GetProcAddress( hker, "SetWaitableTimer");
44 if( !pSetWaitableTimer )
46 win_skip("SetWaitableTimer is not available\n");
47 return;
50 /* try once with a positive number */
51 handle = pCreateWaitableTimerA( NULL, 0, NULL );
52 ok( handle != NULL, "failed to create waitable timer with no name\n" );
54 due.QuadPart = 10000;
55 r = pSetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
56 ok( r, "failed to set timer\n");
58 CloseHandle( handle );
60 /* try once with a negative number */
61 handle = pCreateWaitableTimerA( NULL, 0, NULL );
62 ok( handle != NULL, "failed to create waitable timer with no name\n" );
64 due.QuadPart = -10000;
65 r = pSetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
66 ok( r, "failed to set timer\n");
68 CloseHandle( handle );
71 START_TEST(timer)
73 test_timer();