76{
91 DWORD dwCreateFlags = 0;
93
94
96
98 {
100 return 0;
101 }
102
103 ZeroMemory(&StartupInfo,
sizeof(StartupInfo));
104 ZeroMemory(&ProcessInfo,
sizeof(ProcessInfo));
105
107 {
109 if (*pszArg ==
L'-' || *pszArg ==
L'/')
110 {
111 pszArg++;
113 {
116 goto done;
117 }
118 else if (
_wcsicmp(pszArg,
L"profile") == 0)
119 {
121 }
122 else if (
_wcsicmp(pszArg,
L"netonly") == 0)
123 {
125 }
126 else if (
_wcsicmp(pszArg,
L"noprofile") == 0)
127 {
129 }
131 {
133 }
135 {
136 pszArg += 5;
139 {
140
142 if (pszUserName ==
NULL)
143 {
146 goto done;
147 }
148
150
153 if (pszDomain ==
NULL)
154 {
157 goto done;
158 }
159
161 }
162 else
163 {
166 {
167
169 if (pszUserName ==
NULL)
170 {
173 goto done;
174 }
175
177
179 if (pszDomain ==
NULL)
180 {
183 goto done;
184 }
185
187 }
188 else
189 {
190
192 if (pszUserName ==
NULL)
193 {
196 goto done;
197 }
198
199 wcscpy(pszUserName, pszArg);
200 }
201 }
202 }
203 else
204 {
207 goto done;
208 }
209 }
210 else
211 {
212 if (pszCommandLine ==
NULL)
213 {
215 if (pszCommandLine ==
NULL)
216 {
219 goto done;
220 }
221
222 wcscpy(pszCommandLine, pszArg);
223 break;
224 }
225 }
226 }
227
228
229 if ((bProfile && bNoProfile) ||
230 (bProfile && bNetOnly))
231 {
234 goto done;
235 }
236
237
238 if (pszCommandLine ==
NULL || pszUserName ==
NULL)
239 {
242 goto done;
243 }
244
245 if (bProfile)
247
248 if (bNoProfile)
249 dwLogonFlags &= ~LOGON_WITH_PROFILE;
250
251 if (bNetOnly)
252 {
254 dwLogonFlags &= ~LOGON_WITH_PROFILE;
255 }
256
257 if (pszDomain ==
NULL)
258 {
261 if (pszDomain ==
NULL)
262 {
265 goto done;
266 }
267
269 }
270
271 if (bEnv)
272 {
275 if (pszCurrentDirectory ==
NULL)
276 {
279 goto done;
280 }
281
284 }
285
287 if (pszPassword ==
NULL)
288 {
291 goto done;
292 }
293
294
298
300
302 pszDomain,
303 pszPassword,
304 dwLogonFlags,
306 pszCommandLine,
307 dwCreateFlags,
309 pszCurrentDirectory,
310 &StartupInfo,
311 &ProcessInfo);
313 {
316 }
317
318done:
321
324
325 if (pszPassword)
327
328
329
330 if (pszCurrentDirectory)
332
333 if (pszCommandLine)
335
336 if (pszUserName)
338
339 if (pszDomain)
341
343}
#define IDS_INTERNAL_ERROR
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
void ConPuts(FILE *fp, LPCWSTR psz)
#define ConInitStdStreams()
void ConPrintf(FILE *fp, LPCWSTR psz,...)
void ConResPrintf(FILE *fp, UINT nID,...)
BOOL WINAPI CreateProcessWithLogonW(_In_ LPCWSTR lpUsername, _In_opt_ LPCWSTR lpDomain, _In_ LPCWSTR lpPassword, _In_ DWORD dwLogonFlags, _In_opt_ LPCWSTR lpApplicationName, _Inout_opt_ LPWSTR lpCommandLine, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation)
LPWSTR WINAPI DECLSPEC_HOTPATCH GetEnvironmentStringsW(void)
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
LPCWSTR LPCWSTR LPCWSTR pszEnvironment
#define MAX_PASSWORD_LENGTH
static VOID ConInString(_In_ PWSTR pInput, _In_ DWORD dwLength)
#define LOGON_WITH_PROFILE
DWORD WINAPI GetLastError(void)
#define CREATE_UNICODE_ENVIRONMENT
#define LOGON_NETCREDENTIALS_ONLY
#define GetCurrentDirectory
#define MAX_COMPUTERNAME_LENGTH