Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

PJSysInfo Global Variables

Project: System Information Unit

Unit: PJSysInfo.

The PJSysInfo unit defines several global variables containing extended operating system information. These variables build on similar Win32XXX variables defined in the SysUtils unit.

The variables defined in PJSysInfo are:

Win32PlatformEx

Applies to: ~>5.0

var Win32PlatformEx: Integer;

Win32PlatformEx records the current operating system platform. This is one of VER_PLATFORM_WIN32_NT, VER_PLATFORM_WIN32_WINDOWS or (very unlikely) VER_PLATFORM_WIN32s.

This variable is an analogue of Win32Platform variable defined in SysUtils except that, on operating systems that support it, Win32PlatformEx’s value is not spoofed when the program is running in compatibility mode.

Whether Win32PlatformEx can be spoofed depends on the value returned by TPJOSInfo.CanSpoof. A value of False means Win32PlatformEx returns the correct platform for the host operating system while True means that Win32PlatformEx is spoofed by compatibility mode into returning the platform represented by the emulated operating system.

Win32Platform, on the other hand, is always spoofed by compatibility mode.

Win32MajorVersionEx

Applies to: ~>5.0

var Win32MajorVersionEx: LongWord;

Records the major version number of the operating system.

This variable is an analogue of Win32MajorVersion variable defined in SysUtils except that, on operating systems that support it, Win32MajorVersionEx’s value is not spoofed when the program is running in compatibility mode, whereas Win32MajorVersion is always spoofed in these circumstances.

Whether Win32MajorVersionEx can be spoofed depends on the value returned by TPJOSInfo.CanSpoof. A value of False means Win32MajorVersionEx returns the correct major version number for the host operating system while True means that Win32MajorVersionEx is spoofed by compatibility mode into returning the major version represented by the emulated operating system.

Win32MinorVersionEx

Applies to: ~>5.0

var Win32MinorVersionEx: LongWord;

Records the minor version number of the operating system.

This variable is an analogue of Win32MinorVersion variable defined in SysUtils except that, on operating systems that support it, Win32MinorVersionEx’s value is not spoofed when the program is running in compatibility mode, whereas Win32MinorVersion is always spoofed in these circumstances.

Whether Win32MinorVersionEx can be spoofed depends on the value returned by TPJOSInfo.CanSpoof. A value of False means Win32MinorVersionEx returns the correct minor version number for the host operating system while True means that Win32MinorVersionEx is spoofed by compatibility mode into returning the minor version represented by the emulated operating system.

Win32BuildNumberEx

Applies to: ~>5.0

var Win32BuildNumberEx: Integer;

Records the build number of the operating system.

This variable is an analogue of Win32BuildNumber variable defined in SysUtils except that, on operating systems that support it, Win32BuildNumberEx’s value is not spoofed when the program is running in compatibility mode. Win32BuildNumber is always spoofed in these circumstances.

Whether Win32BuildNumberEx can be spoofed depends on the value returned by TPJOSInfo.CanSpoof. A value of False means Win32BuildNumberEx returns the correct build number for the host operating system while True means that Win32BuildNumberEx is spoofed by compatibility mode into returning the build number represented by the emulated operating system.

Win32CSDVersionEx

Applies to: ~>5.0

var Win32CSDVersionEx: string;

Stores the name of any service pack applied to the operating system. The value is the empty string if there is no service pack.

This variable is an analogue of Win32CSDVersion variable defined in SysUtils except that, on operating systems that support it, Win32CSDVersionEx’s value is not spoofed when the program is running in compatibility mode. Win32CSDVersion is always spoofed in these circumstances.

Whether Win32CSDVersionEx can be spoofed depends on the value returned by TPJOSInfo.CanSpoof. A value of False means Win32CSDVersionEx returns the correct service pack string for the host operating system while True means that Win32CSDVersionEx is spoofed by compatibility mode into returning the service pack of the emulated operating system.

Win32RevisionNumber

Applies to: ~>5.6

var Win32RevisionNumber: Integer;

Stores the operating system’s revision number.

The revision number is read from the registry. If no such value is found then 0 is returned.

Basic tests indicate that this value cannot be spoofed, but registry spoofing is known to vary between different OS versions.

Win32HaveExInfo

Applies to: ~>5.0

var Win32HaveExInfo: Boolean;

This global variable is True if extended operating system information is available and False if not. When False the values of the Win32ServicePackMajor, Win32ServicePackMinor, Win32SuiteMask and Win32ProductType variables are not valid and should not be used.

Extended operating system information is available only on Windows NT platform operating systems from and including Windows NT4 Service Pack 6.

Compatibility modes have no effect on Win32HaveExInfo: its value depends on the capabilities of the actual operating system, even in cases where the emulated operating system would not natively support extended information.

Win32ServicePackMajor

Applies to: ~>5.0

var Win32ServicePackMajor: string;

This global variable stores the major version number the operating system’s service pack or 0 if the OS has no service pack applied.

Note that this variable only stores valid information if the Win32HaveExInfo variable is True.

Running the host program in compatibility mode Win32ServicePackMajor is always spoofed to return the major version of any service pack that relates to the emulated operating system.

When running on operating systems where TPJOSInfo.CanSpoof returns False, compatibility mode no longer spoofs Win32ServicePackMajor and it will return the service pack major version of the actual operating system.

Win32ServicePackMinor

Applies to: ~>5.0

var Win32ServicePackMinor: string;

This global variable stores any minor version number the operating system’s service pack. If Win32ServicePackMajor returns 0 then Win32ServicePackMinor will also return 0.

Note that this variable only stores valid information if the Win32HaveExInfo variable is True.

Running the host program in compatibility mode Win32ServicePackMinor is always spoofed to return the minor version of any service pack that relates to the emulated operating system.

When running on operating systems where TPJOSInfo.CanSpoof returns False, compatibility mode no longer spoofs Win32ServicePackMinor and it will return the service pack minor version of the actual operating system.

Win32SuiteMask

Applies to: ~>5.0

var Win32SuiteMask: Integer;

This global variable stores a combination of bit flags that identify the product suites available on the system. The value is a combination of VER_SUITE_xxx constants that are defined by Microsoft. The constants are declared in the PJSysInfo unit.

Note that this variable only stores valid information if the Win32HaveExInfo variable is true.

Compatibility mode has no effect on this value.

When running on operating systems where TPJOSInfo.CanSpoof returns False Win32SuiteMask always returns 0. You should get product information from the Win32ProductInfo instead.

Win32ProductType

Applies to: ~>5.0

var Win32ProductType: Integer;

This global variable stores additional information about an operating system product.a. The value one of the VER_NT_xxx constants defined by Microsoft. The constants are declared in the PJSysInfo unit.

Note that this variable only stores valid information if the Win32HaveExInfo variable is true.

Compatibility mode has no effect on this value: running an emulation of a server operating system on a desktop system leaves Win32ProductType with the value of VER_NT_WORKSTATION instead of changing it to VER_NT_SERVER as would be the case for a genuine server operating system.

Win32HaveProductInfo

Applies to: ~>5.0

var Win32HaveProductInfo: Boolean;

This global variable informs whether product information is available from the operating system. Such information is obtained from the Windows API function GetProductInfo, which is available on Windows Vista and later operating systems.

When Win32HaveProductInfo is True the product information code can be read from Win32ProductInfo, otherwise Win32ProductInfo is set to 0.

Compatibility modes have no effect on Win32HaveProductInfo: its value depends on the capabilities of the actual operating system, even in cases where the emulated operating system would not natively support the required API functions.

Win32ProductInfo

Applies to: ~>5.0

var Win32ProductInfo: LongWord;

This global variable provides additional product information about the operating system. The value is one of the PRODUCT_xxx constants defined by Microsoft. The constants are declared in the PJSysInfo unit.

Note that this variable only stores valid information if the Win32HaveProductInfo variable is true, otherwise Win32ProductInfo is set to 0.

Running the host program in compatibility mode Win32ProductInfo is always spoofed to return the product information that relates to the emulated operating system. If the emulated operating system did not expose product information in this way the value will be 0.

When running on operating systems where TPJOSInfo.CanSpoof returns False, compatibility mode no longer spoofs Win32ProductInfo and it will return product information relating to the actual operating system.