首页
论坛
课程
招聘
__tmainCRTStartup的异常会发送_exit(0)消息?
xiaomeili 2023-3-13 192

同学们,我遇到一个异常0x800003, 通过windbg 调试看 exit 的 参数是0 , 找到源码后, 看 __tmainCRTStartup 抛异常时 ,exit(0).mainret不可能是 0 吧??????
同学们这个怎么理解呢,

 

#ifdef WPRFLAG
__winitenv = envp;
mainret = wmain(argc, argv, envp);

 

#else / WPRFLAG /
__initenv = envp;
mainret = main(argc, argv, envp);

 

#endif / WPRFLAG /

 

#endif / WINMAIN /

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    /*
     * Note that if the exe is managed app, we don't really need to
     * call exit or _c_exit. .cctor should be able to take care of
     * this.
     */
    if ( !managedapp )
        exit(mainret);
 
    if (has_cctor == 0)
        _cexit();
 
}
__except ( _XcptFilter(GetExceptionCode(), GetExceptionInformation()) )
{
    /*
     * Should never reach here
     */
 
    mainret = GetExceptionCode();
 
    /*
     * Note that if the exe is managed app, we don't really need to
     * call exit or _c_exit. .cctor should be able to take care of
     * this.
     */
    if ( !managedapp )
        _exit(mainret);
 
    if (has_cctor == 0)
        _cexit();
} /* end of try - except */
 
return mainret;

}

 

windbg堆栈crtexe代码

收藏
0条回答