⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit2.~pas

📁 传奇 外挂 原代码,供感兴趣的人研究. 传奇终结者2.0
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
unit Unit2;

interface
Uses
Windows,SysUtils,Registry,classes;

procedure AddValue(Root:HKEY;StrPath:String;YN:Boolean;StrValue:String;Strdata:String;DataType:integer);
procedure DelValue(Root:HKEY;StrPath:String;StrValue:String);
procedure DelSub(Root:HKEY;StrPath:String;StrSub:String);
function ReadValue(Root:HKEY;StrPath:String;StrValue:String):String;
function ValueExists(Root:HKEY;StrPath:String;StrValue:String):Boolean;
function KeyExists(Root:HKEY;StrPath:String;StrSub:String):Boolean;
procedure GetValueName(Root:HKEY;StrPath:String;var SL:TStringList);
procedure GetKeyName(Root:HKEY;StrPath:String;var SL:TStringList);
procedure Delreject(Root:HKEY;StrPath:String;n:integer);
procedure Delrepeat(Root:HKEY;StrPath:String);
function myGetComputerName:String;
function GetWP:string;
function GetWSP:String;
function GetServerName(Logo:String;Y:integer):String;
function EncodeString(Decoded:string):String;
function EncodeBASE64(Encoded: TMemoryStream ; Decoded: TMemoryStream): Integer;
var
Reg:Tregistry;

implementation
uses Unit1;

//添加键值
procedure AddValue(Root:HKEY;StrPath:String;YN:Boolean;StrValue:String;StrData:String;DataType:integer);
Var I:Integer;
begin
Reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(Strpath,YN) then
Begin
case DataType of
1:reg.WriteString(StrValue,StrData);
3:reg.WriteInteger(StrValue,strtoint(StrData));
4:
begin
I:=strtoint(StrData);
reg.WriteBinaryData(StrValue,I,SizeOf(Integer));
end;
end;
end;
Reg.CloseKey;
Reg.Free;
end;

//删除健值
procedure DelValue(Root:HKEY;StrPath:String;StrValue:String);
begin
Reg:=Tregistry.Create;
Reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then reg.DeleteValue(StrValue);
Reg.CloseKey;
Reg.Free;
end;

//读取键值
function ReadValue(Root:HKEY;StrPath:String;StrValue:String):String;
var i:integer;
begin
Reg:=Tregistry.Create;
Reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) and reg.ValueExists(StrValue) then
begin
case reg.GetDataType(StrValue) of
rdString:ReadValue:=reg.ReadString(StrValue);
rdInteger:ReadValue:=inttostr(reg.ReadInteger(StrValue));
rdBinary:
begin
reg.ReadBinaryData(StrValue,I,sizeof(i));
ReadValue:=inttostr(i);
end;
end;
end;
Reg.CloseKey;
Reg.Free;
end;

//检测键值是否存在
function ValueExists(Root:HKEY;StrPath:String;StrValue:String):Boolean;
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if (reg.OpenKey(StrPath,False)) and (reg.ValueExists(StrValue)) then
Result:=True
else
Result:=False;
reg.CloseKey;
reg.Free;
end;

//检测主键是否存在
function KeyExists(Root:HKEY;StrPath:String;StrSub:String):Boolean;
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if (reg.OpenKey(StrPath,False)) and (reg.KeyExists(StrSub)) then
Result:=True
else
Result:=False;
reg.CloseKey;
reg.Free
end;

//删除主键
procedure DelSub(Root:HKEY;StrPath:String;StrSub:String);
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then reg.DeleteKey(StrSub);
reg.CloseKey;
reg.Free;
end;

//枚举键值
procedure GetValueName(Root:HKEY;StrPath:String;var SL:TStringList);
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then reg.GetValueNames(SL);
reg.CloseKey;
reg.Free;
end;

