Cześć mam problem niżej podam przyczynę... A więc mam funkcję czytania adresu bazowego (normalnego adresu nie odczytam) funkcja wygląda następująco
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, PsAPI, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetModuleBaseAddress(ProcessID: Cardinal; MName: String): Pointer;
var
Modules : Array of HMODULE;
cbNeeded, i : Cardinal;
ModuleInfo : TModuleInfo;
ModuleName : Array[0..MAX_PATH] of Char;
PHandle : THandle;
begin
Result := nil;
SetLength(Modules, 1024);
PHandle := OpenProcess(PROCESS_QUERY_INFORMATION + PROCESS_VM_READ, False, ProcessID);
if (PHandle <> 0) then
begin
EnumProcessModules(PHandle, @Modules[0], 1024 * SizeOf(HMODULE), cbNeeded); //Getting the enumeration of modules
SetLength(Modules, cbNeeded div SizeOf(HMODULE)); //Setting the number of modules
for i := 0 to Length(Modules) - 1 do //Start the loop
begin
GetModuleBaseName(PHandle, Modules[i], ModuleName, SizeOf(ModuleName)); //Getting the name of module
if AnsiCompareText(MName, ModuleName) = 0 then //If the module name match with the name of module we are looking for...
begin
GetModuleInformation(PHandle, Modules[i], @ModuleInfo, SizeOf(ModuleInfo)); //Get the information of module
Result := ModuleInfo.lpBaseOfDll; //Return the information we want (The image base address)
CloseHandle(PHandle);
Exit;
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
WHandle : HWND;
Address: DWORD;
ProcessID : Cardinal;
begin
ProcessID := 0;
WHandle := FindWindow('TibiaClient', nil); //Maybe should change 'Softnyx' for nil.
GetWindowThreadProcessId(WHandle, @ProcessID);
Address := Integer(GetModuleBaseAddress(ProcessID, 'Tibia.exe')) + Integer($00949CFC);
ShowMessage(inttostr(Address));
end;
end.
Problem wygląda tak że podałem tutaj :
Address := Integer(GetModuleBaseAddress(ProcessID, 'Tibia.exe')) + Integer($00949CFC);
odpowiedni adres ale go nie wyświetla :( dodam że program nie wywala errorów