forked from winsiderss/phnt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
usermgr.h
223 lines (184 loc) · 3.21 KB
/
usermgr.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
* User Manager service API definitions.
*
* This file is part of System Informer.
*/
#ifndef _USERMGR_H
#define _USERMGR_H
// private
typedef struct _SESSION_USER_CONTEXT
{
ULONGLONG ContextToken;
ULONG SessionId;
ULONG Reserved;
} SESSION_USER_CONTEXT, *PSESSION_USER_CONTEXT;
// private
typedef struct _CRED_PROV_CREDENTIAL
{
ULONG Flags;
ULONG AuthenticationPackage;
ULONG Size;
PVOID Information;
} CRED_PROV_CREDENTIAL, *PCRED_PROV_CREDENTIAL;
#define USERMGRAPI DECLSPEC_IMPORT
// Contexts
#if (PHNT_VERSION >= PHNT_THRESHOLD)
// rev
USERMGRAPI
VOID
WINAPI
UMgrFreeSessionUsers(
_In_ _Post_invalid_ PSESSION_USER_CONTEXT SessionUsers
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrEnumerateSessionUsers(
_Out_ PULONG Count,
_Outptr_ PSESSION_USER_CONTEXT *SessionUsers
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryUserContext(
_In_ HANDLE TokenHandle,
_Out_ PULONGLONG ContextToken
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryUserContextFromSid(
_In_ PWSTR SidString,
_Out_ PULONGLONG ContextToken
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryUserContextFromName(
_In_ PWSTR UserName,
_Out_ PULONGLONG ContextToken
);
#endif
// Tokens
#if (PHNT_VERSION >= PHNT_THRESHOLD)
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryDefaultAccountToken(
_Out_ PHANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQuerySessionUserToken(
_In_ ULONG SessionId,
_Out_ PHANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryUserToken(
_In_ ULONGLONG Context,
_Out_ PHANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryUserTokenFromSid(
_In_ PWSTR SidString,
_Out_ PHANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrQueryUserTokenFromName(
_In_ PWSTR UserName,
_Out_ PHANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrGetConstrainedUserToken(
_In_opt_ HANDLE InputTokenHandle,
_In_ ULONGLONG Context,
_In_opt_ PSECURITY_CAPABILITIES Capabilities,
_Out_ _Ret_maybenull_ PHANDLE OutputTokenHandle
);
#endif
#if (PHNT_VERSION >= PHNT_THRESHOLD2)
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrChangeSessionUserToken(
_In_ HANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrGetImpersonationTokenForContext(
_In_ HANDLE InputTokenHandle,
_In_ ULONGLONG Context,
_Out_ PHANDLE OutputTokenHandle
);
#endif
#if (PHNT_VERSION >= PHNT_REDSTONE)
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrGetSessionActiveShellUserToken(
_In_ ULONG SessionId,
_Out_ PHANDLE TokenHandle
);
#endif
// Single-session SKU
#if (PHNT_VERSION >= PHNT_THRESHOLD)
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrOpenProcessTokenForQuery(
_In_ ULONG ProcessId,
_Out_ PHANDLE TokenHandle
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrOpenProcessHandleForAccess(
_In_ ACCESS_MASK DesiredAccess,
_In_ ULONG ProcessId,
_Out_ PHANDLE ProcessHandle
);
#endif
// Credentials
#if (PHNT_VERSION >= PHNT_THRESHOLD)
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrFreeUserCredentials(
_In_ PCRED_PROV_CREDENTIAL Credentials
);
// rev
USERMGRAPI
HRESULT
WINAPI
UMgrGetCachedCredentials(
_In_ PSID Sid,
_Outptr_ PCRED_PROV_CREDENTIAL *Credentials
);
#endif
#endif