Skip to content

Commit a5ae5f4

Browse files
committed
WIP
1 parent c98c3f0 commit a5ae5f4

12 files changed

Lines changed: 599 additions & 4 deletions

File tree

dll/ntdll/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ include_directories(
1919

2020
add_library(rtl_um OBJECT
2121
rtl/libsupp.c
22+
rtl/perftime.c
2223
rtl/uilist.c
2324
rtl/version.c)
2425
target_link_libraries(rtl_um apisets ${PSEH_LIB})

dll/ntdll/def/ntdll.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,10 @@
10931093
@ stdcall RtlQuerySecurityObject(ptr long ptr long ptr)
10941094
@ stdcall RtlQueryTagHeap(ptr long long long ptr)
10951095
@ stdcall RtlQueryTimeZoneInformation(ptr)
1096+
@ stdcall RtlQueryPerformanceCounter(ptr)
1097+
@ stdcall RtlQueryPerformanceFrequency(ptr)
1098+
@ stdcall -version=0x600+ RtlQueryUnbiasedInterruptTime(ptr)
1099+
@ stdcall -version=0x601+ RtlGetDeviceFamilyInfoEnum(ptr ptr ptr)
10961100
@ stdcall -arch=i386,x86_64 RtlQueueApcWow64Thread(ptr ptr ptr ptr ptr)
10971101
@ stdcall RtlQueueWorkItem(ptr ptr long)
10981102
@ stdcall -register RtlRaiseException(ptr)

dll/ntdll/rtl/perftime.c

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* PROJECT: ReactOS NT DLL
3+
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4+
* PURPOSE: Rtl performance / interrupt-time / device-family helpers
5+
*/
6+
7+
#include <ntdll.h>
8+
9+
#define NDEBUG
10+
#include <debug.h>
11+
12+
/*
13+
* @implemented
14+
*/
15+
BOOLEAN
16+
NTAPI
17+
RtlQueryPerformanceCounter(OUT PLARGE_INTEGER PerformanceCount)
18+
{
19+
LARGE_INTEGER Frequency;
20+
NTSTATUS Status;
21+
22+
Status = NtQueryPerformanceCounter(PerformanceCount, &Frequency);
23+
if (Frequency.QuadPart == 0)
24+
Status = STATUS_NOT_IMPLEMENTED;
25+
26+
if (!NT_SUCCESS(Status))
27+
{
28+
RtlSetLastWin32ErrorAndNtStatusFromNtStatus(Status);
29+
return FALSE;
30+
}
31+
return TRUE;
32+
}
33+
34+
/*
35+
* @implemented
36+
*/
37+
BOOLEAN
38+
NTAPI
39+
RtlQueryPerformanceFrequency(OUT PLARGE_INTEGER Frequency)
40+
{
41+
LARGE_INTEGER Count;
42+
NTSTATUS Status;
43+
44+
Status = NtQueryPerformanceCounter(&Count, Frequency);
45+
if (Frequency->QuadPart == 0)
46+
Status = STATUS_NOT_IMPLEMENTED;
47+
48+
if (!NT_SUCCESS(Status))
49+
{
50+
RtlSetLastWin32ErrorAndNtStatusFromNtStatus(Status);
51+
return FALSE;
52+
}
53+
return TRUE;
54+
}
55+
56+
/*
57+
* @implemented
58+
*/
59+
BOOLEAN
60+
NTAPI
61+
RtlQueryUnbiasedInterruptTime(OUT PULONGLONG UnbiasedTime)
62+
{
63+
PKUSER_SHARED_DATA UserSharedData = SharedUserData;
64+
ULONG High, Low;
65+
ULONGLONG Biased;
66+
67+
if (!UnbiasedTime)
68+
{
69+
RtlSetLastWin32ErrorAndNtStatusFromNtStatus(STATUS_INVALID_PARAMETER);
70+
return FALSE;
71+
}
72+
73+
do
74+
{
75+
High = UserSharedData->InterruptTime.High1Time;
76+
Low = UserSharedData->InterruptTime.LowPart;
77+
} while (High != UserSharedData->InterruptTime.High2Time);
78+
79+
Biased = ((ULONGLONG)(ULONG)High << 32) | Low;
80+
*UnbiasedTime = Biased - UserSharedData->InterruptTimeBias;
81+
return TRUE;
82+
}
83+
84+
/*
85+
* @implemented
86+
*/
87+
VOID
88+
NTAPI
89+
RtlGetDeviceFamilyInfoEnum(
90+
_Out_opt_ PULONGLONG PullUAPInfo,
91+
_Out_opt_ PDWORD PullDeviceFamily,
92+
_Out_opt_ PDWORD PullDeviceForm)
93+
{
94+
RTL_OSVERSIONINFOW VersionInfo;
95+
96+
if (PullUAPInfo)
97+
{
98+
VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
99+
if (NT_SUCCESS(RtlGetVersion(&VersionInfo)))
100+
{
101+
*PullUAPInfo = ((ULONGLONG)VersionInfo.dwMajorVersion << 48) |
102+
((ULONGLONG)VersionInfo.dwMinorVersion << 32) |
103+
VersionInfo.dwBuildNumber;
104+
}
105+
else
106+
{
107+
*PullUAPInfo = 0;
108+
}
109+
}
110+
111+
/* DEVICEFAMILYINFOENUM_DESKTOP */
112+
if (PullDeviceFamily)
113+
*PullDeviceFamily = 3;
114+
115+
if (PullDeviceForm)
116+
*PullDeviceForm = 0;
117+
}

dll/win32/kernel32/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ list(APPEND SOURCE
5050
client/version.c
5151
client/versionansi.c
5252
client/virtmem.c
53+
client/wer.c
5354
client/console/alias.c
5455
client/console/console.c
5556
client/console/history.c

0 commit comments

Comments
 (0)