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

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

Issue 1255073002: clang/win: Fix most -Wunused-function warnings in Chromium code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac Created 5 years, 5 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
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 21 matching lines...) Expand all
32 32
33 bool CheckWin8DepPolicy() { 33 bool CheckWin8DepPolicy() {
34 PROCESS_MITIGATION_DEP_POLICY policy = {}; 34 PROCESS_MITIGATION_DEP_POLICY policy = {};
35 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessDEPPolicy, 35 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessDEPPolicy,
36 &policy, sizeof(policy))) { 36 &policy, sizeof(policy))) {
37 return false; 37 return false;
38 } 38 }
39 return policy.Enable && policy.Permanent; 39 return policy.Enable && policy.Permanent;
40 } 40 }
41 41
42 #if defined(NDEBUG)
42 bool CheckWin8AslrPolicy() { 43 bool CheckWin8AslrPolicy() {
43 PROCESS_MITIGATION_ASLR_POLICY policy = {}; 44 PROCESS_MITIGATION_ASLR_POLICY policy = {};
44 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessASLRPolicy, 45 if (!get_process_mitigation_policy(::GetCurrentProcess(), ProcessASLRPolicy,
45 &policy, sizeof(policy))) { 46 &policy, sizeof(policy))) {
46 return false; 47 return false;
47 } 48 }
48 return policy.EnableForceRelocateImages && policy.DisallowStrippedImages; 49 return policy.EnableForceRelocateImages && policy.DisallowStrippedImages;
49 } 50 }
51 #endif // defined(NDEBUG)
50 52
51 bool CheckWin8StrictHandlePolicy() { 53 bool CheckWin8StrictHandlePolicy() {
52 PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY policy = {}; 54 PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY policy = {};
53 if (!get_process_mitigation_policy(::GetCurrentProcess(), 55 if (!get_process_mitigation_policy(::GetCurrentProcess(),
54 ProcessStrictHandleCheckPolicy, 56 ProcessStrictHandleCheckPolicy,
55 &policy, sizeof(policy))) { 57 &policy, sizeof(policy))) {
56 return false; 58 return false;
57 } 59 }
58 return policy.RaiseExceptionOnInvalidHandleReference && 60 return policy.RaiseExceptionOnInvalidHandleReference &&
59 policy.HandleExceptionsPermanentlyEnabled; 61 policy.HandleExceptionsPermanentlyEnabled;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE), 241 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE),
240 SBOX_ALL_OK); 242 SBOX_ALL_OK);
241 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, 243 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
242 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL), 244 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL),
243 sandbox::SBOX_ALL_OK); 245 sandbox::SBOX_ALL_OK);
244 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown")); 246 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown"));
245 } 247 }
246 248
247 } // namespace sandbox 249 } // namespace sandbox
248 250
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698