Hello everyone, I am just switching from using C++ dll to inline C# code for injection code, but the client just crash all the time :(
Please take a look at the code and help me
Code:
public void testInjectNormalAtk(int pID)
{
string opcode = "";
// asm
// pushad;
// mov eax, commonAtkAddress;
// call eax;
// popad;
// ret;
opcode += "60";
opcode += "B8" + "5F51A0";
opcode += "FFD0";
opcode += "61";
opcode += "C3";
byte[] baOpcode = CalcBytes(opcode);
IntPtr hProcess = openProcess(pID);
IntPtr allocatedAddress = VirtualAllocEX(hProcess, IntPtr.Zero, (IntPtr)baOpcode.Length );
bool success = WriteMemory(hProcess, intPtr2UIntPtr(allocatedAddress), baOpcode, (uint)baOpcode.Length);
IntPtr threadid = CreateRemoteThread(hProcess, allocatedAddress, IntPtr.Zero);
WaitForSingleObject(hProcess);
// clean up
CloseHandle(threadid);
VirtualAllocFree(hProcess, allocatedAddress, baOpcode.Length);
CloseHandle(hProcess);
}
Is there any thing wrong with the opcode ?
the last post was in wrong thread :D
thank all ^^