Sha256: 5faac7f8930e98685e6eda83eb67eeff1b127f7129ba4b5774f6da28f7672a4c

Contents?: true

Size: 1.24 KB

Versions: 79

Compression:

Stored size: 1.24 KB

Contents

# Copyright (C) 2011 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

79 entries across 79 versions & 1 rubygems

Version Path
rconf-0.6.17 lib/rconf/platforms/windows.rb
rconf-0.6.16 lib/rconf/platforms/windows.rb
rconf-0.6.15 lib/rconf/platforms/windows.rb
rconf-0.6.14 lib/rconf/platforms/windows.rb
rconf-0.6.13 lib/rconf/platforms/windows.rb
rconf-0.6.11 lib/rconf/platforms/windows.rb
rconf-0.6.10 lib/rconf/platforms/windows.rb
rconf-0.6.5 lib/rconf/platforms/windows.rb
rconf-0.6.4 lib/rconf/platforms/windows.rb
rconf-0.6.3 lib/rconf/platforms/windows.rb
rconf-0.6.2 lib/rconf/platforms/windows.rb
rconf-0.6.1 lib/rconf/platforms/windows.rb
rconf-0.5.9 lib/rconf/platforms/windows.rb
rconf-0.5.8 lib/rconf/platforms/windows.rb
rconf-0.5.6 lib/rconf/platforms/windows.rb
rconf-0.5.5 lib/rconf/platforms/windows.rb
rconf-0.5.3 lib/rconf/platforms/windows.rb
rconf-0.5.1 lib/rconf/platforms/windows.rb
rconf-0.5.0 lib/rconf/platforms/windows.rb