Announcement

Collapse
No announcement yet.

How to detect windows versions ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to detect windows versions ?

    How do I detect windows version, of say win xp , 7, 8 and 10 ?
    is there some codes to do this ?

  • #2
    Hey Anne,

    One way to do it...

    Pierre

    Code:
    [color=#0000FF]#COMPILE EXE[/color] [b][i][color=#008080]'#Win 9.07# 'Window version from 2000 to Ten[/color][/i][/b]
    [color=#0000FF]#DIM ALL[/color]
    [color=#0000FF]#INCLUDE[/color] [color=#800040]"Win32Api.inc"[/color]
    
    [color=#0000FF]#IF %PB_REVISION[/color] < [color=#FF0000]&H1000[/color]
    [color=#0000FF]TYPE[/color] [color=#009CFF][b]OSVERSIONINFOEXW[/b][/color]
      dwOSVersionInfoSize [color=#0000FF]AS DWORD[/color]
      dwMajorVersion      [color=#0000FF]AS DWORD[/color]
      dwMinorVersion      [color=#0000FF]AS DWORD[/color]
      dwBuildNumber       [color=#0000FF]AS DWORD[/color]
      dwPlatformId        [color=#0000FF]AS DWORD[/color]
      szCSDVersion        [color=#0000FF]AS STRING[/color] * [color=#FF0000]128[/color] * [color=#FF0000]2[/color] [b][i][color=#008080]'Maintenance string for PSS usage (WSTRINGZ)[/color][/i][/b]
      wServicePackMajor   [color=#0000FF]AS WORD[/color]
      wServicePackMinor   [color=#0000FF]AS WORD[/color]
      wSuiteMask          [color=#0000FF]AS WORD[/color]
      wProductType        [color=#0000FF]AS BYTE[/color]
      wReserved           [color=#0000FF]AS BYTE[/color]
    [color=#0000FF]END TYPE[/color]
    [color=#0000FF]#ENDIF[/color]
    
    [color=#0000FF]DECLARE FUNCTION[/color] [color=#009CFF][b]RtlGetVersion[/b][/color] [color=#0000FF]LIB[/color] [color=#800040]"NtDll.dll"[/color] [color=#0000FF]ALIAS[/color] [color=#800040]"RtlGetVersion"[/color] _
    (OsVerInfoEx [color=#0000FF]AS[/color] [color=#009CFF][b]OSVERSIONINFOEXW[/b][/color])  [color=#0000FF]AS LONG[/color] [b][i][color=#008080]'Unicode function, returns %STATUS_SUCCESS (0) on success.
    '_____________________________________________________________________________[/color][/i][/b]
    
    [color=#0000FF]FUNCTION[/color] WinVer() [color=#0000FF]AS SINGLE[/color]
     [color=#0000FF]LOCAL[/color] OsInfoEx [color=#0000FF]AS[/color] [color=#009CFF][b]OSVERSIONINFOEXW[/b][/color]
     [b][i][color=#008080]'2000 5.0, XP 5.1, 2003 5.2, Vista 6.0 Seven 6.1, Eight.Zero 6.2, Eight.One 6.3, and Ten 10.0.[/color][/i][/b]
    
     [color=#009CFF][b]RtlGetVersion[/b][/color](OsInfoEx) [b][i][color=#008080]'Get Windows version, Windows 8 & 10 included, unicode only available[/color][/i][/b]
     [color=#0000FF]FUNCTION[/color] = OsInfoEx.dwMajorVersion + OsInfoEx.dwMinorVersion / [color=#0000FF]IIF[/color](OsInfoEx.dwMinorVersion > [color=#FF0000]9[/color], [color=#FF0000]100[/color], [color=#FF0000]10[/color])
    
    [color=#0000FF]END FUNCTION[/color]
    [b][i][color=#008080]'_____________________________________________________________________________[/color][/i][/b]
    
    [color=#0000FF]FUNCTION PBMAIN[/color]() [color=#0000FF]AS LONG[/color]
    
     [color=#0000FF]MSGBOX STR$[/color](WinVer()), , [color=#800040]"WinVer"[/color]
    
    [color=#0000FF]END FUNCTION[/color]
    [b][i][color=#008080]'_____________________________________________________________________________
    '[/color][/i][/b]

    Comment


    • #3
      Thanks so much, Pierre

      Comment


      • #4
        Greetings ...

        Is there code that performs the same for PBCC? If yes, please post in this thread in the PBCC Forum Section.

        Thanx-A-Lot, Frank
        Frank Ferrell
        Member
        Last edited by Frank Ferrell; 20 Feb 2017, 12:32 PM.

        Comment

        Working...
        X