📄 u_sysinfo.pas
字号:
(*
* One Way Network Sniffer (OWNS)
* Copyright (C) 2001-2002 OWNS
*
* http://owns.sourceforge.net/
* http://www.owns.st
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
(*
* $Id: u_SysInfo.pas,v 1.3 2001/07/02 15:15:05 owns Exp $
* Gives some informations about the system.
* taken from the JCL
*)
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 + -