зеркало из https://github.com/github/ruby.git
win32/resolv.rb: call rb_w32_osid
* ext/win32/lib/win32/resolv.rb: call rb_w32_osid instead of direct GetVersionExA API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f729089f44
Коммит
1c98a41ae3
|
@ -42,19 +42,19 @@ begin
|
|||
rescue LoadError
|
||||
end
|
||||
|
||||
nt = Module.new do
|
||||
break true if [nil].pack("p").size > 4
|
||||
extend Importer
|
||||
dlload "kernel32.dll"
|
||||
getv = extern "int GetVersionExA(void *)", :stdcall
|
||||
info = [ 148, 0, 0, 0, 0 ].pack('V5') + "\0" * 128
|
||||
getv.call(info)
|
||||
break info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
|
||||
end
|
||||
if not nt
|
||||
if [nil].pack("p").size <= 4 # 32bit env
|
||||
begin
|
||||
f = Fiddle
|
||||
osid = f::Handle.new["rb_w32_osid"]
|
||||
rescue f::DLError # not ix86, cannot be Windows 9x
|
||||
else
|
||||
if f::Function.new(osid, [], f::TYPE_INT).call < 2 # VER_PLATFORM_WIN32_NT
|
||||
require_relative 'resolv9x'
|
||||
# return # does not work yet
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Win32
|
||||
#====================================================================
|
||||
# Windows NT
|
||||
|
@ -146,4 +146,3 @@ module Win32
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче