?? unitsysteminfo.pas
字號:
{Unit perteneciente al troyano Coolvibes que contiene todas las funciones
relaccionadas con la obtenci髇 de informaci髇 del sistema remoto}
unit UnitSystemInfo;
interface
uses
Windows,
SysUtils,
UnitFunciones,
registry;
function GetOS(): String;
function GetCPU():String;
function GetUptime():String;
function GetNombreDeUsuario :String;
implementation
function GetOS(): String;
var
osVerInfo: TOSVersionInfo;
begin
Result:='Desconocido';
osVerInfo.dwOSVersionInfoSize:=SizeOf(TOSVersionInfo);
GetVersionEx(osVerInfo);
case osVerInfo.dwPlatformId of
VER_PLATFORM_WIN32_NT: begin
case osVerInfo.dwMajorVersion of
4: Result:='Windows NT 4.0';
5: case osVerInfo.dwMinorVersion of
0: Result:='Windows 2000';
1: Result:='Windows XP';
2: Result:='Windows Server 2003';
end;
6: Result:='Windows Vista';
end;
end;
VER_PLATFORM_WIN32_WINDOWS: begin
case osVerInfo.dwMinorVersion of
0: Result:='Windows 95';
10: Result:='Windows 98';
90: Result:='Windows Me';
end;
end;
end;
if osverinfo.szCSDVersion <> '' then
begin
result := result + ' ' + osverinfo.szCSDVersion;
end;
end;
function GetCPU():String;
begin
//Trim quita los espacios antes y despues de la cadena, ejem " CPU p6 2000 " , con trim "CPU p6 2000"
Result := Trim(GetClave(HKEY_LOCAL_MACHINE, 'HARDWARE\DESCRIPTION\System\CentralProcessor\0', 'ProcessorNameString'));
end;
function GetUptime():String;
var
Tiempo, Dias, Horas, Minutos: Cardinal;
begin
Tiempo := GetTickCount();
Dias := Tiempo div (1000 * 60 * 60 * 24);
Tiempo := Tiempo - Dias * (1000 * 60 * 60 * 24);
Horas := Tiempo div (1000 * 60 * 60);
Tiempo := Tiempo - Horas * (1000 * 60 * 60);
Minutos:= Tiempo div (1000 *60);
Result := IntToStr(Dias) + 'd ' + IntToStr(Horas) + 'h ' + IntToStr(Minutos) + 'm';
end;
function GetNombreDeUsuario :String;
var
reg : TRegistry;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
If reg.OpenKey('System\CurrentControlSet\Control\ComputerName\ComputerName',True) then
begin
if reg.ReadString('ComputerName') = '' then begin
Result:= 'N/A';
end
else begin
Result:=reg.ReadString('ComputerName');
end;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -