diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-15 01:59:15 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-15 01:59:15 +0000 |
commit | 935aa54d9a5e2e617c61c9f8dcea398768413443 (patch) | |
tree | 3df9ec9316cd4d5b7171e5c6c869a01d823cc507 /sandbox | |
parent | 7d1f3348c26eda2d1656860c821d335bf94d4cda (diff) | |
download | chromium_src-935aa54d9a5e2e617c61c9f8dcea398768413443.zip chromium_src-935aa54d9a5e2e617c61c9f8dcea398768413443.tar.gz chromium_src-935aa54d9a5e2e617c61c9f8dcea398768413443.tar.bz2 |
Move windows version-related stuff out of base/win_util and into base/win/windows_version. Many files now only need to include this instead of all of win_util.
Remove a bunch of unused code from base/win_util. There was a surprising amount.
Replace the AppUserModel property key with the one from the SDK now that we use the Win7 SDK. Move GetLogonSessionOnlyDACL from win_util to ipc since it's only used in that one place.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/3823002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/src/integrity_level_test.cc | 10 | ||||
-rw-r--r-- | sandbox/src/policy_broker.cc | 6 | ||||
-rw-r--r-- | sandbox/src/policy_target_test.cc | 12 | ||||
-rw-r--r-- | sandbox/src/registry_dispatcher.cc | 6 | ||||
-rw-r--r-- | sandbox/src/restricted_token_utils.cc | 11 | ||||
-rw-r--r-- | sandbox/tests/validation_tests/suite.cc | 2 |
6 files changed, 24 insertions, 23 deletions
diff --git a/sandbox/src/integrity_level_test.cc b/sandbox/src/integrity_level_test.cc index fff26da..cdc8da7 100644 --- a/sandbox/src/integrity_level_test.cc +++ b/sandbox/src/integrity_level_test.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. #include <windows.h> #include <atlsecurity.h> -#include "base/win_util.h" +#include "base/win/windows_version.h" #include "testing/gtest/include/gtest/gtest.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_policy.h" @@ -45,7 +45,7 @@ SBOX_TESTS_COMMAND int CheckIntegrityLevel(int argc, wchar_t **argv) { } TEST(IntegrityLevelTest, TestLowILReal) { - if (win_util::WINVERSION_VISTA != win_util::GetWinVersion()) + if (base::win::VERSION_VISTA != base::win::GetVersion()) return; TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); @@ -61,7 +61,7 @@ TEST(IntegrityLevelTest, TestLowILReal) { } TEST(DelayedIntegrityLevelTest, TestLowILDelayed) { - if (win_util::WINVERSION_VISTA != win_util::GetWinVersion()) + if (base::win::VERSION_VISTA != base::win::GetVersion()) return; TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); @@ -77,7 +77,7 @@ TEST(DelayedIntegrityLevelTest, TestLowILDelayed) { } TEST(IntegrityLevelTest, TestNoILChange) { - if (win_util::WINVERSION_VISTA != win_util::GetWinVersion()) + if (base::win::VERSION_VISTA != base::win::GetVersion()) return; TestRunner runner(JOB_LOCKDOWN, USER_INTERACTIVE, USER_INTERACTIVE); diff --git a/sandbox/src/policy_broker.cc b/sandbox/src/policy_broker.cc index f2316b0..ff67667 100644 --- a/sandbox/src/policy_broker.cc +++ b/sandbox/src/policy_broker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -8,7 +8,7 @@ #include "base/logging.h" #include "base/pe_image.h" -#include "base/win_util.h" +#include "base/win/windows_version.h" #include "sandbox/src/interception.h" #include "sandbox/src/interceptors.h" #include "sandbox/src/policy_target.h" @@ -100,7 +100,7 @@ bool SetupBasicInterceptions(InterceptionManager* manager) { !INTERCEPT_NT(manager, NtOpenThreadToken, OPEN_THREAD_TOKEN_ID, 20)) return false; - if (win_util::GetWinVersion() >= win_util::WINVERSION_XP) { + if (base::win::GetVersion() >= base::win::VERSION_XP) { // Bug 27218: We don't have dispatch for some x64 syscalls. // This one is also provided by process_thread_policy. if (!INTERCEPT_NT(manager, NtOpenProcessTokenEx, OPEN_PROCESS_TOKEN_EX_ID, diff --git a/sandbox/src/policy_target_test.cc b/sandbox/src/policy_target_test.cc index 98f2418..577c8c5 100644 --- a/sandbox/src/policy_target_test.cc +++ b/sandbox/src/policy_target_test.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. -#include "base/win_util.h" +#include "base/win/windows_version.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_factory.h" #include "sandbox/src/sandbox_utils.h" @@ -158,7 +158,7 @@ SBOX_TESTS_COMMAND int PolicyTargetTest_process(int argc, wchar_t **argv) { TEST(PolicyTargetTest, SetInformationThread) { TestRunner runner; - if (win_util::GetWinVersion() >= win_util::WINVERSION_XP) { + if (base::win::GetVersion() >= base::win::VERSION_XP) { runner.SetTestState(BEFORE_REVERT); EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token")); } @@ -167,13 +167,13 @@ TEST(PolicyTargetTest, SetInformationThread) { EXPECT_EQ(ERROR_NO_TOKEN, runner.RunTest(L"PolicyTargetTest_token")); runner.SetTestState(EVERY_STATE); - if (win_util::GetWinVersion() >= win_util::WINVERSION_XP) + if (base::win::GetVersion() >= base::win::VERSION_XP) EXPECT_EQ(SBOX_TEST_FAILED, runner.RunTest(L"PolicyTargetTest_steal")); } TEST(PolicyTargetTest, OpenThreadToken) { TestRunner runner; - if (win_util::GetWinVersion() >= win_util::WINVERSION_XP) { + if (base::win::GetVersion() >= base::win::VERSION_XP) { runner.SetTestState(BEFORE_REVERT); EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"PolicyTargetTest_token2")); } @@ -184,7 +184,7 @@ TEST(PolicyTargetTest, OpenThreadToken) { TEST(PolicyTargetTest, OpenThreadTokenEx) { TestRunner runner; - if (win_util::GetWinVersion() < win_util::WINVERSION_XP) + if (base::win::GetVersion() < base::win::VERSION_XP) return; runner.SetTestState(BEFORE_REVERT); diff --git a/sandbox/src/registry_dispatcher.cc b/sandbox/src/registry_dispatcher.cc index b268157..5f53770 100644 --- a/sandbox/src/registry_dispatcher.cc +++ b/sandbox/src/registry_dispatcher.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. #include "sandbox/src/registry_dispatcher.h" #include "base/scoped_handle_win.h" -#include "base/win_util.h" +#include "base/win/windows_version.h" #include "sandbox/src/crosscall_client.h" #include "sandbox/src/interception.h" #include "sandbox/src/interceptors.h" @@ -63,7 +63,7 @@ bool RegistryDispatcher::SetupService(InterceptionManager* manager, if (IPC_NTOPENKEY_TAG == service) { bool result = INTERCEPT_NT(manager, NtOpenKey, OPEN_KEY_ID, 16); - if (win_util::GetWinVersion() >= win_util::WINVERSION_WIN7) + if (base::win::GetVersion() >= base::win::VERSION_WIN7) result &= INTERCEPT_NT(manager, NtOpenKeyEx, OPEN_KEY_EX_ID, 20); return result; } diff --git a/sandbox/src/restricted_token_utils.cc b/sandbox/src/restricted_token_utils.cc index 2bc4c59..8842865 100644 --- a/sandbox/src/restricted_token_utils.cc +++ b/sandbox/src/restricted_token_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -10,7 +10,7 @@ #include "base/logging.h" #include "base/scoped_handle_win.h" -#include "base/win_util.h" +#include "base/win/windows_version.h" #include "sandbox/src/job.h" #include "sandbox/src/restricted_token.h" #include "sandbox/src/security_level.h" @@ -85,9 +85,8 @@ DWORD CreateRestrictedToken(HANDLE *token_handle, // in the token to achieve this. You should also set the process to be // low integrity level so it can't access object created by other // processes. - if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) { + if (base::win::GetVersion() >= base::win::VERSION_VISTA) restricted_token.AddRestrictingSidLogonSession(); - } break; } case USER_RESTRICTED: { @@ -286,7 +285,7 @@ const wchar_t* GetIntegrityLevelString(IntegrityLevel integrity_level) { return NULL; } DWORD SetTokenIntegrityLevel(HANDLE token, IntegrityLevel integrity_level) { - if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) + if (base::win::GetVersion() < base::win::VERSION_VISTA) return ERROR_SUCCESS; const wchar_t* integrity_level_str = GetIntegrityLevelString(integrity_level); @@ -312,7 +311,7 @@ DWORD SetTokenIntegrityLevel(HANDLE token, IntegrityLevel integrity_level) { } DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) { - if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) + if (base::win::GetVersion() < base::win::VERSION_VISTA) return ERROR_SUCCESS; const wchar_t* integrity_level_str = GetIntegrityLevelString(integrity_level); diff --git a/sandbox/tests/validation_tests/suite.cc b/sandbox/tests/validation_tests/suite.cc index 49faf6d..a5886cd 100644 --- a/sandbox/tests/validation_tests/suite.cc +++ b/sandbox/tests/validation_tests/suite.cc @@ -11,6 +11,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "sandbox/tests/common/controller.h" +#pragma comment(lib, "shlwapi.lib") + namespace sandbox { // Returns true if the volume that contains any_path supports ACL security. The |