Failed to debug DLL and exe Loading

Source: Internet
Author: User

If the application initialization fails (0xc0000142. Please click "Confirm" to check whether the dependency is correct. You can use the "depends.exe" tool to check whether the dependency is correct. If there is no problem, you can use tools such as resourcehacker to check the manifest information of the resource segments of EXE and DLL, and check whether the dependent CRT is correct, note that the information between different DLL versions may be different (one EXE cannot load multiple versions of CRT at the same time ). If the problem persists, you can only analyze it through the debugger. Run devenv.exe program path to start the program, open the following file, and set the breakpoint in the corresponding place:

 

DLL entry point:

C:/program files/Microsoft Visual Studio 8/VC/CRT/src/dllcrt0.c

Bool winapi

_ Dllmaincrtstartup (

Handle hdllhandle,

DWORD dwreason,

Lpvoid lpreserved

)

{

If (dwreason = dll_process_attach)

{

/*

* The/GS Security Cookie must be initialized before any exception

* Handling targetting the current image is registered. No Function

* Using exception handling can be called in the current image

* After _ security_init_cookie has been called.

*/

_ Security_init_cookie ();

}

Return _ dllmaincrtstartup (hdllhandle, dwreason, lpreserved );

}

When a DLL fails to be loaded, you can set a breakpoint in line 3 of C:/program files/Microsoft Visual Studio 8/VC/CRT/src/dllcrt0.c.

Bool winapi _ crt_init (

Handle hdllhandle,

DWORD dwreason,

Lpvoid lpreserved

)

 

 

EXE part

C:/program files/Microsoft Visual Studio 8/VC/CRT/src/crt0.c 199 action EXE entry point

_ Declspec (noinline)

Int

_ Tmaincrtstartup (

Void

)

C:/program files/Microsoft Visual Studio 8/VC/CRT/src/_ file. C. Class class

Int _ cdecl _ initstdio (void)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.