Skip to content
New Age Soldier edited this page Aug 25, 2020 · 56 revisions

int getProcIDFromName(string name)

  • Find a program's process ID via a name. Use task manager to find this.

      getProcIDFromName("iw4sp"); //dont need to include .exe
    

bool OpenProcess(int procID) OR bool OpenProcess(string procName)

  • This function uses overloading so you can use either an integer (proc ID) or a string (process name). This opens a program's process by the process ID OR name. Returns true on success, returns false on failure. This function will check if the process is already open, and will check if it's running. You can use this in an infinite loop in a new thread.
  • Ex1: OpenProcess(12345);
  • Ex2: OpenProcess("MyGame.exe");

UIntPtr getCode(string name, string path = "", int size = 8)

  • Get code from ini file, or use the name string as your address and leave path empty.
  • Ex1: getCode("myCheatCode", "file.ini");
  • Ex2: getCode("module.dll+0x12345678,0x12,0x34,0x56");

void closeProcess()

  • Triggers the CloseHandle function. This is not required when making a trainer.

bool ChangeProtection(string code, MemoryProtection newProtection, out MemoryProtection oldProtection, string file = "")

  • Change protection on address.

string sanitizeString(string str)

string CutString(string str)

  • Does exactly what sanitizeString does but breaks off after it hits something not between ASCII 32 and 126. Good for strings that carry on for too long.

IntPtr moveAddress(string name, string path, int move)

  • Get address and move distance from starting address. Ex: Write integer 1, to 8 different addresses, 250 bytes apart.

      for (i = 0; i < (8*250); i+=250){
          IntPtr writeHere = MemLib.moveAddress("test", codeFile, i);
          MemLib.writeMemory(writeHere.ToString("X"), "int", "1");
      }
    

bool writeMemory(string code, string type, string write, string file)

  • Write to pointer/offset. Returns false on failure, returns true on success. Setup.

TYPES: float, int, byte, 2bytes, bytes, long, string, double.

    MemLib.writeMemory("godMode", "int", "1", codeFile); //with ini file
    MemLib.writeMemory("module.dll+0x12345678,0x12,0x34,0x56", "int", "1"); //without ini file

bool writeMove(string code, string type, string write, int moveQty, string file)

  • Write to pointer/offset. Returns false on failure, returns true on success. Good for an array, like for a character's equipment inventory or something like that.

      for (int i = 0; i < 40; i++)
      {
          int sNum = i * 6;
          MemLib.writeMove("item_slot1_qty", "byte", "99", sNum, codeFile);
      }
    

Freeze Value

  • The FreezeValue function creates a thread with a loop that constantly writes the value to the address. This function uses the same arguments as the writeMemory function. UnFreezeValue will remove the address from the loop.

    MemLib.FreezeValue(string address, string type, string value, string file = "")
    
    MemLib.UnFreezeValue(string address)
    

Read Memory

InjectDLL(String strDLLName)

  • Inject a dll file in to the process. Only used to trigger internal functions. Not for beginners.

      MemLib.InjectDLL("myFile.dll");
    

void ThreadStartClient(string func, string name)

  • An experimental function that creates a pipe between your program and the opened process to communicate through. This is used to trigger injected functions. Not for beginners.

      Thread ClientThread = new Thread(() => MemLib.ThreadStartClient("warp", "myThread"));
      ClientThread.Start();
    

string LoadCode(string name, string file)

  • Read the value in the .ini code file.

Ex: if your code file has SomeLabel=SomeCode

    MemLib.LoadCode("SomeLabel", Application.StartupPath + @"\codes.ini");

Would return:

SomeCode

bool isAdmin()

  • Check if program is running with Administrative Privileges.

bool is64bit()

  • Check if game is 64bit.