blob: 45c3ab11710fd48130afb4adfaafc1c893b67ca3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SANDBOX_WIN_SRC_ALTERNATE_DESKTOP_H_
#define SANDBOX_WIN_SRC_ALTERNATE_DESKTOP_H_
#include "sandbox/win/src/sandbox.h"
#include <string>
namespace sandbox {
// Holds handles and integrity levels about alternate desktops.
class AlternateDesktop {
public:
AlternateDesktop()
: desktop_(nullptr),
winstation_(nullptr),
integrity_(INTEGRITY_LEVEL_SYSTEM) {}
~AlternateDesktop();
AlternateDesktop(const AlternateDesktop&) = delete;
AlternateDesktop& operator=(const AlternateDesktop&) = delete;
// Updates the desktop token's integrity level to be no higher than
// `integrity_level`.
ResultCode UpdateDesktopIntegrity(IntegrityLevel integrity_level);
// Populate this object, creating a winstation if `alternate_winstation` is
// true.
ResultCode Initialize(bool alternate_winstation);
std::wstring GetDesktopName();
private:
// Handle for the alternate desktop.
HDESK desktop_;
// Winstation for the alternate desktop, or nullptr if not used.
HWINSTA winstation_;
// Last set integrity level of the desktop.
IntegrityLevel integrity_;
};
} // namespace sandbox
#endif // SANDBOX_WIN_SRC_ALTERNATE_DESKTOP_H_
|