kernelbase: Use the user shared data to implement GetTickCount().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Alexandre Julliard 2020-05-21 17:06:22 +02:00
parent 6a1667fab4
commit 8ca9e0b1ab
2 changed files with 32 additions and 2 deletions

View File

@ -725,8 +725,8 @@
# @ stub GetThreadSelectedCpuSets
@ stdcall GetThreadTimes(long ptr ptr ptr ptr)
@ stdcall GetThreadUILanguage()
@ stdcall GetTickCount() kernel32.GetTickCount
@ stdcall -ret64 GetTickCount64() kernel32.GetTickCount64
@ stdcall GetTickCount()
@ stdcall -ret64 GetTickCount64()
@ stdcall GetTimeFormatA(long long ptr str ptr long) kernel32.GetTimeFormatA
@ stdcall GetTimeFormatEx(wstr long ptr wstr ptr long) kernel32.GetTimeFormatEx
@ stdcall GetTimeFormatW(long long ptr wstr ptr long) kernel32.GetTimeFormatW

View File

@ -42,6 +42,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(sync);
static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000;
/* check if current version is NT or Win95 */
static inline BOOL is_version_nt(void)
{
@ -126,6 +128,34 @@ static BOOL get_open_object_attributes( OBJECT_ATTRIBUTES *attr, UNICODE_STRING
***********************************************************************/
/******************************************************************************
* GetTickCount (kernelbase.@)
*/
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
{
/* note: we ignore TickCountMultiplier */
return user_shared_data->u.TickCount.LowPart;
}
/******************************************************************************
* GetTickCount64 (kernelbase.@)
*/
ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
{
ULONG high, low;
do
{
high = user_shared_data->u.TickCount.High1Time;
low = user_shared_data->u.TickCount.LowPart;
}
while (high != user_shared_data->u.TickCount.High2Time);
/* note: we ignore TickCountMultiplier */
return (ULONGLONG)high << 32 | low;
}
static HANDLE normalize_handle_if_console( HANDLE handle )
{
static HANDLE wait_event;