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:
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;
}
It is well documented so it shouldn't be that hard (I hope). Thanks