Skip to content
Jacob Fliss edited this page Oct 2, 2018 · 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.

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);

### 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);
      }
    

Read Memory

InjectDLL(String strDLLName)

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

ThreadStartClient(object obj)

  • 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.

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.