Index: base/win/windows_version.cc |
=================================================================== |
--- base/win/windows_version.cc (revision 76445) |
+++ 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 = |
+ GetWOW64StatusForHandle(GetCurrentProcess()); |
+ return wow64_status; |
+} |
+ |
+WOW64Status GetWOW64StatusForHandle(HANDLE handle) { |
+ typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL); |
+ IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>( |
+ GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process")); |
+ if (is_wow64_process == NULL) |
brettw
2011/03/03 22:28:53
I guess I would have just written !is_wow_64_proce
Peter Kasting
2011/03/03 22:33:23
Don't care much. Changed.
|
+ return WOW64_DISABLED; |
+ BOOL is_wow64 = FALSE; |
+ if (!(*is_wow64_process)(handle, &is_wow64)) |
+ return WOW64_UNKNOWN; |
+ return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED; |
+} |
+ |
} // namespace win |
} // namespace base |