Memory Class Extended (C#)

Posts 111 of 11 · Page 1 of 1
Memory Class Extended (C#)
I made this a long time ago and only recently started digging up in these sections...
So anyways, I made this class to simplify the task of opening/reading and writing to the memory. It's probably more flexible than Jorndel's memory class (If you know who he is.)

So anyways, it's in DLL format so just add it as a reference and put the DLL with the program you use.

USAGE:

Code:
//You need to import the DLL into your resources
using MemoryControl; //Allows it to be used in project.

MemC.cOpenProcessMemory("iw5mp"); // Opens the given application. DO THIS BEFORE ANYTHING ELSE;
MemC.cCloseProcess(); // Closes the process opened with cOpenProcessMemory(). DO THIS AFTER EDITING/READING MEMORY;
MemC.getProcessID("explorer"); // Returns an integer value of the application ID of the given process;
MemC.WriteXNOP(desiredAddress, 5); //Writes 5 NOP bytes (0x90) to the given address;
MemC.WriteXInt(desiredAddress, 255); //Writes the value 255 to the given address;
MemC.WriteXFloat(desiredAddress, floatValue); //Writes the floatValue to the given address;
MemC.WriteXDouble(desiredAddress, doubleValue); //Writes the doubleValue to the given address;
MemC.WriteXString(desiredAddress, stringX); //Writes stringX to the desired address(ASCII);
MemC.WriteXBytes(desiiredAddress, byteBuffer); //Writes the given bytes in the byteBuffer to the given address;
MemC.readXInt(desiredAddress); // Returns the integer stored at the desired address;
MemC.readXBytes(desiredAddress, 100); //Returns a byte array of 100 bytes from given address;
MemC.readXString(desiredAddress, 20); //Returns a string of 20 characters from desired address;
MemC.readXFloat(desiredAddress); //Returns a floating point at the desired address;
MemC.readXDouble(desiredAddress); //Returns a double at the desired address;
Basically that's it. If you do get any errors, try renaming the DLL to "ClassLibrary1.dll"

Virus Scans:
Virus Total (0/38)
Jotti's Malware Scan(0/19)
Memory Control_mpgh.net.rar3 KB · 130 downloads Scanning…
I'll have a bash with it later and make a simple trainer for one of my test games.
Any code injection stuff? or did you list all the features?

Thanks...xxx
Quote Originally Posted by Pingo View Post
I'll have a bash with it later and make a simple trainer for one of my test games.
Any code injection stuff? or did you list all the features?

Thanks...xxx
Nope but I can add it :P
Perfect, great job ^ ^
will be very useful, thanks.
MemC.cOpenProcessMemory("iw5mp"); // Opens the given application. DO THIS BEFORE ANYTHING ELSE;

Ummm, just to help ppl out, that line is actually wrong.. Here is the functions of the .dll listed below

public class MemC
{
public static IntPtr cProcessHandle;

public MemC();

public static void cCloseProcess();
public extern static int CloseHandle(IntPtr hObject);
public static void cOpenProcess(string ProcessX);
public static int getProcessID(string AppX);
public extern static IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, uint dwProcessId);
public extern static int ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] buffer, uint size, out IntPtr lpNumberOfBytesRead);
public static byte[] readXBytes(int desiredAddress, int noOfBytesToRead);
public static double readXDouble(int desiredAddress);
public static float readXFloat(int desiredAddress);
public static int readXInt(int desiredAddress);
public static string readXString(int desiredAddress, int sizeOfString);
public extern static bool WriteProcessMemory(IntPtr hProcess, uint lpBaseAddress, byte[] lpBuffer, uint nSize, out int lpNumberOfBytesWritten);
public static void WriteXBytes(int desiredAddress, byte[] bytesToWrite);
public static void WriteXDouble(int desiredAddrsss, double valToWrite);
public static void WriteXFloat(int desiredAddrsss, float valToWrite);
public static void WriteXInt(int desiredAddrsss, int valToWrite);
public static void WriteXNOP(int desiredAddress, int noOfNOPsToWrite);
public static void WriteXString(int desiredAddrsss, string valToWrite);

So as you see, it should actually be..
MemC.cOpenProcess("YourTargetProcess"); // Opens the given application. DO THIS BEFORE ANYTHING ELSE;

:P
It's a function parameter, it's designed to be changed. That's the point. The code is not "wrong."

"iw5mp" was apparently "skype"

