windows_version.h revision dc0f95d653279beabeb9817299e2902918ba123e
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
3// found in the LICENSE file.
4
5#ifndef BASE_WIN_WINDOWS_VERSION_H_
6#define BASE_WIN_WINDOWS_VERSION_H_
7#pragma once
8
9typedef void* HANDLE;
10
11namespace base {
12namespace win {
13
14// NOTE: Keep these in order so callers can do things like
15// "if (GetWinVersion() > WINVERSION_2000) ...".  It's OK to change the values,
16// though.
17enum Version {
18  VERSION_PRE_2000 = 0,     // Not supported
19  VERSION_2000 = 1,         // Not supported
20  VERSION_XP = 2,
21  VERSION_SERVER_2003 = 3,  // Also includes Windows XP Professional x64 edition
22  VERSION_VISTA = 4,
23  VERSION_2008 = 5,
24  VERSION_WIN7 = 6,
25};
26
27// Returns the running version of Windows.
28Version GetVersion();
29
30// Returns the major and minor version of the service pack installed.
31void GetServicePackLevel(int* major, int* minor);
32
33enum WindowsArchitecture {
34  X86_ARCHITECTURE,
35  X64_ARCHITECTURE,
36  IA64_ARCHITECTURE,
37  OTHER_ARCHITECTURE,
38};
39
40// Returns the processor architecture this copy of Windows natively uses.
41// For example, given an x64-capable processor, we have three possibilities:
42//   32-bit Chrome running on 32-bit Windows:           X86_ARCHITECTURE
43//   32-bit Chrome running on 64-bit Windows via WOW64: X64_ARCHITECTURE
44//   64-bit Chrome running on 64-bit Windows:           X64_ARCHITECTURE
45WindowsArchitecture GetWindowsArchitecture();
46
47enum WOW64Status {
48  WOW64_DISABLED,
49  WOW64_ENABLED,
50  WOW64_UNKNOWN,
51};
52
53// Returns whether this process is running under WOW64 (the wrapper that allows
54// 32-bit processes to run on 64-bit versions of Windows).  This will return
55// WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit Chrome
56// on 64-bit Windows".  WOW64_UNKNOWN means "an error occurred", e.g. the
57// process does not have sufficient access rights to determine this.
58WOW64Status GetWOW64Status();
59
60// Like GetWOW64Status(), but for the supplied handle instead of the current
61// process.
62WOW64Status GetWOW64StatusForProcess(HANDLE process_handle);
63
64}  // namespace win
65}  // namespace base
66
67#endif  // BASE_WIN_WINDOWS_VERSION_H_
68