ntoskrnl.exe: Update the tick count in KUSER_SHARED_DATA when accessed.

EasyAntiCheat.sys constantly reads this value, so I think keeping it
up-to-date is a good idea.

Signed-off-by: Derek Lesho <dereklesho52@Gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2019-03-21 00:23:09 -04:00 committed by Alexandre Julliard
parent e7863eaa4e
commit c988910cae
1 changed files with 13 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <stdarg.h> #include <stdarg.h>
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h" #include "winternl.h"
@ -594,6 +595,15 @@ static void fake_syscall_function(void)
} }
static void update_shared_data(void)
{
struct _KUSER_SHARED_DATA *shared_data = (struct _KUSER_SHARED_DATA *)wine_user_shared_data;
shared_data->u.TickCountQuad = GetTickCount64();
shared_data->u.TickCount.High2Time = shared_data->u.TickCount.High1Time;
}
/*********************************************************************** /***********************************************************************
* emulate_instruction * emulate_instruction
* *
@ -794,6 +804,7 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
if (offset <= sizeof(KSHARED_USER_DATA) - data_size) if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
{ {
ULONGLONG temp = 0; ULONGLONG temp = 0;
update_shared_data();
memcpy( &temp, wine_user_shared_data + offset, data_size ); memcpy( &temp, wine_user_shared_data + offset, data_size );
store_reg_word( context, instr[2], (BYTE *)&temp, long_op, rex ); store_reg_word( context, instr[2], (BYTE *)&temp, long_op, rex );
context->Rip += prefixlen + len + 2; context->Rip += prefixlen + len + 2;
@ -814,6 +825,7 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
if (offset <= sizeof(KSHARED_USER_DATA) - data_size) if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
{ {
update_shared_data();
switch (*instr) switch (*instr)
{ {
case 0x8a: store_reg_byte( context, instr[1], wine_user_shared_data + offset, rex ); break; case 0x8a: store_reg_byte( context, instr[1], wine_user_shared_data + offset, rex ); break;
@ -835,6 +847,7 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
if (offset <= sizeof(KSHARED_USER_DATA) - data_size) if (offset <= sizeof(KSHARED_USER_DATA) - data_size)
{ {
update_shared_data();
memcpy( &context->Rax, wine_user_shared_data + offset, data_size ); memcpy( &context->Rax, wine_user_shared_data + offset, data_size );
context->Rip += prefixlen + len + 1; context->Rip += prefixlen + len + 1;
return ExceptionContinueExecution; return ExceptionContinueExecution;