meh trying to just play around with this stuff a bit but i cant seem to get the memory addresses to work for me lol
i reversed perfect world's character structure and tried to recreate it as best i could. i even found the base address which never changes and managed to find the offsets so that i can allways 100% get back into the character structure even if the game is restarted and pointers change.
how it works is
Code
BASE ADDRESS(ptr)->ANOTHER ADDRESS(ptr)+34->DATA STRUCTURE
the base address never changes and as long as you add an offset of 34 to the second pointer you will always be placed at the beginning of the structure. knowing this i recreated the structure as best i could and then tried to point the address at it hopefully allowing me to simple do
Code
Stats->p_player->Current_HP;
and since p_player would be pointing to the begining of the structure all other memory address should line up allowing me to do this in theory. alas i cant calculate the address properly. it always overshoots the address i need and segfaults the game
Code
#include "main.h"
//base address: 00BBC9CC
typedef struct
{
BYTE Unknown01[0x488]; //Unknown stuff (skip it all and align it with the stuff we do know)
DWORD Id;
DWORD Level;
DWORD Cultivation; //create defines for cultivations 0-22
DWORD Current_HP;
DWORD Current_MP;
DWORD Exp;
DWORD Spirit;
DWORD Attribute_Points;
DWORD Current_Chi;
DWORD Attack_Level;
DWORD Defence_Level;
float Critical_Rate;
float Rage_Damage;
DWORD Stealth_Level;
DWORD Stealth_Detection_Level;
DWORD Slaying_Level;
DWORD Warding_level;
DWORD Vitality_Points;
DWORD Magic_Points;
DWORD Strength_Points;
DWORD Dextarity_Points;
DWORD Max_HP;
DWORD Max_MP;
DWORD HP_Regen;
DWORD MP_Regen;
float Walk_Speed;
float Run_Speed;
float Swim_Speed;
float Fly_Speed;
DWORD Accuracy;
DWORD Min_Attack_Damage;
DWORD Max_Attack_Damage;
float Attack_Rate; // 20/value
float Range;
DWORD Min_Metal_Damage;
DWORD Max_Metal_Damage;
DWORD Min_Wood_Damage;
DWORD Max_Wood_Damage;
DWORD Min_Water_Damage;
DWORD Max_Water_Damage;
DWORD Min_Fire_Damage;
DWORD Max_Fire_Damage;
DWORD Min_Earth_Damage;
DWORD Max_Earth_Damage;
DWORD Min_Magic_Damage;
DWORD Max_Magic_Damage;
DWORD Metal_Defence;
DWORD Wood_Defence;
DWORD Water_Defence;
DWORD Fire_Defence;
DWORD Earth_Defence;
DWORD Physical_Defence;
DWORD Evasion;
DWORD Max_Chi;
DWORD Coins;
DWORD Max_Coins;
}PLAYER;
typedef struct
{
BYTE Unknown[0x34]; //move ahead 0x34 bytes (52 bytes)
PLAYER *p_player; //this should align the address to BASEPTR->ADDRPTR+34->actual address
}VARBASE;
DLL_EXPORT void SomeFunction(const LPCSTR sometext)
{
MessageBox(0, sometext, "DLL is inside process", 0);
}
DWORD WINAPI function()
{
VARBASE *Stats = (VARBASE*)0x00BBC9CC;
char lol[1000];
sprintf(lol, "stats pointer: %p | player pointer: %p | player pointer + 34: %ld", (void*)Stats, (void*)Stats->p_player, (Stats->p_player->Level));
SomeFunction(lol);
return NULL;
}
DLL_EXPORT BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
SomeFunction("Creating thread");
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)function, 0, 0, 0);
break;
}
return TRUE;
}
for some reason no matter what i try the second pointers address is never correct. its always 2,500 - 75,000 bytes ahead of what it should be. and i know for a fact that the offset is 0x34 because i can pull up all the character details through cheatengine using baseptr->prt+34->address+offset (offset being which data you want to pull from the structure)
so idk im going to have to look into it in the morning, but its really pissing me off lol. there is no reason why this should work. for some reason the second pointer after i try moving ahead 0x34 bytes points to 0x00000301 rather then 0x0A**CDF4 like it always does in cheat engine. (the base address always points to somewhere around 0x0A**CDC0)
This post was edited by AbDuCt on Mar 29 2013 02:55am