CONSTANTS
{ OSMemType used by SystemMemStatus }
MemoryLoad = 1; // Total memory used in percents (%)
TotalPhys = 2; // Total physical memory in bytes
AvailPhys = 3; // Available physical memory (bytes)
TotalPageFile = 4; // Total page file in (bytes)
AvailPageFile = 5; // Available page file (bytes)
TotalVirtual = 6; // Total virtual memory in bytes
AvailVirtual = 7; // Available virtual memory (bytes)
{ ProcMemType used by ProcessMemStatus }
WorkingSetSize =1; //- the current working set size, in bytes.
PageFaultCount =2; //- the number of page faults.
PeakWorkingSetSize =3; //- the peak working set size, in bytes.
QuotaPeakPagedPoolUsage =4; //- The peak paged pool usage, in bytes.
QuotaPagedPoolUsage =5; //- The current paged pool usage, in bytes.
QuotaPeakNonPagedPoolUsg =6; //- The peak nonpaged pool usage, in bytes.
QuotaNonPagedPoolUsg =7; //- The current nonpaged pool usage, in bytes.
PagefileUsage =8; //- The current space allocated for the pagefile, in bytes.
PeakPagefileUsage =9; //- The peak space allocated for the pagefile, in bytes.
FUNCTIONS
{ DLL Management }
procedure ReleaseMemory (P: PAnsiChar); stdcall; { It is CRITICAL to call ReleaseMemory after each call to a function that returns a string. Details here }
function GetDllVersion: Real; stdcall; { Returns the version of this DLL }
{ CPU }
function CPUFamily : PAnsiChar; stdcall; { Get cpu identifier from the windows registry }
function GetCPUVendor : PAnsiChar; stdcall; { GetCPUVendor function }
function GetCPUSpeed : Double; stdcall; { The higher the delay, the accurate the result. Default= 200ms }
function IsIntel64BitCPU : Boolean; stdcall; { Detects IA64 processors }
function GetCpuTheoreticSpeed: Integer; stdcall; { Get cpu speed (in MHz) }
function IsCPUIDAvailable : Boolean; stdcall;
function GetCPUID (CoreMask: Word): PAnsiChar; stdcall; { Get the ID of the specified physical core }
function GetCpuIdNow : PAnsiChar; stdcall; { Get the ID of the first available core }
function GetCPUCount : Integer; stdcall; { The number of LOGICAL processors in the current group }
{ RAM }
function SystemMemStatus (CONST OSMemType : Byte): Cardinal; stdcall; { in Bytes. Limited by the capacity of the OS (32bits OSs will report max 2 or 3 GB). See constants defined above }
function SystemMemStatus_KB (CONST OSMemType : Byte): PAnsiChar; stdcall;
function SystemMemStatus_MB (CONST OSMemType : Byte): PAnsiChar; stdcall;
{ PROCESS RAM }
function ProcessMemStatus (CONST ProcMemType: Byte= 1): Cardinal; stdcall; { Returns data about the memory used of the current process }
function ProcessPeakMem : PAnsiChar; stdcall; { Shows the highest amount of memory this program ever occupied }
function ProcessCurrentMem: PAnsiChar; stdcall;
{ VIRTUAL RAM }
function GetPageSize : Cardinal; stdcall; { The page size and the granularity of page protection and commitment. This is the page size used by the VirtualAlloc function. }
function GetMemGranularity: Integer; stdcall; { Granularity with which virtual memory is allocated (in KB) }
{ RAM - Advanced stuff }
function GetLowAddr : Cardinal; stdcall; { Lowest RAM memory address accessible to applications (this is the RAM address, not virtual memory address) }
function GetHiAddr : Cardinal; stdcall; { Lowest RAM memory address accessible to applications }
function TrimWorkingSet; stdcall; { Minimizes the amount to RAM used by application by swapping the unused pages back to disk }
{ HDD }
function GetPartitionID (Partition : PAnsiChar): PAnsiChar; stdcall; { Get the ID of the specified patition. Example of parameter: 'C:' }
function GetIDESerialNumber(DriveNumber: Byte ): PAnsiChar; stdcall; { DriveNr starts from 0 (for the first drive) }
{ BIOS (NEW!) }
function BiosDate : PAnsiChar; stdcall;
function BiosVersion : PAnsiChar; stdcall; { Could be something like: TOSQCI - 6040000 Ver 1.00PARTTBL. TOS is from Toshiba, Q is comming from product series (Qosmio) }
function BiosProductID: PAnsiChar; stdcall; { Manufacturer product (laptop, PC) ID - Could be something like: Toshiba_PQX33U-01G00H }
function BiosVideo : PAnsiChar; stdcall;
{ UTILS }
function GenerateHardwareReport: PAnsiChar; { Before calling this I need to enter a valid key into CubicHardID: }
function FormatBytes (CONST Size: Int64; CONST Decimals: Integer): PAnsiChar; stdcall; { Format bytes to KB, MB, GB, TB }
function BinToInt (Value: PAnsiChar): Integer; stdcall; {Utility. Convers a string representing a binary value '110101010' to integer }
function IntToBin (CONST Value, Digits: integer): PAnsiChar; stdcall; {Utility. Convers an integer to its binary representation such as '110101010' }
function CoreNumber2CoreMask(CoreNo: integer): integer; stdcall; {Utility function that can be used as 'CPUMask' parameter for 'GetCPUID' }
Each exported function is well explained in the source code.
Explanation for the types used in this DLL:
- PAnsiChar = null terminated string (equivalent to LPSTR)
- Byte = 'unsigned char'
- Cardinal = 32 bits unsigned
- Integer = 32 bits signed
- Longint = Same as Integer
- Byte = 8 bits unsigned
- Char = Same as Byte
- More about types here.
The following functions are freely accessible (you don't need a to purchase the DLL in order to use them). Note: some functions may be available only in the Delphi version of the DLL.
- ChangeByteOrder
- IntToBin
- CoreNumber2CoreMask
- WindowsProductID
- GetPageSize
- GetMemGranularity
- GetLowAddr
- GetHiAddr
- SystemMemStatus
- ProcessCurrentMem
- ProcessPeakMem
- IsCPUIDAvailable
- GetCPUSpeed
- GetCPUCount
- IsIntel64BitCPU
- GetDllVersion
- ReleaseMemory
|