LightbulbHow to use cheat engine as a dll library [delphi,c++,c,c# language available]

Posts 14 of 4 · Page 1 of 1
How to use cheat engine as a dll library [delphi,c++,c,c# language available]
Hi guys !

I would like to present you a project I'm working on. It is a library based on cheat engine a powerfull memory editing software.
I made this library to give programmers the possibility to make their own cheat engine with only a few lines of code.

This is really simple, my dll embed the cheat engine core and exports some functions. No more cheat engine software, no more manual updating a trainer ! No more headaches while making a trainer !
Moreover, you can use your favorite programming language and calls theses functions !

What you can do for now :
- inject any asm scripts with theses symbols (ALLOC DEALLOC LABEL DEFINE REGISTERSYMBOL UNREGISTERSYMBOL INCLUDE READMEM LOADLIBRARY).
- manipulate a virtual cheat table to activate and desactivate any script
- the memory scanner will come soon !

And I'm glad to tell you that this project is open source, and available on github at this address : github.com/fenix01/cheatengine-library

You may found on github, (samples for delphi, c++, lazarus,a compiled library for 64 bits OS, and the full source code)

Here it's a c++ example. It takes only 60 lines of code to inject a script.

Code:
#include <Windows.h>
#include <string>
#include <iostream>
#include "..\..\wrapper\c++\Connector.hpp"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	//load the cheat engine library
	HINSTANCE libInst;

	//don't forget to put the dll in the same directory
#ifdef _WIN64
	libInst = LoadLibraryW(L"ce-lib64.dll");
#else
	libInst = LoadLibrary("ce-lib32.dll");
#endif

	loadFunctions(libInst);

	//get all running processes and print the list
	BSTR proc;
	iGetProcessList(proc);
	wcout << proc;

	BSTR pid = ::SysAllocString(L"00000000");
	cout << "put the pid of the process\r\n";
	wcin >> pid; //don't forget to put the eight digit like 00000000
	wcout << pid << "\r\n";
	iOpenProcess(pid);//open running process by pid

	//add a script to the virtual table
	BSTR name = ::SysAllocString(L"example");//name of the script

	//Don't try to run this script or you will get an exception.
	//this script is just an example. 
	//It's a hook script for the MessageBox api.
	BSTR script = ::SysAllocString(
		L"[enable]\r\n"
		L"alloc(hook, 1024)\r\n"
		L"hook:\r\n"
		L"db 49 4C EB 76\r\n"
		L"db 68 00 6F 00 6F 00 6B 00 20 00 21 00 00 00\r\n"
		L"pop eax\r\n"
		L"add esp, 10\r\n"
		L"push 30\r\n"
		L"push hook+4\r\n"
		L"push hook+4\r\n"
		L"push 0\r\n"
		L"push eax\r\n"
		L"jmp [hook]\r\n"
		L"0042434C:\r\n"
		L"dd hook+12\r\n"
		L"[disable]\r\n"
		L"0042434C :\r\n"
		L"db 49 4C EB 76\r\n"
		L"dealloc(hook)");//the auto assemble script
	//add the script
	iAddScript(name, script);
	//remove the script with index 0 in the virtual table
	iRemoveScript(0);
	//add a script
	iAddScript(name, script);
	//activate the script
	iActivateScript(0, true);

	system("PAUSE");
	FreeLibrary(libInst);
	return 0;
}


In a next stage, I would like to include the lua script engine, the pointer scanner, and the kernelmode driver.
How i can add my progam like blabla.exe
not PID. cz PID can Change Everytime
Hi Diiedha,

Your program is probably protected because windows assigns a unique ID to each process. It may be possible that your program embed a kernel driver to change the pid. One way would be to hook the call which loads the driver and your pid will remain the same all the time. Another way could be to hook the openprocess api, then suspend the process and call my iOpenProcess(pid) function with the correct ID.
I'm glad to announce you the release of the cheat engine library v1.2
This new version includes a full support of the memory scanner.
So now you will be able to search for these types (string, double, float, integer, ...).
All options are supported (fast scan, start address, stop address, unicode, casesensitive, writable, executable, copyOnWrite).

I made a memory scanner example in c# and delphi. Here it's a screenshot.



The library is available on github : type cheatengine-library
Posts 14 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?