📄 cefuncproc.pas.svn-base
字号:
createdir(cheatenginedir+'temp'); //in case it doesn't exist
dllloc1:=cheatenginedir+'temp\';
dllloc2:=cheatenginedir+'temp\';
//random sized name
for i:=1 to 3+random(6) do
dllloc1:=dllloc1+chr(64+random(26));
dllloc1:=dllloc1+'.DLL';
dllloc:=cheatenginedir+'stealth.dll';
if copyfile(pchar(dllloc),pchar(dllloc1),false) then
dll:=LoadLibrary(pchar(dllloc1))
else
dll:=loadlibrary(pchar(dllloc));
hookloc:=getprocaddress(dll,'hook');
hyperscanview.formscanningHandle:=setwindowshookex(WH_CALLWNDPROCRET ,hookloc,DLL,0); //just to get the dll inside the process
stealthhook:=hyperscanview.formscanningHandle;
end;
procedure DisableStealth;
var i: integer;
filedata:_WIN32_FIND_DATAA;
f: thandle;
filelist: array of string;
begin
if stealthhook<>0 then Unhookwindowshookex(stealthhook);
stealthhook:=0;
//delete tempdir
f:=FindFirstFile(pchar(cheatenginedir+'temp\*.DLL'),filedata);
if f<>invalid_handle_value then
begin
setlength(filelist,1);
filelist[length(filelist)-1]:=cheatenginedir+'temp\'+filedata.cFileName;
while findnextfile(f,filedata) do
begin
setlength(filelist,length(filelist)+1);
filelist[length(filelist)-1]:=cheatenginedir+'temp\'+filedata.cFileName;
end;
windows.FindClose(f);
end;
for i:=0 to length(filelist)-1 do
deletefile(filelist[i]);
setlength(filelist,0);
removedirectory(pchar(cheatenginedir+'temp'));
end;
procedure ToggleOtherWindows;
type Tprocesslistitem = record
processid: dword;
processname: string;
end;
var winhandle: Hwnd;
winprocess: Dword;
i,j: integer;
SNAPHandle: THandle;
ProcessEntry: ProcessEntry32;
Check: Boolean;
processlist: array of Tprocesslistitem;
hideall,hidethisone: boolean;
begin
hideall:=false;
allwindowsareback:=false;
if length(windowlist)<>0 then
begin
for i:=0 to length(windowlist)-1 do
showwindow(windowlist[i],SW_SHOW);
setlength(windowlist,0);
allwindowsareback:=true;
exit;
end;
lastactive:=getactivewindow;
lastforeground:=GetForegroundWindow;
if onlyfront then
begin
GetWindowThreadProcessId(lastforeground,addr(winprocess));
if getcurrentprocessid=winprocess then
begin
beep;
sleep(100);
beep;
sleep(100);
exit;
end;
setlength(windowlist,1);
windowlist[0]:=lastforeground;
showwindow(lastforeground,sw_hide);
exit;
end;
if length(donthidelist)>0 then
begin
//first get a process list
SNAPHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
If SnapHandle>0 then
begin
ProcessEntry.dwSize:=SizeOf(ProcessEntry);
Check:=Process32First(SnapHandle,ProcessEntry);
while check do
begin
if processentry.th32ProcessID<>0 then
begin
setlength(processlist,length(processlist)+1);
processlist[length(processlist)-1].processid:=processentry.th32ProcessID;
processlist[length(processlist)-1].processname:=lowercase(ExtractFilename(processentry.szExeFile));
end;
check:=Process32Next(SnapHandle,ProcessEntry);
end;
end else hideall:=true; //else sorry dude, but no exceptions for you, say goodbye to ALL your windows
end else hideall:=true;
winhandle:=getwindow(GetForegroundWindow,GW_HWNDFIRST);
while winhandle<>0 do
begin
GetWindowThreadProcessId(winhandle,addr(winprocess));
if (winprocess<>getCurrentProcessID) {and (winprocess<>3600) }then
begin
if isWindowVisible(winhandle) then
begin
hidethisone:=true;
if not hideall then
begin
//see if you can hide it or not
//check this window process with the process list
//and then see if the processname equals an item from the donthide list
for i:=0 to length(processlist)-1 do
if processlist[i].processid=winprocess then
begin
//found the process id, now check if the processname of this process equals an item from the list
for j:=0 to length(donthidelist)-1 do
if processlist[i].processname=donthidelist[j] then //it's in so do not hide
begin
hidethisone:=false;
break;
end;
break;
end;
end;
if hidethisone then
begin
showwindow(winhandle,SW_HIDE);
// setwindowpos(winhandle,0,0,0,0,0,SWP_HIDEWINDOW or SWP_NOREPOSITION or SWP_NOSIZE or SWP_NOZORDER or SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSENDCHANGING);
setlength(windowlist,length(windowlist)+1);
windowlist[length(windowlist)-1]:=winhandle;
end;
// showwindow(winhandle,sw_show); //remove this for real version
end;
end;
winhandle:=getwindow(winhandle,GW_HWNDNEXT);
end;
// application.BringToFront;
end;
function GetSystemType: Integer; //from Stuart Johnson with a little change by me
const
{ operating system constants }
cOsUnknown = 999999;
cOsWin95 = 0;
cOsWin98 = 1;
cOsWin98SE = 2;
cOsWinME = 3;
cOsWinNT = 4;
cOsWin2000 = 5;
cOsWinXP = 6;
cOsNewer = 7;
var
osVerInfo : TOSVersionInfo;
majorVer, minorVer : Integer;
begin
if overridedebug then
begin
result:=cOsWinXP;
exit;
end;
{ set operating system type flag }
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(osVerInfo) then
begin
majorVer := osVerInfo.dwMajorVersion;
minorVer := osVerInfo.dwMinorVersion;
case osVerInfo.dwPlatformId of
VER_PLATFORM_WIN32_NT : { Windows NT/2000 }
begin
if majorVer <= 4 then
result := cOsWinNT
else
if (majorVer = 5) AND (minorVer= 0) then
result := cOsWin2000
else
if (majorVer = 5) AND (minorVer = 1) then
result := cOsWinXP
else if (majorver > 5) then result:=cOsNewer
else
result := cOsUnknown;
end; {case }
VER_PLATFORM_WIN32_WINDOWS : { Windows 9x/ME }
begin
if (majorVer = 4) AND (minorVer = 0) then
result := cOsWin95
else
if (majorVer = 4) AND (minorVer = 10) then
begin
if osVerInfo.szCSDVersion[1] = 'A' then
result := cOsWin98SE
else
result := cOsWin98;
end {if Version = 'A'}
else
if (majorVer = 4) AND (minorVer = 90) then
result := cOsWinME
else
result := cOsUnknown;
end; {case VER_PLATFORM_WIN32_WINDOWS}
else
result := cOsUnknown;
end;
end
else
result := cOsUnknown;
end;
function Is64bitOS: boolean;
var iswow64: BOOL;
begin
result:=false;
if assigned(IsWow64Process) then
begin
iswow64:=false;
if IsWow64Process(GetCurrentProcess,iswow64) and iswow64 then
result:=true;
end;
end;
function KeyToStr(key:word):string;
begin
case key of
VK_BACK : result:='Backspace';
VK_TAB : result:='Tab';
VK_CLEAR : result:='Clear';
VK_RETURN : result:='Enter';
VK_PAUSE : result:='Pause';
VK_CAPITAL : result:='Caps Lock';
VK_ESCAPE : result:='Esc';
VK_SPACE : result:='Space bar';
VK_PRIOR : result:='Page Up';
VK_NEXT : result:='Page Down';
VK_END : result:='End';
VK_HOME : result:='Home';
VK_LEFT : result:='Left Arrow';
VK_UP : result:='Up Arrow';
VK_RIGHT : result:='Right Arrow';
VK_DOWN : result:='Down Arrow';
VK_SELECT : result:='Select';
VK_PRINT : result:='Print';
VK_EXECUTE : result:='Execute';
VK_SNAPSHOT : result:='Print Screen';
VK_INSERT : result:='Insert';
VK_DELETE : result:='Delete';
VK_HELP : result:='Help';
VK_LWIN : result:='Left Windows key';
VK_RWIN : result:='Right Windows key';
VK_APPS : result:='Applications key';
VK_NUMPAD0 : result:='numeric 0';
VK_NUMPAD1 : result:='numeric 1';
VK_NUMPAD2 : result:='numeric 2';
VK_NUMPAD3 : result:='numeric 3';
VK_NUMPAD4 : result:='numeric 4';
VK_NUMPAD5 : result:='numeric 5';
VK_NUMPAD6 : result:='numeric 6';
VK_NUMPAD7 : result:='numeric 7';
VK_NUMPAD8 : result:='numeric 8';
VK_NUMPAD9 : result:='numeric 9';
VK_MULTIPLY : result:='numeric *';
VK_ADD : result:='numeric +';
VK_SEPARATOR : result:='numeric Separator';
VK_SUBTRACT : result:='numeric -';
VK_DECIMAL : result:='numeric .';
VK_DIVIDE : result:='numeric /';
VK_F1 : result:='F1';
VK_F2 : result:='F2';
VK_F3 : result:='F3';
VK_F4 : result:='F4';
VK_F5 : result:='F5';
VK_F6 : result:='F6';
VK_F7 : result:='F7';
VK_F8 : result:='F8';
VK_F9 : result:='F9';
VK_F10 : result:='F10';
VK_F11 : result:='F11';
VK_F12 : result:='F12';
VK_F13 : result:='F13';
VK_F14 : result:='F14';
VK_F15 : result:='F15';
VK_F16 : result:='F16';
VK_F17 : result:='F17';
VK_F18 : result:='F18';
VK_F19 : result:='F19';
VK_F20 : result:='F20';
VK_F21 : result:='F21';
VK_F22 : result:='F22';
VK_F23 : result:='F23';
VK_F24 : result:='F24';
VK_NUMLOCK : result:='Num Lock';
VK_SCROLL : result:='Scroll Lock';
48..57 : result:=chr(key);
65..90 : result:=chr(key);
else result:='#'+IntToStr(key);
end;
end;
procedure decimal(var key: char); //removed
begin
{
case key of
chr(8) : ;
chr(16) : ;
'0'..'9' : ;
else key:=chr(0);
end;
}
end;
procedure hexadecimal(var key: char); //removed
begin
{case key of
chr(8) : ;
chr(16) : ;
'A'..'F' : ;
'a'..'f' : key:=uppercase(key)[1];
'0'..'9' : ;
else key:=chr(0);
end; }
end;
function ByteStringToText(s: string;hex: boolean):string;
var temp: tbytes;
i,j: integer;
begin
ConvertStringToBytes(s,hex,temp);
result:='';
for i:=0 to length(temp)-1 do
if temp[i]>$13 then
result:=result+chr(temp[i]);
end;
function ByteStringToDouble(s: string;hex: boolean):double;
var temp: tbytes;
temp2: double;
p: ^byte;
i,j: integer;
begin
ConvertStringToBytes(s,hex,temp);
p:=@temp2;
if length(temp)<8 then
begin
j:=length(temp);
setlength(temp,8);
for i:=j to 7 do
temp[i]:=0;
end;
for i:=0 to length(temp)-1 do
begin
if temp[i]=-1 then temp[i]:=0;
p^:=byte(temp[i]);
inc(p);
end;
result:=temp2;
end;
function ByteStringToSingle(s: string;hex: boolean):single;
var temp: tbytes;
temp2: single;
p: ^byte;
i,j: integer;
begin
ConvertStringToBytes(s,hex,temp);
p:=@temp2;
if length(temp)<4 then
begin
j:=length(temp);
setlength(temp,4);
for i:=j to 3 do
temp[i]:=0;
end;
for i:=0 to length(temp)-1 do
begin
if temp[i]=-1 then temp[i]:=0;
p^:=byte(temp[i]);
inc(p);
end;
result:=temp2;
end;
function ByteStringToInt(s: string;hex: boolean):int64;
var temp: tbytes;
i: integer;
power: integer;
begin
ConvertStringToBytes(s,hex,temp);
power:=0;
result:=0;
for i:=0 to length(temp)-1 do
begin
result:=result+(temp[i]*trunc(math.power(256,power)));
inc(power);
end;
end;
function VarToBytes(v: pointer; size: integer): string;
var p: ^byte;
j,k: integer;
res: array of string;
begin
result:='';
p:=v;
setlength(res,size);
for k:=0 to size-1 do
begin
res[k]:=inttohex(p^,2);
inc(p);
end;
j:=size;
for k:=size-1 to 1 do
if res[k]='00' then dec(j);
for k:=0 to j-1 do
result:=result+res[k]+' ';
result:=copy(result,1,length(result)-1);
end;
function BinToInt(s: string): int64;
var i: integer;
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -