79{
94 DWORD dwCreateFlags = 0;
96
97
99
101 {
103 return 0;
104 }
105
106 ZeroMemory(&StartupInfo,
sizeof(StartupInfo));
107 ZeroMemory(&ProcessInfo,
sizeof(ProcessInfo));
108
110 {
112 if (*pszArg ==
L'-' || *pszArg ==
L'/')
113 {
114 pszArg++;
116 {
119 goto done;
120 }
121 else if (
_wcsicmp(pszArg,
L"profile") == 0)
122 {
124 }
125 else if (
_wcsicmp(pszArg,
L"netonly") == 0)
126 {
128 }
129 else if (
_wcsicmp(pszArg,
L"noprofile") == 0)
130 {
132 }
134 {
136 }
138 {
139 pszArg += 5;
142 {
143
145 if (pszUserName ==
NULL)
146 {
149 goto done;
150 }
151
153
156 if (pszDomain ==
NULL)
157 {
160 goto done;
161 }
162
164 }
165 else
166 {
169 {
170
172 if (pszUserName ==
NULL)
173 {
176 goto done;
177 }
178
180
182 if (pszDomain ==
NULL)
183 {
186 goto done;
187 }
188
190 }
191 else
192 {
193
195 if (pszUserName ==
NULL)
196 {
199 goto done;
200 }
201
202 wcscpy(pszUserName, pszArg);
203 }
204 }
205 }
206 else
207 {
210 goto done;
211 }
212 }
213 else
214 {
215 if (pszCommandLine ==
NULL)
216 {
218 if (pszCommandLine ==
NULL)
219 {
222 goto done;
223 }
224
225 wcscpy(pszCommandLine, pszArg);
226 break;
227 }
228 }
229 }
230
231
232 if ((bProfile && bNoProfile) ||
233 (bProfile && bNetOnly))
234 {
237 goto done;
238 }
239
240
241 if (pszCommandLine ==
NULL || pszUserName ==
NULL)
242 {
245 goto done;
246 }
247
248 if (bProfile)
250
251 if (bNoProfile)
252 dwLogonFlags &= ~LOGON_WITH_PROFILE;
253
254 if (bNetOnly)
255 {
257 dwLogonFlags &= ~LOGON_WITH_PROFILE;
258 }
259
260 DPRINT(
"User: %S\n", pszUserName);
261 DPRINT(
"Domain: %S\n", pszDomain);
262 DPRINT(
"CommandLine: %S\n", pszCommandLine);
263
264 if (pszDomain ==
NULL)
265 {
268 if (pszDomain ==
NULL)
269 {
272 goto done;
273 }
274
276 }
277
278 if (bEnv)
279 {
282 if (pszCurrentDirectory ==
NULL)
283 {
286 goto done;
287 }
288
291 }
292
294 if (pszPassword ==
NULL)
295 {
298 goto done;
299 }
300
301
305
307
309 pszDomain,
310 pszPassword,
311 dwLogonFlags,
313 pszCommandLine,
314 dwCreateFlags,
316 pszCurrentDirectory,
317 &StartupInfo,
318 &ProcessInfo);
320 {
323 }
324
325done:
328
331
332 if (pszPassword)
334
335
336
337 if (pszCurrentDirectory)
339
340 if (pszCommandLine)
342
343 if (pszUserName)
345
346 if (pszDomain)
348
350}
void ConPuts(FILE *fp, LPCWSTR psz)
#define ConInitStdStreams()
void ConPrintf(FILE *fp, LPCWSTR psz,...)
void ConResPrintf(FILE *fp, UINT nID,...)
#define IDS_INTERNAL_ERROR
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
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)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LPCWSTR LPCWSTR LPCWSTR pszEnvironment
#define MAX_PASSWORD_LENGTH
static VOID ConInString(_In_ PWSTR pInput, _In_ DWORD dwLength)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define LOGON_WITH_PROFILE
DWORD WINAPI GetLastError(void)
#define CREATE_UNICODE_ENVIRONMENT
LPWSTR WINAPI GetEnvironmentStringsW(void)
#define LOGON_NETCREDENTIALS_ONLY
#define GetCurrentDirectory
#define MAX_COMPUTERNAME_LENGTH