FightRay
FightRay

Reputation: 134

Is there a way to reset Windows' timeGetTime value (time elapsed since Windows started) programmatically?

In all releases after Windows 7, shutdowns and restarts usually perform a fast boot, and are not considered "full" shut down.

How to Perform a Full Shutdown in Windows 10

In Windows' Win32 API, there's a function called timeGetTime(), which returns a DWORD representing the time elapsed since Windows booted up.

The variable this function returns only resets after a full shutdown.

Is there a way to programmatically reset this value to 0? I'm specifically trying to do this in my C# application, but any language is acceptable as it can be converted to C#.

Upvotes: 1

Views: 573

Answers (2)

shavit
shavit

Reputation: 1063

Considering you're asking to solve this to solve the Clock Overrun bug in FutureLegends, you could use Detours (or EasyHook as you use C#) to hook timeGetTime() and GetTickCount(), rather than do this globally

Upvotes: 0

Security Guard
Security Guard

Reputation: 411

What are you trying to accomplish here that requires the counter to be reset to 0?

To answer your question, NO. There is no way to programmatically reset the value to 0. And even if you accomplish this by writing some hack driver (since time counter is protected entity under Windows or for that matter any other OS), you will see several undesirable sideaffects and most likely will cause an immediate watchdog timer bugcheck under windows. Every OS guarantees that time counter will only move forward and a lot of OS components take this fact for granted.

Upvotes: 2

Related Questions