#include <apitest.h>
#include <sddl.h>
#include <userenv.h>
#include <strsafe.h>
Go to the source code of this file.
◆ SE_BACKUP_NAME
#define SE_BACKUP_NAME L"SeBackupPrivilege" |
◆ SE_RESTORE_NAME
#define SE_RESTORE_NAME L"SeRestorePrivilege" |
◆ EnablePrivilege()
static BOOL EnablePrivilege |
( |
LPCWSTR |
lpszPrivilegeName, |
|
|
BOOL |
bEnablePrivilege |
|
) |
| |
|
static |
Definition at line 25 of file LoadUserProfile.c.
26{
30
33 &hToken);
35
37 lpszPrivilegeName,
38 &
tp.Privileges[0].Luid);
40
41 tp.PrivilegeCount = 1;
43
45
46Quit:
49}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
#define GetCurrentProcess()
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED
Referenced by START_TEST().
◆ GetUserSid()
Definition at line 59 of file LoadUserProfile.c.
60{
66
69 if (UserBuffer ==
NULL)
71
78 {
80 if (TempBuffer ==
NULL)
81 {
84 }
85
86 UserBuffer = TempBuffer;
92 }
93
95 {
98 }
99
101
104 {
107 }
108
110
112
114 {
117 }
118
120}
#define ERROR_INSUFFICIENT_BUFFER
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
DWORD WINAPI GetLengthSid(PSID pSid)
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_In_ ULONG _In_ ULONG _In_ ULONG Length
DWORD WINAPI GetLastError(void)
Referenced by START_TEST().
◆ START_TEST()
Definition at line 122 of file LoadUserProfile.c.
123{
129
133 &hToken);
135 {
136 trace(
"OpenThreadToken failed with error %lu, falling back to OpenProcessToken\n",
GetLastError());
139 &hToken);
140 }
142 {
144 return;
145 }
146
149 if (pUserSid)
150 {
155 {
156 trace(
"User SID is '%ls'\n", pSidStr);
158 }
161 }
162 else
163 {
164 trace(
"No SID available!\n");
165 }
166
167
168 ZeroMemory(&ProfileInfo[0],
sizeof(ProfileInfo[0]));
169 ProfileInfo[0].
dwSize =
sizeof(ProfileInfo[0]);
174 ok(ProfileInfo[0].hProfile ==
NULL,
"ProfileInfo[0].hProfile != NULL, expected NULL\n");
175
177 {
178 trace(
"LoadUserProfileW(ProfileInfo[0]) unexpectedly succeeded, unload the user profile just in case...\n");
180 }
181
182
183
184
189
190
192 {
194 ProfileInfo[
i].
dwSize =
sizeof(ProfileInfo[
i]);
199 ok(ProfileInfo[
i].hProfile !=
NULL,
"ProfileInfo[%d].hProfile == NULL\n",
i);
200 trace(
"ProfileInfo[%d].hProfile = 0x%p\n",
i, ProfileInfo[
i].hProfile);
201 }
202
205 {
206 trace(
"UnloadUserProfile(ProfileInfo[%d].hProfile)\n",
i);
209 }
210
211
214
215
217}
PSID WINAPI GetUserSid(IN HANDLE hToken)
static BOOL EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
BOOL WINAPI OpenThreadToken(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle)
BOOL WINAPI LoadUserProfileW(_In_ HANDLE hToken, _Inout_ LPPROFILEINFOW lpProfileInfo)
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
HANDLE WINAPI GetCurrentThread(void)
#define TOKEN_IMPERSONATE