Win32 Api函数调试中断

前端之家收集整理的这篇文章主要介绍了Win32 Api函数调试中断前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在SetTimer功能上休息一下,看看哪些组件用什么值注册什么定时器.这可能吗?
是的,你可以这样做.首先确保您的调试器具有 public symbols设置.

SetTimer生活在user32,但这只是它导出的.最简单的方法是使用命令行调试器NTSD.我们需要其真实姓名,因此在user32中查找匹配的符号:

  1. 0:000> x user32!*timer*
  2. 759992b9 USER32!NtUserValidateTimerCallback = <no type information>
  3. 759977d5 USER32!NtUserSetTimer = <no type information>
  4. 759e4f13 USER32!NtUserSetSystemTimer = <no type information>
  5. 759993bf USER32!NtUserKillTimer = <no type information>

啊,哈!它的调试符号是NtUserSetTimer:

  1. 0:000> bp user32!NtUserSetTimer

在Visual Studio中,您可以通过写入一个简单的scratch程序,然后设置断点并右键单击并选择“Go to Disassembly”来确定SetTimer的存在位置:

  1. int _tmain(int argc,_TCHAR* argv[]) {
  2. SetTimer(NULL,NULL);
  3. 004113BE mov esi,esp
  4. 004113C0 push 0
  5. 004113C2 push 0
  6. 004113C4 push 0
  7. 004113C6 push 0
  8. 004113C8 call dword ptr [__imp__SetTimer@16 (418338h)]

如果我们进入那个电话,那我们到这里来:

  1. _NtUserSetTimer@16:
  2. 759977D5 mov eax,123Dh
  3. 759977DA mov edx,7FFE0300h
  4. 759977DF call dword ptr [edx]
  5. 759977E1 ret 10h

所以在Visual Studio中设置一个断点,你必须在断点中使用context operator.从菜单中选择:Debug – >新断点 – >在功能中断,然后输入:

  1. {,user32.dll}_NtUserSetTimer@16

猜你在找的Windows相关文章