class WinFFI::OSVERSIONINFOEX

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 22
def initialize
  super
  self[:dwOSVersionInfoSize] = size
end

Public Instance Methods

<=>(version) click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 47
def <=>(version)
  hex <=> WIN32_WINNT[case version
    when '2000',  2000                          then :WIN2K
    when 'xp',    :xp                           then :WINXP
    when 'server2003', :server2003, 2003        then :WS03
    when 'vista', :vista, 'longhorn', :longhorn then :VISTA
    when '7',     7                             then :WIN7
    when '8',     8                             then :WIN8
    when '8.1',   8.1,    'blue',     :blue     then :WINBLUE
    when '10',    10,     'thresold', :thresold then :WIN10
    when Integer         then version
    else raise ArgumentError, 'Unknown Version'
  end]
end
build() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 34
def build; dwBuildNumber  end
build=(build) click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 43
def build=(build); self.dwBuildNumber = build end
get!() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 27
def get!
  Kernel32.GetVersionEx(self)
  self
end
hex() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 45
def hex; (major << 8) + minor end
major() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 32
def major; dwMajorVersion end
major=(major) click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 37
def major=(major)
  self.dwMajorVersion = major
end
minor() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 33
def minor; dwMinorVersion end
minor=(minor) click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 41
def minor=(minor); self.dwMinorVersion = minor end
name() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 62
def name
  case hex
    when   WIN32_WINNT[:WIN2K]...WIN32_WINNT[:WINXP]   then 'Windows 2000'
    when   WIN32_WINNT[:WINXP]...WIN32_WINNT[:VISTA]   then 'Windows XP'
    when   WIN32_WINNT[:VISTA]...WIN32_WINNT[:WIN7]    then 'Windows Vista'
    when    WIN32_WINNT[:WIN7]...WIN32_WINNT[:WIN8]    then 'Windows 7'
    when    WIN32_WINNT[:WIN8]...WIN32_WINNT[:WINBLUE] then 'Windows 8'
    when WIN32_WINNT[:WINBLUE]...WIN32_WINNT[:WIN10]   then 'Windows 8.1'
    when   WIN32_WINNT[:WIN10]                         then 'Windows 10'
    else                                                    'Unknown'
  end
end
sp() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 35
def sp; wServicePackMajor end
to_s() click to toggle source
# File lib/win-ffi/kernel32/struct/system_info/os_version_info_ex.rb, line 75
def to_s; "#{name} v#{major}.#{minor}.#{build} SP#{sp}" end