Here is the whole thing in delphi code, it SHOULD work, but i couldn't test it (no delphi compiler here)
maybe you have to correct some spell failures or something, but that’s the basic how it should works…
Code:
function memoryreadptr(WindowName:string;adress:cardinal):pointer;
var p : pointer;
puffer : cardinal;
BytesRead: DWord;
WindowHandle,ProcessId,ThreadId,ProcessHandle : integer;
begin
p := addr(adress); // convert the cardinal address to a pointer
WindowHandle := FindWindow(nil,WindowName); // find the window with that title and take the handle (only ONE window with that title should be open)
ThreadId := GetWindowThreadProcessId(pchar(WindowName),@ProcessId); // get that process id
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId); // open process cuz we want to read the memory of it
if not ReadProcessMemory( HandleWindow, p , @puffer,sizeof(cardinal), BytesRead ) then // read as many bytes as cardinal can contain (32bits, 4 byte) from the memory in the var puffer
begin
closehandle(ProcessHandle); // close the processhandle cuz we have already read
memoryreadptr := addr($00000000); // return nothing
exit; // exit function
end;
closehandle(ProcessHandle); // close the processhandle cuz we have already read
memoryreadptr := addr(Puffer); // output
end;
function memoryreadfloat(WindowName:string;adress:cardinal):single;
var p : pointer;
puffer : single;
BytesRead: DWord;
WindowHandle,ProcessId,ThreadId,ProcessHandle : integer;
begin
p := addr(adress); // convert the cardinal address to a pointer
WindowHandle := FindWindow(nil,WindowName); // find the window with that title and take the handle (only ONE window with that title should be open)
ThreadId := GetWindowThreadProcessId(pchar(WindowName),@ProcessId); // get that process id
ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId); // open process cuz we want to read the memory of it
if not ReadProcessMemory( HandleWindow, p , @puffer,sizeof(single), BytesRead ) then // read as many bytes as single can contain from the memory in the var puffer
begin
closehandle(ProcessHandle); // close the processhandle cuz we have already read
memoryreadptr := 0; // return nothing
exit; // exit function
end;
closehandle(ProcessHandle); // close the processhandle cuz we have already read
memoryreadptr := Puffer; // output
end;
function getpbase():pointer;
var puff : pointer;
begin
puff := memoryreadptr('World of Warcraft', $10BD5F4);
if puff > $00000000 then
puff := memoryreadptr('World of Warcraft', puff+$34);
if puff > $00000000 then
puff := memoryreadptr('World of Warcraft', puff+$24);
getpbase := puff;
end;
function location(axis:string):single;
begin
if (axis == 'x') or (axis == 'y') or (axis == 'z') then
else
begin
location := 0;
exit;
end;
if axis = 'x' then
location := memoryreadfloat('World of Warcraft', getpbase()+$798);
if axis = 'y' then
location := memoryreadfloat('World of Warcraft', getpbase()+$79C);
if axis = 'z' then
location := memoryreadfloat('World of Warcraft', getpbase()+$7A0);
end;
procedure TForm1.Button1Click(sender: TObject);
//var x,y,z: single;
begin
//x := location('x');
//y := location('y');
//z := location('z');
showmessage('X = '+floattostr(location('x')+#13#10+
'Y = '+floattostr(location('y')+#13#10+
'Z = '+floattostr(location('z'));
end;