1

我目前正在尝试将我的项目更新为 64 位支持。该项目使用 i686-w64-mingw32 工具链构建了一个 32 位 dll,可以与 rundll 一起使用来启动它。

现在,我正在尝试使用 x86_64-w64-mingw32 工具链来构建它的 64 位版本。我在编译时也使用-m64。DLL 可以被构建和链接,甚至可以被执行。但是在windbg中检查结果时我得到了奇怪的结果(见下面的输出)。看起来它将我的 mmbbq.dll 加载到 32 位地址空间中。它还加载一些依赖项的 32 位版本。我们可以通过查看模块加载时的基地址在输出中看到这一点。它首先加载一些 64 位 dll(可能是 rundll 依赖项)。然后它开始加载 32 位的东西,最后以 32 位模式加载我的 64 位 dll。有趣的是,当我检查它的 PE 标头时,我的 DLL 是 64 位版本。

对此行为的任何解释或我可能搞砸的其他事情,或者我只是误解了输出?我认为基地址应该与 64 位模式下的不同。

CommandLine: C:\Windows\SysWOW64\rundll32.exe mmbbq.dll rundll_inject
Starting directory: E:\cygwin\home\will\praty\reversing\mmbbq\dist  
Symbol search path is: SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00000000`00530000 00000000`0053e000   rundll32.exe
ModLoad: 00000000`779a0000 00000000`77b49000   ntdll.dll
ModLoad: 00000000`77b80000 00000000`77d00000   ntdll32.dll
ModLoad: 00000000`75200000 00000000`7523f000   C:\Windows\SYSTEM32\wow64.dll
ModLoad: 00000000`751a0000 00000000`751fc000   C:\Windows\SYSTEM32\wow64win.dll
ModLoad: 00000000`75190000 00000000`75198000   C:\Windows\SYSTEM32\wow64cpu.dll
(1870.1660): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
00000000`77a4cb60 cc              int     3
0:000> g
ModLoad: 00000000`77720000 00000000`7783f000   WOW64_IMAGE_SECTION
ModLoad: 00000000`76ce0000 00000000`76df0000   WOW64_IMAGE_SECTION
ModLoad: 00000000`77720000 00000000`7783f000   NOT_AN_IMAGE
ModLoad: 00000000`77620000 00000000`7771a000   NOT_AN_IMAGE
ModLoad: 00000000`76ce0000 00000000`76df0000   C:\Windows\syswow64\kernel32.dll
ModLoad: 00000000`76c30000 00000000`76c76000   C:\Windows\syswow64\KERNELBASE.dll
ModLoad: 00000000`75520000 00000000`75620000   C:\Windows\syswow64\USER32.dll
ModLoad: 00000000`75620000 00000000`756b0000   C:\Windows\syswow64\GDI32.dll
ModLoad: 00000000`76330000 00000000`7633a000   C:\Windows\syswow64\LPK.dll
ModLoad: 00000000`77220000 00000000`772bd000   C:\Windows\syswow64\USP10.dll
ModLoad: 00000000`77170000 00000000`7721c000   C:\Windows\syswow64\msvcrt.dll
ModLoad: 00000000`76b90000 00000000`76c30000   C:\Windows\syswow64\ADVAPI32.dll
ModLoad: 00000000`76ae0000 00000000`76af9000   C:\Windows\SysWOW64\sechost.dll
ModLoad: 00000000`764a0000 00000000`76590000   C:\Windows\syswow64\RPCRT4.dll
ModLoad: 00000000`75260000 00000000`752c0000   C:\Windows\syswow64\SspiCli.dll
ModLoad: 00000000`75250000 00000000`7525c000   C:\Windows\syswow64\CRYPTBASE.dll
ModLoad: 00000000`756b0000 00000000`756da000   C:\Windows\syswow64\imagehlp.dll
(1870.1660): WOW64 breakpoint - code 4000001f (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
ntdll32!LdrpDoDebuggerBreak+0x2c:
77c20fab cc              int     3
0:000:x86> g
ModLoad: 72cb0000 72cfc000   C:\Windows\SysWOW64\apphelp.dll
ModLoad: 6a090000 6a11d000   C:\Windows\AppPatch\AcLayers.DLL
ModLoad: 756e0000 7632a000   C:\Windows\syswow64\SHELL32.dll
ModLoad: 76c80000 76cd7000   C:\Windows\syswow64\SHLWAPI.dll
ModLoad: 76340000 7649c000   C:\Windows\syswow64\ole32.dll
ModLoad: 76b00000 76b8f000   C:\Windows\syswow64\OLEAUT32.dll
ModLoad: 72d80000 72d97000   C:\Windows\SysWOW64\USERENV.dll
ModLoad: 72d70000 72d7b000   C:\Windows\SysWOW64\profapi.dll
ModLoad: 75120000 75171000   C:\Windows\SysWOW64\WINSPOOL.DRV
ModLoad: 6a320000 6a332000   C:\Windows\SysWOW64\MPR.dll
ModLoad: 74970000 7497e000   C:\Windows\AppPatch\AcWow64.DLL
ModLoad: 75180000 75189000   C:\Windows\SysWOW64\VERSION.dll
ModLoad: 752f0000 75350000   C:\Windows\SysWOW64\IMM32.DLL
ModLoad: 765a0000 7666c000   C:\Windows\syswow64\MSCTF.dll
ModLoad: 6c440000 6cdf4000   mmbbq.dll
ModLoad: 00000000`6c440000 00000000\`6cdf4000   mmbbq.dll
ModLoad: 00000000`6c440000 00000000\`6cdf4000   mmbbq.dll
ModLoad: 00000000`6c440000 00000000\`6cdf4000   E:\cygwin\home\will\praty\reversing    \mmbbq\dist\mmbbq.dll
(1870.30c): Break instruction exception - code 80000003 (first chance)
ntdll!DbgBreakPoint:
00000000`779f0530 cc              int     3

