Okey on this tutorial I’ll show you how to make DLL Injection using Export Function, this is the very easy way to make Injection because on this tutorial I’ll teach how to make using exists loader console (Loader – by Chyper). I try to make it by my self but I have some issue with 64 Bit, cant inject it on 64bit.
And I have find some info and they said, if we must have 32 bit DLL to be injected to 32 bit process. We cant inject 64bit dll into 32bit process, I don’t know its right or not, but if someone have a solution, may I know how to make it work on 64 bit.
Now, we start make a Injector using Loader_IA32.exe to do a hard step for use, so I’ll explain what is Loader_IA32.exe, Loader_IA32.exe is a tools to do inject or eject a module (DLL) remotely using LibraryLoad A (I don’t know why my coda is’t working when I use LoadLibraryA too.). to run this tools they need 3 params ( they have 6 but we just need the 3 params).
Loader_IA32.exe Params :
- --lunch=”path exe to be launch” (I don’t use it)
- --args=”arguments for run a exe path” (I don’t use it)
- --pid=”game PID” (we use this parameter)
- --eject (we can use this for eject, but I will teach how to inject first)
- --module=”dll name” (yeah we use this parameter)
- --export=”export function name”
Now, Open your Visual Studio C# 2010 / 2011 ( I haven’t try 2011, but want to try it later), after you open it create a Windows Application Project (the name is up to you).
Then use 1 Label to make label for Process Name, and 3 textbox 1 for write process name, 1 for DLL name , and another 1 for Export Function that we want to call, 1 checkbox to be a toggle for auto injection or manual injection, and 1 button for manual injection. And here my GUI :
And we need this using (add this on the top of code or after all default using)
PHP Code:
using System.Diagnostics;
using System.Threading;
Now make a function / method using DoInjectToProcess
This function is used will be calling once when Inject button pressed or will be calling continuesly when auto inject toggle is checked. Here is the function :
PHP Code:
public void DoInjectToProcess()
{
while (true)
{
try
{
Process p = Process.GetProcessesByName(textBox1.Text)[0];
if (p.Id != 0)
{
Process.Start("Loader_IA32.exe", "--pid=\"" + p.Id + "\" --module=\"" + textBox2.Text + "\" --export=\"" + textBox3.Text + "\"");
break;
}
}
catch (Exception e)
{
}
}
}
Now double click on Inject button and call DoInjectToProcess() there, it’s will look like this :
PHP Code:
private void button1_Click(object sender, EventArgs e)
{
DoInjectToProcess(); // call inject function
}
Then double click on checkbox and put this code on checkbox changed and it will look like this :
PHP Code:
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
button1.Enabled = false;
th.Start(); // start thread when check
}
else
{
button1.Enabled = true;
th.Abort();//stop trade when uncheck
}
}
And change your constructor method (mine is MainForm) to be like this :
PHP Code:
Thread th; // declar thread object
public MainForm()
{
InitializeComponent();
th = new Thread(DoInjectToProcess); // make a thread for auto injection
}
Done, now u need to be make all what we need into 1 folder, it will look like this :
Thx to : Cypher for a Loader (Sorry I have to decompile your exe to get parameter that u used but still this Loader_IA32.exe credit to you).
Waiting for my own C# Injector, I’ll share how to make after I get it working with 64 bit, but until it get work, u can use this method to inject DLL from my last tutorial about How To Make C# Unmanaged Export Library.
And waiting other stuff I’ll share.
If Have any question feel free to ask.