Hi,
I'm a Delphi programmer as well. Here's how i read the (max 20 length/zero terminated) charactername, i read it byte by byte:
Code:
function ReadCharacterName(iPid: Integer; iAddress: Cardinal): String;
var
bytesRead: Cardinal;
PidHandle: Integer;
myResult: Cardinal;
lLooper: Boolean;
lLoopValue: Integer;
lString: String;
lIndex: Integer;
begin
bytesRead:= 0;
Pidhandle := OpenProcess(PROCESS_VM_READ,False,iPid);
lLooper := True;
lLoopValue := 0;
lIndex := 1;
lString := '';
while lLooper and (lIndex <= 20) do
begin
ReadProcessMemory(PidHandle, ptr(iAddress + lLoopValue), @myResult, 1, bytesRead);
if chr(myResult) = #0 then
lLooper := False
else
begin
lString := lString + Chr(myResult);
lLoopValue := lLoopValue + 1;
end;
lIndex := lIndex + 1;
end;
closehandle(Pidhandle);
Result := lString;
end;
function input: the process id and the modulebaseadress+playername offset. I suppose you have the function to get the module baseaddress, can post that as well if you like.
I also see the CurrentRealm offset in you're code. Can be read in the exact same way as the charactername, maybe change the max length offset.
Good luck!