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

Side by Side Diff: sandbox/win/src/process_mitigations_test.cc

Issue 1284533002: clang/win: Try to fix 64-bit build after https://codereview.chromium.org/1261953003. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | tools/gn/exec_process_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/win/scoped_handle.h" 6 #include "base/win/scoped_handle.h"
7 7
8 #include "base/win/windows_version.h" 8 #include "base/win/windows_version.h"
9 #include "sandbox/win/src/nt_internals.h" 9 #include "sandbox/win/src/nt_internals.h"
10 #include "sandbox/win/src/process_mitigations.h" 10 #include "sandbox/win/src/process_mitigations.h"
(...skipping 12 matching lines...) Expand all
23 PBOOL permanent); 23 PBOOL permanent);
24 24
25 typedef BOOL (WINAPI *GetProcessMitigationPolicyFunction)( 25 typedef BOOL (WINAPI *GetProcessMitigationPolicyFunction)(
26 HANDLE process, 26 HANDLE process,
27 PROCESS_MITIGATION_POLICY mitigation_policy, 27 PROCESS_MITIGATION_POLICY mitigation_policy,
28 PVOID buffer, 28 PVOID buffer,
29 SIZE_T length); 29 SIZE_T length);
30 30
31 GetProcessMitigationPolicyFunction get_process_mitigation_policy; 31 GetProcessMitigationPolicyFunction get_process_mitigation_policy;
32 32
33 #if !defined(_WIN64)
33 bool CheckWin8DepPolicy() { 34 bool CheckWin8DepPolicy() {
34 PROCESS_MITIGATION_DEP_POLICY policy = {}; 35 PROCESS_MITIGATION_DEP_POLICY policy = {};
35 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessDEPPolicy, 36 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessDEPPolicy,
36 &policy, sizeof(policy))) { 37 &policy, sizeof(policy))) {
37 return false; 38 return false;
38 } 39 }
39 return policy.Enable && policy.Permanent; 40 return policy.Enable && policy.Permanent;
40 } 41 }
42 #endif // !defined(_WIN64)
41 43
42 #if defined(NDEBUG) 44 #if defined(NDEBUG)
43 bool CheckWin8AslrPolicy() { 45 bool CheckWin8AslrPolicy() {
44 PROCESS_MITIGATION_ASLR_POLICY policy = {}; 46 PROCESS_MITIGATION_ASLR_POLICY policy = {};
45 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessASLRPolicy, 47 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessASLRPolicy,
46 &policy, sizeof(policy))) { 48 &policy, sizeof(policy))) {
47 return false; 49 return false;
48 } 50 }
49 return policy.EnableForceRelocateImages && policy.DisallowStrippedImages; 51 return policy.EnableForceRelocateImages && policy.DisallowStrippedImages;
50 } 52 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE), 243 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE),
242 SBOX_ALL_OK); 244 SBOX_ALL_OK);
243 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, 245 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
244 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL), 246 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL),
245 sandbox::SBOX_ALL_OK); 247 sandbox::SBOX_ALL_OK);
246 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown")); 248 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown"));
247 } 249 }
248 250
249 } // namespace sandbox 251 } // namespace sandbox
250 252
OLDNEW
« no previous file with comments | « no previous file | tools/gn/exec_process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698