OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <windows.h> | 6 #include <windows.h> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "sandbox/win/src/interception_internal.h" | 9 #include "sandbox/win/src/interception_internal.h" |
10 #include "sandbox/win/src/internal_types.h" | 10 #include "sandbox/win/src/internal_types.h" |
11 #include "sandbox/win/src/sandbox_utils.h" | 11 #include "sandbox/win/src/sandbox_utils.h" |
12 #include "sandbox/win/src/service_resolver.h" | 12 #include "sandbox/win/src/service_resolver.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 enum Version { | 15 enum Version { |
16 VERSION_PRE_XP_SP2 = 0, // Not supported. | 16 VERSION_PRE_XP_SP2 = 0, // Not supported. |
17 VERSION_XP_SP2, | 17 VERSION_XP_SP2, |
18 VERSION_SERVER_2003, // Also includes XP Pro x64 and Server 2003 R2. | 18 VERSION_SERVER_2003, // Also includes XP Pro x64 and Server 2003 R2. |
19 VERSION_VISTA, // Also includes Windows Server 2008. | 19 VERSION_VISTA, // Also includes Windows Server 2008. |
20 VERSION_WIN7, // Also includes Windows Server 2008 R2. | 20 VERSION_WIN7, // Also includes Windows Server 2008 R2. |
21 VERSION_WIN8, // Also includes Windows Server 2012. | 21 VERSION_WIN8, // Also includes Windows Server 2012. |
22 VERSION_WIN8_1, | 22 VERSION_WIN8_1, |
| 23 VERSION_WIN10, |
23 VERSION_WIN_LAST, // Indicates error condition. | 24 VERSION_WIN_LAST, // Indicates error condition. |
24 }; | 25 }; |
25 | 26 |
26 // Whether a process is running under WOW64 (the wrapper that allows 32-bit | 27 // Whether a process is running under WOW64 (the wrapper that allows 32-bit |
27 // processes to run on 64-bit versions of Windows). This will return | 28 // processes to run on 64-bit versions of Windows). This will return |
28 // WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit | 29 // WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit |
29 // Chrome on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g. | 30 // Chrome on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g. |
30 // the process does not have sufficient access rights to determine this. | 31 // the process does not have sufficient access rights to determine this. |
31 enum WOW64Status { WOW64_DISABLED, WOW64_ENABLED, WOW64_UNKNOWN, }; | 32 enum WOW64Status { WOW64_DISABLED, WOW64_ENABLED, WOW64_UNKNOWN, }; |
32 | 33 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 version_ = VERSION_WIN7; | 79 version_ = VERSION_WIN7; |
79 break; | 80 break; |
80 case 2: | 81 case 2: |
81 // Treat Windows Server 2012 the same as Windows 8. | 82 // Treat Windows Server 2012 the same as Windows 8. |
82 version_ = VERSION_WIN8; | 83 version_ = VERSION_WIN8; |
83 break; | 84 break; |
84 default: | 85 default: |
85 version_ = VERSION_WIN8_1; | 86 version_ = VERSION_WIN8_1; |
86 break; | 87 break; |
87 } | 88 } |
| 89 } else if (version_number_.major == 10) { |
| 90 version_ = VERSION_WIN10; |
88 } else if (version_number_.major > 6) { | 91 } else if (version_number_.major > 6) { |
89 version_ = VERSION_WIN_LAST; | 92 version_ = VERSION_WIN_LAST; |
90 } else { | 93 } else { |
91 version_ = VERSION_PRE_XP_SP2; | 94 version_ = VERSION_PRE_XP_SP2; |
92 } | 95 } |
93 | 96 |
94 service_pack_.major = version_info.wServicePackMajor; | 97 service_pack_.major = version_info.wServicePackMajor; |
95 service_pack_.minor = version_info.wServicePackMinor; | 98 service_pack_.minor = version_info.wServicePackMinor; |
96 } | 99 } |
97 | 100 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 thunk = new sandbox::Wow64ResolverThunk(current_process, relaxed); | 136 thunk = new sandbox::Wow64ResolverThunk(current_process, relaxed); |
134 } else if (os_info.version() >= VERSION_WIN8) { | 137 } else if (os_info.version() >= VERSION_WIN8) { |
135 thunk = new sandbox::Win8ResolverThunk(current_process, relaxed); | 138 thunk = new sandbox::Win8ResolverThunk(current_process, relaxed); |
136 } else { | 139 } else { |
137 thunk = new sandbox::ServiceResolverThunk(current_process, relaxed); | 140 thunk = new sandbox::ServiceResolverThunk(current_process, relaxed); |
138 } | 141 } |
139 #endif | 142 #endif |
140 | 143 |
141 return thunk; | 144 return thunk; |
142 } | 145 } |
OLD | NEW |