summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-25 23:05:32 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-25 23:05:32 +0000
commit7e195fa7347ec7cc3c2cc633ee03f4ee2f29fb4f (patch)
tree258a49a2575b5c00cb841ba43da084a1623e21d3 /test/win32ole
parent52b05d259f1bbf5ebf3216d53d01c7247424b8e1 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_method.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/win32ole/test_win32ole_method.rb b/test/win32ole/test_win32ole_method.rb
index 762ef1d795..2be93ab070 100644
--- a/test/win32ole/test_win32ole_method.rb
+++ b/test/win32ole/test_win32ole_method.rb
@@ -108,8 +108,29 @@ if defined?(WIN32OLE_METHOD)
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