Author | Message | Time |
---|---|---|
Myndfyr | Is it possible to have a memory representation (a byte stream, for instance) of a DLL and LoadLibrary()-or-equivalent it? I've found one very involved thing that I don't want to use that involved reading the PE headers and stuff like that. Not really what I was hoping for. What it really boils down to is that I just don't want to write the temporary file. :-| I want to include a DLL as a resource in my application's binary. | August 23, 2006, 8:17 PM |
Skywing | You would have to do most of the hard work yourself with setting up the in memory layout. One option might be to hook NtCreateFile/NtCreateSection/NtMapViewOfSection in usermode and let the NTDLL loader manage the import snapping and all of that, with you instead returning a pointer to your own DLL in memory instead of going through the usual image section mapping process. Note that this approach still requires you to setup the in-memory layout and protections correctly, but it does free you from doing your own import resolution and making the dll accessible to anything using the conventional dll resolution APIs (e.g. GetModuleHandle). | August 23, 2006, 11:14 PM |
Yoni | In other words... Disgusting. | August 27, 2006, 4:46 PM |
Myndfyr | [quote author=Yoni link=topic=15579.msg157262#msg157262 date=1156697218] In other words... Disgusting. [/quote] Hahaha yes, still more work than I wanted to do. Thanks though :) | August 27, 2006, 7:10 PM |
Yoni | You can find a usable temp filename using GetTempFileName (kernel32). | August 28, 2006, 7:52 PM |
Myndfyr | [quote author=Yoni link=topic=15579.msg157276#msg157276 date=1156794728] You can find a usable temp filename using GetTempFileName (kernel32). [/quote] Yeah, there's a C# API for that too, but I'm not sure I want to do that yet. :o | August 29, 2006, 1:21 AM |
JoeTheOdd | I'm probably overlooking something but how does WarCraft III apply IX86BlueDrake.dll? I don't think it gets written to a file before it's loaded, just brought straight out of the MPQ. | September 10, 2006, 5:44 AM |
UserLoser | [quote author=Joe[x86] link=topic=15579.msg157728#msg157728 date=1157867092] I'm probably overlooking something but how does WarCraft III apply IX86BlueDrake.dll? I don't think it gets written to a file before it's loaded, just brought straight out of the MPQ. [/quote] Downloads the ix86BlueDrake.mpq, extracts the file to your harddrive, hExtraWork = LoadLibrary(ix86BlueDrake.dll), ExtraWork = GetProcAddress(hExtraWork, "Extrawork"), ExtraWork(&ExtraWorkData). | September 10, 2006, 7:38 PM |
JoeTheOdd | Eh, mmk. | September 12, 2006, 2:16 AM |