diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-20 16:05:56 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-20 16:05:56 +0000 |
commit | ff608eb386a2662bbe076a2a59b21eb90bc34532 (patch) | |
tree | 63c82289115c4b64d6d444816aab4f895f43917c /sandbox/src/sandbox_policy_base.h | |
parent | 1e3af029048d55a3b7c39100683121d71c8ea673 (diff) | |
download | chromium_src-ff608eb386a2662bbe076a2a59b21eb90bc34532.zip chromium_src-ff608eb386a2662bbe076a2a59b21eb90bc34532.tar.gz chromium_src-ff608eb386a2662bbe076a2a59b21eb90bc34532.tar.bz2 |
Add support for alternate window station.
TEST: Start chrome, make sure it loads pages, then user process explorer to make sure the WindowStation handle name is not the same as the browser process.
BUG:10996
Review URL: http://codereview.chromium.org/113190
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/src/sandbox_policy_base.h')
-rw-r--r-- | sandbox/src/sandbox_policy_base.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/sandbox/src/sandbox_policy_base.h b/sandbox/src/sandbox_policy_base.h index 5b34272..b6f2693 100644 --- a/sandbox/src/sandbox_policy_base.h +++ b/sandbox/src/sandbox_policy_base.h @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 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. #ifndef SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ #define SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ -#include <Windows.h> +#include <windows.h> #include <list> #include "base/basictypes.h" @@ -57,9 +57,26 @@ class PolicyBase : public Dispatcher, public TargetPolicy { return SBOX_ALL_OK; } - virtual ResultCode SetDesktop(const wchar_t* desktop) { - desktop_ = desktop; - return SBOX_ALL_OK; + virtual ResultCode SetAlternateDesktop(bool alternate_winstation) { + use_alternate_desktop_ = true; + use_alternate_winstation_ = alternate_winstation; + return CreateAlternateDesktop(alternate_winstation); + } + + virtual std::wstring GetAlternateDesktop() const; + + virtual ResultCode CreateAlternateDesktop(bool alternate_winstation); + + virtual void DestroyAlternateDesktop() { + if (alternate_desktop_handle_) { + ::CloseDesktop(alternate_desktop_handle_); + alternate_desktop_handle_ = NULL; + } + + if (alternate_winstation_handle_) { + ::CloseWindowStation(alternate_winstation_handle_); + alternate_winstation_handle_ = NULL; + } } virtual ResultCode SetIntegrityLevel(IntegrityLevel integrity_level) { @@ -84,10 +101,6 @@ class PolicyBase : public Dispatcher, public TargetPolicy { return SBOX_ALL_OK; } - std::wstring GetDesktop() const { - return desktop_; - } - // Creates a Job object with the level specified in a previous call to // SetJobLevel(). Returns the standard windows of ::GetLastError(). DWORD MakeJobObject(HANDLE* job); @@ -133,7 +146,8 @@ class PolicyBase : public Dispatcher, public TargetPolicy { TokenLevel initial_level_; JobLevel job_level_; uint32 ui_exceptions_; - std::wstring desktop_; + bool use_alternate_desktop_; + bool use_alternate_winstation_; IntegrityLevel integrity_level_; IntegrityLevel delayed_integrity_level_; // The array of objects that will answer IPC calls. @@ -149,6 +163,9 @@ class PolicyBase : public Dispatcher, public TargetPolicy { // The list of dlls to unload in the target process. std::vector<std::wstring> blacklisted_dlls_; + static HDESK alternate_desktop_handle_; + static HWINSTA alternate_winstation_handle_; + DISALLOW_COPY_AND_ASSIGN(PolicyBase); }; |