有什么方法可以操纵 TimeGetTime 计时器的值
我有一个使用 GetLastInputInfo 函数的应用程序,并将其与 GetTickCount 的值(返回 Windows 启动以来的毫秒数)进行比较,作为检测键盘或鼠标应用程序上无人操作超过一定时间的方法。此代码有一个错误,该错误在 GetTickCount 计数器滚动大约 49 天后并未显现出来。
我希望能够测试应用程序对这种轮转的敏感性 - 但速度要快于每 7 周一次。有谁知道强制 GetTickCount 返回值的方法(任何清晰的编程语言的示例 - 包括 .BAT - 都可以)?
I have an app using the GetLastInputInfo function and compares it with the value of GetTickCount (which returns the number of milliseconds since Windows started) as a way of detecting nobody at the keyboard or mouse application for more than a certain time. This code had a bug which did not manifest itself will the GetTickCount counter rolled over - around 49 days.
I want to be able to test applications generally for susceptibility to this roll-over - but faster than every 7 weeks. Does anyone know of a means of forcing the value returned by GetTickCount (example in any legible programming language - including .BAT - is fine)?
This isn't really a duplicate of this earlier question. I'm interested in a technique that will allow me to characterise the behaviour of code that's already in the wild.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
运行经过检查的 Windows 版本。它人为地将
GetTickCount
值设置为启动时翻转前 1 小时,以便计数器值在 1 小时内翻转,而不是 49 天。Run the checked build of Windows. It artificially sets the
GetTickCount
value to 1 hour before rollover at boot, so that the counter value rolls over in 1 hour instead of 49 days.