[前][次][番号順一覧][スレッド一覧]

ruby-changes:16457

From: suke <ko1@a...>
Date: Sat, 26 Jun 2010 08:05:50 +0900 (JST)
Subject: [ruby-changes:16457] Ruby:r28442 (trunk): * test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check

suke	2010-06-26 08:05:32 +0900 (Sat, 26 Jun 2010)

  New Revision: 28442

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28442

  Log:
    * test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check
      that OS is Windows 32bit or Windows 64bit in order to get
      correct offset value.

  Modified files:
    trunk/ChangeLog
    trunk/test/win32ole/test_win32ole_method.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28441)
+++ ChangeLog	(revision 28442)
@@ -1,3 +1,9 @@
+Sat Jun 26 07:59:18 2010  Masaki Suketa <masaki.suketa@n...>
+
+	* test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check
+	  that OS is Windows 32bit or Windows 64bit in order to get
+	  correct offset value.
+
 Sat Jun 26 04:39:12 2010  Masaya Tarui  <tarui@r...>
 
 	* ext/dl/lib/dl/func.rb (call): don't overwrite original arguments
Index: test/win32ole/test_win32ole_method.rb
===================================================================
--- test/win32ole/test_win32ole_method.rb	(revision 28441)
+++ test/win32ole/test_win32ole_method.rb	(revision 28442)
@@ -108,8 +108,29 @@
       assert_equal(1610743810, @m_namespace.dispid)
     end
 
+    def is_win64?
+      if /win64$/ =~ RUBY_PLATFORM
+        return true
+      end
+      require 'Win32API'
+      get_current_process = Win32API.new('kernel32', 'GetCurrentProcess', nil, 'i')
+      handle = get_current_process.call
+      is_wow64 = false
+      begin
+        is_wow64_process = Win32API.new('Kernel32', 'IsWow64Process', ['i', 'p'], 'i')
+        bool = "\0\0\0\0"
+        if is_wow64_process.call(handle, bool) != 0
+          is_wow64 = bool != "\0\0\0\0"
+        end
+      rescue RuntimeError
+        # no IsWow64Process
+      end
+      is_wow64
+    end
+
     def test_offset_vtbl
-      assert_equal(24, @m_invoke.offset_vtbl)
+      exp = is_win64? ? 48 : 24
+      assert_equal(exp, @m_invoke.offset_vtbl)
     end
 
     def test_size_params

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]