简体   繁体   中英

injecting dll into exe file

I want to execute an exe file which is written in VC++.net 2008 in a computer which has windows xp and has not .net framework and none of c++ libraries. but when i run the file i get this error:

This application has failed to start because the application configuration is incorrect....

I want a way to put all dependency together to become free of this problem. does anyone know what should I do?

If you are writing a pure C++ application (Win32 only, no .NET), then you want to staticly link the C++ run time, which can be changed in your project's properties. See this answer for the instructions. (It is for VC2005, but the steps are the same in VC2008)

您似乎正在寻找一个.Net链接程序,例如这个

You have two basic choices: either write your program in pure C++ (or some other language that can/will produce completely standalone executable files) or else use a dependency walker to find what DLLs are needed, and package them up into an installation program.

The option you're suggesting (taking an existing executable that depends on some DLLS, and trying to "inject" the DLLs into the executable) is pretty much unworkable. In theory, you could (for example) create an installation program as an executable and just have the user re-run the installation program every time they want to run your program. This will usually add enough overhead that your users probably won't like it.

Likewise, you could put the DLL in the executable as a binary resource and use FindResource , LoadResource , etc., to write its content out to a temporary file -- but this requires some semi-advanced programming, and it still imposes a fair amount of overhead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM