blob: c1895b0f25f60b86763bc08f1de8bcca5d155d47 (
plain) (
blame)
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
46
47
48
49
50
51
|
// Copyright (c) 2016 Egor Tensin <egor@tensin.name>
// This file is part of the "Privilege check" project.
// For details, see https://github.com/egor-tensin/privilege-check
// Distributed under the MIT License.
#pragma once
#include "handle.hpp"
#include "sid.hpp"
#include <windows.h>
#include <string>
namespace token {
namespace permissions {
constexpr DWORD query() {
return TOKEN_QUERY;
}
constexpr DWORD duplicate() {
return TOKEN_DUPLICATE;
}
} // namespace permissions
constexpr DWORD default_permissions = permissions::query();
// Current thread's primary impersonation token.
inline Handle dumb() {
return Handle{NULL};
}
Handle open_for_process(const Handle& process, DWORD permissions = default_permissions);
Handle open_for_current_process(DWORD permissions = default_permissions);
bool get_linked(Handle& token);
Handle get_for_identification(const Handle& token);
DWORD query_integrity_level(const Handle& token);
std::wstring integrity_level_to_string(DWORD);
bool check_belongs(const Handle& token, const SidBuffer& sid);
bool query_elevation(const Handle& token);
} // namespace token
|