Sha256: be9e97ff11b62d93c56939424a8f11b4665aa4a1f1ac1ec5a651c17d7990565c

Contents?: true

Size: 1.25 KB

Versions: 22

Compression:

Stored size: 1.25 KB

Contents

# Copyright (C) 2011-2012 RightScale, Inc, All Rights Reserved Worldwide.
#
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
# reproduction, modification, or disclosure of this program is
# strictly prohibited. Any use of this program by an authorized
# licensee is strictly subject to the terms and conditions,
# including confidentiality obligations, set forth in the applicable
# License Agreement between RightScale.com, Inc. and
# the licensee

require 'Win32API'

module RightConf

  # Linux specific implementation
  class Platform

    attr_reader :flavor, :release

    # Initialize flavor and release
    def init
      GetVersionEx = Win32API.new("kernel32", "GetVersionEx", 'P', 'L')
      osversioninfo = [
        148,       # size of this struct (IN)
        0,         # major version (OUT)
        0,         # minor version (OUT)
        0,         # build (OUT)
        0,         # platform (OUT)
        "\0" * 128 # additional info (OUT)
      ].pack('LLLLLa128')

      raise 'Failed to detect Windows version' unless GetVersionEx.call(osversioninfo) == 1 # => 1, means succeeded
      version = osversioninfo.unpack('LLLLLZ128') # 'Z' means ASCIIZ string
    end

  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rconf-1.0.13 lib/rconf/platforms/windows.rb
rconf-1.0.12 lib/rconf/platforms/windows.rb
rconf-1.0.11 lib/rconf/platforms/windows.rb
rconf-1.0.10 lib/rconf/platforms/windows.rb
rconf-1.0.9 lib/rconf/platforms/windows.rb
rconf-1.0.8 lib/rconf/platforms/windows.rb
rconf-1.0.7 lib/rconf/platforms/windows.rb
rconf-1.0.6 lib/rconf/platforms/windows.rb
rconf-1.0.5 lib/rconf/platforms/windows.rb
rconf-1.0.4 lib/rconf/platforms/windows.rb
rconf-1.0.3 lib/rconf/platforms/windows.rb
rconf-1.0.1 lib/rconf/platforms/windows.rb
rconf-1.0.0 lib/rconf/platforms/windows.rb
rconf-0.10.1 lib/rconf/platforms/windows.rb
rconf-0.10.0 lib/rconf/platforms/windows.rb
rconf-0.9.25 lib/rconf/platforms/windows.rb
rconf-0.9.24 lib/rconf/platforms/windows.rb
rconf-0.9.23 lib/rconf/platforms/windows.rb
rconf-0.9.22 lib/rconf/platforms/windows.rb
rconf-0.9.21 lib/rconf/platforms/windows.rb