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

📄 unitfunciones.pas

📁 Coolvibes 远程控制 Coolvibes 远程控制 Coolvibes 远程控制 Coolvibes 远程控制
💻 PAS
字号:
{Unit perteneciente al troyano Coolvibes que contiene todas las funciones
que son usadas en varias partes del programa}
unit UnitFunciones;

interface

uses
  Windows,
  SysUtils;

  function GetClave(key:Hkey; subkey,nombre:String):String;
  function AnchuraPantalla():Integer;
  function AlturaPantalla():Integer;
  function HexToInt(s: string): Longword;
{  function FileTime2DateTime(FileTime: TFileTime): TDateTime;
En un f鷗uro es posible que se use esta funci髇 para mostrar la fecha de modificaci髇 de una clave}
  function FindWindowsDir : string;
  function FindSystemDir : string;
  function FindTempDir : string;
  function FindRootDir : string;
  function BooleanToStr(Bool : Boolean; TrueString, FalseString : string) : String;
  Function getIdleTime:String;

implementation

function GetClave(key:Hkey; subkey,nombre:String):String;
var
  bytesread:dword;
  regKey: HKEY;
  valor:String;
begin
  Result:='';
  RegOpenKeyEx(key,PChar(subkey),0, KEY_READ, regKey);
  RegQueryValueEx(regKey,PChar(nombre),nil,nil,nil,@bytesread);
  SetLength(valor, bytesread);
  if RegQueryValueEx(regKey,PChar(nombre),nil,nil,@valor[1],@bytesread)=0 then
    result:=valor;
  RegCloseKey(regKey);
end;

function AlturaPantalla():Integer;
var
  Rectangulo: TRECT;
begin
  GetWindowRect(GetDesktopWindow(),
                Rectangulo);
  Result:=Rectangulo.Bottom-Rectangulo.Top;
end;

function AnchuraPantalla():Integer;
var
  Rectangulo: TRECT;
begin
  GetWindowRect(GetDesktopWindow(),
                Rectangulo);
  Result:=Rectangulo.Right-Rectangulo.Left;
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);
      else
        raise EConvertError.Create('No Hex-Number');
    end;
  end;
end;

function FindWindowsDir : string;
//retorna el directorio de windows
var  DataSize : byte;
begin
 SetLength(Result, 255);
 DataSize := GetWindowsDirectory(PChar(Result), 255);
 if DataSize <> 0 then
  begin
  SetLength(Result, DataSize);
  if Result[Length(Result)] <> '\' then Result := Result + '\';
  end;
end;

function FindSystemDir : string;
//retorna el directorio de windows
var  DataSize : byte;
begin
 SetLength(Result, 255);
 DataSize := GetSystemDirectory(PChar(Result), 255);
 if DataSize <> 0 then
  begin
  SetLength(Result, DataSize);
  if Result[Length(Result)] <> '\' then Result := Result + '\';
  end;
end;

function FindTempDir : string;
//retorna el directorio de los temporales
var DataSize : byte;
begin
SetLength(Result, MAX_PATH);
DataSize := GetTempPath(MAX_PATH, PChar(Result));
if DataSize <> 0 then
  begin
  SetLength(Result, DataSize);
  If Result[Length(Result)] <> '\' then Result := Result + '\';
  end;
end;

function FindRootDir : string;
//retorna el root del directorio de windows
var  DataSize : byte;
begin
 SetLength(Result, 255);
 DataSize := GetWindowsDirectory(PChar(Result), 255);
 if DataSize <> 0 then
  begin
  Result := Copy(Result, 1, 3);
  end;
end;


function BooleanToStr(Bool : Boolean; TrueString, FalseString : string) : String;
//Devuelve la string especificada para true si el boolean que se le pasa es true, y viceversa
begin
if Bool then Result := TrueString
else Result := FalseString;
end;


Function getIdleTime:String;
var
liInfo: TLastInputInfo;
hour, min, sec : integer;
begin
Result := '';
liInfo.cbSize := SizeOf(TLastInputInfo) ;
GetLastInputInfo(liInfo) ;
sec := (GetTickCount - liInfo.dwTime) div 1000;
min := Sec div 60 ;
Sec := Sec mod 60 ;
hour := Min div 60;
Min := Min mod 60 ;

if hour < 10 then Result := Result + '0'+IntToStr(hour)
else Result := Result + IntToStr(hour);

if min < 10 then Result := Result + ':0'+IntToStr(min)
else Result := Result + ':'+IntToStr(min);

if sec < 10 then Result := Result + ':0'+IntToStr(sec)
else Result := Result + ':'+IntToStr(sec);

Result := Result + ' (hh:mm:ss)';

end;

{function FileTime2DateTime(FileTime: TFileTime): TDateTime;
var
  LocalFileTime: TFileTime;
  SystemTime: TSystemTime;
begin
  FileTimeToLocalFileTime(FileTime, LocalFileTime);
  FileTimeToSystemTime(LocalFileTime, SystemTime);
  Result := SystemTimeToDateTime(SystemTime);
end;}

end.

⌨️ 快捷键说明

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