Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b60b50ba
Commit
b60b50ba
authored
Jan 26, 2017
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jan 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Catch page faults in NtQueryPerformanceCounter.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
00475e1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
time.c
dlls/ntdll/tests/time.c
+23
-0
time.c
dlls/ntdll/time.c
+11
-3
No files found.
dlls/ntdll/tests/time.c
View file @
b60b50ba
...
...
@@ -26,6 +26,7 @@
static
VOID
(
WINAPI
*
pRtlTimeToTimeFields
)(
const
LARGE_INTEGER
*
liTime
,
PTIME_FIELDS
TimeFields
)
;
static
VOID
(
WINAPI
*
pRtlTimeFieldsToTime
)(
PTIME_FIELDS
TimeFields
,
PLARGE_INTEGER
Time
)
;
static
NTSTATUS
(
WINAPI
*
pNtQueryPerformanceCounter
)(
LARGE_INTEGER
*
counter
,
LARGE_INTEGER
*
frequency
);
static
const
int
MonthLengths
[
2
][
12
]
=
{
...
...
@@ -94,13 +95,35 @@ static void test_pRtlTimeToTimeFields(void)
}
}
static
void
test_NtQueryPerformanceCounter
(
void
)
{
LARGE_INTEGER
counter
,
frequency
;
NTSTATUS
status
;
status
=
pNtQueryPerformanceCounter
(
NULL
,
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"expected STATUS_ACCESS_VIOLATION, got %08x
\n
"
,
status
);
status
=
pNtQueryPerformanceCounter
(
NULL
,
&
frequency
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"expected STATUS_ACCESS_VIOLATION, got %08x
\n
"
,
status
);
status
=
pNtQueryPerformanceCounter
(
&
counter
,
(
void
*
)
0xdeadbee0
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"expected STATUS_ACCESS_VIOLATION, got %08x
\n
"
,
status
);
status
=
pNtQueryPerformanceCounter
((
void
*
)
0xdeadbee0
,
&
frequency
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"expected STATUS_ACCESS_VIOLATION, got %08x
\n
"
,
status
);
status
=
pNtQueryPerformanceCounter
(
&
counter
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
status
=
pNtQueryPerformanceCounter
(
&
counter
,
&
frequency
);
ok
(
status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
}
START_TEST
(
time
)
{
HMODULE
mod
=
GetModuleHandleA
(
"ntdll.dll"
);
pRtlTimeToTimeFields
=
(
void
*
)
GetProcAddress
(
mod
,
"RtlTimeToTimeFields"
);
pRtlTimeFieldsToTime
=
(
void
*
)
GetProcAddress
(
mod
,
"RtlTimeFieldsToTime"
);
pNtQueryPerformanceCounter
=
(
void
*
)
GetProcAddress
(
mod
,
"NtQueryPerformanceCounter"
);
if
(
pRtlTimeToTimeFields
&&
pRtlTimeFieldsToTime
)
test_pRtlTimeToTimeFields
();
else
win_skip
(
"Required time conversion functions are not available
\n
"
);
test_NtQueryPerformanceCounter
();
}
dlls/ntdll/time.c
View file @
b60b50ba
...
...
@@ -46,6 +46,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
...
...
@@ -472,10 +473,17 @@ NTSTATUS WINAPI NtQuerySystemTime( PLARGE_INTEGER Time )
*/
NTSTATUS
WINAPI
NtQueryPerformanceCounter
(
LARGE_INTEGER
*
counter
,
LARGE_INTEGER
*
frequency
)
{
if
(
!
counter
)
return
STATUS_ACCESS_VIOLATION
;
__TRY
{
counter
->
QuadPart
=
monotonic_counter
();
if
(
frequency
)
frequency
->
QuadPart
=
TICKSPERSEC
;
}
__EXCEPT_PAGE_FAULT
{
return
STATUS_ACCESS_VIOLATION
;
}
__ENDTRY
counter
->
QuadPart
=
monotonic_counter
();
if
(
frequency
)
frequency
->
QuadPart
=
TICKSPERSEC
;
return
STATUS_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment