Skip to content

Commit

Permalink
Fix time error bug when installing arkdrv driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackINT3 committed Dec 22, 2020
1 parent 5a4f7b4 commit cf3d548
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/OpenArk/kernel/driver/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,21 @@ std::wstring ParseDriverPath(UCHAR *symlnk);
#define RECOVER_SIGN_TIME() \
SYSTEMTIME saved = { 0 };\
GetLocalTime(&saved);\
FILETIME ft;\
SystemTimeToFileTime(&saved, &ft);\
auto ticks = GetTickCount();\
SYSTEMTIME cur = { 0 };\
cur.wYear = 2012;\
cur.wMonth = 1;\
cur.wDay = 1;\
SetLocalTime(&cur);\
ON_SCOPE_EXIT([&] { saved.wSecond += (GetTickCount() - ticks)/1000; SetLocalTime(&saved); });
ON_SCOPE_EXIT([&] { \
LARGE_INTEGER li;\
li.LowPart = ft.dwLowDateTime;\
li.HighPart = ft.dwHighDateTime;\
li.QuadPart += (GetTickCount() - ticks) * 10000; \
ft.dwHighDateTime = li.HighPart; \
ft.dwLowDateTime = li.LowPart; \
FileTimeToSystemTime(&ft, &saved); \
SetLocalTime(&saved); \
});

0 comments on commit cf3d548

Please sign in to comment.