this is my source currently
thanks in advance for help
PHP Code:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Registry, tlhelp32, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
cFolder: string;
Pid, Pidhandle, NewValue, Data: Integer;
Address, Written: Cardinal;
Const
process = 'conquer.exe';
implementation
{$R *.dfm}
// Get Process ID
// Example
// Pidhandle := OpenProcess(PROCESS_ALL_ACCESS,False,Pid);
function GetID(Const ExeFileName: string; var ProcessId: integer): boolean;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
result := false;
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while integer(ContinueLoop) <> 0 do begin
if (StrIComp(PChar(ExtractFileName(FProcessEntry32.szExeFile)), PChar(ExeFileName)) = 0)
or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0) then begin
ProcessId:= FProcessEntry32.th32ProcessID;
result := true;
break;
end;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
// Example
// cFolder:=(GetRegistryData(HKEY_LOCAL_MACHINE,'\software\valve\steam\', 'InstallPath'));
// ShowMessage(sFolder+'\steamapps\'+Edit1.text+'\insurgency\insurgency\')
function GetRegistryData(RootKey: HKEY; Key, Value: string): variant;
var
Reg: TRegistry;
RegDataType: TRegDataType;
DataSize, Len: integer;
s: string;
label cantread;
begin
Reg := nil;
try
Reg := TRegistry.Create(KEY_QUERY_VALUE);
Reg.RootKey := RootKey;
if Reg.OpenKeyReadOnly(Key) then begin
try
RegDataType := Reg.GetDataType(Value);
if (RegDataType = rdString) or
(RegDataType = rdExpandString) then
Result := Reg.ReadString(Value)
else if RegDataType = rdInteger then
Result := Reg.ReadInteger(Value)
else if RegDataType = rdBinary then begin
DataSize := Reg.GetDataSize(Value);
if DataSize = -1 then goto cantread;
SetLength(s, DataSize);
Len := Reg.ReadBinaryData(Value, PChar(s)^, DataSize);
if Len <> DataSize then goto cantread;
Result := s;
end else
cantread:
raise Exception.Create(SysErrorMessage(ERROR_CANTREAD));
except
s := ''; // Deallocates memory if allocated
Reg.CloseKey;
raise;
end;
Reg.CloseKey;
end else
raise Exception.Create(SysErrorMessage(GetLastError));
except
Reg.Free;
raise;
end;
Reg.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Address := $038506C0; //
NewValue := 1; //
Data := 4; //
Pidhandle := OpenProcess(PROCESS_ALL_ACCESS,False,Pid);
ReadProcessMemory(Pidhandle, Pointer(Address), @NewValue, Data, nil);
closehandle(Pidhandle);
label1.Caption:=
end;
end.