summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-15 03:42:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-15 03:42:09 +0000
commit486f3f4270102bb79102085168cbf953818f52f6 (patch)
treedd5ff39e63f8e86f222d9f5e3381d9137051cc68
parent0f5a8418818b404473d15f75a33e226ac38cbb01 (diff)
win32/resolv.rb: check pointer size
* ext/win32/lib/win32/resolv.rb: check pointer size first, NT if it is larger than 4 as Windows 9X are 32-bit mode only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/win32/lib/win32/resolv.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/win32/lib/win32/resolv.rb b/ext/win32/lib/win32/resolv.rb
index 2e724e3..8dc9e0d 100644
--- a/ext/win32/lib/win32/resolv.rb
+++ b/ext/win32/lib/win32/resolv.rb
@@ -35,14 +35,16 @@ module Win32
end
end
-kernel32 = Module.new do
+nt = Module.new do
+ break true if [nil].pack("p").size > 4
extend Importer
dlload "kernel32"
+ 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
-getv = kernel32.extern "int GetVersionExA(void *)", :stdcall
-info = [ 148, 0, 0, 0, 0 ].pack('V5') + "\0" * 128
-getv.call(info)
-if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
+if nt
#====================================================================
# Windows NT
#====================================================================