-------
@Kenshin13 Why no source : (
No I was not talking about the Function parameter, I was talking about the function itself... compare these two, since you obviously missed what i was saying.

MemC.cOpenProcessMemory(""); <-- What you had posted , There is no MemC.cOpenProcessMemory

MemC.cOpenProcess(""); <-- What it should be,
Quote Originally Posted by epiccode View Post
No I was not talking about the Function parameter, I was talking about the function itself... compare these two, since you obviously missed what i was saying.

MemC.cOpenProcessMemory(""); <-- What you had posted , There is no MemC.cOpenProcessMemory

MemC.cOpenProcess(""); <-- What it should be,
Thing is, when I originally posted this, I was high so I recalled the function names from my memory... (hehe Not a good idea...)
Quote Originally Posted by abuckau907 View Post
It's a function parameter, it's designed to be changed. That's the point. The code is not "wrong."

"iw5mp" was apparently "skype"
Actually iw5mp is the process name for MW3. (I'm a MW3 programmer hence why I used that.)

Quote Originally Posted by abuckau907 View Post
@Kenshin13 Why no source : (
Because you can get the source yourself? I think I've updated this.
Code:
MemoryControl v1.0

Usage: ( Initialization )

using MemoryControl;

#################FUNCTIONS#################

- bool cOpenProcess ( string ProcessName );

 Opens the specified process and stores it for use with additional functions.
 Eg. if( cOpenProcess( "notepad" ) ) { ... }
 
- bool cCloseProcess ( );

 Closes the process opened using cOpenProcess so a new process can be opened if needed.
 Eg. if( cOpenProcess ( "notepad" ) ) { cCloseProcess ( ); }

- int getProcessID ( string ProcessName );

 Returns the integer value of the provided process.
 Eg. if( getProcessID ( "notepad" ) == 1337 ) { ... }
 
- bool WriteNop( int Offset, int numNops );

 Writes a certain number of No-Operation bytes to the specified offset.
 Eg. if( WriteNop( 0xDEADBEEF, 3 ) ) { ... }

- IntPtr getModuleBase ( string ModuleName );

 Returns the base address of the module name provided from the list of modules in the process opened using cOpenProcess( "x" );
 Eg. IntPtr BaseOffset = getModuleBase( "kernel32.dll" );
 
##################Other Opertaions##################

- bool WriteInt( int Offset, int ValueToWrite );
- bool WriteFloat( int Offset, float ValueToWrite );
- bool WriteDouble( int Offset, double ValueToWrite );
- bool WriteString( int Offset, string ValueToWrite );
- bool WriteBytes( int Offset, byte[] ValueToWrite );
- byte[] ReadBytes( int Offset, int NumOfBytesToRead );
- string ReadString( int Offset, int SizeOfString );
- double ReadDouble( int Offset );
- float ReadFloat( int Offset );
- int ReadInt( int Offset );
Virus Total [0/48]
Jotti [0/22]

If you want the source just decompile it. I'm too lazy to comment it etc.
MemoryControl_mpgh.net.rar4 KB · 21 downloads Scanning…
I see.

MemC.cOpenProcessMemory("iw5mp"); // Opens the given application. DO THIS BEFORE ANYTHING ELSE;

Ummm, just to help ppl out, that line is actually wrong.. Here is the functions of the .dll listed below

public class MemC
{
public static IntPtr cProcessHandle;

public MemC();

public static void cCloseProcess();
public extern static int CloseHandle(IntPtr hObject);
public static void cOpenProcess(string ProcessX);
public static int getProcessID(string AppX);
public extern static IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, uint dwProcessId);
public extern static int ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] buffer, uint size, out IntPtr lpNumberOfBytesRead);
public static byte[] readXBytes(int desiredAddress, int noOfBytesToRead);
public static double readXDouble(int desiredAddress);
public static float readXFloat(int desiredAddress);
public static int readXInt(int desiredAddress);
public static string readXString(int desiredAddress, int sizeOfString);
public extern static bool WriteProcessMemory(IntPtr hProcess, uint lpBaseAddress, byte[] lpBuffer, uint nSize, out int lpNumberOfBytesWritten);
public static void WriteXBytes(int desiredAddress, byte[] bytesToWrite);
public static void WriteXDouble(int desiredAddrsss, double valToWrite);
public static void WriteXFloat(int desiredAddrsss, float valToWrite);
public static void WriteXInt(int desiredAddrsss, int valToWrite);
public static void WriteXNOP(int desiredAddress, int noOfNOPsToWrite);
public static void WriteXString(int desiredAddrsss, string valToWrite);

So as you see, it should actually be..
MemC.cOpenProcess("YourTargetProcess"); // Opens the given application. DO THIS BEFORE ANYTHING ELSE;

:P
could have been reduced to
Hey OP, is the function name cOpenProcess or cOpenProcessMemory? cOpenProcessMemory doesn't seem to exist.
*Thanks for pointing it out.

edit: I posted neither function name.
When i Posted about that, I was High and Noticed the mistake lol..! "Sour Diesel" Btw I'm working on a major release here, but I'm gonna keep quiet about it for now.
Posts 111 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?