Sync to trunk (r44371)
[reactos.git] / reactos / dll / win32 / kernel32 / misc / perfcnt.c
1 /* $Id$ */
2 /*
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/kernel32/misc/perfcnt.c
6 * PURPOSE: Performance counter
7 * PROGRAMMER: Eric Kohl
8 */
9
10 /* INCLUDES *****************************************************************/
11
12 #include <k32.h>
13
14 #define NDEBUG
15 #include <debug.h>
16
17
18 /* FUNCTIONS ****************************************************************/
19
20 /*
21 * @implemented
22 */
23 BOOL WINAPI
24 QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
25 {
26 LARGE_INTEGER Frequency;
27 NTSTATUS Status;
28
29 Status = NtQueryPerformanceCounter(lpPerformanceCount,
30 &Frequency);
31 if (!NT_SUCCESS(Status))
32 {
33 SetLastErrorByStatus(Status);
34 return(FALSE);
35 }
36
37 if (Frequency.QuadPart == 0ULL)
38 {
39 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
40 return(FALSE);
41 }
42
43 return(TRUE);
44 }
45
46
47 /*
48 * @implemented
49 */
50 BOOL WINAPI
51 QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
52 {
53 LARGE_INTEGER Count;
54 NTSTATUS Status;
55
56 Status = NtQueryPerformanceCounter(&Count,
57 lpFrequency);
58 if (!NT_SUCCESS(Status))
59 {
60 SetLastErrorByStatus(Status);
61 return(FALSE);
62 }
63
64 if (lpFrequency->QuadPart == 0ULL)
65 {
66 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
67 return(FALSE);
68 }
69
70 return(TRUE);
71 }
72
73 /* EOF */