Thursday, March 5, 2009

Embedding DLLs and EXEs inside your Win32 PE

I'm re-writing some code from C# to Win32 C++ right now, and needed to access a PE which was embedded inside a .Net assembly. My first thought was to see if I could access the resource within the .Net assembly from my Win32 program. Unfortunately, it does not appear that .Net embedded resources are contained within your typical PE resource section, but are inside some .Net specific assembly resource location.

So, I figured, the embedded PE needed to be moved out of the .Net assembly and into the PE I am building with C++. So, I spent a few hours trying to figure out how to embed and access arbitrary binary data inside the PE resource section, and found this really great blog post.

After I found that, it was just a matter of minutes until I got it working with my Win32 program. Thanks, Akbar!

1 comment:

  1. Yes, it's quite an epic error with Win32...
    I also couldn't understand what was actually happened with the DLL file. If you don`t feel comfortable with the following DLL,
    the Download missing .dll files will be the
    right solution in such situation.