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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/win/windows_version.h" 5 #include "base/win/windows_version.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace base { 11 namespace base {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 GetVersionEx(reinterpret_cast<OSVERSIONINFOW*>(&version_info)); 61 GetVersionEx(reinterpret_cast<OSVERSIONINFOW*>(&version_info));
62 service_pack_major = version_info.wServicePackMajor; 62 service_pack_major = version_info.wServicePackMajor;
63 service_pack_minor = version_info.wServicePackMinor; 63 service_pack_minor = version_info.wServicePackMinor;
64 checked_version = true; 64 checked_version = true;
65 } 65 }
66 66
67 *major = service_pack_major; 67 *major = service_pack_major;
68 *minor = service_pack_minor; 68 *minor = service_pack_minor;
69 } 69 }
70 70
71 WOW64Status GetWOW64Status() {
72 static WOW64Status wow64_status =
73 GetWOW64StatusForHandle(GetCurrentProcess());
74 return wow64_status;
75 }
76
77 WOW64Status GetWOW64StatusForHandle(HANDLE handle) {
78 typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL);
79 IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>(
80 GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process"));
81 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.
82 return WOW64_DISABLED;
83 BOOL is_wow64 = FALSE;
84 if (!(*is_wow64_process)(handle, &is_wow64))
85 return WOW64_UNKNOWN;
86 return is_wow64 ? WOW64_ENABLED : WOW64_DISABLED;
87 }
88
71 } // namespace win 89 } // namespace win
72 } // namespace base 90 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698