Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (26 sloc) 3.44 KB

System Information Unit

This unit, PJSysInfo, contains a set of static classes that provide various pieces of system information. They are:

Class Description
TPJComputerInfo Provides information about the computer system.
TPJSystemFolders Provides the paths of various standard system folders.
TPJOSInfo Provides information about the operating system.

The PJSysInfo unit also defines a set of global variables that compliment and extend the operating system information provided by global variables defined in the SysUtils unit.

Certain Windows types and constants not defined by Delphi that assist in working with extended operating system information are declared in this unit. Help on these definitions can be found on MSDN or in the Windows platform SDK.

Changes in v5.0

With the introduction of Windows 8.1 Microsoft has deprecated the GetVersion and GetVersionEx API functions that PJSysInfo uses to get operating system version information. These API functions always return information about the reported operating system, which, when the program is running in compatibility mode, may be different to the true operating system. Furthermore GetVersion will not detect Windows 8.1 correctly in all cases.

From version 5, to avoid using the deprecated API functions, a different approach is used to obtain version information when running on Windows 8.1 or later. This new method always returns information about the true operating system, regardless of any compatibility mode.

These changes mean that some of TPJOSInfo's methods and some global variables are affected by compatibility mode when run on operating systems prior to Windows 8.1, but will ignore compatibility mode on Windows 8.1 and later. To help decide if compatibility mode will affect the returned information check the value returned from TPJOSInfo.CanSpoof [v5.0]: True is returned if compatibility mode has an effect on the retrieved OS information and False is returned if not.

It is unfortunate that the class's behaviour is no longer consistent across operating systems, but there is no choice if the code is to abide by Microsoft's much criticised decision to deprecate and possibly remove the old API.

v5.0 also adds some new methods to TPJOSInfo that can be used to detect operating systems that always ignore compatibility mode.

Deprecated & Removed Code

Versions of PJSysInfo prior to v3.0 contained a set of deprecated routines and a deprecated component that duplicated a subset of the system information exposed by the classes and global variables above.

From v3.0 this deprecated code was not compiled unless the PJSYSINFO_COMPILE_DEPRECATED symbol was defined before compiling the unit.

The deprecated code was removed entirely at v4.0.

Conventions

This documentation relates to v3.x, v4.x and v5.x of the System Information Unit.

Unless specified otherwise, classes, variables and methods are available in all versions from v3.0. Items that became available later are marked with the version at which they were introduced, for example [4.0].


Links: