[DllImport("kernel32.dll")]
public static extern IntPtr CreateRemoteThread(int hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi)]
public static extern IntPtr GetModuleHandle(string Module);
[DllImport("kernel32.dll")]
public static extern int CloseHandle(IntPtr hHandle);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi)]
public static extern IntPtr GetProcAddress(IntPtr hModule, string Procedure);
[DllImport("kernel32.dll")]
public static extern int OpenProcess(uint dwAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
// so on with others, WriteProcessMemory, VirtualAllocEx and VirtualFreeEx
int ProcId;
string DllName;
IntPtr LoadLibAddr = GetProcAddress(GetModuleHandle("Kernel32.dll"), "LoadLibraryA");
int HandleProc = OpenProcess(0x1fffff, false, ProcId);
int DllSize = DllName.Length + 1;
IntPtr Remotedll = VirtualAllocEx(HandleProc, IntPtr.Zero, DllSize, 0x1000, 4);
// WriteDllString to the allocated memory..
// Call CreateRemoteThread;
IntPtr Hndl = CreateRemoteThread(ProcId, IntPtr.Zero, 0, LoadLibAddr, Remotedll, 0, IntPtr.Zero);
VirtualFreeEx(ProcId, Hndl, DllSize, 0x8000);
CloseHandle(Hndl);
.
EDIT:
Wait, you can't use gabrola's code in C#, unless managed dll's can be injected nowadays..
You have to do it C# style.. Marshal.GetFunctionPointerForDelegate(Delegate d), WriteProcessMemory, VirtualAllocEx, VirtualFreeEx, CloseHandle, OpenProcess.. etc
As Nullable said you can't create the DLL in C# since it's managed, it has to be in C++.
Nono I never said I was creating the DLL in C#, I am going to create the DLL in C++ as a ATL COM Component and then use Interop COM to use the methods in C# .
[DllImport("kernel32.dll")]
public static extern IntPtr CreateRemoteThread(int hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi)]
public static extern IntPtr GetModuleHandle(string Module);
[DllImport("kernel32.dll")]
public static extern int CloseHandle(IntPtr hHandle);
[DllImport("kernel32.dll", CharSet=CharSet.Ansi)]
public static extern IntPtr GetProcAddress(IntPtr hModule, string Procedure);
[DllImport("kernel32.dll")]
public static extern int OpenProcess(uint dwAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
// so on with others, WriteProcessMemory, VirtualAllocEx and VirtualFreeEx
int ProcId;
string DllName;
IntPtr LoadLibAddr = GetProcAddress(GetModuleHandle("Kernel32.dll"), "LoadLibraryA");
int HandleProc = OpenProcess(0x1fffff, false, ProcId);
int DllSize = DllName.Length + 1;
IntPtr Remotedll = VirtualAllocEx(HandleProc, IntPtr.Zero, DllSize, 0x1000, 4);
// WriteDllString to the allocated memory..
// Call CreateRemoteThread;
IntPtr Hndl = CreateRemoteThread(ProcId, IntPtr.Zero, 0, LoadLibAddr, Remotedll, 0, IntPtr.Zero);
VirtualFreeEx(ProcId, Hndl, DllSize, 0x8000);
CloseHandle(Hndl);
.
EDIT:
Wait, you can't use gabrola's code in C#, unless managed dll's can be injected nowadays..
You have to do it C# style.. Marshal.GetFunctionPointerForDelegate(Delegate d), WriteProcessMemory, VirtualAllocEx, VirtualFreeEx, CloseHandle, OpenProcess.. etc
Ahhh, looks like music to my eyes, compared to C++ atleast haha.
Nono I never said I was creating the DLL in C#, I am going to create the DLL in C++ as a ATL COM Component and then use Interop COM to use the methods in C# .
What's the point behind this? I mean all what needs to happen is once the c++ dll gets injected using winject or whatever this code runs
Nono I never said I was creating the DLL in C#, I am going to create the DLL in C++ as a ATL COM Component and then use Interop COM to use the methods in C# .
Quote:
Originally Posted by gabrola
That code only injects the unmanaged DLL into the process
D2NT 3.0 Barb Sequence 04/12/2010 - Diablo 2 - 1 Replies Kann man den so einstellen, dass er mit dem einen Slot teleportiert und Bo'd und mit dem anderen nur angreift?
Wäre ganz hilfreich
Base sequence patch 5226 04/08/2010 - CO2 Programming - 2 Replies Hello,
I thought I'd give it a try, but before I continue on pointess searching through executables, has anything changed? As in cryptography?
Thanks,
ImmuneOne.
Conquer 4267 Login Sequence 01/25/2010 - CO2 Private Server - 28 Replies Anyone remember it? Ive got to the game server and im receiving a 1010:137 Packet which is empty except for my Character ID, Ive tried the following:
Respond with identical packet - Displays interface, servername, cords 0,0, with the message "Logging into server.....please wait", opening interface panels scars the background.
Respond with 1010:74 packet - Nothing changes, remains with the black login screen, so im assuming that the client doesnt understand it at this version.
Respond...
Remove Death sequence 06/14/2009 - Conquer Online 2 - 2 Replies How do i remove the monsters right after they die. I would much rather them die and diapear rather that fall down and just lay there for a few seconds.
Thx
nid help with the sequence 03/09/2008 - Dekaron - 0 Replies i have this as a sequence for my 2mbot but it doesnt do anything?
SL(1000)
CN
MT(200,200)
MT(200,100)
CR
AT
MT(100,50)