ntdll: Extend NtGetTickCount() to return 64-bits. Forward kernel32 functions to it.

Marking the function as DECLSPEC_HOTPATCH to avoid reopening
https://bugs.winehq.org/show_bug.cgi?id=36486 .  Even with -fno-PIC,
without DECLSPEC_HOTPATCH the generated code has a pushl at offset 7
that triggers the failure.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2019-05-16 10:20:32 +01:00 committed by Alexandre Julliard
parent 6b47a72e4a
commit 3e927c4aec
6 changed files with 10 additions and 38 deletions

View File

@ -858,8 +858,8 @@
@ stdcall GetThreadPriorityBoost(long ptr)
@ stdcall GetThreadSelectorEntry(long long ptr)
@ stdcall GetThreadTimes(long ptr ptr ptr ptr)
@ stdcall GetTickCount()
@ stdcall -ret64 GetTickCount64()
@ stdcall GetTickCount() ntdll.NtGetTickCount
@ stdcall -ret64 GetTickCount64() ntdll.NtGetTickCount
@ stdcall GetTimeFormatA(long long ptr str ptr long)
@ stdcall GetTimeFormatEx(wstr long ptr wstr ptr long)
@ stdcall GetTimeFormatW(long long ptr wstr ptr long)

View File

@ -178,38 +178,6 @@ INT WINAPI MulDiv( INT nMultiplicand, INT nMultiplier, INT nDivisor)
return ret;
}
/******************************************************************************
* GetTickCount64 (KERNEL32.@)
*/
ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
{
LARGE_INTEGER counter, frequency;
NtQueryPerformanceCounter( &counter, &frequency );
return counter.QuadPart * 1000 / frequency.QuadPart;
}
/***********************************************************************
* GetTickCount (KERNEL32.@)
*
* Get the number of milliseconds the system has been running.
*
* PARAMS
* None.
*
* RETURNS
* The current tick count.
*
* NOTES
* The value returned will wrap around every 2^32 milliseconds.
*/
DWORD WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
{
return GetTickCount64();
}
/******************************************************************************
* GetSystemRegistryQuota (KERNEL32.@)
*/

View File

@ -737,7 +737,7 @@ UINT WINAPI GetTempFileNameW( LPCWSTR path, LPCWSTR prefix, UINT unique, LPWSTR
{
/* get a "random" unique number and try to create the file */
HANDLE handle;
UINT num = GetTickCount() & 0xffff;
UINT num = NtGetTickCount() & 0xffff;
static UINT last;
/* avoid using the same name twice in a short interval */

View File

@ -194,7 +194,7 @@
@ stdcall NtGetCurrentProcessorNumber()
# @ stub NtGetDevicePowerState
@ stub NtGetPlugPlayEvent
@ stdcall NtGetTickCount()
@ stdcall -ret64 NtGetTickCount() get_tick_count64
@ stdcall NtGetWriteWatch(long long ptr long ptr ptr ptr)
@ stdcall NtImpersonateAnonymousToken(long)
@ stub NtImpersonateClientOfPort
@ -1142,7 +1142,7 @@
@ stdcall -private ZwGetCurrentProcessorNumber() NtGetCurrentProcessorNumber
# @ stub ZwGetDevicePowerState
@ stub ZwGetPlugPlayEvent
@ stdcall -private ZwGetTickCount() NtGetTickCount
@ stdcall -private -ret64 ZwGetTickCount() get_tick_count64
@ stdcall -private ZwGetWriteWatch(long long ptr long ptr ptr ptr) NtGetWriteWatch
@ stdcall -private ZwImpersonateAnonymousToken(long) NtImpersonateAnonymousToken
@ stub ZwImpersonateClientOfPort

View File

@ -268,4 +268,8 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
/* string functions */
int __cdecl NTDLL_tolower( int c );
int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 );
/* time functions */
ULONGLONG WINAPI get_tick_count64( void );
#define NtGetTickCount get_tick_count64
#endif

View File

@ -557,7 +557,7 @@ NTSTATUS WINAPI NtQueryPerformanceCounter( LARGE_INTEGER *counter, LARGE_INTEGER
* NtGetTickCount (NTDLL.@)
* ZwGetTickCount (NTDLL.@)
*/
ULONG WINAPI NtGetTickCount(void)
ULONGLONG WINAPI DECLSPEC_HOTPATCH get_tick_count64(void)
{
return monotonic_counter() / TICKSPERMSEC;
}