📄 cefuncproc.pas
字号:
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 = -1;
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 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
result:=0;
for i:=length(s) downto 1 do
if s[i]='1' then result:=result+trunc(power(2,length(s)-i ));
end;
function Inttobin(i: int64): string;
var temp,temp2: string;
j: integer;
begin
temp:='';
while i>0 do
begin
if (i mod 2)>0 then temp:=temp+'1'
else temp:=temp+'0';
i:=i div 2;
end;
temp2:='';
for j:=length(temp) downto 1 do
temp2:=temp2+temp[j];
result:=temp2;
end;
function getbit(bitnr: integer; bt: Byte):integer;
begin
if (trunc(power(2,bitnr)) and bt)>0 then result:=1 else result:=0;
end;
function scanbits(var found: dword;number:dword;var bytep: pbyte;nrofbits,i,actualread: integer): boolean;
var j,k,l,m: integer;
actualwrite: dword;
tempcount: integer;
tempj,tempk: integer;
tempb: pbyte;
begin
for j:=0 to actualread-1 do
begin
//scan each bit till you find bitarray[bittofind]
for k:=0 to 7 do
begin
tempb:=bytep;
//see if there are enough bits to scan, if not, save the bits to be scanned and exit
//bitsleft=((actualread-j)*8) - k
if nrofbits>(((actualread-j)*8) - k) then
begin
tempcount:=(((actualread-j)*8) - k); //should always be nrofbits-1
setlength(tempbits,nrofbits);
tempk:=k;
for l:=1 to tempcount do
begin
tempbits[l]:=getbit(tempk,bytep^);
inc(tempk);
if tempk>7 then
begin
inc(bytep);
tempk:=0;
end;
end;
result:=true;
exit;
end;
m:=k;
for l:=0 to nrofbits-1 do
begin
if bitscan[l]<>2 then
if getbit(m,tempb^)<>bitscan[l] then break;
if l=nrofbits-1 then
begin
//foundit
foundaddressb[found].address:=memoryregion[i].BaseAddress+j;
foundaddressb[found].bit:=k;
inc(found);
if found=number then
begin
blockwrite(Addressfile,pointer(foundaddressB)^,found*(sizeof(bitaddress)),actualwrite);
found:=0;
end;
end;
inc(m);
if m>7 then
begin
m:=0;
inc(tempb);
end;
end;
end;
inc(bytep);
end;
result:=true;
end;
procedure setbit(bitnr: integer; var bt: Byte;state:integer);
{
pre: bitnr=bit between 0 and 7
bt=pointer to the byte
post: bt has the bit set specified in state
result: bt has a bit set or unset
}
begin
if state=1 then
bt:=bt or trunc(power(2,bitnr)) //set that bit to 1
else
bt:=bt and ($ff xor trunc(power(2,bitnr))); //set the bit to 0
end;
function undolastscan(valtype: integer;max:integer;hexadecimal:boolean;results: TStringlist): integer;
var address: dword;
address2: bitaddress;
value1: byte;
value2: word;
value3: dword;
value4: single;
value5: double;
value6: int64;
value7: string;
x: pchar;
value8: array of byte;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -