[Windows programming] use. Local to redirect the DLL loading path

Source: Internet
Author: User

When debugging a DLL or com program, the DLL file may be occupied by other programs and cannot be replaced. On WINXP and Vista, you can create a. Local folder to redirect the DLL loading path.

 

Procedure(Assume that your exeis myapp.exe and the DLL to be debugged is mymodule. dll ):

1) create a myapp.exe. Local file in the myapp.exe directory.

2) copy the mymodule. dll you want to load to the myapp.exe. Local directory.

3) Run myapp.exe

 

OriginalE:/test/myapp.exeLoaded DLL

Modload: 00400000 00432000 myapp.exe
Modload: 7c800000 7c8f4000 C:/Windows/system32/kernel32.dll
Modload: 77c10000 77c68000 C:/Windows/system32/msvcrt. dll

Modload: 00440000 00c80000 C:/Windows/system32/mymodule. dll
Modload: 77dd0000 77e6b000 C:/Windows/system32/advapi32.dll

 

After creating the. Local folder,E:/test/myapp.exeLoaded DLL

Modload: 00400000 00432000 myapp.exe
Modload: 7c800000 7c8f4000 C:/Windows/system32/kernel32.dll
Modload: 77c10000 77c68000 C:/Windows/system32/msvcrt. dll

Modload: 00440000 00c80000 E:/test/myapp.exe. Local/mymodule. dll
Modload: 77dd0000 77e6b000 C:/Windows/system32/advapi32.dll

 

Note: To enable the. Local function, you must set the veriverrideenable value in the Registry and restart the machine.

[HKEY_LOCAL_MACHINE/software/Microsoft/Windows NT/CurrentVersion/Image File Execution options]" Veriverrideenable"= DWORD: 00000001 [tips] You can enter the following command on the command line to set the registry: reg Add "HKLM/software/Microsoft/Windows NT/CurrentVersion/Image File Execution options"/V implements verrideenable/T REG_DWORD/D 1/f --

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.