Windows Driver Kit: Kernel-Mode Driver Architecture
PsGetVersion
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.
BOOLEAN
PsGetVersion(
PULONG MajorVersion OPTIONAL,
PULONG MinorVersion OPTIONAL,
PULONG BuildNumber OPTIONAL,
PUNICODE_STRING CSDVersion OPTIONAL
);
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:
| Value | Meaning |
| TRUE (1) | Checked build of the operating system. |
| FALSE (0) | Free build of the operating system. |
Comments
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
IRQL: PASSIVE_LEVEL
Headers: Declared in Ntddk.h. Include Ntddk.h.