mirror of
https://github.com/reactos/reactos.git
synced 2025-07-10 20:54:12 +00:00
[ROSTESTS]
Add a test for NtQueryTimerResolution and NtSetTimerResolution, by Aleksander Andrejevic. See CORE-7387 for more information. svn path=/trunk/; revision=59786
This commit is contained in:
parent
63feab70a0
commit
282942655f
3 changed files with 69 additions and 0 deletions
|
@ -18,6 +18,7 @@ list(APPEND SOURCE
|
||||||
RtlGetLongestNtPathLength.c
|
RtlGetLongestNtPathLength.c
|
||||||
RtlInitializeBitMap.c
|
RtlInitializeBitMap.c
|
||||||
SystemInfo.c
|
SystemInfo.c
|
||||||
|
Timer.c
|
||||||
ZwContinue.c
|
ZwContinue.c
|
||||||
testlist.c)
|
testlist.c)
|
||||||
|
|
||||||
|
|
66
rostests/apitests/ntdll/Timer.c
Normal file
66
rostests/apitests/ntdll/Timer.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS API tests
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* PURPOSE: Test for NtQueryTimerResolution and NtSetTimerResolution.
|
||||||
|
* PROGRAMMER: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#include <wine/test.h>
|
||||||
|
#include <ndk/ketypes.h>
|
||||||
|
#include <ndk/kefuncs.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
START_TEST(TimerResolution)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
ULONG CurrentResolution;
|
||||||
|
ULONG MinimumResolution;
|
||||||
|
ULONG MaximumResolution;
|
||||||
|
ULONG CurrentResolution2;
|
||||||
|
|
||||||
|
/* Get the current timer resolution */
|
||||||
|
Status = NtSetTimerResolution(0, /* Ignored */
|
||||||
|
FALSE, /* Don't change resolution */
|
||||||
|
&CurrentResolution);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When not setting the resolution, it always
|
||||||
|
* returns STATUS_TIMER_RESOLUTION_NOT_SET
|
||||||
|
*/
|
||||||
|
ok_hex(Status, STATUS_TIMER_RESOLUTION_NOT_SET);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the timer resolution limits and current timer resolution
|
||||||
|
* using a different method
|
||||||
|
*/
|
||||||
|
Status = NtQueryTimerResolution(&MinimumResolution,
|
||||||
|
&MaximumResolution,
|
||||||
|
&CurrentResolution2);
|
||||||
|
|
||||||
|
/* This function should always return STATUS_SUCCESS */
|
||||||
|
ok_hex(Status, STATUS_SUCCESS);
|
||||||
|
|
||||||
|
/* These two values should be the same */
|
||||||
|
ok_hex(CurrentResolution, CurrentResolution2);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Even if you give it invalid values,
|
||||||
|
* NtSetTimerResolution will return STATUS_SUCCESS,
|
||||||
|
* but it will not change the resolution.
|
||||||
|
*/
|
||||||
|
Status = NtSetTimerResolution(MinimumResolution - 1,
|
||||||
|
TRUE,
|
||||||
|
&CurrentResolution);
|
||||||
|
ok_hex(Status, STATUS_SUCCESS);
|
||||||
|
printf("Current resolution: %d ; minimum resolution: %d\n", CurrentResolution, MinimumResolution);
|
||||||
|
ok(CurrentResolution >= MinimumResolution, "Current resolution: %d became too low! (minimum resolution: %d)\n", CurrentResolution, MinimumResolution);
|
||||||
|
|
||||||
|
Status = NtSetTimerResolution(MaximumResolution + 1,
|
||||||
|
TRUE,
|
||||||
|
&CurrentResolution);
|
||||||
|
ok_hex(Status, STATUS_SUCCESS);
|
||||||
|
printf("Current resolution: %d ; maximum resolution: %d\n", CurrentResolution, MaximumResolution);
|
||||||
|
ok(CurrentResolution <= MaximumResolution, "Current resolution: %d became too high! (maximum resolution: %d)\n", CurrentResolution, MaximumResolution);
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ extern void func_RtlGetFullPathName_UstrEx(void);
|
||||||
extern void func_RtlGetLongestNtPathLength(void);
|
extern void func_RtlGetLongestNtPathLength(void);
|
||||||
extern void func_RtlInitializeBitMap(void);
|
extern void func_RtlInitializeBitMap(void);
|
||||||
extern void func_ZwContinue(void);
|
extern void func_ZwContinue(void);
|
||||||
|
extern void func_TimerResolution(void);
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
||||||
{ "RtlInitializeBitMap", func_RtlInitializeBitMap },
|
{ "RtlInitializeBitMap", func_RtlInitializeBitMap },
|
||||||
{ "ZwContinue", func_ZwContinue },
|
{ "ZwContinue", func_ZwContinue },
|
||||||
|
{ "TimerResolution", func_TimerResolution },
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue