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

Unified Diff: content/common/sandbox_win.cc

Issue 649533003: C++11 declares a type safe null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Presubmit errors Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/sandbox_mac_unittest_helper.h ('k') | content/common/savable_url_schemes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index 97071757abc33e58740185a2cfc0e343bf68d87f..ab3939d23f5c360a492bc332217fee5bcfba47f5 100644
--- a/content/common/sandbox_win.cc
+++ b/content/common/sandbox_win.cc
@@ -31,8 +31,8 @@
#include "sandbox/win/src/win_utils.h"
#include "ui/gfx/win/dpi.h"
-static sandbox::BrokerServices* g_broker_services = NULL;
-static sandbox::TargetServices* g_target_services = NULL;
+static sandbox::BrokerServices* g_broker_services = nullptr;
+static sandbox::TargetServices* g_target_services = nullptr;
namespace content {
namespace {
@@ -183,7 +183,7 @@ bool IsExpandedModuleName(HMODULE module, const wchar_t* module_name) {
void BlacklistAddOneDll(const wchar_t* module_name,
bool check_in_browser,
sandbox::TargetPolicy* policy) {
- HMODULE module = check_in_browser ? ::GetModuleHandleW(module_name) : NULL;
+ HMODULE module = check_in_browser ? ::GetModuleHandleW(module_name) : nullptr;
if (!module) {
// The module could have been loaded with a 8.3 short name. We check
// the three most common cases: 'thelongname.dll' becomes
@@ -256,16 +256,16 @@ bool ShouldSetJobLevel(const base::CommandLine& cmd_line) {
BOOL in_job = true;
// Either there is no job yet associated so we must add our job,
- if (!::IsProcessInJob(::GetCurrentProcess(), NULL, &in_job))
+ if (!::IsProcessInJob(::GetCurrentProcess(), nullptr, &in_job))
NOTREACHED() << "IsProcessInJob failed. " << GetLastError();
if (!in_job)
return true;
// ...or there is a job but the JOB_OBJECT_LIMIT_BREAKAWAY_OK limit is set.
JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = {0};
- if (!::QueryInformationJobObject(NULL,
+ if (!::QueryInformationJobObject(nullptr,
JobObjectExtendedLimitInformation, &job_info,
- sizeof(job_info), NULL)) {
+ sizeof(job_info), nullptr)) {
NOTREACHED() << "QueryInformationJobObject failed. " << GetLastError();
return true;
}
@@ -416,7 +416,7 @@ typedef BOOL (WINAPI *DuplicateHandleFunctionPtr)(HANDLE source_process_handle,
DuplicateHandleFunctionPtr g_iat_orig_duplicate_handle;
-NtQueryObject g_QueryObject = NULL;
+NtQueryObject g_QueryObject = nullptr;
static const char* kDuplicateHandleWarning =
"You are attempting to duplicate a privileged handle into a sandboxed"
@@ -472,7 +472,7 @@ BOOL WINAPI DuplicateHandlePatch(HANDLE source_process_handle,
// Only sandboxed children are placed in jobs, so just check them.
BOOL is_in_job = FALSE;
- if (!::IsProcessInJob(target_process_handle, NULL, &is_in_job)) {
+ if (!::IsProcessInJob(target_process_handle, nullptr, &is_in_job)) {
// We need a handle with permission to check the job object.
if (ERROR_ACCESS_DENIED == ::GetLastError()) {
HANDLE temp_handle;
@@ -483,7 +483,7 @@ BOOL WINAPI DuplicateHandlePatch(HANDLE source_process_handle,
PROCESS_QUERY_INFORMATION,
FALSE, 0));
base::win::ScopedHandle process(temp_handle);
- CHECK(::IsProcessInJob(process.Get(), NULL, &is_in_job));
+ CHECK(::IsProcessInJob(process.Get(), nullptr, &is_in_job));
}
}
@@ -542,13 +542,13 @@ bool InitBrokerServices(sandbox::BrokerServices* broker_services) {
// In non-official builds warn about dangerous uses of DuplicateHandle.
#ifndef OFFICIAL_BUILD
BOOL is_in_job = FALSE;
- CHECK(::IsProcessInJob(::GetCurrentProcess(), NULL, &is_in_job));
+ CHECK(::IsProcessInJob(::GetCurrentProcess(), nullptr, &is_in_job));
// In a Syzygy-profiled binary, instrumented for import profiling, this
// patch will end in infinite recursion on the attempted delegation to the
// original function.
if (!base::debug::IsBinaryInstrumented() &&
!is_in_job && !g_iat_patch_duplicate_handle.is_patched()) {
- HMODULE module = NULL;
+ HMODULE module = nullptr;
wchar_t module_name[MAX_PATH];
CHECK(::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
reinterpret_cast<LPCWSTR>(InitBrokerServices),
@@ -656,7 +656,7 @@ base::ProcessHandle StartSandboxedProcess(
switches::kEnableWin32kRendererLockDown)) {
if (policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
sandbox::TargetPolicy::FAKE_USER_GDI_INIT,
- NULL) != sandbox::SBOX_ALL_OK) {
+ nullptr) != sandbox::SBOX_ALL_OK) {
return 0;
}
mitigations |= sandbox::MITIGATION_WIN32K_DISABLE;
@@ -684,7 +684,7 @@ base::ProcessHandle StartSandboxedProcess(
if (type_str == switches::kRendererProcess) {
if (ShouldUseDirectWrite()) {
AddDirectory(base::DIR_WINDOWS_FONTS,
- NULL,
+ nullptr,
true,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
policy);
« no previous file with comments | « content/common/sandbox_mac_unittest_helper.h ('k') | content/common/savable_url_schemes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698