[PATCH v2 1/3] ntdll/tests: Test updating TickCount in user_shared_data.
Rémi Bernon
rbernon at codeweavers.com
Fri Apr 24 07:36:24 CDT 2020
Original patch from: Andrew Wesie <awesie at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
v2: This should fix a race condition with the previous version where
the service could quit and detach USD view from other services
although they would still be using it.
This version now relies on both the processes and the service open
predetermined named sections and each map it into its address space.
The service can now start late or exit early without impacting the
processes. It can now also catch up with previously started services
and have the timestamp updates working for them as well.
dlls/ntdll/tests/time.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index 5382a952d8d..6ce56f39fd8 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.c
@@ -18,7 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSUNION
#include "ntdll_test.h"
+#include "ddk/wdm.h"
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
@@ -29,6 +31,7 @@ static VOID (WINAPI *pRtlTimeFieldsToTime)( PTIME_FIELDS TimeFields, PLARGE_IN
static NTSTATUS (WINAPI *pNtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency );
static NTSTATUS (WINAPI *pRtlQueryTimeZoneInformation)( RTL_TIME_ZONE_INFORMATION *);
static NTSTATUS (WINAPI *pRtlQueryDynamicTimeZoneInformation)( RTL_DYNAMIC_TIME_ZONE_INFORMATION *);
+static ULONG (WINAPI *pNtGetTickCount)(void);
static const int MonthLengths[2][12] =
{
@@ -153,12 +156,35 @@ static void test_RtlQueryTimeZoneInformation(void)
wine_dbgstr_w(tzinfo.DaylightName));
}
+static void test_NtGetTickCount(void)
+{
+ KSHARED_USER_DATA *user_shared_data = (void *)0x7ffe0000;
+ ULONG diff;
+ int i;
+
+ if (!pNtGetTickCount)
+ {
+ win_skip("NtGetTickCount is not available\n");
+ return;
+ }
+
+ for (i = 0; i < 5; ++i)
+ {
+ diff = (user_shared_data->u.TickCountQuad * user_shared_data->TickCountMultiplier) >> 24;
+ diff = pNtGetTickCount() - diff;
+ todo_wine
+ ok(diff < 100, "NtGetTickCount - TickCountQuad too high, expected < 100 got %d\n", diff);
+ Sleep(50);
+ }
+}
+
START_TEST(time)
{
HMODULE mod = GetModuleHandleA("ntdll.dll");
pRtlTimeToTimeFields = (void *)GetProcAddress(mod,"RtlTimeToTimeFields");
pRtlTimeFieldsToTime = (void *)GetProcAddress(mod,"RtlTimeFieldsToTime");
pNtQueryPerformanceCounter = (void *)GetProcAddress(mod, "NtQueryPerformanceCounter");
+ pNtGetTickCount = (void *)GetProcAddress(mod,"NtGetTickCount");
pRtlQueryTimeZoneInformation =
(void *)GetProcAddress(mod, "RtlQueryTimeZoneInformation");
pRtlQueryDynamicTimeZoneInformation =
@@ -169,5 +195,6 @@ START_TEST(time)
else
win_skip("Required time conversion functions are not available\n");
test_NtQueryPerformanceCounter();
+ test_NtGetTickCount();
test_RtlQueryTimeZoneInformation();
}
--
2.26.1
More information about the wine-devel
mailing list