ruby-changes:41755
From: nobu <ko1@a...>
Date: Mon, 15 Feb 2016 12:41:47 +0900 (JST)
Subject: [ruby-changes:41755] nobu:r53829 (trunk): win32/resolv.rb: check pointer size
nobu 2016-02-15 12:42:09 +0900 (Mon, 15 Feb 2016) New Revision: 53829 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53829 Log: 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. Modified files: trunk/ext/win32/lib/win32/resolv.rb Index: ext/win32/lib/win32/resolv.rb =================================================================== --- ext/win32/lib/win32/resolv.rb (revision 53828) +++ ext/win32/lib/win32/resolv.rb (revision 53829) @@ -35,14 +35,16 @@ module Win32 https://github.com/ruby/ruby/blob/trunk/ext/win32/lib/win32/resolv.rb#L35 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 #==================================================================== -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/