[Delphi] OpenProcess() does not return handle

06/20/2012 11:29 theevilworm#1
Hello, I have the following code:
Code:
begin
WindowName := FindWindow(NIL,'SRO_Client');
edit1.text:=inttostr(windowname);
if WindowName<>0 then
  begin
  GetWindowThreadProcessID(WindowName,@ProcessID);
  ProcessHandle := OpenProcess(PROCESS_ALL_ACCESS, false, ProcessID);
  ReadProcessMemory(ProcessHandle, ptr($0181C594), @CharHPnoOffset, SizeOf(CharHPnoOffset), read);
  address1:=CharHPnoOffset+$454;
  ReadProcessMemory(ProcessHandle, ptr(address1), @CharHP, SizeOf(CharHP), read);
  edit1.text:=inttostr(charhpnooffset);
end;
The problem is that WindowName and ProcessID get correct values, but OpenProcess() gives ProcessHandle the value 0. This is not correct of course. Is this because of some hack prevention or did I make a mistake?
I am using this program on a private server client, not on iSRO.