ReactOS 0.4.17-dev-804-g023d8af
process.c
Go to the documentation of this file.
1/*
2 * Win32 processes
3 *
4 * Copyright 1996, 1998 Alexandre Julliard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22#include <string.h>
23
24#include "ntstatus.h"
25#define WIN32_NO_STATUS
26#include "windef.h"
27#include "winbase.h"
28#include "winnls.h"
29#include "wincontypes.h"
30#include "winternl.h"
31
32#include "kernelbase.h"
33#include "wine/debug.h"
34#include "wine/condrv.h"
35
37
39static DWORD shutdown_priority = 0x280;
40
41/***********************************************************************
42 * Processes
43 ***********************************************************************/
44
45
46/***********************************************************************
47 * find_exe_file
48 */
49static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, DWORD buflen )
50{
52 BOOL ret;
53
54 if (!set_ntstatus( RtlGetExePath( name, &load_path ))) return FALSE;
55
56 TRACE( "looking for %s in %s\n", debugstr_w(name), debugstr_w(load_path) );
57
58 ret = (SearchPathW( load_path, name, L".exe", buflen, buffer, NULL ) ||
59 /* not found, try without extension in case it is a Unix app */
60 SearchPathW( load_path, name, NULL, buflen, buffer, NULL ));
61
62 if (ret) /* make sure it can be opened, SearchPathW also returns directories */
63 {
65 NULL, OPEN_EXISTING, 0, 0 );
67 }
69 return ret;
70}
71
72
73/*************************************************************************
74 * get_file_name
75 *
76 * Helper for CreateProcess: retrieve the file name to load from the
77 * app name and command line. Store the file name in buffer, and
78 * return a possibly modified command line.
79 */
81{
82 WCHAR *name, *pos, *first_space, *ret = NULL;
83 const WCHAR *p;
84
85 /* first check for a quoted file name */
86
87 if (cmdline[0] == '"' && (p = wcschr( cmdline + 1, '"' )))
88 {
89 int len = p - cmdline - 1;
90 /* extract the quoted portion as file name */
91 if (!(name = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
92 memcpy( name, cmdline + 1, len * sizeof(WCHAR) );
93 name[len] = 0;
94
95 if (!find_exe_file( name, buffer, buflen )) goto done;
96 ret = cmdline; /* no change necessary */
97 goto done;
98 }
99
100 /* now try the command-line word by word */
101
102 if (!(name = RtlAllocateHeap( GetProcessHeap(), 0, (lstrlenW(cmdline) + 1) * sizeof(WCHAR) )))
103 return NULL;
104 pos = name;
105 p = cmdline;
106 first_space = NULL;
107
108 for (;;)
109 {
110 while (*p && *p != ' ' && *p != '\t') *pos++ = *p++;
111 *pos = 0;
112 if (find_exe_file( name, buffer, buflen ))
113 {
114 ret = cmdline;
115 break;
116 }
117 if (!first_space) first_space = pos;
118 if (!(*pos++ = *p++)) break;
119 }
120
121 if (!ret)
122 {
124 }
125 else if (first_space) /* build a new command-line with quotes */
126 {
127 if (!(ret = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(cmdline) + 3) * sizeof(WCHAR) )))
128 goto done;
129 swprintf( ret, lstrlenW(cmdline) + 3, L"\"%s\"%s", name, p );
130 }
131
132 done:
134 return ret;
135}
136
137
138/***********************************************************************
139 * create_process_params
140 */
142 const WCHAR *cur_dir, void *env, DWORD flags,
143 const STARTUPINFOW *startup )
144{
146 UNICODE_STRING imageW, curdirW, cmdlineW, titleW, desktopW, runtimeW, newdirW;
147 WCHAR imagepath[MAX_PATH];
148 WCHAR *envW = env;
149
150 if (!GetLongPathNameW( filename, imagepath, MAX_PATH )) lstrcpynW( imagepath, filename, MAX_PATH );
151 if (!GetFullPathNameW( imagepath, MAX_PATH, imagepath, NULL )) lstrcpynW( imagepath, filename, MAX_PATH );
152
153 if (env && !(flags & CREATE_UNICODE_ENVIRONMENT)) /* convert environment to unicode */
154 {
155 char *e = env;
156 DWORD lenW;
157
158 while (*e) e += strlen(e) + 1;
159 e++; /* final null */
160 lenW = MultiByteToWideChar( CP_ACP, 0, env, e - (char *)env, NULL, 0 );
161 if ((envW = RtlAllocateHeap( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
162 MultiByteToWideChar( CP_ACP, 0, env, e - (char *)env, envW, lenW );
163 }
164
165 newdirW.Buffer = NULL;
166 if (cur_dir)
167 {
168 if (RtlDosPathNameToNtPathName_U( cur_dir, &newdirW, NULL, NULL ))
169 cur_dir = newdirW.Buffer + 4; /* skip \??\ prefix */
170 else
171 cur_dir = NULL;
172 }
173 RtlInitUnicodeString( &imageW, imagepath );
174 RtlInitUnicodeString( &curdirW, cur_dir );
175 RtlInitUnicodeString( &cmdlineW, cmdline );
176 RtlInitUnicodeString( &titleW, startup->lpTitle ? startup->lpTitle : imagepath );
177 RtlInitUnicodeString( &desktopW, startup->lpDesktop );
178 runtimeW.Buffer = (WCHAR *)startup->lpReserved2;
179 runtimeW.Length = runtimeW.MaximumLength = startup->cbReserved2;
180 if (RtlCreateProcessParametersEx( &params, &imageW, NULL, cur_dir ? &curdirW : NULL,
181 &cmdlineW, envW, &titleW, &desktopW,
183 {
184 RtlFreeUnicodeString( &newdirW );
185 if (envW != env) RtlFreeHeap( GetProcessHeap(), 0, envW );
186 return NULL;
187 }
188 RtlFreeUnicodeString( &newdirW );
189
191 params->ProcessGroupId = NtCurrentTeb()->Peb->ProcessParameters->ProcessGroupId;
192 else if (!(flags & CREATE_NEW_CONSOLE))
193 params->ConsoleFlags = 1;
194
195 if (flags & CREATE_NEW_CONSOLE) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC;
196 else if (!(flags & DETACHED_PROCESS))
197 {
199 else
200 {
201 params->ConsoleHandle = NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle;
202 if (!params->ConsoleHandle) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC;
203 }
204 }
205
206 if (startup->dwFlags & STARTF_USESTDHANDLES)
207 {
208 params->hStdInput = startup->hStdInput;
209 params->hStdOutput = startup->hStdOutput;
210 params->hStdError = startup->hStdError;
211 }
212 else if (!(flags & (DETACHED_PROCESS | CREATE_NEW_CONSOLE)))
213 {
214 params->hStdInput = NtCurrentTeb()->Peb->ProcessParameters->hStdInput;
215 params->hStdOutput = NtCurrentTeb()->Peb->ProcessParameters->hStdOutput;
216 params->hStdError = NtCurrentTeb()->Peb->ProcessParameters->hStdError;
217 }
218
219 if (params->hStdInput == INVALID_HANDLE_VALUE) params->hStdInput = NULL;
220 if (params->hStdOutput == INVALID_HANDLE_VALUE) params->hStdOutput = NULL;
221 if (params->hStdError == INVALID_HANDLE_VALUE) params->hStdError = NULL;
222
223 params->dwX = startup->dwX;
224 params->dwY = startup->dwY;
225 params->dwXSize = startup->dwXSize;
226 params->dwYSize = startup->dwYSize;
227 params->dwXCountChars = startup->dwXCountChars;
228 params->dwYCountChars = startup->dwYCountChars;
229 params->dwFillAttribute = startup->dwFillAttribute;
230 params->dwFlags = startup->dwFlags;
231 params->wShowWindow = startup->wShowWindow;
232
233 if (envW != env) RtlFreeHeap( GetProcessHeap(), 0, envW );
234 return params;
235}
236
238{
241 void *value;
242};
243
245{
246 DWORD mask; /* bitmask of items in list */
247 DWORD size; /* max number of items in list */
248 DWORD count; /* number of items in list */
252};
253
254/***********************************************************************
255 * create_nt_process
256 */
258 SECURITY_ATTRIBUTES *tsa, DWORD process_flags,
262 const struct proc_thread_attr *handle_list,
263 const struct proc_thread_attr *job_list)
264{
265 OBJECT_ATTRIBUTES process_attr, thread_attr;
266 PS_CREATE_INFO create_info;
271 UINT pos = 0;
272
273 if (!params->ImagePathName.Buffer[0]) return STATUS_OBJECT_PATH_NOT_FOUND;
275 if (!status)
276 {
278
279 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_IMAGE_NAME;
280 attr->Attributes[pos].Size = nameW.Length;
281 attr->Attributes[pos].ValuePtr = nameW.Buffer;
282 attr->Attributes[pos].ReturnLength = NULL;
283 pos++;
284 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_CLIENT_ID;
285 attr->Attributes[pos].Size = sizeof(info->ClientId);
286 attr->Attributes[pos].ValuePtr = &info->ClientId;
287 attr->Attributes[pos].ReturnLength = NULL;
288 pos++;
289 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_IMAGE_INFO;
290 attr->Attributes[pos].Size = sizeof(info->ImageInformation);
291 attr->Attributes[pos].ValuePtr = &info->ImageInformation;
292 attr->Attributes[pos].ReturnLength = NULL;
293 pos++;
294 if (parent)
295 {
296 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_PARENT_PROCESS;
297 attr->Attributes[pos].Size = sizeof(parent);
298 attr->Attributes[pos].ValuePtr = parent;
299 attr->Attributes[pos].ReturnLength = NULL;
300 pos++;
301 }
302 if ((process_flags & PROCESS_CREATE_FLAGS_INHERIT_HANDLES) && handle_list)
303 {
304 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_HANDLE_LIST;
305 attr->Attributes[pos].Size = handle_list->size;
306 attr->Attributes[pos].ValuePtr = handle_list->value;
307 attr->Attributes[pos].ReturnLength = NULL;
308 pos++;
309 }
310 if (token)
311 {
312 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_TOKEN;
313 attr->Attributes[pos].Size = sizeof(token);
314 attr->Attributes[pos].ValuePtr = token;
315 attr->Attributes[pos].ReturnLength = NULL;
316 pos++;
317 }
318 if (debug)
319 {
320 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_DEBUG_PORT;
321 attr->Attributes[pos].Size = sizeof(debug);
322 attr->Attributes[pos].ValuePtr = debug;
323 attr->Attributes[pos].ReturnLength = NULL;
324 pos++;
325 }
326 if (job_list)
327 {
328 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_JOB_LIST;
329 attr->Attributes[pos].Size = job_list->size;
330 attr->Attributes[pos].ValuePtr = job_list->value;
331 attr->Attributes[pos].ReturnLength = NULL;
332 pos++;
333 }
334 if (machine)
335 {
336 attr->Attributes[pos].Attribute = PS_ATTRIBUTE_MACHINE_TYPE;
337 attr->Attributes[pos].Size = sizeof(machine);
338 attr->Attributes[pos].Value = machine;
339 attr->Attributes[pos].ReturnLength = NULL;
340 pos++;
341 }
342 attr->TotalLength = offsetof( PS_ATTRIBUTE_LIST, Attributes[pos] );
343
344 InitializeObjectAttributes( &process_attr, NULL, 0, NULL, psa ? psa->lpSecurityDescriptor : NULL );
345 InitializeObjectAttributes( &thread_attr, NULL, 0, NULL, tsa ? tsa->lpSecurityDescriptor : NULL );
346
348 &process_attr, &thread_attr, process_flags,
350 &create_info, attr );
351
353 }
354 return status;
355}
356
357
358/***********************************************************************
359 * create_vdm_process
360 */
365{
366 const WCHAR *winevdm = (is_win64 || is_wow64 ?
367 L"C:\\windows\\syswow64\\winevdm.exe" :
368 L"C:\\windows\\system32\\winevdm.exe");
369 WCHAR *newcmdline;
371 UINT len;
372
373 len = (lstrlenW(params->ImagePathName.Buffer) + lstrlenW(params->CommandLine.Buffer) +
374 lstrlenW(winevdm) + 16);
375
376 if (!(newcmdline = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
377 return STATUS_NO_MEMORY;
378
379 swprintf( newcmdline, len, L"%s --app-name \"%s\" %s",
380 winevdm, params->ImagePathName.Buffer, params->CommandLine.Buffer );
381 RtlInitUnicodeString( &params->ImagePathName, winevdm );
382 RtlInitUnicodeString( &params->CommandLine, newcmdline );
384 HeapFree( GetProcessHeap(), 0, newcmdline );
385 return status;
386}
387
388
389/***********************************************************************
390 * create_cmd_process
391 */
396{
397 WCHAR comspec[MAX_PATH];
398 WCHAR *newcmdline;
400 UINT len;
401
402 if (!GetEnvironmentVariableW( L"COMSPEC", comspec, ARRAY_SIZE( comspec )))
403 lstrcpyW( comspec, L"C:\\windows\\system32\\cmd.exe" );
404
405 len = lstrlenW(comspec) + 7 + lstrlenW(params->CommandLine.Buffer) + 2;
406 if (!(newcmdline = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
407 return STATUS_NO_MEMORY;
408
409 swprintf( newcmdline, len, L"%s /s/c \"%s\"", comspec, params->CommandLine.Buffer );
410 RtlInitUnicodeString( &params->ImagePathName, comspec );
411 RtlInitUnicodeString( &params->CommandLine, newcmdline );
413 RtlFreeHeap( GetProcessHeap(), 0, newcmdline );
414 return status;
415}
416
417
418/*********************************************************************
419 * CloseHandle (kernelbase.@)
420 */
422{
425 else if (handle == (HANDLE)STD_OUTPUT_HANDLE)
427 else if (handle == (HANDLE)STD_ERROR_HANDLE)
429
430 return set_ntstatus( NtClose( handle ));
431}
432
433
434/**********************************************************************
435 * CreateProcessAsUserA (kernelbase.@)
436 */
438 SECURITY_ATTRIBUTES *process_attr,
439 SECURITY_ATTRIBUTES *thread_attr,
440 BOOL inherit, DWORD flags, void *env,
441 const char *cur_dir, STARTUPINFOA *startup_info,
443{
444 return CreateProcessInternalA( token, app_name, cmd_line, process_attr, thread_attr,
445 inherit, flags, env, cur_dir, startup_info, info, NULL );
446}
447
448
449/**********************************************************************
450 * CreateProcessAsUserW (kernelbase.@)
451 */
453 SECURITY_ATTRIBUTES *process_attr,
454 SECURITY_ATTRIBUTES *thread_attr,
455 BOOL inherit, DWORD flags, void *env,
456 const WCHAR *cur_dir, STARTUPINFOW *startup_info,
458{
459 return CreateProcessInternalW( token, app_name, cmd_line, process_attr, thread_attr,
460 inherit, flags, env, cur_dir, startup_info, info, NULL );
461}
462
463/**********************************************************************
464 * CreateProcessInternalA (kernelbase.@)
465 */
467 SECURITY_ATTRIBUTES *process_attr,
468 SECURITY_ATTRIBUTES *thread_attr,
469 BOOL inherit, DWORD flags, void *env,
470 const char *cur_dir, STARTUPINFOA *startup_info,
471 PROCESS_INFORMATION *info, HANDLE *new_token )
472{
473 BOOL ret = FALSE;
474 WCHAR *app_nameW = NULL, *cmd_lineW = NULL, *cur_dirW = NULL;
475 UNICODE_STRING desktopW, titleW;
477
478 desktopW.Buffer = NULL;
479 titleW.Buffer = NULL;
480 if (app_name && !(app_nameW = file_name_AtoW( app_name, TRUE ))) goto done;
481 if (cmd_line && !(cmd_lineW = file_name_AtoW( cmd_line, TRUE ))) goto done;
482 if (cur_dir && !(cur_dirW = file_name_AtoW( cur_dir, TRUE ))) goto done;
483
484 if (startup_info->lpDesktop) RtlCreateUnicodeStringFromAsciiz( &desktopW, startup_info->lpDesktop );
485 if (startup_info->lpTitle) RtlCreateUnicodeStringFromAsciiz( &titleW, startup_info->lpTitle );
486
487 memcpy( &infoW.StartupInfo, startup_info, sizeof(infoW.StartupInfo) );
488 infoW.StartupInfo.lpDesktop = desktopW.Buffer;
489 infoW.StartupInfo.lpTitle = titleW.Buffer;
490
492 infoW.lpAttributeList = ((STARTUPINFOEXW *)startup_info)->lpAttributeList;
493
494 ret = CreateProcessInternalW( token, app_nameW, cmd_lineW, process_attr, thread_attr,
495 inherit, flags, env, cur_dirW, (STARTUPINFOW *)&infoW, info, new_token );
496done:
497 RtlFreeHeap( GetProcessHeap(), 0, app_nameW );
498 RtlFreeHeap( GetProcessHeap(), 0, cmd_lineW );
499 RtlFreeHeap( GetProcessHeap(), 0, cur_dirW );
500 RtlFreeUnicodeString( &desktopW );
502 return ret;
503}
504
505/**********************************************************************
506 * CreateProcessInternalW (kernelbase.@)
507 */
509 SECURITY_ATTRIBUTES *process_attr,
510 SECURITY_ATTRIBUTES *thread_attr,
511 BOOL inherit, DWORD flags, void *env,
512 const WCHAR *cur_dir, STARTUPINFOW *startup_info,
513 PROCESS_INFORMATION *info, HANDLE *new_token )
514{
515 const struct proc_thread_attr *handle_list = NULL, *job_list = NULL;
517 WCHAR *p, *tidy_cmdline = cmd_line;
520 HANDLE parent = 0, debug = 0;
521 ULONG nt_flags = 0;
522 USHORT machine = 0;
524
525 /* Process the AppName and/or CmdLine to get module name and path */
526
527 TRACE( "app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
528
529 if (new_token) FIXME( "No support for returning created process token\n" );
530
531 if (app_name)
532 {
533 if (!cmd_line || !cmd_line[0]) /* no command-line, create one */
534 {
535 if (!(tidy_cmdline = RtlAllocateHeap( GetProcessHeap(), 0, (lstrlenW(app_name)+3) * sizeof(WCHAR) )))
536 return FALSE;
537 swprintf( tidy_cmdline, lstrlenW(app_name) + 3, L"\"%s\"", app_name );
538 }
539 }
540 else
541 {
542 if (!(tidy_cmdline = get_file_name( cmd_line, name, ARRAY_SIZE(name) ))) return FALSE;
543 app_name = name;
544 }
545
546 /* Warn if unsupported features are used */
547
550 WARN( "(%s,...): ignoring some flags in %lx\n", debugstr_w(app_name), flags );
551
552 if (cur_dir)
553 {
554 DWORD attr = GetFileAttributesW( cur_dir );
556 {
558 goto done;
559 }
560 }
561
562 info->hThread = info->hProcess = 0;
563 info->dwProcessId = info->dwThreadId = 0;
564
565 if (!(params = create_process_params( app_name, tidy_cmdline, cur_dir, env, flags, startup_info )))
566 {
568 goto done;
569 }
570
572 {
573 if ((status = DbgUiConnectToDbg())) goto done;
575 }
576
578 {
580 (struct _PROC_THREAD_ATTRIBUTE_LIST *)((STARTUPINFOEXW *)startup_info)->lpAttributeList;
581 unsigned int i;
582
583 if (attrs)
584 {
585 for (i = 0; i < attrs->count; ++i)
586 {
587 switch(attrs->attrs[i].attr)
588 {
590 parent = *(HANDLE *)attrs->attrs[i].value;
591 TRACE("PROC_THREAD_ATTRIBUTE_PARENT_PROCESS parent %p.\n", parent);
592 if (!parent)
593 {
595 goto done;
596 }
597 break;
599 FIXME("PROC_THREAD_ATTRIBUTE_EXTENDED_FLAGS %lx.\n", *(ULONG *)attrs->attrs[i].value);
600 break;
602 handle_list = &attrs->attrs[i];
603 TRACE("PROC_THREAD_ATTRIBUTE_HANDLE_LIST handle count %Iu.\n", attrs->attrs[i].size / sizeof(HANDLE));
604 break;
606 {
607 struct pseudo_console *console = attrs->attrs[i].value;
608 TRACE( "PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE %p reference %p\n",
609 console, console->reference );
610 params->ConsoleHandle = console->reference;
611 break;
612 }
614 job_list = &attrs->attrs[i];
615 TRACE( "PROC_THREAD_ATTRIBUTE_JOB_LIST handle count %Iu.\n",
616 attrs->attrs[i].size / sizeof(HANDLE) );
617 break;
619 machine = *(USHORT *)attrs->attrs[i].value;
620 TRACE( "PROC_THREAD_ATTRIBUTE_MACHINE %x.\n", machine );
621 break;
622 default:
623 FIXME("Unsupported attribute %#Ix.\n", attrs->attrs[i].attr);
624 break;
625 }
626 }
627 }
628 }
629
634
635 status = create_nt_process( token, debug, process_attr, thread_attr,
636 nt_flags, params, &rtl_info, parent, machine, handle_list, job_list );
637 switch (status)
638 {
639 case STATUS_SUCCESS:
640 break;
644 TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(app_name) );
645 status = create_vdm_process( token, debug, process_attr, thread_attr,
646 nt_flags, params, &rtl_info );
647 break;
649 /* check for .com or .bat extension */
650 if (!(p = wcsrchr( app_name, '.' ))) break;
651 if (!wcsicmp( p, L".com" ) || !wcsicmp( p, L".pif" ))
652 {
653 TRACE( "starting %s as DOS binary\n", debugstr_w(app_name) );
654 status = create_vdm_process( token, debug, process_attr, thread_attr,
655 nt_flags, params, &rtl_info );
656 }
657 else if (!wcsicmp( p, L".bat" ) || !wcsicmp( p, L".cmd" ))
658 {
659 TRACE( "starting %s as batch binary\n", debugstr_w(app_name) );
660 status = create_cmd_process( token, debug, process_attr, thread_attr,
661 nt_flags, params, &rtl_info );
662 }
663 break;
664 }
665
666 if (!status)
667 {
668 info->hProcess = rtl_info.Process;
669 info->hThread = rtl_info.Thread;
670 info->dwProcessId = HandleToUlong( rtl_info.ClientId.UniqueProcess );
671 info->dwThreadId = HandleToUlong( rtl_info.ClientId.UniqueThread );
672 if (!(flags & CREATE_SUSPENDED)) NtResumeThread( rtl_info.Thread, NULL );
673 TRACE( "started process pid %04lx tid %04lx\n", info->dwProcessId, info->dwThreadId );
674 }
675
676 done:
678 if (tidy_cmdline != cmd_line) HeapFree( GetProcessHeap(), 0, tidy_cmdline );
679 return set_ntstatus( status );
680}
681
682
683/**********************************************************************
684 * CreateProcessA (kernelbase.@)
685 */
687 SECURITY_ATTRIBUTES *process_attr,
688 SECURITY_ATTRIBUTES *thread_attr, BOOL inherit,
689 DWORD flags, void *env, const char *cur_dir,
690 STARTUPINFOA *startup_info, PROCESS_INFORMATION *info )
691{
692 return CreateProcessInternalA( NULL, app_name, cmd_line, process_attr, thread_attr,
693 inherit, flags, env, cur_dir, startup_info, info, NULL );
694}
695
696
697/**********************************************************************
698 * CreateProcessW (kernelbase.@)
699 */
701 SECURITY_ATTRIBUTES *process_attr,
703 void *env, const WCHAR *cur_dir, STARTUPINFOW *startup_info,
705{
706 return CreateProcessInternalW( NULL, app_name, cmd_line, process_attr, thread_attr,
707 inherit, flags, env, cur_dir, startup_info, info, NULL );
708}
709
710
711/**********************************************************************
712 * SetProcessInformation (kernelbase.@)
713 */
715{
716 switch (info_class)
717 {
724 default:
725 FIXME("Unrecognized information class %d.\n", info_class);
726 return FALSE;
727 }
728}
729
730
731/*********************************************************************
732 * DuplicateHandle (kernelbase.@)
733 */
735 HANDLE dest_process, HANDLE *dest,
737{
738 return set_ntstatus( NtDuplicateObject( source_process, source, dest_process, dest,
740}
741
742
743/***********************************************************************
744 * GetApplicationRestartSettings (kernelbase.@)
745 */
747 DWORD *size, DWORD *flags )
748{
749 FIXME( "%p, %p, %p, %p)\n", process, cmdline, size, flags );
750 return E_NOTIMPL;
751}
752
753
754/***********************************************************************
755 * GetCurrentProcess (kernelbase.@)
756 */
758{
759 return (HANDLE)~(ULONG_PTR)0;
760}
761
762
763/***********************************************************************
764 * GetCurrentProcessId (kernelbase.@)
765 */
767{
769}
770
771
772/***********************************************************************
773 * GetErrorMode (kernelbase.@)
774 */
776{
777 UINT mode;
778
780 &mode, sizeof(mode), NULL );
781 return mode;
782}
783
784
785/***********************************************************************
786 * GetExitCodeProcess (kernelbase.@)
787 */
789{
792
794 if (!status && exit_code) *exit_code = pbi.ExitStatus;
795 return set_ntstatus( status );
796}
797
798
799/*********************************************************************
800 * GetHandleInformation (kernelbase.@)
801 */
803{
805
807 return FALSE;
808
809 if (flags)
810 {
811 *flags = 0;
812 if (info.Inherit) *flags |= HANDLE_FLAG_INHERIT;
813 if (info.ProtectFromClose) *flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
814 }
815 return TRUE;
816}
817
818
819/***********************************************************************
820 * GetPriorityClass (kernelbase.@)
821 */
823{
825
827 &pbi, sizeof(pbi), NULL )))
828 return 0;
829
830 switch (pbi.BasePriority)
831 {
838 default: return 0;
839 }
840}
841
842
843/***********************************************************************
844 * GetProcessGroupAffinity (kernelbase.@)
845 */
847{
848 FIXME( "(%p,%p,%p): stub\n", process, count, array );
849#ifdef __REACTOS__
850#define THEONLYGROUP 0 // Fake support for a single group
851
852 if (!GetPriorityClass(process)) // Just used to verify the process handle
853 {
854 return FALSE;
855 }
856 if (*count < 1)
857 {
858 *count = 1;
860 return FALSE;
861 }
862 *count = 1;
863 array[0] = THEONLYGROUP;
864 return TRUE;
865#else
867 return FALSE;
868#endif
869}
870
871
872/******************************************************************
873 * GetProcessHandleCount (kernelbase.@)
874 */
876{
878 count, sizeof(*count), NULL ));
879}
880
881
882/***********************************************************************
883 * GetProcessHeap (kernelbase.@)
884 */
886{
887 return NtCurrentTeb()->Peb->ProcessHeap;
888}
889
890
891/*********************************************************************
892 * GetProcessId (kernelbase.@)
893 */
895{
897
899 &pbi, sizeof(pbi), NULL )))
900 return 0;
901 return pbi.UniqueProcessId;
902}
903
904
905/**********************************************************************
906 * GetProcessMitigationPolicy (kernelbase.@)
907 */
908BOOL WINAPI /* DECLSPEC_HOTPATCH */ GetProcessMitigationPolicy( HANDLE process, PROCESS_MITIGATION_POLICY policy,
909 void *buffer, SIZE_T length )
910{
911 FIXME( "(%p, %u, %p, %Iu): stub\n", process, policy, buffer, length );
912 return TRUE;
913}
914
915
916/***********************************************************************
917 * GetProcessPriorityBoost (kernelbase.@)
918 */
920{
921 FIXME( "(%p,%p): semi-stub\n", process, disable );
922 *disable = FALSE; /* report that no boost is present */
923 return TRUE;
924}
925
926
927/***********************************************************************
928 * GetProcessShutdownParameters (kernelbase.@)
929 */
931{
934 return TRUE;
935}
936
937
938/*********************************************************************
939 * GetProcessTimes (kernelbase.@)
940 */
942 FILETIME *kernel, FILETIME *user )
943{
945
947 return FALSE;
948
949 create->dwLowDateTime = time.CreateTime.u.LowPart;
950 create->dwHighDateTime = time.CreateTime.u.HighPart;
951 exit->dwLowDateTime = time.ExitTime.u.LowPart;
952 exit->dwHighDateTime = time.ExitTime.u.HighPart;
953 kernel->dwLowDateTime = time.KernelTime.u.LowPart;
954 kernel->dwHighDateTime = time.KernelTime.u.HighPart;
955 user->dwLowDateTime = time.UserTime.u.LowPart;
956 user->dwHighDateTime = time.UserTime.u.HighPart;
957 return TRUE;
958}
959
960
961/***********************************************************************
962 * GetProcessVersion (kernelbase.@)
963 */
965{
969
970 if (pid && pid != GetCurrentProcessId())
971 {
972 if (!(process = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, pid ))) return 0;
975 }
977 &info, sizeof(info), NULL );
978
979 if (!set_ntstatus( status )) return 0;
980 return MAKELONG( info.MinorSubsystemVersion, info.MajorSubsystemVersion );
981}
982
983
984/***********************************************************************
985 * GetProcessWorkingSetSizeEx (kernelbase.@)
986 */
988 SIZE_T *maxset, DWORD *flags)
989{
990 FIXME( "(%p,%p,%p,%p): stub\n", process, minset, maxset, flags );
991 /* 32 MB working set size */
992 if (minset) *minset = 32*1024*1024;
993 if (maxset) *maxset = 32*1024*1024;
995 return TRUE;
996}
997
998
999/******************************************************************************
1000 * IsProcessInJob (kernelbase.@)
1001 */
1003{
1005
1006 switch (status)
1007 {
1009 *result = TRUE;
1010 return TRUE;
1012 *result = FALSE;
1013 return TRUE;
1014 default:
1015 return set_ntstatus( status );
1016 }
1017}
1018
1019
1020/***********************************************************************
1021 * IsProcessorFeaturePresent (kernelbase.@)
1022 */
1024{
1026}
1027
1028
1029/**********************************************************************
1030 * IsWow64Process2 (kernelbase.@)
1031 */
1033{
1035}
1036
1037
1038/**********************************************************************
1039 * IsWow64Process (kernelbase.@)
1040 */
1042{
1043 ULONG_PTR pbi;
1045
1047 if (!status) *wow64 = !!pbi;
1048 return set_ntstatus( status );
1049}
1050
1051/*********************************************************************
1052 * GetProcessInformation (kernelbase.@)
1053 */
1055{
1056 switch (info_class)
1057 {
1059 {
1063 ULONG i;
1064
1065 if (size != sizeof(*mi))
1066 {
1068 return FALSE;
1069 }
1070
1072 machines, sizeof(machines), NULL );
1073 if (status) return set_ntstatus( status );
1074
1075 for (i = 0; machines[i].Machine; i++)
1076 {
1077 if (machines[i].Process)
1078 {
1079 mi->ProcessMachine = machines[i].Machine;
1080 mi->Res0 = 0;
1081 mi->MachineAttributes = 0;
1082 if (machines[i].KernelMode)
1083 mi->MachineAttributes |= KernelEnabled;
1084 if (machines[i].UserMode)
1085 mi->MachineAttributes |= UserEnabled;
1086 if (machines[i].WoW64Container)
1087 mi->MachineAttributes |= Wow64Container;
1088
1089 return TRUE;
1090 }
1091 }
1092
1093 break;
1094 }
1095 default:
1096 FIXME("Unsupported information class %d.\n", info_class);
1097 }
1098
1099 return FALSE;
1100}
1101
1102
1103/*********************************************************************
1104 * OpenProcess (kernelbase.@)
1105 */
1107{
1108 HANDLE handle;
1110 CLIENT_ID cid;
1111
1112 if (GetVersion() & 0x80000000) access = PROCESS_ALL_ACCESS;
1113
1114 attr.Length = sizeof(OBJECT_ATTRIBUTES);
1115 attr.RootDirectory = 0;
1116 attr.Attributes = inherit ? OBJ_INHERIT : 0;
1117 attr.ObjectName = NULL;
1118 attr.SecurityDescriptor = NULL;
1119 attr.SecurityQualityOfService = NULL;
1120
1121 cid.UniqueProcess = ULongToHandle(id);
1122 cid.UniqueThread = 0;
1123
1124 if (!set_ntstatus( NtOpenProcess( &handle, access, &attr, &cid ))) return NULL;
1125 return handle;
1126}
1127
1128
1129/***********************************************************************
1130 * ProcessIdToSessionId (kernelbase.@)
1131 */
1133{
1136
1137 if (pid == GetCurrentProcessId())
1138 {
1139 *id = NtCurrentTeb()->Peb->SessionId;
1140 return TRUE;
1141 }
1145 return set_ntstatus( status );
1146}
1147
1148
1149/***********************************************************************
1150 * QueryProcessCycleTime (kernelbase.@)
1151 */
1153{
1155
1157 return FALSE;
1158
1159 *cycle = time.AccumulatedCycles;
1160 return TRUE;
1161}
1162
1163
1164/***********************************************************************
1165 * SetErrorMode (kernelbase.@)
1166 */
1168{
1169 UINT old = GetErrorMode();
1170
1172 &mode, sizeof(mode) );
1173 return old;
1174}
1175
1176
1177/*************************************************************************
1178 * SetHandleCount (kernelbase.@)
1179 */
1181{
1182 return count;
1183}
1184
1185
1186/*********************************************************************
1187 * SetHandleInformation (kernelbase.@)
1188 */
1190{
1192
1193 /* if not setting both fields, retrieve current value first */
1196 {
1198 return FALSE;
1199 }
1201 info.Inherit = (flags & HANDLE_FLAG_INHERIT) != 0;
1203 info.ProtectFromClose = (flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
1204
1206}
1207
1208
1209/***********************************************************************
1210 * SetPriorityClass (kernelbase.@)
1211 */
1213{
1215
1216 ppc.Foreground = FALSE;
1217 switch (class)
1218 {
1225 default:
1227 return FALSE;
1228 }
1229 return set_ntstatus( NtSetInformationProcess( process, ProcessPriorityClass, &ppc, sizeof(ppc) ));
1230}
1231
1232
1233/***********************************************************************
1234 * SetProcessAffinityUpdateMode (kernelbase.@)
1235 */
1237{
1238 FIXME( "(%p,0x%08lx): stub\n", process, flags );
1240 return FALSE;
1241}
1242
1243
1244/***********************************************************************
1245 * SetProcessGroupAffinity (kernelbase.@)
1246 */
1248 GROUP_AFFINITY *old )
1249{
1250 FIXME( "(%p,%p,%p): stub\n", process, new, old );
1252 return FALSE;
1253}
1254
1255
1256/**********************************************************************
1257 * SetProcessMitigationPolicy (kernelbase.@)
1258 */
1259BOOL WINAPI /* DECLSPEC_HOTPATCH */ SetProcessMitigationPolicy( PROCESS_MITIGATION_POLICY policy,
1260 void *buffer, SIZE_T length )
1261{
1262 FIXME( "(%d, %p, %Iu): stub\n", policy, buffer, length );
1263 return TRUE;
1264}
1265
1266
1267/***********************************************************************
1268 * SetProcessPriorityBoost (kernelbase.@)
1269 */
1271{
1272 FIXME( "(%p,%d): stub\n", process, disable );
1273 return TRUE;
1274}
1275
1276
1277/***********************************************************************
1278 * SetProcessShutdownParameters (kernelbase.@)
1279 */
1281{
1282 FIXME( "(%08lx, %08lx): partial stub.\n", level, flags );
1285 return TRUE;
1286}
1287
1288
1289/***********************************************************************
1290 * SetProcessWorkingSetSizeEx (kernelbase.@)
1291 */
1293 SIZE_T maxset, DWORD flags )
1294{
1295 return TRUE;
1296}
1297
1298
1299/******************************************************************************
1300 * TerminateProcess (kernelbase.@)
1301 */
1303{
1304 if (!handle)
1305 {
1307 return FALSE;
1308 }
1310}
1311
1312
1313/***********************************************************************
1314 * Process startup information
1315 ***********************************************************************/
1316
1317
1318static char *command_lineA;
1320
1321/******************************************************************
1322 * init_startup_info
1323 */
1325{
1327
1328 command_lineW = params->CommandLine.Buffer;
1329 if (!RtlUnicodeStringToAnsiString( &ansi, &params->CommandLine, TRUE )) command_lineA = ansi.Buffer;
1330}
1331
1332
1333/**********************************************************************
1334 * BaseFlushAppcompatCache (kernelbase.@)
1335 */
1337{
1338 FIXME( "stub\n" );
1340 return FALSE;
1341}
1342
1343
1344/***********************************************************************
1345 * GetCommandLineA (kernelbase.@)
1346 */
1348{
1349 return command_lineA;
1350}
1351
1352
1353/***********************************************************************
1354 * GetCommandLineW (kernelbase.@)
1355 */
1357{
1358 return command_lineW;
1359}
1360
1361
1362/***********************************************************************
1363 * GetStartupInfoW (kernelbase.@)
1364 */
1366{
1368
1370
1372
1373 info->cb = sizeof(*info);
1374 info->lpReserved = NULL;
1375 info->lpDesktop = params->Desktop.Buffer;
1376 info->lpTitle = params->WindowTitle.Buffer;
1377 info->dwX = params->dwX;
1378 info->dwY = params->dwY;
1379 info->dwXSize = params->dwXSize;
1380 info->dwYSize = params->dwYSize;
1381 info->dwXCountChars = params->dwXCountChars;
1382 info->dwYCountChars = params->dwYCountChars;
1383 info->dwFillAttribute = params->dwFillAttribute;
1384 info->dwFlags = params->dwFlags;
1385 info->wShowWindow = params->wShowWindow;
1386 info->cbReserved2 = params->RuntimeInfo.MaximumLength;
1387 info->lpReserved2 = params->RuntimeInfo.MaximumLength ? (void *)params->RuntimeInfo.Buffer : NULL;
1388 if (params->dwFlags & STARTF_USESTDHANDLES)
1389 {
1390 info->hStdInput = params->hStdInput;
1391 info->hStdOutput = params->hStdOutput;
1392 info->hStdError = params->hStdError;
1393 }
1395}
1396
1397
1398/***********************************************************************
1399 * GetStdHandle (kernelbase.@)
1400 */
1402{
1403 switch (std_handle)
1404 {
1405 case STD_INPUT_HANDLE: return NtCurrentTeb()->Peb->ProcessParameters->hStdInput;
1406 case STD_OUTPUT_HANDLE: return NtCurrentTeb()->Peb->ProcessParameters->hStdOutput;
1407 case STD_ERROR_HANDLE: return NtCurrentTeb()->Peb->ProcessParameters->hStdError;
1408 }
1410 return INVALID_HANDLE_VALUE;
1411}
1412
1413
1414/***********************************************************************
1415 * SetStdHandle (kernelbase.@)
1416 */
1418{
1419 switch (std_handle)
1420 {
1421 case STD_INPUT_HANDLE: NtCurrentTeb()->Peb->ProcessParameters->hStdInput = handle; return TRUE;
1422 case STD_OUTPUT_HANDLE: NtCurrentTeb()->Peb->ProcessParameters->hStdOutput = handle; return TRUE;
1423 case STD_ERROR_HANDLE: NtCurrentTeb()->Peb->ProcessParameters->hStdError = handle; return TRUE;
1424 }
1426 return FALSE;
1427}
1428
1429
1430/***********************************************************************
1431 * SetStdHandleEx (kernelbase.@)
1432 */
1434{
1435 HANDLE *ptr;
1436
1437 switch (std_handle)
1438 {
1439 case STD_INPUT_HANDLE: ptr = &NtCurrentTeb()->Peb->ProcessParameters->hStdInput; break;
1440 case STD_OUTPUT_HANDLE: ptr = &NtCurrentTeb()->Peb->ProcessParameters->hStdOutput; break;
1441 case STD_ERROR_HANDLE: ptr = &NtCurrentTeb()->Peb->ProcessParameters->hStdError; break;
1442 default:
1444 return FALSE;
1445 }
1446 if (prev) *prev = *ptr;
1447 *ptr = handle;
1448 return TRUE;
1449}
1450
1451
1452/***********************************************************************
1453 * Process environment
1454 ***********************************************************************/
1455
1456
1457static inline SIZE_T get_env_length( const WCHAR *env )
1458{
1459 const WCHAR *end = env;
1460 while (*end) end += lstrlenW(end) + 1;
1461 return end + 1 - env;
1462}
1463
1464/***********************************************************************
1465 * ExpandEnvironmentStringsA (kernelbase.@)
1466 */
1468{
1469 UNICODE_STRING us_src;
1470 PWSTR dstW = NULL;
1471 DWORD count_neededW;
1472 DWORD count_neededA = 0;
1473
1475
1476 /* We always need to call ExpandEnvironmentStringsW, since we need the result to calculate the needed buffer size */
1477 count_neededW = ExpandEnvironmentStringsW( us_src.Buffer, NULL, 0 );
1478 if (!(dstW = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, count_neededW * sizeof(WCHAR) ))) goto cleanup;
1479 count_neededW = ExpandEnvironmentStringsW( us_src.Buffer, dstW, count_neededW );
1480
1481 /* Calculate needed buffer */
1482 count_neededA = WideCharToMultiByte( CP_ACP, 0, dstW, count_neededW, NULL, 0, NULL, NULL );
1483
1484 /* If provided buffer is enough, do actual conversion */
1485 if (count > count_neededA)
1486 count_neededA = WideCharToMultiByte( CP_ACP, 0, dstW, count_neededW, dst, count, NULL, NULL );
1487 else if(dst)
1488 *dst = 0;
1489
1490cleanup:
1491 RtlFreeUnicodeString( &us_src );
1492 HeapFree( GetProcessHeap(), 0, dstW );
1493
1494 if (count_neededA >= count) /* When the buffer is too small, native over-reports by one byte */
1495 return count_neededA + 1;
1496 return count_neededA;
1497}
1498
1499
1500/***********************************************************************
1501 * ExpandEnvironmentStringsW (kernelbase.@)
1502 */
1504{
1505 UNICODE_STRING us_src, us_dst;
1507 DWORD res;
1508
1509 TRACE( "(%s %p %lu)\n", debugstr_w(src), dst, len );
1510
1511 RtlInitUnicodeString( &us_src, src );
1512
1513 /* make sure we don't overflow the maximum UNICODE_STRING size */
1515
1516 us_dst.Length = 0;
1517 us_dst.MaximumLength = len * sizeof(WCHAR);
1518 us_dst.Buffer = dst;
1519
1520 res = 0;
1521 status = RtlExpandEnvironmentStrings_U( NULL, &us_src, &us_dst, &res );
1522 res /= sizeof(WCHAR);
1524 {
1525 if(!set_ntstatus( status ))
1526 return 0;
1527 }
1528 return res;
1529}
1530
1531
1532/***********************************************************************
1533 * GetEnvironmentStrings (kernelbase.@)
1534 * GetEnvironmentStringsA (kernelbase.@)
1535 */
1537{
1538 LPWSTR env;
1539 LPSTR ret;
1540 SIZE_T lenA, lenW;
1541
1543 env = NtCurrentTeb()->Peb->ProcessParameters->Environment;
1544 lenW = get_env_length( env );
1545 lenA = WideCharToMultiByte( CP_ACP, 0, env, lenW, NULL, 0, NULL, NULL );
1546 if ((ret = HeapAlloc( GetProcessHeap(), 0, lenA )))
1547 WideCharToMultiByte( CP_ACP, 0, env, lenW, ret, lenA, NULL, NULL );
1549 return ret;
1550}
1551
1552
1553/***********************************************************************
1554 * GetEnvironmentStringsW (kernelbase.@)
1555 */
1557{
1558 LPWSTR ret;
1559 SIZE_T len;
1560
1563 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
1564 memcpy( ret, NtCurrentTeb()->Peb->ProcessParameters->Environment, len );
1566 return ret;
1567}
1568
1569
1570/***********************************************************************
1571 * SetEnvironmentStringsA (kernelbase.@)
1572 */
1574{
1575 WCHAR *envW;
1576 const char *p = env;
1577 DWORD len;
1578 BOOL ret;
1579
1580 for (p = env; *p; p += strlen( p ) + 1);
1581
1582 len = MultiByteToWideChar( CP_ACP, 0, env, p - env, NULL, 0 );
1583 if (!(envW = HeapAlloc( GetProcessHeap(), 0, len )))
1584 {
1586 return FALSE;
1587 }
1588 MultiByteToWideChar( CP_ACP, 0, env, p - env, envW, len );
1589 ret = SetEnvironmentStringsW( envW );
1590 HeapFree( GetProcessHeap(), 0, envW );
1591 return ret;
1592}
1593
1594
1595/***********************************************************************
1596 * SetEnvironmentStringsW (kernelbase.@)
1597 */
1599{
1600 WCHAR *p;
1601 WCHAR *new_env;
1603
1604 for (p = env; *p; p += wcslen( p ) + 1)
1605 {
1606 const WCHAR *eq = wcschr( p, '=' );
1607 if (!eq || eq == p)
1608 {
1610 return FALSE;
1611 }
1612 }
1613
1614 if ((status = RtlCreateEnvironment( FALSE, &new_env )))
1615 return set_ntstatus( status );
1616
1617 for (p = env; *p; p += wcslen( p ) + 1)
1618 {
1619 const WCHAR *eq = wcschr( p, '=' );
1621 var.Buffer = p;
1622 var.Length = (eq - p) * sizeof(WCHAR);
1623 RtlInitUnicodeString( &value, eq + 1 );
1624 if ((status = RtlSetEnvironmentVariable( &new_env, &var, &value )))
1625 {
1626 RtlDestroyEnvironment( new_env );
1627 return set_ntstatus( status );
1628 }
1629 }
1630
1631 RtlSetCurrentEnvironment( new_env, NULL );
1632 return TRUE;
1633}
1634
1635
1636/***********************************************************************
1637 * GetEnvironmentVariableA (kernelbase.@)
1638 */
1640{
1641 UNICODE_STRING us_name, us_value;
1642 PWSTR valueW;
1644 DWORD len, ret;
1645
1646 /* limit the size to sane values */
1647 size = min( size, 32767 );
1648 if (!(valueW = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return 0;
1649
1651 us_value.Length = 0;
1652 us_value.MaximumLength = (size ? size - 1 : 0) * sizeof(WCHAR);
1653 us_value.Buffer = valueW;
1654
1655 status = RtlQueryEnvironmentVariable_U( NULL, &us_name, &us_value );
1656 len = us_value.Length / sizeof(WCHAR);
1657 if (status == STATUS_BUFFER_TOO_SMALL) ret = len + 1;
1658 else if (!set_ntstatus( status )) ret = 0;
1659 else if (!size) ret = len + 1;
1660 else
1661 {
1662 if (len) WideCharToMultiByte( CP_ACP, 0, valueW, len + 1, value, size, NULL, NULL );
1663 value[len] = 0;
1664 ret = len;
1665 }
1666
1667 RtlFreeUnicodeString( &us_name );
1669 return ret;
1670}
1671
1672
1673/***********************************************************************
1674 * GetEnvironmentVariableW (kernelbase.@)
1675 */
1677{
1678 UNICODE_STRING us_name, us_value;
1680 DWORD len;
1681
1682 TRACE( "(%s %p %lu)\n", debugstr_w(name), val, size );
1683
1684 RtlInitUnicodeString( &us_name, name );
1685 us_value.Length = 0;
1686 us_value.MaximumLength = (size ? size - 1 : 0) * sizeof(WCHAR);
1687 us_value.Buffer = val;
1688
1689 status = RtlQueryEnvironmentVariable_U( NULL, &us_name, &us_value );
1690 len = us_value.Length / sizeof(WCHAR);
1691 if (status == STATUS_BUFFER_TOO_SMALL) return len + 1;
1692 if (!set_ntstatus( status )) return 0;
1693 if (!size) return len + 1;
1694 val[len] = 0;
1695 return len;
1696}
1697
1698
1699/***********************************************************************
1700 * FreeEnvironmentStringsA (kernelbase.@)
1701 * FreeEnvironmentStringsW (kernelbase.@)
1702 */
1704{
1705 return HeapFree( GetProcessHeap(), 0, ptr );
1706}
1707
1708
1709/***********************************************************************
1710 * SetEnvironmentVariableA (kernelbase.@)
1711 */
1713{
1714 UNICODE_STRING us_name, us_value;
1715 BOOL ret;
1716
1717 if (!name)
1718 {
1720 return FALSE;
1721 }
1722
1724 if (value)
1725 {
1727 ret = SetEnvironmentVariableW( us_name.Buffer, us_value.Buffer );
1728 RtlFreeUnicodeString( &us_value );
1729 }
1730 else ret = SetEnvironmentVariableW( us_name.Buffer, NULL );
1731 RtlFreeUnicodeString( &us_name );
1732 return ret;
1733}
1734
1735
1736/***********************************************************************
1737 * SetEnvironmentVariableW (kernelbase.@)
1738 */
1740{
1741 UNICODE_STRING us_name, us_value;
1743
1744 TRACE( "(%s %s)\n", debugstr_w(name), debugstr_w(value) );
1745
1746 if (!name)
1747 {
1749 return FALSE;
1750 }
1751
1752 RtlInitUnicodeString( &us_name, name );
1753 if (value)
1754 {
1755 RtlInitUnicodeString( &us_value, value );
1756 status = RtlSetEnvironmentVariable( NULL, &us_name, &us_value );
1757 }
1758 else status = RtlSetEnvironmentVariable( NULL, &us_name, NULL );
1759
1760 return set_ntstatus( status );
1761}
1762
1763
1764/***********************************************************************
1765 * Process/thread attribute lists
1766 ***********************************************************************/
1767
1768/***********************************************************************
1769 * InitializeProcThreadAttributeList (kernelbase.@)
1770 */
1773{
1774 SIZE_T needed;
1775 BOOL ret = FALSE;
1776
1777 TRACE( "(%p %ld %lx %p)\n", list, count, flags, size );
1778
1779 needed = FIELD_OFFSET( struct _PROC_THREAD_ATTRIBUTE_LIST, attrs[count] );
1780 if (list && *size >= needed)
1781 {
1782 list->mask = 0;
1783 list->size = count;
1784 list->count = 0;
1785 list->unk = 0;
1786 ret = TRUE;
1787 }
1789
1790 *size = needed;
1791 return ret;
1792}
1793
1794
1796{
1797 switch (attr)
1798 {
1800 if (size != sizeof(HANDLE)) return ERROR_BAD_LENGTH;
1801 break;
1803 if (size != sizeof(ULONG)) return ERROR_BAD_LENGTH;
1804 break;
1806 if ((size / sizeof(HANDLE)) * sizeof(HANDLE) != size) return ERROR_BAD_LENGTH;
1807 break;
1809 if (size != sizeof(PROCESSOR_NUMBER)) return ERROR_BAD_LENGTH;
1810 break;
1812 if (size != sizeof(DWORD) && size != sizeof(DWORD64)) return ERROR_BAD_LENGTH;
1813 break;
1815 if (size != sizeof(DWORD) && size != sizeof(DWORD64) && size != sizeof(DWORD64) * 2)
1816 return ERROR_BAD_LENGTH;
1817 break;
1819 if (size != sizeof(HPCON)) return ERROR_BAD_LENGTH;
1820 break;
1822 if ((size / sizeof(HANDLE)) * sizeof(HANDLE) != size) return ERROR_BAD_LENGTH;
1823 break;
1825 if (size != sizeof(USHORT)) return ERROR_BAD_LENGTH;
1826 break;
1827 default:
1828 FIXME( "Unhandled attribute %Iu\n", attr & PROC_THREAD_ATTRIBUTE_NUMBER );
1829 return ERROR_NOT_SUPPORTED;
1830 }
1831 return 0;
1832}
1833
1834
1835/***********************************************************************
1836 * UpdateProcThreadAttribute (kernelbase.@)
1837 */
1839 DWORD flags, DWORD_PTR attr, void *value,
1840 SIZE_T size, void *prev_ret, SIZE_T *size_ret )
1841{
1842 DWORD mask, err;
1843 struct proc_thread_attr *entry;
1844
1845 TRACE( "(%p %lx %08Ix %p %Id %p %p)\n", list, flags, attr, value, size, prev_ret, size_ret );
1846
1847 if (list->count >= list->size)
1848 {
1850 return FALSE;
1851 }
1853 {
1854 SetLastError( err );
1855 return FALSE;
1856 }
1857
1859 if (list->mask & mask)
1860 {
1862 return FALSE;
1863 }
1864 list->mask |= mask;
1865
1866 entry = list->attrs + list->count;
1867 entry->attr = attr;
1868 entry->size = size;
1869 entry->value = value;
1870 list->count++;
1871 return TRUE;
1872}
1873
1874
1875/***********************************************************************
1876 * DeleteProcThreadAttributeList (kernelbase.@)
1877 */
1879{
1880 return;
1881}
1882
1883
1884/***********************************************************************
1885 * CompareObjectHandles (kernelbase.@)
1886 */
1888{
1889 return set_ntstatus( NtCompareObjects( first, second ));
1890}
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
static void startup(void)
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:78
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR nameW[]
Definition: main.c:49
void user(int argc, const char *argv[])
Definition: cmds.c:1350
EXTERN_C NTSTATUS WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG)
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define HandleToUlong(h)
Definition: basetsd.h:73
#define ULongToHandle(h)
Definition: basetsd.h:75
#define HandleToULong(h)
Definition: basetsd.h:89
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
@ ProcessBasicInformation
Definition: cicbase.cpp:63
@ ProcessWow64Information
Definition: cicbase.cpp:65
Definition: list.h:37
size_type size() const
Definition: _list.h:379
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:171
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_NOTIMPL
Definition: ddrawi.h:99
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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)
Definition: logon.c:987
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:227
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define GetCurrentProcess()
Definition: compat.h:759
#define GENERIC_READ
Definition: compat.h:135
#define IsWow64Process
Definition: compat.h:760
#define GetProcessId(x)
Definition: compat.h:737
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define wcsicmp
Definition: compat.h:15
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
static void cleanup(void)
Definition: main.c:1335
PPEB Peb
Definition: dllmain.c:27
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
DWORD WINAPI GetLongPathNameW(IN LPCWSTR lpszShortPath, OUT LPWSTR lpszLongPath, IN DWORD cchBuffer)
Definition: path.c:1456
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1425
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1274
#define THEONLYGROUP
Definition: proc.c:912
WCHAR * file_name_AtoW(LPCSTR name, BOOL alloc)
Definition: file.c:411
UINT WINAPI DECLSPEC_HOTPATCH GetErrorMode(void)
Definition: process.c:775
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentStringsW(WCHAR *env)
Definition: process.c:1598
static WCHAR * command_lineW
Definition: process.c:1319
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(LPCSTR name, LPCSTR value)
Definition: process.c:1712
BOOL WINAPI DECLSPEC_HOTPATCH GetProcessWorkingSetSizeEx(HANDLE process, SIZE_T *minset, SIZE_T *maxset, DWORD *flags)
Definition: process.c:987
BOOL WINAPI BaseFlushAppcompatCache(void)
Definition: process.c:1336
BOOL WINAPI DECLSPEC_HOTPATCH ProcessIdToSessionId(DWORD pid, DWORD *id)
Definition: process.c:1132
HRESULT WINAPI GetApplicationRestartSettings(HANDLE process, WCHAR *cmdline, DWORD *size, DWORD *flags)
Definition: process.c:746
void WINAPI DECLSPEC_HOTPATCH GetStartupInfoW(STARTUPINFOW *info)
Definition: process.c:1365
BOOL WINAPI DECLSPEC_HOTPATCH GetHandleInformation(HANDLE handle, DWORD *flags)
Definition: process.c:802
BOOL WINAPI DECLSPEC_HOTPATCH GetProcessTimes(HANDLE process, FILETIME *create, FILETIME *exit, FILETIME *kernel, FILETIME *user)
Definition: process.c:941
HANDLE WINAPI kernelbase_GetCurrentProcess(void)
Definition: process.c:757
BOOL WINAPI DECLSPEC_HOTPATCH SetProcessGroupAffinity(HANDLE process, const GROUP_AFFINITY *new, GROUP_AFFINITY *old)
Definition: process.c:1247
DWORD WINAPI DECLSPEC_HOTPATCH GetProcessVersion(DWORD pid)
Definition: process.c:964
UINT WINAPI DECLSPEC_HOTPATCH SetErrorMode(UINT mode)
Definition: process.c:1167
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalA(HANDLE token, const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info, HANDLE *new_token)
Definition: process.c:466
BOOL WINAPI SetProcessPriorityBoost(HANDLE process, BOOL disable)
Definition: process.c:1270
BOOL WINAPI DECLSPEC_HOTPATCH CompareObjectHandles(HANDLE first, HANDLE second)
Definition: process.c:1887
DWORD WINAPI DECLSPEC_HOTPATCH ExpandEnvironmentStringsA(LPCSTR src, LPSTR dst, DWORD count)
Definition: process.c:1467
BOOL WINAPI DECLSPEC_HOTPATCH IsProcessInJob(HANDLE process, HANDLE job, BOOL *result)
Definition: process.c:1002
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW(HANDLE token, const WCHAR *app_name, WCHAR *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const WCHAR *cur_dir, STARTUPINFOW *startup_info, PROCESS_INFORMATION *info, HANDLE *new_token)
Definition: process.c:508
BOOL WINAPI GetProcessInformation(HANDLE process, PROCESS_INFORMATION_CLASS info_class, void *data, DWORD size)
Definition: process.c:1054
BOOL WINAPI DECLSPEC_HOTPATCH GetProcessPriorityBoost(HANDLE process, PBOOL disable)
Definition: process.c:919
BOOL WINAPI GetProcessMitigationPolicy(HANDLE process, PROCESS_MITIGATION_POLICY policy, void *buffer, SIZE_T length)
Definition: process.c:908
HANDLE WINAPI DECLSPEC_HOTPATCH GetStdHandle(DWORD std_handle)
Definition: process.c:1401
BOOL WINAPI SetProcessInformation(HANDLE process, PROCESS_INFORMATION_CLASS info_class, void *info, DWORD size)
Definition: process.c:714
static DWORD validate_proc_thread_attribute(DWORD_PTR attr, SIZE_T size)
Definition: process.c:1795
DWORD WINAPI DECLSPEC_HOTPATCH GetPriorityClass(HANDLE process)
Definition: process.c:822
static NTSTATUS create_cmd_process(HANDLE token, HANDLE debug, SECURITY_ATTRIBUTES *psa, SECURITY_ATTRIBUTES *tsa, DWORD flags, RTL_USER_PROCESS_PARAMETERS *params, RTL_USER_PROCESS_INFORMATION *info)
Definition: process.c:392
BOOL WINAPI DECLSPEC_HOTPATCH SetHandleInformation(HANDLE handle, DWORD mask, DWORD flags)
Definition: process.c:1189
static DWORD shutdown_flags
Definition: process.c:38
BOOL WINAPI DECLSPEC_HOTPATCH SetPriorityClass(HANDLE process, DWORD class)
Definition: process.c:1212
BOOL WINAPI DECLSPEC_HOTPATCH SetStdHandleEx(DWORD std_handle, HANDLE handle, HANDLE *prev)
Definition: process.c:1433
BOOL WINAPI DECLSPEC_HOTPATCH FreeEnvironmentStringsW(LPWSTR ptr)
Definition: process.c:1703
BOOL WINAPI DECLSPEC_HOTPATCH SetProcessShutdownParameters(DWORD level, DWORD flags)
Definition: process.c:1280
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
LPWSTR WINAPI DECLSPEC_HOTPATCH GetEnvironmentStringsW(void)
Definition: process.c:1556
BOOL WINAPI DECLSPEC_HOTPATCH GetProcessShutdownParameters(LPDWORD level, LPDWORD flags)
Definition: process.c:930
BOOL WINAPI DECLSPEC_HOTPATCH DuplicateHandle(HANDLE source_process, HANDLE source, HANDLE dest_process, HANDLE *dest, DWORD access, BOOL inherit, DWORD options)
Definition: process.c:734
BOOL WINAPI SetProcessMitigationPolicy(PROCESS_MITIGATION_POLICY policy, void *buffer, SIZE_T length)
Definition: process.c:1259
DWORD WINAPI kernelbase_GetCurrentProcessId(void)
Definition: process.c:766
BOOL WINAPI DECLSPEC_HOTPATCH GetProcessGroupAffinity(HANDLE process, USHORT *count, USHORT *array)
Definition: process.c:846
BOOL WINAPI DECLSPEC_HOTPATCH IsProcessorFeaturePresent(DWORD feature)
Definition: process.c:1023
HANDLE WINAPI kernelbase_GetProcessHeap(void)
Definition: process.c:885
LPSTR WINAPI DECLSPEC_HOTPATCH GetEnvironmentStringsA(void)
Definition: process.c:1536
static DWORD shutdown_priority
Definition: process.c:39
BOOL WINAPI DECLSPEC_HOTPATCH GetExitCodeProcess(HANDLE process, LPDWORD exit_code)
Definition: process.c:788
void WINAPI DECLSPEC_HOTPATCH DeleteProcThreadAttributeList(struct _PROC_THREAD_ATTRIBUTE_LIST *list)
Definition: process.c:1878
static SIZE_T get_env_length(const WCHAR *env)
Definition: process.c:1457
static char * command_lineA
Definition: process.c:1318
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentStringsA(char *env)
Definition: process.c:1573
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessAsUserA(HANDLE token, const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:437
LPWSTR WINAPI GetCommandLineW(void)
Definition: process.c:1356
LPSTR WINAPI GetCommandLineA(void)
Definition: process.c:1347
BOOL WINAPI DECLSPEC_HOTPATCH GetProcessHandleCount(HANDLE process, DWORD *count)
Definition: process.c:875
void init_startup_info(RTL_USER_PROCESS_PARAMETERS *params)
Definition: process.c:1324
static NTSTATUS create_nt_process(HANDLE token, HANDLE debug, SECURITY_ATTRIBUTES *psa, SECURITY_ATTRIBUTES *tsa, DWORD process_flags, RTL_USER_PROCESS_PARAMETERS *params, RTL_USER_PROCESS_INFORMATION *info, HANDLE parent, USHORT machine, const struct proc_thread_attr *handle_list, const struct proc_thread_attr *job_list)
Definition: process.c:257
static NTSTATUS create_vdm_process(HANDLE token, HANDLE debug, SECURITY_ATTRIBUTES *psa, SECURITY_ATTRIBUTES *tsa, DWORD flags, RTL_USER_PROCESS_PARAMETERS *params, RTL_USER_PROCESS_INFORMATION *info)
Definition: process.c:361
BOOL WINAPI DECLSPEC_HOTPATCH SetProcessAffinityUpdateMode(HANDLE process, DWORD flags)
Definition: process.c:1236
static RTL_USER_PROCESS_PARAMETERS * create_process_params(const WCHAR *filename, const WCHAR *cmdline, const WCHAR *cur_dir, void *env, DWORD flags, const STARTUPINFOW *startup)
Definition: process.c:141
BOOL WINAPI DECLSPEC_HOTPATCH SetStdHandle(DWORD std_handle, HANDLE handle)
Definition: process.c:1417
BOOL WINAPI DECLSPEC_HOTPATCH QueryProcessCycleTime(HANDLE process, ULONG64 *cycle)
Definition: process.c:1152
BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2(HANDLE process, USHORT *machine, USHORT *native_machine)
Definition: process.c:1032
BOOL WINAPI DECLSPEC_HOTPATCH SetProcessWorkingSetSizeEx(HANDLE process, SIZE_T minset, SIZE_T maxset, DWORD flags)
Definition: process.c:1292
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(const WCHAR *app_name, WCHAR *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const WCHAR *cur_dir, STARTUPINFOW *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:700
UINT WINAPI DECLSPEC_HOTPATCH SetHandleCount(UINT count)
Definition: process.c:1180
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(LPCWSTR name, LPCWSTR value)
Definition: process.c:1739
BOOL WINAPI DECLSPEC_HOTPATCH UpdateProcThreadAttribute(struct _PROC_THREAD_ATTRIBUTE_LIST *list, DWORD flags, DWORD_PTR attr, void *value, SIZE_T size, void *prev_ret, SIZE_T *size_ret)
Definition: process.c:1838
static BOOL find_exe_file(const WCHAR *name, WCHAR *buffer, DWORD buflen)
Definition: process.c:49
BOOL WINAPI DECLSPEC_HOTPATCH InitializeProcThreadAttributeList(struct _PROC_THREAD_ATTRIBUTE_LIST *list, DWORD count, DWORD flags, SIZE_T *size)
Definition: process.c:1771
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
#define swprintf
Definition: precomp.h:40
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
#define ULONG_PTR
Definition: config.h:101
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum mode
Definition: glext.h:6217
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
const GLint * first
Definition: glext.h:5794
GLuint GLfloat * val
Definition: glext.h:7180
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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
Definition: glfuncs.h:248
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 token
Definition: glfuncs.h:210
unsigned int UINT
Definition: sysinfo.c:13
static const WCHAR titleW[]
Definition: htmlelem.c:1067
#define PROCESS_CREATE_FLAGS_BREAKAWAY
Definition: pstypes.h:87
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:162
#define PROCESS_CREATE_FLAGS_INHERIT_HANDLES
Definition: pstypes.h:89
#define PROCESS_CREATE_FLAGS_NO_DEBUG_INHERIT
Definition: pstypes.h:88
#define QUOTA_LIMITS_HARDWS_MIN_DISABLE
#define QUOTA_LIMITS_HARDWS_MAX_DISABLE
static TfClientId cid
const char * filename
Definition: ioapi.h:137
#define NtCurrentTeb
uint32_t entry
Definition: isohybrid.c:63
#define e
Definition: ke_i.h:82
static const SecPkgInfoW infoW
Definition: kerberos.c:293
#define debugstr_w
Definition: kernel32.h:32
BOOL is_wow64
Definition: main.c:38
static const BOOL is_win64
Definition: kernelbase.h:49
#define debug(msg)
Definition: key_call.c:71
if(dx< 0)
Definition: linetemp.h:194
BOOL * PBOOL
Definition: minwindef.h:137
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
unsigned __int64 ULONG64
Definition: imports.h:198
static PVOID ptr
Definition: dispmode.c:27
#define PROCESS_QUERY_LIMITED_INFORMATION
Definition: security.c:59
const char * var
Definition: shader.c:5666
static WCHAR load_path[MAX_PATH]
Definition: loader.c:557
#define eq(received, expected, label, type)
Definition: locale.c:179
static BOOL inherit
Definition: process.c:77
static LPCWSTR name
Definition: process.c:76
static UINT exit_code
Definition: process.c:80
static HANDLE job
Definition: process.c:79
static const char machine[]
Definition: profile.c:104
static const struct access_res create[16]
Definition: package.c:7505
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
static WCHAR valueW[]
Definition: reg.c:1394
static char * dest
Definition: rtl.c:149
static USHORT native_machine
Definition: wow64.c:92
INTERNETFEATURELIST feature
Definition: misc.c:1807
static MONITORINFO mi
Definition: win.c:9400
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
#define min(a, b)
Definition: monoChain.cc:55
int disable
Definition: msacm.c:1365
@ SystemSupportedProcessorArchitectures
Definition: extypes.h:414
#define KernelMode
Definition: asm.h:38
#define UserMode
Definition: asm.h:39
@ ObjectHandleFlagInformation
Definition: obtypes.h:267
NTSYSAPI NTSTATUS NTAPI RtlDestroyProcessParameters(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
NTSYSAPI NTSTATUS NTAPI RtlSetEnvironmentVariable(_In_z_ PWSTR *Environment, _In_ PUNICODE_STRING Name, _In_ PUNICODE_STRING Value)
Definition: env.c:338
NTSYSAPI NTSTATUS NTAPI RtlCreateEnvironment(_In_ BOOLEAN Inherit, _Out_ PWSTR *Environment)
Definition: env.c:31
NTSYSAPI VOID NTAPI RtlDestroyEnvironment(_In_ PWSTR Environment)
Definition: env.c:116
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI PRTL_USER_PROCESS_PARAMETERS NTAPI RtlNormalizeProcessParams(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
NTSYSAPI NTSTATUS NTAPI RtlQueryEnvironmentVariable_U(_In_opt_ PWSTR Environment, _In_ PCUNICODE_STRING Name, _Out_ PUNICODE_STRING Value)
Definition: env.c:659
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
LPCWSTR app_name
Definition: notevil.c:34
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1342
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1327
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3429
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define UNICODE_STRING_MAX_CHARS
PROCESSOR_NUMBER
Definition: ntbasedef.h:654
static void ULONG *static PIO_STATUS_BLOCK void ULONG FS_INFORMATION_CLASS info_class
Definition: pipe.c:102
NTSTATUS NTAPI NtIsProcessInJob(_In_ HANDLE ProcessHandle, _In_opt_ HANDLE JobHandle)
Definition: job.c:2014
NTSTATUS NTAPI NtOpenProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId)
Definition: process.c:1470
NTSTATUS NTAPI NtSetInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _In_reads_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength)
Definition: query.c:1422
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_to_opt_(ProcessInformationLength, *ReturnLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:211
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
#define STATUS_INVALID_IMAGE_WIN_16
Definition: ntstatus.h:635
#define STATUS_INVALID_IMAGE_NE_FORMAT
Definition: ntstatus.h:613
#define STATUS_PROCESS_IN_JOB
Definition: ntstatus.h:161
#define STATUS_PROCESS_NOT_IN_JOB
Definition: ntstatus.h:160
#define STATUS_INVALID_IMAGE_NOT_MZ
Definition: ntstatus.h:633
#define STATUS_INVALID_IMAGE_PROTECT
Definition: ntstatus.h:634
NTSTATUS NTAPI NtDuplicateObject(IN HANDLE SourceProcessHandle, IN HANDLE SourceHandle, IN HANDLE TargetProcessHandle OPTIONAL, OUT PHANDLE TargetHandle OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG HandleAttributes, IN ULONG Options)
Definition: obhandle.c:3437
NTSTATUS NTAPI NtSetInformationObject(_In_ HANDLE ObjectHandle, _In_ OBJECT_INFORMATION_CLASS ObjectInformationClass, _In_reads_bytes_(Length) PVOID ObjectInformation, _In_ ULONG Length)
Sets information for an object or for a handle to an object.
Definition: oblife.c:1845
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
@ ProcessMachineTypeInfo
@ ProcessLeapSecondInfo
@ ProcessMemoryPriority
@ ProcessPowerThrottling
enum _PROCESS_INFORMATION_CLASS PROCESS_INFORMATION_CLASS
static BOOL wow64
Definition: psapi_main.c:44
#define OBJ_INHERIT
Definition: winternl.h:225
#define err(...)
#define get_file_name
Definition: regproc.h:51
#define offsetof(TYPE, MEMBER)
#define CONSOLE_HANDLE_ALLOC
Definition: condrv.h:198
#define CONSOLE_HANDLE_ALLOC_NO_WINDOW
Definition: condrv.h:199
#define exit(n)
Definition: config.h:202
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
struct proc_thread_attr attrs[1]
Definition: process.c:251
LPVOID lpSecurityDescriptor
Definition: compat.h:193
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: undname.c:54
Definition: cookie.c:202
Definition: name.c:39
DWORD_PTR attr
Definition: process.c:239
void * value
Definition: process.c:241
HANDLE reference
Definition: kernelbase.h:35
HANDLE process
Definition: kernelbase.h:36
Definition: ps.c:97
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint16_t * LPWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
uint64_t DWORD64
Definition: typedefs.h:67
char * LPSTR
Definition: typedefs.h:51
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES
Definition: pdh_main.c:96
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
static UINT WPARAM LPARAM BOOL ansi
Definition: misc.c:135
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:186
#define STD_OUTPUT_HANDLE
Definition: winbase.h:293
#define STD_INPUT_HANDLE
Definition: winbase.h:292
#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
Definition: winbase.h:1148
#define CREATE_BREAKAWAY_FROM_JOB
Definition: winbase.h:214
#define PROC_THREAD_ATTRIBUTE_JOB_LIST
Definition: winbase.h:1143
#define PROFILE_SERVER
Definition: winbase.h:220
#define REALTIME_PRIORITY_CLASS
Definition: winbase.h:189
#define HANDLE_FLAG_PROTECT_FROM_CLOSE
Definition: winbase.h:290
#define BELOW_NORMAL_PRIORITY_CLASS
Definition: winbase.h:195
#define CREATE_UNICODE_ENVIRONMENT
Definition: winbase.h:191
#define HIGH_PRIORITY_CLASS
Definition: winbase.h:188
#define HANDLE_FLAG_INHERIT
Definition: winbase.h:289
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1205
#define PROC_THREAD_ATTRIBUTE_NUMBER
Definition: winbase.h:1100
#define CREATE_NO_WINDOW
Definition: winbase.h:217
#define STD_ERROR_HANDLE
Definition: winbase.h:294
#define PROC_THREAD_ATTRIBUTE_EXTENDED_FLAGS
Definition: winbase.h:1134
#define CREATE_DEFAULT_ERROR_MODE
Definition: winbase.h:216
#define CREATE_NEW_PROCESS_GROUP
Definition: winbase.h:190
#define PROFILE_KERNEL
Definition: winbase.h:219
#define CREATE_SUSPENDED
Definition: winbase.h:183
#define PROC_THREAD_ATTRIBUTE_MACHINE_TYPE
Definition: winbase.h:1150
#define PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
Definition: winbase.h:1133
#define EXTENDED_STARTUPINFO_PRESENT
Definition: winbase.h:205
#define DEBUG_ONLY_THIS_PROCESS
Definition: winbase.h:182
#define PROC_THREAD_ATTRIBUTE_HANDLE_LIST
Definition: winbase.h:1135
#define PROFILE_USER
Definition: winbase.h:218
#define STARTF_USESTDHANDLES
Definition: winbase.h:476
#define IDLE_PRIORITY_CLASS
Definition: winbase.h:187
#define DETACHED_PROCESS
Definition: winbase.h:184
#define CREATE_NEW_CONSOLE
Definition: winbase.h:185
#define DEBUG_PROCESS
Definition: winbase.h:181
#define PROC_THREAD_ATTRIBUTE_CHILD_PROCESS_POLICY
Definition: winbase.h:1144
#define ABOVE_NORMAL_PRIORITY_CLASS
Definition: winbase.h:196
#define PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY
Definition: winbase.h:1140
#define PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR
Definition: winbase.h:1138
_Inout_ PERBANDINFO * pbi
Definition: winddi.h:3917
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define WINAPI
Definition: msvc.h:6
NTSYSAPI void WINAPI RtlReleasePebLock(void)
Definition: libsupp.c:84
NTSYSAPI NTSTATUS WINAPI DbgUiConnectToDbg(void)
Definition: dbgui.c:25
NTSYSAPI NTSTATUS WINAPI RtlWow64GetProcessMachines(HANDLE, USHORT *, USHORT *)
NTSYSAPI NTSTATUS WINAPI NtCreateUserProcess(HANDLE *, HANDLE *, ACCESS_MASK, ACCESS_MASK, OBJECT_ATTRIBUTES *, OBJECT_ATTRIBUTES *, ULONG, ULONG, RTL_USER_PROCESS_PARAMETERS *, PS_CREATE_INFO *, PS_ATTRIBUTE_LIST *)
#define PROCESS_PRIOCLASS_REALTIME
Definition: winternl.h:2756
#define PS_ATTRIBUTE_IMAGE_NAME
Definition: winternl.h:4157
#define PROCESS_PRIOCLASS_ABOVE_NORMAL
Definition: winternl.h:2758
NTSYSAPI NTSTATUS WINAPI NtQuerySystemInformationEx(SYSTEM_INFORMATION_CLASS, void *, ULONG, void *, ULONG, ULONG *)
NTSYSAPI void WINAPI RtlAcquirePebLock(void)
Definition: libsupp.c:74
#define PROCESS_PRIOCLASS_NORMAL
Definition: winternl.h:2754
#define PS_ATTRIBUTE_CLIENT_ID
Definition: winternl.h:4155
NTSYSAPI NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PCWSTR, const UNICODE_STRING *, UNICODE_STRING *, ULONG *)
NTSYSAPI HANDLE WINAPI DbgUiGetThreadDebugObject(void)
Definition: dbgui.c:333
NTSYSAPI NTSTATUS WINAPI RtlCreateProcessParametersEx(RTL_USER_PROCESS_PARAMETERS **, const UNICODE_STRING *, const UNICODE_STRING *, const UNICODE_STRING *, const UNICODE_STRING *, PWSTR, const UNICODE_STRING *, const UNICODE_STRING *, const UNICODE_STRING *, const UNICODE_STRING *, ULONG)
#define PROCESS_PRIOCLASS_HIGH
Definition: winternl.h:2755
#define PS_ATTRIBUTE_DEBUG_PORT
Definition: winternl.h:4153
#define PROCESS_PRIOCLASS_IDLE
Definition: winternl.h:2753
#define PS_ATTRIBUTE_IMAGE_INFO
Definition: winternl.h:4158
NTSYSAPI void WINAPI RtlReleasePath(PWSTR)
#define PS_ATTRIBUTE_HANDLE_LIST
Definition: winternl.h:4163
@ ProcessPagePriority
Definition: winternl.h:1921
@ ProcessSessionInformation
Definition: winternl.h:1906
@ ProcessPowerThrottlingState
Definition: winternl.h:1959
@ ProcessPriorityClass
Definition: winternl.h:1900
@ ProcessLeapSecondInformation
Definition: winternl.h:1979
@ ProcessImageInformation
Definition: winternl.h:1919
@ ProcessDefaultHardErrorMode
Definition: winternl.h:1894
@ ProcessCycleTime
Definition: winternl.h:1920
@ ProcessTimes
Definition: winternl.h:1886
@ ProcessHandleCount
Definition: winternl.h:1902
NTSYSAPI NTSTATUS WINAPI RtlGetExePath(PCWSTR, PWSTR *)
#define PROCESS_PRIOCLASS_BELOW_NORMAL
Definition: winternl.h:2757
NTSYSAPI PEB *WINAPI RtlGetCurrentPeb(void)
Definition: libsupp.c:65
#define PS_ATTRIBUTE_TOKEN
Definition: winternl.h:4154
NTSYSAPI NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(PCWSTR, PUNICODE_STRING, PWSTR *, CURDIR *)
#define PROCESS_CREATE_FLAGS_SUSPENDED
Definition: winternl.h:4066
#define THREAD_CREATE_FLAGS_CREATE_SUSPENDED
Definition: winternl.h:4078
NTSYSAPI BOOLEAN WINAPI RtlIsProcessorFeaturePresent(UINT)
#define PS_ATTRIBUTE_PARENT_PROCESS
Definition: winternl.h:4152
NTSYSAPI NTSTATUS WINAPI NtCompareObjects(HANDLE, HANDLE)
#define PS_ATTRIBUTE_JOB_LIST
Definition: winternl.h:4170
NTSYSAPI void WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR *)
#define PROCESS_PARAMS_FLAG_NORMALIZED
Definition: winternl.h:299
#define PS_ATTRIBUTE_MACHINE_TYPE
Definition: winternl.h:4179
@ KernelEnabled
Definition: winehacks.h:19
@ Wow64Container
Definition: winehacks.h:20
@ UserEnabled
Definition: winehacks.h:18
#define ERROR_OBJECT_NAME_EXISTS
Definition: winerror.h:776
#define ERROR_BAD_LENGTH
Definition: winerror.h:249
#define ERROR_GEN_FAILURE
Definition: winerror.h:256
#define ERROR_ENVVAR_NOT_FOUND
Definition: winerror.h:383
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151