61{
64
68
71
73
75 {
81 TRACE(
"CurrentDirectory: '%S'\n",
pRequest->CurrentDirectory);
85 }
86
90 if (hTargetProcessHandle ==
NULL)
91 {
93 WARN(
"OpenProcess() failed with Error %lu\n", dwError);
94 goto done;
95 }
96
98
99
105 &hToken);
107 {
109 WARN(
"LogonUser() failed with Error %lu\n", dwError);
110 goto done;
111 }
112
113
115 {
116 ProfileInfo.
dwSize =
sizeof(ProfileInfo);
118
120 &ProfileInfo);
122 {
124 WARN(
"LoadUserProfile() failed with Error %lu\n", dwError);
125 goto done;
126 }
127 }
128
129
130 ZeroMemory(&StartupInfo,
sizeof(StartupInfo));
131 StartupInfo.
cb =
sizeof(StartupInfo);
132
133
134
135
136 ZeroMemory(&ProcessInfo,
sizeof(ProcessInfo));
137
138
148 &StartupInfo,
149 &ProcessInfo);
151 {
153 WARN(
"CreateProcessAsUser() failed with Error %lu\n", dwError);
154 goto done;
155 }
156
157
158 if (pResponse !=
NULL)
159 {
162 hTargetProcessHandle,
164 0,
167
170 hTargetProcessHandle,
172 0,
175
177 pResponse->dwThreadId = ProcessInfo.
dwThreadId;
178 }
179
180done:
181 if (hTargetProcessHandle)
183
186
189
192
195
196 if (pResponse !=
NULL)
197 pResponse->dwError = dwError;
198}
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessAsUserW(_In_opt_ HANDLE hToken, _In_opt_ LPCWSTR lpApplicationName, _Inout_opt_ LPWSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation)
#define GetCurrentProcess()
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
BOOL WINAPI LoadUserProfileW(_In_ HANDLE hToken, _Inout_ LPPROFILEINFOW lpProfileInfo)
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
#define PROCESS_DUP_HANDLE
#define LOGON_WITH_PROFILE
DWORD WINAPI GetLastError(void)
#define LOGON32_LOGON_INTERACTIVE
#define LOGON32_PROVIDER_DEFAULT
#define DUPLICATE_SAME_ACCESS