C++入口点->主要的()
我正在编写自己的小型用户模式调试器以获取乐趣。我知道 PE 头中指定的入口点不是程序定义的 main() (就 microsoft c++ 运行时而言)
我在哪里可以找到有关此入口点之间发生的调用的一些文档,直到实际的 main() 函数,为什么调用它们,以及它们做什么?
I am writing my own little user mode debugger for fun. I know that the entry point specified in the PE header is not the programs defined main() (as far as microsoft c++ runtime is concerned anyway)
Where can I find some documentation on the calls that take place between this entry point, up until the actual main() function, and why they are called, and what they do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你不能。事实上main可能不存在。例如:您可以覆盖链接器使用的默认 CRT 入口点,main 可以内联到 CRT 启动函数中,等等...
You can't. In fact main may not exist. E.g: you can override the default CRT entry point used by the linker, the main can be inlined into the CRT startup function, etc...
CRT 的源代码随 Visual Studio 一起提供。例如,对于 Visual Studio 2010 默认安装位置,它位于:
实际的
main()
位于crt0.c
中。不同类型的 CRT(静态、DLL、MT、x86、x64 等)由一些定义控制,例如
CRTDLL
、_M_IA64
等。当你深入挖掘时你就会看到。The source code for the CRT comes with Visual Studio. For example, for Visual Studio 2010 default installation location, it's at:
The actual
main()
is incrt0.c
.The different types of CRT (static, DLL, MT, x86, x64, etc.) are controlled by some defines like
CRTDLL
,_M_IA64
and more. You'll see when you dig in.据我所知,除了源代码本身之外,代码的调用等行为没有被记录。
将光标首先放在
main
中并使用调试器“运行到此处”。或者在那里设置断点。然后只需检查调用堆栈中的调用即可。干杯&呵呵,,
AFAIK the calls etc., the action of the code, is not documented except by the source code itself.
Place cursor first in
main
and use debugger "run to here". Or set a breakpoint there. Then just inspect the calls in the call stack.Cheers & hth.,