Index: base/win/windows_version.cc |
=================================================================== |
--- base/win/windows_version.cc (revision 76817) |
+++ base/win/windows_version.cc (working copy) |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -68,5 +68,23 @@ |
*minor = service_pack_minor; |
} |
+WOW64Status GetWOW64Status() { |
+ static WOW64Status wow64_status = |
+ GetWOW64StatusForProcess(GetCurrentProcess()); |
+ return wow64_status; |
+} |
+ |
+WOW64Status GetWOW64StatusForProcess(HANDLE process_handle) { |
+ typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL); |
+ IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>( |
+ GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process")); |
rvargas (doing something else)
2011/03/04 00:12:18
Can we save this pointer? GetProcAddress is not th
Peter Kasting
2011/03/04 01:11:48
But the entire return value is cached in GetWOW64S
rvargas (doing something else)
2011/03/04 01:21:49
Even better :)
|
+ if (!is_wow64_process) |
+ return WOW64_DISABLED; |
+ BOOL is_wow64 = FALSE; |
+ if (!(*is_wow64_process)(process_handle, &is_wow64)) |
+ return WOW64_UNKNOWN; |
+ return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; |
+} |
+ |
} // namespace win |
} // namespace base |