• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Writing and Reading ProcessMemory Example

Master-m

Need help? Just ask!
Senator
Joined
May 28, 2007
Messages
4,338
Reaction score
16
Location
The Netherlands
ReadProcessMemory:

Code:
#include <windows.h>
#include <iostream>

int main()
{
	// Find tibia and get the process id.
	HWND hWnd;
	DWORD processId;
	HANDLE hProcess;
	hWnd = FindWindow("TibiaClient", 0);
	GetWindowThreadProcessId(hWnd, &processId);
	// Get access to the process so we can read and write to it.
	hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, processId);

	int lvl; // int = 4 bytes;
	// Read 4 bytes from 0x6059C0 in hProcess and save it in lvl variable.
	ReadProcessMemory(hProcess, (LPVOID)0x6059C0, &lvl, 4, 0);
	std::cout << "Current Level: " << lvl << std::endl;

	char name[30]; // char = 1 byte; char[30] = 30 bytes;
	// Read 30 bytes from 0x605A34 in hProcess and save it in name variable.
	ReadProcessMemory(hProcess, (LPVOID)(0x605A34), &name, 30, 0);
	std::cout << "First name in battlelist: " << name << std::endl;

	return 0;
}


WriteProcessMemory:

Code:
#include <windows.h>
#include <iostream>

int main()
{
	// Find tibia and get the process id.
	HWND hWnd;
	DWORD processId;
	HANDLE hProcess;
	hWnd = FindWindow("TibiaClient", 0);
	GetWindowThreadProcessId(hWnd, &processId);
	// Get access to the process so we can read and write to it.
	hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, processId);

	int lvl; // int = 4 bytes;
	std::cout << "Enter a new value for level: ";
	std::cin >> lvl;
	// Write the value from lvl variable to 0x6059C0 in hProcess.
	WriteProcessMemory(hProcess, (LPVOID)0x6059C0, &lvl, 4, 0);
	
	char name[30]; // char = 1 byte; char[30] = 30 bytes;
	std::cout << "Enter a new name for the first creature in battlelist: ";
	std::cin >> name;
	// Write the text from name variable to 0x605A34 in hProcess.
	// Use strlen(name) to get the lenght of the text to write.
	WriteProcessMemory(hProcess, (LPVOID)(0x605A34), &name, strlen(name)+1, 0);

This example code was written by Stiju.
 
Where to get the new 8.0 addresses from? ;/ I guess that wouldn't work without them :rolleyes:
 
http://otland.net/showthread.php?tid=118&pid=3224#pid3224
 
Can someone explain what it does and what it's useful for? What can you teach by this? Making something connect through tibias proxies like bots ? Or what? ;o Would be appreciated!
 
Back
Top