summaryrefslogtreecommitdiffstats
path: root/base/win/windows_version.h
blob: 1d4b9bf218899e5e2a719ce8606070614047ac6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// 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.

#ifndef BASE_WIN_WINDOWS_VERSION_H_
#define BASE_WIN_WINDOWS_VERSION_H_
#pragma once

#include "base/base_api.h"

typedef void* HANDLE;

namespace base {
namespace win {

// NOTE: Keep these in order so callers can do things like
// "if (GetWinVersion() > WINVERSION_2000) ...".  It's OK to change the values,
// though.
enum Version {
  VERSION_PRE_2000 = 0,     // Not supported
  VERSION_2000 = 1,         // Not supported
  VERSION_XP = 2,
  VERSION_SERVER_2003 = 3,  // Also includes Windows XP Professional x64 edition
  VERSION_VISTA = 4,
  VERSION_2008 = 5,
  VERSION_WIN7 = 6,
};

// Returns the running version of Windows.
BASE_API Version GetVersion();

// Returns the major and minor version of the service pack installed.
BASE_API void GetServicePackLevel(int* major, int* minor);

enum WindowsArchitecture {
  X86_ARCHITECTURE,
  X64_ARCHITECTURE,
  IA64_ARCHITECTURE,
  OTHER_ARCHITECTURE,
};

// Returns the processor architecture this copy of Windows natively uses.
// For example, given an x64-capable processor, we have three possibilities:
//   32-bit Chrome running on 32-bit Windows:           X86_ARCHITECTURE
//   32-bit Chrome running on 64-bit Windows via WOW64: X64_ARCHITECTURE
//   64-bit Chrome running on 64-bit Windows:           X64_ARCHITECTURE
BASE_API WindowsArchitecture GetWindowsArchitecture();

enum WOW64Status {
  WOW64_DISABLED,
  WOW64_ENABLED,
  WOW64_UNKNOWN,
};

// Returns whether this process is running under WOW64 (the wrapper that allows
// 32-bit processes to run on 64-bit versions of Windows).  This will return
// WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit Chrome
// on 64-bit Windows".  WOW64_UNKNOWN means "an error occurred", e.g. the
// process does not have sufficient access rights to determine this.
BASE_API WOW64Status GetWOW64Status();

// Like GetWOW64Status(), but for the supplied handle instead of the current
// process.
BASE_API WOW64Status GetWOW64StatusForProcess(HANDLE process_handle);

}  // namespace win
}  // namespace base

#endif  // BASE_WIN_WINDOWS_VERSION_H_