[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 illusion98
parent 5079dec872
commit c6a73a2f9a
1 changed files with 3 additions and 0 deletions

View File

@ -512,6 +512,9 @@ 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) {
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);