Mapping Dll bytes?

Posts 13 of 3 · Page 1 of 1
Mapping Dll bytes?
So, I have a loader for my dlls, basically what it does now is writing the dll from the resources to the disk then injecting it and after the game process ends, it delets the dll from the disk.
But I want to find a way to make almost impossible for people to leech it or something... so I was thinking in a way to map the dll bytes directly from the Loader Resources and inject it without needing to write it to the HDD. Is there a way to do that?


Here's how i'm injecting for now:


Code:
public void InjectDllFromDisk(IntPtr Proc, String DllPath)
{
       IntPtr bytes;

       Int32 Lenght = DllPath.Length + 1;
       IntPtr Mem = (IntPtr)VirtualAllocEx(Proc, (IntPtr)null, (uint)Lenght, 0x1000, 0x40);
       WriteProcessMemory(Proc, Mem, DllPath, (UIntPtr)Lenght, out bytes);

       UIntPtr Injector = (UIntPtr)GetProcAddress( GetModuleHandle("kernel32.dll"), "LoadLibraryA");
       IntPtr hThread = (IntPtr)CreateRemoteThread(Proc, (IntPtr)null, 0, Injector, Mem, 0, out bytes);

       int Result = WaitForSingleObject(hThread, 10 * 1000);

       Thread.Sleep(1000);

       VirtualFreeEx(Proc, Mem, (UIntPtr)0, 0x8000);

       return;
}
I wrote and released a library that features "Manual Mapping" injection in C# (open source). However, to fully understand the process behind manual mapping, you're going to need at least an intermediate knowledge of both the Windows Loader (ala LoadLibrary) as well as Microsoft's Portable Executable file structure.

http://www.mpgh.net/forum/292-combat...library-c.html
That's neat :O

I'll do my best to understand the code... It is well documented so it shouldn't be that hard (I hope). Thanks
Posts 13 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?