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

📄 u_sysinfo.pas

📁 漏洞扫描系列中HB Network Scanner 测试用练习代码
💻 PAS
字号:
unit u_SysInfo;


interface

uses
  Windows;

function GetSwapFileUsage: Integer;
function GetMemoryLoad: Byte;
function getPlatformId : DWORD;

implementation

// Returns the percentage of swap file space occupied. This is a value between 0 and 100.
function GetSwapFileUsage: Integer;
var
  MemoryStatus: TMemoryStatus;
begin
  FillChar(MemoryStatus, SizeOf(MemoryStatus), 0);
  MemoryStatus.dwLength := SizeOf(MemoryStatus);
  GlobalMemoryStatus(MemoryStatus);
  with MemoryStatus do
    Result := 100 - Trunc(dwAvailPageFile / dwTotalPageFile * 100);
end;

// This function returns the current system memory load. The result is a value between 0 and 100.
function GetMemoryLoad: Byte;
var
  MemoryStatus: TMemoryStatus;
begin
  FillChar(MemoryStatus, SizeOf(MemoryStatus), 0);
  MemoryStatus.dwLength := SizeOf(MemoryStatus);
  GlobalMemoryStatus(MemoryStatus);
  Result := MemoryStatus.dwMemoryLoad;
end;

// this function does not come from JCL
// returns VER_PLATFORM_WIN32_WINDOWS (95,98,Me)
// or      VER_PLATFORM_WIN32_NT (NT,2000)
function getPlatformId : DWORD;
var
  l_info : OSVERSIONINFO;
begin
  // on d閠ermine quelle est la version de windows utilis閑
  l_info.dwOSVersionInfoSize := Sizeof(OSVERSIONINFO);
  GetVersionEx(l_Info);
  result := l_Info.dwPlatformId;
end;


end.

⌨️ 快捷键说明

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