ReactOS  0.4.15-dev-439-g292f67a
timer.c File Reference
#include "wine/test.h"
#include "winbase.h"
Include dependency graph for timer.c:

Go to the source code of this file.

Functions

static void test_timer (void)
 
 START_TEST (timer)
 

Function Documentation

◆ START_TEST()

START_TEST ( timer  )

Definition at line 69 of file timer.c.

70 {
71  test_timer();
72 }
static void test_timer(void)
Definition: timer.c:25

◆ test_timer()

static void test_timer ( void  )
static

Definition at line 25 of file timer.c.

26 {
27  HANDLE (WINAPI *pCreateWaitableTimerA)( SECURITY_ATTRIBUTES*, BOOL, LPSTR );
28  BOOL (WINAPI *pSetWaitableTimer)(HANDLE, LARGE_INTEGER*, LONG, PTIMERAPCROUTINE, LPVOID, BOOL);
29  HMODULE hker = GetModuleHandleA("kernel32.dll");
30  HANDLE handle;
31  BOOL r;
32  LARGE_INTEGER due;
33 
34  pCreateWaitableTimerA = (void*)GetProcAddress( hker, "CreateWaitableTimerA");
35  if( !pCreateWaitableTimerA )
36  {
37  win_skip("CreateWaitableTimerA is not available\n");
38  return;
39  }
40 
41  pSetWaitableTimer = (void*)GetProcAddress( hker, "SetWaitableTimer");
42  if( !pSetWaitableTimer )
43  {
44  win_skip("SetWaitableTimer is not available\n");
45  return;
46  }
47 
48  /* try once with a positive number */
49  handle = pCreateWaitableTimerA( NULL, 0, NULL );
50  ok( handle != NULL, "failed to create waitable timer with no name\n" );
51 
52  due.QuadPart = 10000;
53  r = pSetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
54  ok( r, "failed to set timer\n");
55 
57 
58  /* try once with a negative number */
59  handle = pCreateWaitableTimerA( NULL, 0, NULL );
60  ok( handle != NULL, "failed to create waitable timer with no name\n" );
61 
62  due.QuadPart = -10000;
63  r = pSetWaitableTimer( handle, &due, 0x1f4, NULL, NULL, FALSE );
64  ok( r, "failed to set timer\n");
65 
67 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:407
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char * LPSTR
Definition: xmlstorage.h:182
#define BOOL
Definition: nt_native.h:43
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
void(CALLBACK * PTIMERAPCROUTINE)(PVOID, DWORD, DWORD)
Definition: winbase.h:1421
#define WINAPI
Definition: msvc.h:6
PVOID HANDLE
Definition: typedefs.h:72
#define LPVOID
Definition: nt_native.h:45
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define ok(value,...)
Definition: atltest.h:57
#define GetProcAddress(x, y)
Definition: compat.h:419
#define win_skip
Definition: test.h:149
LONGLONG QuadPart
Definition: typedefs.h:113

Referenced by START_TEST().