#include <windows.h>
#include <iostream>
#include <TlHelp32.h>
// Addresses and Offsets (example values)
DWORD_PTR humanoid_base = 0x7FF6EBE40000; // The base address of the Humanoid object
DWORD_PTR walkspeed_offset_a = 0x1C0;
DWORD_PTR walkspeed_offset_b = 0x398;
extern "C" __declspec(dllexport) void ReadWalkSpeed(HANDLE process) {
DWORD_PTR walkspeed_address_a = humanoid_base + walkspeed_offset_a;
DWORD_PTR walkspeed_address_b = humanoid_base + walkspeed_offset_b;
float current_speed_a, current_speed_b;
// Read current WalkSpeed values
if (ReadProcessMemory(process, (LPCVOID)walkspeed_address_a, ¤t_speed_a, sizeof(current_speed_a), NULL)) {
std::cout << "Current WalkSpeed A: " << current_speed_a << std::endl;
}
else {
std::cout << "Failed to read WalkSpeed A. Error: " << GetLastError() << std::endl;
}
if (ReadProcessMemory(process, (LPCVOID)walkspeed_address_b, ¤t_speed_b, sizeof(current_speed_b), NULL)) {
std::cout << "Current WalkSpeed B: " << current_speed_b << std::endl;
}
else {
std::cout << "Failed to read WalkSpeed B. Error: " << GetLastError() << std::endl;
}
}
extern "C" __declspec(dllexport) void ChangeWalkSpeed(HANDLE process, float new_speed) {
DWORD_PTR walkspeed_address_a = humanoid_base + walkspeed_offset_a;
DWORD_PTR walkspeed_address_b = humanoid_base + walkspeed_offset_b;
// Attempt to write new WalkSpeed values
std::cout << "Attempting to write to WalkSpeed A at address: " << std::hex << walkspeed_address_a << std::endl;
if (!WriteProcessMemory(process, (LPVOID)walkspeed_address_a, &new_speed, sizeof(new_speed), NULL)) {
std::cout << "Failed to write to WalkSpeed A. Error: " << GetLastError() << std::endl;
}
else {
std::cout << "Successfully wrote to WalkSpeed A." << std::endl;
}
std::cout << "Attempting to write to WalkSpeed B at address: " << std::hex << walkspeed_address_b << std::endl;
if (!WriteProcessMemory(process, (LPVOID)walkspeed_address_b, &new_speed, sizeof(new_speed), NULL)) {
std::cout << "Failed to write to WalkSpeed B. Error: " << GetLastError() << std::endl;
}
else {
std::cout << "Successfully wrote to WalkSpeed B." << std::endl;
}
}
DWORD GetProcessIdByName(const wchar_t* process_name) {
PROCESSENTRY32 process_entry;
process_entry.dwSize = sizeof(PROCESSENTRY32);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot == INVALID_HANDLE_VALUE) {
std::cerr << "Failed to take process snapshot. Error: " << GetLastError() << std::endl;
return 0;
}
if (Process32First(snapshot, &process_entry)) {
do {
if (wcscmp(process_entry.szExeFile, process_name) == 0) {
CloseHandle(snapshot);
return process_entry.th32ProcessID;
}
} while (Process32Next(snapshot, &process_entry));
}
CloseHandle(snapshot);
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
// Initialization code can go here
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
// Cleanup code can go here
break;
}
return TRUE;
}
Simple walksped changing program, i know i have the right offsets but not sure about the humanoid address.