unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan, TlHelp32, ExtCtrls, ShellApi;
type
TForm1 = class(TForm)
XPManifest1: TXPManifest;
Timer1: TTimer;
GroupBox1: TGroupBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox6: TCheckBox;
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Label1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
function GetPidByName(ProcessName : string)
WORD;
var
Process : DWORD;
ProcessEntry : TProcessEntry32;
begin
Result := 0;
ProcessEntry.dwSize := SizeOf(TProcessEntry32);
Process := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (Process32First(Process, ProcessEntry)) then
repeat
if (lstrcmpi(ProcessEntry.szExeFile,PChar(ProcessName )) = 0) then
begin
Result := ProcessEntry.th32ProcessID;
Exit;
end;
until (not Process32Next(Process, ProcessEntry));
end;
procedure ChangePrivilege(szPrivilege: PChar; fEnable: Boolean);
var
NewState: TTokenPrivileges;
luid: TLargeInteger;
hToken: THandle;
ReturnLength: DWord;
begin
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, hToken);
LookupPrivilegeValue(nil, szPrivilege, luid);
NewState.PrivilegeCount := 1;
NewState.Privileges[0].Luid := luid;
if (fEnable) then
NewState.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
else
NewState.Privileges[0].Attributes := 0;
AdjustTokenPrivileges(hToken, False, NewState, SizeOf(NewState), nil, ReturnLength);
CloseHandle(hToken);
end;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ShellExecute(handle,'open','https://progamercity.net/forum.php',nil,nil,sw_shownormal);
ChangePrivilege('SeDebugPrivilege',True);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
PID : DWORD;
hProc: DWORD;
Value3,Value1 : Integer;
Written : DWORD;
Buffer : Byte;
begin
PID:= GetPidByName('game.exe');
if PID<>0 then
begin
hProc:= OpenProcess(PROCESS_ALL_ACCESS,false,PID);
Value3:= 1;
ReadProcessMemory(hProc,Ptr($00460000),@Buffer,1,W ritten);
if Buffer = $0D then
begin
if CheckBox2.Checked then
WriteProcessMemory(hProc,Ptr($00000),@Value3,1,Wri tten);
if CheckBox3.Checked then
WriteProcessMemory(hProc,Ptr($00000),@Value3,1,Wri tten);
if CheckBox6.Checked then
WriteProcessMemory(hProc,Ptr($00000),@Value3,1,Wri tten);
ExitProcess(0);
end;
CloseHandle(hProc);
end;
end;
procedure TForm1.Label1Click(Sender: TObject);
begin
ShellExecute(handle,'open','https://progamercity.net/forum.php',nil,nil,sw_shownormal);
end;