📄 memorytrainerunit.pas.svn-base
字号:
//indicate that this hotkey got pressed
beep;
if userdefinedform<>nil then
begin
for j:=0 to length(userdefinedform.cheat)-1 do
if userdefinedform.cheat[j].cheatnr=i then
userdefinedform.cheat[j].activated:=true;
for j:=0 to length(userdefinedform.cheatlist)-1 do
userdefinedform.cheatlist[j].Items[i].activated:=true;
end;
frmMemoryTrainer.clist.Items[i].activated:=true;
//and activate the thread that sleeps 500 ms and keeps the collor to activated when active , and black when not
TSetColorThread.mycreate(i);
end;
end;
procedure TfrmMemoryTrainer.FormClose(Sender: TObject;
var Action: TCloseAction);
var i: integer;
begin
try
{
for i:=0 to length(trainerdata)-1 do
unregisterhotkey(self.Handle,i);
unregisterhotkey(self.Handle,$bfff);}
finally
application.Terminate;
end;
end;
procedure TfrmMemoryTrainer.FormCreate(Sender: TObject);
var temp: dword;
x: pchar;
i,j,k,l,err: integer;
bp1,bp2: ^byte;
imagestream: Tmemorystream;
buf: pchar;
temp2: integer;
temptb: TBytes;
tempab: array of byte;
tempb: boolean;
tempc: tcolor;
tempi: integer;
tempbc: tbevelcut;
tempbk: tbevelkind;
tempcursor: tcursor;
temps: string;
popup: boolean;
keymod:word;
pid: dword;
ownprocesshandle: THandle;
tokenhandle: thandle;
tp:TTokenPrivileges;
prev: TTokenPrivileges;
hotkey: TKeyCombo;
ReturnLength: Dword;
begin
pid:=GetCurrentProcessID;
ownprocesshandle:=OpenProcess(PROCESS_ALL_ACCESS,true,pid);
tokenhandle:=0;
if ownprocesshandle<>0 then
begin
if OpenProcessToken(ownprocesshandle,TOKEN_QUERY or TOKEN_ADJUST_PRIVILEGES ,tokenhandle) then
begin
if lookupPrivilegeValue(nil, 'SeDebugPrivilege' ,tp.Privileges[0].Luid) then
begin
tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
tp.PrivilegeCount := 1; // One privilege to set
AdjustTokenPrivileges(tokenhandle,false,tp,sizeof(tp),@prev,returnlength);
end;
end;
end;
viewdefault:=true;
clist:=tcheatlist.create(nil);
with clist do
begin
Left:=0;
Top:=15;
Width:=scrollbox1.Width-3;
Height:=50;
AutoSize:=true;
Anchors:=[akleft,aktop,akright];
parent:=scrollbox1;
end;
trainerfile.ReadBuffer(temp,4); //version (can be discarded)
//trainerdatasize
trainerfile.ReadBuffer(temp,4);
setlength(trainerdata,temp);
for i:=0 to length(trainerdata)-1 do
begin
trainerdata[i].active:=false;
//description
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
trainerdata[i].description:=x;
freemem(x);
//hotkeytext
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
trainerdata[i].hotkeytext:=x;
freemem(x);
trainerfile.ReadBuffer(trainerdata[i].hotkey,sizeof(trainerdata[i].hotkey));
//nr of code entries
trainerfile.ReadBuffer(temp,4);
setlength(trainerdata[i].codeentrys,temp);
for j:=0 to length(trainerdata[i].codeentrys)-1 do
begin
trainerfile.ReadBuffer(temp,4);
if protect then temp:=temp xor $11221122;
trainerdata[i].codeentrys[j].address:=temp;
//modulename
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
trainerdata[i].codeentrys[j].modulename:=x;
freemem(x);
//moduleoffset
trainerfile.ReadBuffer(temp,4);
if protect then temp:=temp xor $22112211;
trainerdata[i].codeentrys[j].moduleoffset:=temp;
trainerfile.ReadBuffer(temp,4);
setlength(trainerdata[i].codeentrys[j].originalopcode,temp);
trainerfile.ReadBuffer(pointer(trainerdata[i].codeentrys[j].originalopcode)^,temp);
end;
//address entrys
trainerfile.ReadBuffer(temp,4);
setlength(trainerdata[i].addressentrys,temp);
for j:=0 to length(trainerdata[i].addressentrys)-1 do
begin
trainerfile.readBuffer(temp,sizeof(trainerdata[i].addressentrys[j].address));
if protect then temp:=temp xor $dead1337;
trainerdata[i].addressentrys[j].address:=temp;
//interpretableaddress
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
if protect then //decrypt temps
for k:=0 to temp-1 do
x[k]:=chr(ord(x[k]) xor (k+2));
trainerdata[i].addressentrys[j].interpretableaddress:=x;
trainerfile.readBuffer(trainerdata[i].addressentrys[j].ispointer,sizeof(trainerdata[i].addressentrys[j].ispointer));
trainerfile.ReadBuffer(tempi,4);
setlength(trainerdata[i].addressentrys[j].pointers,tempi);
for k:=0 to tempi-1 do
begin
trainerfile.readBuffer(trainerdata[i].addressentrys[j].pointers[k].address,sizeof(trainerdata[i].addressentrys[j].pointers[k].address));
//interpretableaddress for pointer
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
if protect then //decrypt temps
for l:=0 to temp-1 do
x[l]:=chr(ord(x[l]) xor (l+3));
trainerdata[i].addressentrys[j].pointers[k].interpretableaddress:=x;
trainerfile.readBuffer(trainerdata[i].addressentrys[j].pointers[k].offset,sizeof(trainerdata[i].addressentrys[j].pointers[k].offset));
end;
trainerfile.ReadBuffer(trainerdata[i].addressentrys[j].bit,sizeof(trainerdata[i].addressentrys[j].bit));
trainerfile.readBuffer(trainerdata[i].addressentrys[j].memtyp,sizeof(trainerdata[i].addressentrys[j].memtyp));
trainerfile.readbuffer(trainerdata[i].addressentrys[j].frozen,sizeof(trainerdata[i].addressentrys[j].frozen));
trainerfile.readbuffer(trainerdata[i].addressentrys[j].frozendirection,sizeof(trainerdata[i].addressentrys[j].frozendirection));
trainerfile.readbuffer(trainerdata[i].addressentrys[j].setvalue,sizeof(trainerdata[i].addressentrys[j].setvalue));
trainerfile.readbuffer(trainerdata[i].addressentrys[j].userinput,sizeof(trainerdata[i].addressentrys[j].userinput));
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
trainerdata[i].addressentrys[j].value:=x;
freemem(x);
trainerdata[i].addressentrys[j].valuelength:=length(trainerdata[i].addressentrys[j].value);
//autoassemblerscript
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
if protect then //decrypt temps
for k:=0 to temp-1 do
x[k]:=chr(ord(x[k]) xor (k+1));
trainerdata[i].addressentrys[j].autoassemblescript:=x;
freemem(x);
end;
end;
//title
//trainerfile.ReadBuffer(temp,4);
temp:=0;
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(pointer(x)^,temp);
x[temp]:=#0;
if protect then
begin
for i:=0 to temp-1 do
x[i]:=chr(ord(x[i]) xor 56);
end;
caption:=x;
application.Title:=caption;
freemem(x);
//launch filename
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(x^,temp);
x[temp]:=#0;
filename:=x;
//autolaunch
trainerfile.ReadBuffer(autolaunch,sizeof(autolaunch));
//popup on keypress
trainerfile.ReadBuffer(popup,sizeof(popup));
//processname
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(x^,temp);
x[temp]:=#0;
process:=x;
freemem(x);
//hotkeytext (discarded)
trainerfile.ReadBuffer(temp,4);
getmem(x,temp);
trainerfile.ReadBuffer(x^,temp);
freemem(x);
//hotkey+shiftstate
trainerfile.ReadBuffer(hotkey,sizeof(hotkey));
if popup then //register this hotkey
begin
registerhotkey2(self.Handle,$bfff,hotkey)
end;
//aboutboxtext
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(x^,temp);
x[temp]:=#0;
if protect then
begin
for i:=0 to temp-1 do
x[i]:=chr(ord(x[i]) xor 166);
end;
aboutboxtext:=x;
freemem(x);
//freeze timer interval
trainerfile.ReadBuffer(tempi,sizeof(tempi));
freezer.Interval:=tempi;
trainerfile.ReadBuffer(temp,4);
if temp=$666 then
begin
//default uid
//image
trainerfile.ReadBuffer(temp,4); //size of image
if temp>0 then
image1.Picture.Bitmap.LoadFromStream(trainerfile);
trainerfile.ReadBuffer(temp2,sizeof(width));
width:=temp2;
trainerfile.ReadBuffer(temp2,sizeof(height));
height:=temp2;
trainerfile.ReadBuffer(temp2,sizeof(panel1.width));
panel1.width:=temp2;
trainerfile.ReadBuffer(temp2,sizeof(panel1.height));
panel1.height:=temp2;
end
else
begin
//user defined ui
viewdefault:=false;
userdefinedform:=tuserdefinedform.create(self);
userdefinedform.Caption:=caption;
//windowwidth
trainerfile.readbuffer(temp,4);
userdefinedform.Width:=temp;
//windowheight
trainerfile.readbuffer(temp,4);
userdefinedform.height:=temp;
userdefinedform.Position:=poscreencenter;
userdefinedform.BorderStyle:=bsSingle;
while true do
begin
trainerfile.ReadBuffer(temp,4);
case temp of
0: with tbutton2.create(nil) do
begin
trainerfile.ReadBuffer(temp,sizeof(integer));
left:=temp;
trainerfile.ReadBuffer(temp,sizeof(integer));
top:=temp;
trainerfile.ReadBuffer(temp,sizeof(integer));
width:=temp;
trainerfile.ReadBuffer(temp,sizeof(integer));
height:=temp;
//caption
trainerfile.ReadBuffer(temp,4);
getmem(x,temp+1);
trainerfile.ReadBuffer(x^,temp);
x[temp]:=#0;
caption:=x;
freemem(x);
//wordwrap
trainerfile.ReadBuffer(tempb,sizeof(tempb));
wordwrap:=tempb;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -