Adjust Tick Count
Download Adjust Tick Count
This utility uses DLL injection and API hooking to intercept calls to the
::GetTickCount API within any user process, and adjust the value
returned to these processes.
The ::GetTickCount API returns the number of milliseconds that
have elapsed since Windows was started as a 32-bit unsigned integer. This value
rollsover every 49.7 days. Some of our applications were experiencing freezes after
running for approximately 50 days, so I wrote this app as a way of forcing
::GetTickCount to rollover without having to wait for 7 weeks.
To use AdjustTickCount, extract the contents of AdjustTickCount.zip
to your hard disk, and start AdjustTickCount.exe:
To change the value returned by the GetTickCount API, set the new value in the
New tick count edit box, and click on the Set button. The screen below shows
that we've set a new tick count of 0x40000000. Observe the difference between the
True tick count and Adjusted tick count values.
To adjust the tick count of another process, simply tick the process(es) in the
process list on the right hand side of the dialog. For example, if we launch
ShowTickCount.exe (which is part of AdjustTickCount.zip),
we can see the tick count incrementing once a second:
If we now select ShowTickCount from the process list, we'll see the ShowTickCount
UI update to show the adjusted tick counts.
| Tick count | Shows the return value when GetTickCount is called from the
main module. |
| DLL tick count | Shows the tick count when GetTickCount is called from a statically linked
DLL |
| COM tick count | Shows the tick count when GetTickCount is called from a dynamically linked
DLL (requires manual registration of COMTickCount.dll (see AdjustTickCount.zip)). |
How it works
When we tick a process in the process list, Adjust Tick Count injects AdjustTickCount.dll
into the process. When the DLL is loaded, it redirects the GetTickCount API in all the loaded modules
to our own implementation of the function. Now, whenever GetTickCount is called, our version of
GetTickCount is called - we call through to the real implementation of GetTickCount
and adjust the returned value before returning to the client.
Adjust Tick Count only hooks those modules loaded when AdjustTickCount.dll is injected into the
process. If any modules are subsequently loaded (like a COM module), the GetTickCount API in that
module isn't hooked. Under these circumstances, the dynamically loaded modules can be hooked by, detaching then
re-attaching Adjust Tick Count to that process (i.e. untick, then re-tick the process in Adjust Tick Count's
process list).
Compatibility
Adjust Tick Count runs on the following platforms:
- Windows NT4 (SP6)
- Windows 2000
- Windows XP Professional
|