【问题标题】:Why Entry Point Address of executable in dumpbin is different from WinDbg?为什么 dumpbin 中可执行文件的入口点地址与 WinDbg 不同?
【发布时间】:2019-02-26 15:01:33
【问题描述】:

我试图了解加载可执行文件的机制,所以我用 notepad.exe 做了两个不同的测试

1) 运行dumpbin命令:

dumpbin /ALL "C:\Windows\System32\notepad.exe" /OUT:"C:\sample\log4.txt" 

我在 OPTIONALHEADER VALUES 下得到以下值:

1AC50 entry point (000000014001AC50) WinMainCRTStartup
1000 base of code
140000000 image base (0000000140000000 to 0000000140042FFF)

2) 运行 WinDbg:

x notepad!*CRT* 

我得到了这些:

00b9bf9a          notepad!__mainCRTStartup (void)
00b9bf90          notepad!WinMainCRTStartup (<no parameter info>)
00ba04a4          notepad!msvcrt_NULL_THUNK_DATA = <no type information>
00ba050c          notepad!_IMPORT_DESCRIPTOR_msvcrt = <no type information>

我不明白为什么 14001AC50 和 00b9bf90 是不同的值。它们不应该是相同的 AddressOfEntryPoint 值吗?

提前致谢

【问题讨论】:

  • 记事本有两种风格,您无法将 32 位版本与 64 位版本进行比较。使用 64 位版本的 Windbg 获得更快乐的匹配。谷歌“windows aslr”也是如此。
  • 是的,那是我的错误。谢谢!

标签: windows windbg entry-point dumpbin


【解决方案1】:

造成这种差异的原因有很多。

首先,您在notepad.exe 的x64 版本上运行dumpbin,存储在System32,但您似乎正在调试存储在SysWoW64 中的x86 notepad.exe。确保您已启动 x64 或 AMD64 版本的 WinDbg,并且您附加到 C:\Windows\System32\notepad.exe

一旦解决了问题,事情就会开始变得更有意义,但还有一件事要记住。 WinDbg 中的x 命令在运行进程中显示符号的虚拟内存地址,而dumpbin 将其显示为与模块基地址的偏移量。

从模块库中快速减去一些东西应该匹配。

这是它在我的系统上的外观:

C:\>dumpbin /ALL "C:\Windows\System32\notepad.exe" | find "entry point"
           1AC50 entry point (000000014001AC50) WinMainCRTStartup

0:000> x notepad!WinMainCRTStartup
00007ff6`4fe1ac50 notepad!WinMainCRTStartup (<no parameter info>)
0:000> ? notepad!WinMainCRTStartup - notepad
Evaluate expression: 109648 = 00000000`0001ac50

【讨论】:

  • 请注意,图像特征包括“动态基础”,因此加载的图像基础不是PE头中指定的地址(例如0x140000000)。见ASLR
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-11-05
  • 2012-09-11
  • 2023-03-14
  • 2015-11-15
  • 2011-01-12
  • 1970-01-01
相关资源
最近更新 更多