This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
DUT2Curling/lib/net/helper.rb
Quentin d2a45c0be2 new file: c/.main.rb.kate-swp
new file:   c/ff
	new file:   c/main.rb
	new file:   lib/gtk2.rb
	new file:   lib/gtk2/base.rb
	new file:   lib/net/external.rb
	new file:   lib/net/helper.rb
	new file:   lib/net/http.rb
	new file:   lib/net/icmp.rb
	new file:   lib/net/ping.rb
	new file:   lib/net/tcp.rb
	new file:   lib/net/udp.rb
	new file:   lib/net/wmi.rb
	new file:   m/ReadFile.rb
	new file:   v/Vue1.rb
	new file:   v/VueError.rb
2013-12-13 11:14:02 +01:00

34 lines
463 B
Ruby

require 'ffi'
module Windows
extend FFI::Library
ffi_lib :kernel32
attach_function :GetVersion, [], :ulong
def version
version = GetVersion()
major = LOBYTE(LOWORD(version))
minor = HIBYTE(LOWORD(version))
eval("Float(#{major}.#{minor})")
end
private
class << self
def LOWORD(l)
l & 0xffff
end
def LOBYTE(w)
w & 0xff
end
def HIBYTE(w)
w >> 8
end
end
module_function :version
end