Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4063)

Unified Diff: base/win/windows_version.cc

Issue 6610029: Create a "GetWOW64Status()" utility function and make the rest of the codebas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698