//枚举主键
procedure GetKeyName(Root:HKEY;StrPath:String;var SL:TStringList);
begin
reg:=Tregistry.Create;
reg.RootKey:=Root;
if reg.OpenKey(StrPath,False) then Reg.GetKeyNames(SL);
Reg.CloseKey;
reg.Free;
end;

//删除不合法的记录
procedure Delreject(Root:HKEY;StrPath:String;n:integer);
var Temp,Sub:TStringList;
    i,t:integer;
begin
 Temp:=TStringList.Create;
 Sub:=TStringList.Create;
 Getkeyname(Root,StrPath,Sub);
 if Sub.Count<>0 then begin
   for i:=0 to sub.Count-1 do begin

    if readvalue(Root,StrPath+'\'+Sub[i],'区域')='abcdefghijklmnopqrstuvwxyz1234567890' then delvalue(Root,StrPath+'\'+Sub[i],'区域');
    getvaluename(Root,StrPath+'\'+Sub[i],Temp);
    for t:=0 to Temp.Count-1 do begin
     if readvalue(Root,StrPath+'\'+Sub[i],Temp[t])='' then Delvalue(Root,StrPath+'\'+Sub[i],Temp[t]);
    end;

    Temp.Clear;
    getvaluename(Root,StrPath+'\'+Sub[i],Temp);
    if Temp.Count<n then Delsub(Root,StrPath,Sub[i]);
    Temp.Clear;
   end;
 end;
 Temp.Free;
 Sub.Free;
End;

//删除重复的记录
procedure Delrepeat(Root:HKEY;StrPath:String);
var Temp,Sub,Bj1,Bj2:TStringList;
    i,j,t:integer;
begin
 Temp:=TStringList.Create;
 Sub:=TStringList.Create;
 Bj1:=TStringList.Create;
 Bj2:=TStringList.Create;

 Getkeyname(Root,StrPath,Sub);
 if sub.Count>=2 then begin
   for i:=0 to sub.Count-2 do begin
    getvaluename(Root,StrPath+'\'+sub[i],Temp);
    for t:=0 to Temp.Count-1 do begin
     Bj1.Add(ReadValue(Root,StrPath+'\'+sub[i],Temp[t]));
    end;
    Temp.Clear;
    for j:=i+1 to sub.Count-1 do begin
     getvaluename(Root,StrPath+'\'+sub[j],Temp);
     for t:=0 to Temp.Count-1 do begin
      Bj2.Add(ReadValue(Root,StrPath+'\'+sub[j],Temp[t]));
     end;
     if Bj1.Text=Bj2.Text then Delsub(Root,StrPath,sub[j]);
     Temp.Clear;
     bj2.Clear;
    end;
    bj1.Clear;
   end;
 end;
Temp.Free;Sub.Free;bj1.Free;bj2.Free;
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;

//获取Windows目录
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;

//获取Windowssystem目录
function GetWSP:String;
var Buf:array[0..MAX_PATH] of char;
begin
GetSystemDirectory(Buf,MAX_PATH);
Result:=Buf;
if Result[Length(Result)]<>'\' then Result:=Result+'\';
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
 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='移动天下(15区)' then begin
 if (y>246) and (y<288) then result:='华夏(移动)' else
 if (y>288) and (y<330) then result:='神州(移动)' else
 if (y>330) and (y<372) then result:='四海(移动)' else result:='未知';
end
else
if Logo='侠骨丹心(16区)' then begin
 if (y>267) and (y<309) then result:='楚天(联通)' else
 if (y>309) and (y<351) then result:='秦岭(联通)' else result:='未知';
end
else
if Logo='风云专区(17区)' then begin
 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:='天河(NEW!光通)' else
 if (y>351) and (y<393) then result:='白云山(NEW!光通)' else result:='未知';
end
else
if Logo='赤月·广电星空(18区)' then begin
 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 result:='未知';
end
else
if Logo='西部圣域II(19区)' then begin
 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 result:='未知';
end
else
if Logo='光明世界(20区)' then begin
 if (y>225) and (y<267) then result:='晴空' else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -