PsGetVersion function

This function is obsolete in Windows XP and later versions of the Windows operating system. Use RtlGetVersion instead.

PsGetVersion returns caller-selected information about the current version of the NT-based operating system.

Syntax

NTKERNELAPI BOOLEAN PsGetVersion(
  PULONG          MajorVersion,
  PULONG          MinorVersion,
  PULONG          BuildNumber,
  PUNICODE_STRING CSDVersion
);

Parameters

MajorVersion

Points to a caller-supplied variable that this routine sets to the major version of the operating system. This optional parameter can be NULL.

MinorVersion

Points to a caller-supplied variable that this routine sets to the minor version of the operating system. This optional parameter can be NULL.

BuildNumber

Points to a caller-supplied variable that this routine sets to the current build number of the operating system. This optional parameter can be NULL.

CSDVersion

Points to a caller-allocated buffer in which this routine returns the current service-pack version as a Unicode string only during system driver initialization. This optional parameter can be NULL.

Return Value

PsGetVersion returns whether the system is a checked or free build, as follows:

Return code Description
TRUE (1)
Checked build of the operating system.
FALSE (0)
Free build of the operating system.

Remarks

PsGetVersion returns the requested information, depending on which optional parameter(s) the caller supplies.

To retrieve the current service-pack number, it is easier and more efficient to make an application-level call within the Win32 environment than to call PsGetVersion during system driver initialization, which then must parse the string it returns at CSDVersion. When the registry is initialized, a driver cannot obtain this string from PsGetVersion, but must read the CmCSDVersionString value from the registry.

Requirements

   
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI compliance rules IrqlPsPassive, PowerIrpDDis, HwStorPortProhibitedDDIs