更新 从 System32 目录使用 rundll32 后,它看起来更好。但我仍然对我的 dll 加载到“0x00000000”段中感到困惑。那是常规的 64 位行为吗?

CommandLine: C:\Windows\System32\rundll32.exe "mmbbq.dll",rundll_inject 0,0,0,0
Starting directory: E:\cygwin\home\will\praty\reversing\mmbbq\dist
Symbol search path is: SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00000000`ff350000 00000000`ff35f000   rundll32.exe
ModLoad: 00000000`779a0000 00000000`77b49000   ntdll.dll
ModLoad: 00000000`77720000 00000000`7783f000   C:\Windows\system32\kernel32.dll
ModLoad: 000007fe`fe0c0000 000007fe`fe12c000   C:\Windows\system32\KERNELBASE.dll
ModLoad: 00000000`77620000 00000000`7771a000   C:\Windows\system32\USER32.dll
ModLoad: 000007fe`feb10000 000007fe`feb77000   C:\Windows\system32\GDI32.dll
ModLoad: 000007fe`fe560000 000007fe`fe56e000   C:\Windows\system32\LPK.dll
ModLoad: 000007fe`ffbe0000 000007fe`ffca9000   C:\Windows\system32\USP10.dll
ModLoad: 000007fe`fe1d0000 000007fe`fe26f000   C:\Windows\system32\msvcrt.dll
ModLoad: 000007fe`fe730000 000007fe`fe749000   C:\Windows\system32\imagehlp.dll
ModLoad: 000007fe`ffb00000 000007fe`ffbdb000   C:\Windows\system32\ADVAPI32.dll
ModLoad: 000007fe`fe690000 000007fe`fe6af000   C:\Windows\SYSTEM32\sechost.dll
ModLoad: 000007fe`fe7a0000 000007fe`fe8cd000   C:\Windows\system32\RPCRT4.dll
(1b24.1b70): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
00000000`77a4cb60 cc              int     3
0:000> g
ModLoad: 000007fe`fe270000 000007fe`fe29e000   C:\Windows\system32\IMM32.DLL
ModLoad: 000007fe`ff9f0000 000007fe`ffaf9000   C:\Windows\system32\MSCTF.dll
ModLoad: 00000000`6c440000 00000000`6cdf4000   mmbbq.dll
ModLoad: 00000000`6c440000 00000000`6cdf4000   mmbbq.dll
ModLoad: 00000000`6c440000 00000000`6cdf4000   mmbbq.dll
ModLoad: 00000000`6c440000 00000000`6cdf4000   E:\cygwin\home\will\praty\reversing\mmbbq\dist\mmbbq.dll
ModLoad: 00000000`77b70000 00000000`77b77000   C:\Windows\system32\PSAPI.DLL
ModLoad: 000007fe`fe6b0000 000007fe`fe721000   C:\Windows\system32\SHLWAPI.dll
ModLoad: 000007fe`fe750000 000007fe`fe79d000   C:\Windows\system32\WS2_32.dll
ModLoad: 000007fe`fe550000 000007fe`fe558000   C:\Windows\system32\NSI.dll
ModLoad: 000007fe`feb80000 000007fe`ff908000   C:\Windows\system32\shell32.dll
4

1 回答 1

2

您正在运行c:\Windows\syswow64\rundll32.exe这是您要运行的 32 位版本的 rundll32.exe c:\windows\system32\rundll32.exe

0:000:x86>从所有 syswow64 模块和提示中可以看出,您正在启动一个 32 位进程。

于 2012-08-15T12:57:41.547 回答