How to get Service Pack Number of OS from Kernel Mode

Home Forums Discussions General How to get Service Pack Number of OS from Kernel Mode

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5111
    dkg0414
    Participant

      Hi All,

      I need a way to get the service pack number of OS from Kernel mode as i have to support my driver for all the serice packs of xp , 2k and server 2003.

      Is there any exported variable in windows to do so or any kernel api is there or not.

      Please reply soon

      Kind Regards
      Deepak

      #6344
      Vadim Smirnov
      Keymaster

        RTFM DDK

        Windows XP and below:

        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.

        Windows XP and above

        NTSTATUS
        RtlGetVersion(
        IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
        );
        Parameters
        lpVersionInformation
        Pointer to either a RTL_OSVERSIONINFOW structure or a RTL_OSVERSIONINFOEXW structure that contains the version information about the currently running operating system. A caller specifies which input structure is used by setting the dwOSVersionInfoSize member of the structure to the size in bytes of the structure that is used.

        typedef struct _OSVERSIONINFOEXW {
        ULONG dwOSVersionInfoSize;
        ULONG dwMajorVersion;
        ULONG dwMinorVersion;
        ULONG dwBuildNumber;
        ULONG dwPlatformId;
        WCHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage
        USHORT wServicePackMajor;
        USHORT wServicePackMinor;

        USHORT wSuiteMask;
        UCHAR wProductType;
        UCHAR wReserved;
        } RTL_OSVERSIONINFOEXW;

        #6345
        dkg0414
        Participant

          thnx a ton buddy.

          I think it will work for my case.

          Is there any exported variable like “NtBuildNumber” which keeps the Version Number and CSD String.

          Asking just out of curiosity.

          Kind Regards
          Deepak

          #6346
          Vadim Smirnov
          Keymaster

            Is there any exported variable like “NtBuildNumber” which keeps the Version Number and CSD String.

            NtBuildNumber is exported by kernel, CSD string with service pack not.

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.