[KERNEL] Do not convert time if provided time_ptr is invalid (Fixes Dark Souls crash)

This commit is contained in:
Gliniak 2019-11-24 09:32:30 +01:00 committed by illusion
parent 96952c70e3
commit 621077536c
1 changed files with 4 additions and 8 deletions

View File

@ -512,14 +512,10 @@ static_assert(sizeof(X_TIME_FIELDS) == 16, "Must be LARGEINTEGER");
// https://support.microsoft.com/en-us/kb/167296
void RtlTimeToTimeFields(lpqword_t time_ptr,
pointer_t<X_TIME_FIELDS> time_fields_ptr) {
// int64_t time_ms = time_ptr.value() / 10000 - 11644473600000LL;
// TEST
long long inttime = 11644473600000;
long long timeptrval = time_ptr.value();
if (timeptrval) {
inttime = timeptrval;
}
int64_t time_ms = (short)((inttime % 10000000) / 10000);
if (!time_ptr.value())
return;
int64_t time_ms = time_ptr.value() / 10000 - 11644473600000LL;
time_t timet = time_ms / 1000;
struct tm* tm = gmtime(&timet);