2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/kernel32/process/create.c
5 * PURPOSE: Process functions
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 * Ariadne ( ariadne@xs4all.nl)
10 /* INCLUDES ****************************************************************/
17 #define CMD_STRING L"cmd /c "
19 extern __declspec(noreturn
)
22 ConsoleControlDispatcher(DWORD CodeAndFlag
);
24 /* INTERNAL FUNCTIONS *******************************************************/
26 _SEH_FILTER(BaseExceptionFilter
)
28 EXCEPTION_POINTERS
*ExceptionInfo
= _SEH_GetExceptionPointers();
29 LONG ExceptionDisposition
= EXCEPTION_EXECUTE_HANDLER
;
31 if (GlobalTopLevelExceptionFilter
!= NULL
)
35 ExceptionDisposition
= GlobalTopLevelExceptionFilter(ExceptionInfo
);
42 if ((ExceptionDisposition
== EXCEPTION_CONTINUE_SEARCH
|| ExceptionDisposition
== EXCEPTION_EXECUTE_HANDLER
) &&
43 GlobalTopLevelExceptionFilter
!= UnhandledExceptionFilter
)
45 ExceptionDisposition
= UnhandledExceptionFilter(ExceptionInfo
);
48 return ExceptionDisposition
;
53 BaseProcessStartup(PPROCESS_START_ROUTINE lpStartAddress
)
57 DPRINT("BaseProcessStartup(..) - setting up exception frame.\n");
61 /* Set our Start Address */
62 NtSetInformationThread(NtCurrentThread(),
63 ThreadQuerySetWin32StartAddress
,
65 sizeof(PPROCESS_START_ROUTINE
));
67 /* Call the Start Routine */
68 uExitCode
= (lpStartAddress
)();
70 _SEH_EXCEPT(BaseExceptionFilter
)
72 /* Get the SEH Error */
73 uExitCode
= _SEH_GetExceptionCode();
77 /* Exit the Process with our error */
78 ExitProcess(uExitCode
);
82 * Tells CSR that a new process was created
86 BasepNotifyCsrOfCreation(ULONG dwCreationFlags
,
88 IN BOOL InheritHandles
)
90 ULONG Request
= CREATE_PROCESS
;
91 CSR_API_MESSAGE CsrRequest
;
94 DPRINT("BasepNotifyCsrOfCreation: Process: %lx, Flags %lx\n",
95 ProcessId
, dwCreationFlags
);
97 /* Fill out the request */
98 CsrRequest
.Data
.CreateProcessRequest
.NewProcessId
= ProcessId
;
99 CsrRequest
.Data
.CreateProcessRequest
.Flags
= dwCreationFlags
;
100 CsrRequest
.Data
.CreateProcessRequest
.bInheritHandles
= InheritHandles
;
103 Status
= CsrClientCallServer(&CsrRequest
,
105 MAKE_CSR_API(Request
, CSR_NATIVE
),
106 sizeof(CSR_API_MESSAGE
));
107 if (!NT_SUCCESS(Status
) || !NT_SUCCESS(CsrRequest
.Status
))
109 DPRINT1("Failed to tell csrss about new process\n");
110 return CsrRequest
.Status
;
114 return STATUS_SUCCESS
;
118 * Creates the first Thread in a Proces
122 BasepCreateFirstThread(HANDLE ProcessHandle
,
123 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
124 PSECTION_IMAGE_INFORMATION SectionImageInfo
,
127 OBJECT_ATTRIBUTES LocalObjectAttributes
;
128 POBJECT_ATTRIBUTES ObjectAttributes
;
130 INITIAL_TEB InitialTeb
;
134 DPRINT("BasepCreateFirstThread. hProcess: %lx\n", ProcessHandle
);
136 /* Create the Thread's Stack */
137 BasepCreateStack(ProcessHandle
,
138 SectionImageInfo
->MaximumStackSize
,
139 SectionImageInfo
->CommittedStackSize
,
142 /* Create the Thread's Context */
143 BasepInitializeContext(&Context
,
145 SectionImageInfo
->TransferAddress
,
146 InitialTeb
.StackBase
,
149 /* Convert the thread attributes */
150 ObjectAttributes
= BasepConvertObjectAttributes(&LocalObjectAttributes
,
154 /* Create the Kernel Thread Object */
155 Status
= NtCreateThread(&hThread
,
163 if (!NT_SUCCESS(Status
))
173 * Converts ANSI to Unicode Environment
177 BasepConvertUnicodeEnvironment(OUT SIZE_T
* EnvSize
,
178 IN PVOID lpEnvironment
)
182 UNICODE_STRING UnicodeEnv
;
185 DPRINT("BasepConvertUnicodeEnvironment\n");
187 /* Scan the environment to calculate its Unicode size */
188 AnsiEnv
.Buffer
= pcScan
= (PCHAR
)lpEnvironment
;
191 pcScan
+= strlen(pcScan
) + 1;
194 /* Create our ANSI String */
195 if (pcScan
== (PCHAR
)lpEnvironment
)
197 AnsiEnv
.Length
= 2 * sizeof(CHAR
);
202 AnsiEnv
.Length
= (USHORT
)((ULONG_PTR
)pcScan
- (ULONG_PTR
)lpEnvironment
+ sizeof(CHAR
));
204 AnsiEnv
.MaximumLength
= AnsiEnv
.Length
+ 1;
206 /* Allocate memory for the Unicode Environment */
207 UnicodeEnv
.Buffer
= NULL
;
208 *EnvSize
= AnsiEnv
.MaximumLength
* sizeof(WCHAR
);
209 Status
= NtAllocateVirtualMemory(NtCurrentProcess(),
210 (PVOID
)&UnicodeEnv
.Buffer
,
216 if (!NT_SUCCESS(Status
))
218 SetLastError(Status
);
223 /* Use the allocated size */
224 UnicodeEnv
.MaximumLength
= (USHORT
)*EnvSize
;
227 RtlAnsiStringToUnicodeString(&UnicodeEnv
, &AnsiEnv
, FALSE
);
228 return UnicodeEnv
.Buffer
;
232 * Converts a Win32 Priority Class to NT
236 BasepConvertPriorityClass(IN ULONG dwCreationFlags
)
240 if(dwCreationFlags
& IDLE_PRIORITY_CLASS
)
242 ReturnClass
= PROCESS_PRIORITY_CLASS_IDLE
;
244 else if(dwCreationFlags
& BELOW_NORMAL_PRIORITY_CLASS
)
246 ReturnClass
= PROCESS_PRIORITY_CLASS_BELOW_NORMAL
;
248 else if(dwCreationFlags
& NORMAL_PRIORITY_CLASS
)
250 ReturnClass
= PROCESS_PRIORITY_CLASS_NORMAL
;
252 else if(dwCreationFlags
& ABOVE_NORMAL_PRIORITY_CLASS
)
254 ReturnClass
= PROCESS_PRIORITY_CLASS_ABOVE_NORMAL
;
256 else if(dwCreationFlags
& HIGH_PRIORITY_CLASS
)
258 ReturnClass
= PROCESS_PRIORITY_CLASS_HIGH
;
260 else if(dwCreationFlags
& REALTIME_PRIORITY_CLASS
)
262 /* Check for Privilege First */
263 if (BasepCheckRealTimePrivilege())
265 ReturnClass
= PROCESS_PRIORITY_CLASS_REALTIME
;
269 ReturnClass
= PROCESS_PRIORITY_CLASS_HIGH
;
274 ReturnClass
= PROCESS_PRIORITY_CLASS_INVALID
;
281 * Duplicates a standard handle and writes it where requested.
285 BasepDuplicateAndWriteHandle(IN HANDLE ProcessHandle
,
286 IN HANDLE StandardHandle
,
290 HANDLE DuplicatedHandle
;
293 DPRINT("BasepDuplicateAndWriteHandle. hProcess: %lx, Handle: %lx,"
294 "Address: %p\n", ProcessHandle
, StandardHandle
, Address
);
296 /* Don't touch Console Handles */
297 if (IsConsoleHandle(StandardHandle
)) return;
299 /* Duplicate the handle */
300 Status
= NtDuplicateObject(NtCurrentProcess(),
304 DUPLICATE_SAME_ACCESS
| DUPLICATE_SAME_ATTRIBUTES
,
307 if (NT_SUCCESS(Status
))
310 NtWriteVirtualMemory(ProcessHandle
,
320 BasepGetDllPath(LPWSTR FullPath
,
323 /* FIXME: Not yet implemented */
329 BasepCopyHandles(IN PRTL_USER_PROCESS_PARAMETERS Params
,
330 IN PRTL_USER_PROCESS_PARAMETERS PebParams
,
331 IN BOOL InheritHandles
)
333 DPRINT("BasepCopyHandles %p %p, %d\n", Params
, PebParams
, InheritHandles
);
335 /* Copy the handle if we are inheriting or if it's a console handle */
336 if (InheritHandles
|| IsConsoleHandle(PebParams
->StandardInput
))
338 Params
->StandardInput
= PebParams
->StandardInput
;
340 if (InheritHandles
|| IsConsoleHandle(PebParams
->StandardOutput
))
342 Params
->StandardOutput
= PebParams
->StandardOutput
;
344 if (InheritHandles
|| IsConsoleHandle(PebParams
->StandardError
))
346 Params
->StandardError
= PebParams
->StandardError
;
352 BasepInitializeEnvironment(HANDLE ProcessHandle
,
354 LPWSTR ApplicationPathName
,
355 LPWSTR lpCurrentDirectory
,
356 LPWSTR lpCommandLine
,
357 LPVOID lpEnvironment
,
359 LPSTARTUPINFOW StartupInfo
,
363 WCHAR FullPath
[MAX_PATH
];
365 LPWSTR DllPathString
;
366 PRTL_USER_PROCESS_PARAMETERS ProcessParameters
;
367 PRTL_USER_PROCESS_PARAMETERS RemoteParameters
= NULL
;
368 UNICODE_STRING DllPath
, ImageName
, CommandLine
, CurrentDirectory
;
374 UNICODE_STRING Desktop
, Shell
, Runtime
, Title
;
375 PPEB OurPeb
= NtCurrentPeb();
376 LPVOID Environment
= lpEnvironment
;
378 DPRINT("BasepInitializeEnvironment\n");
380 /* Get the full path name */
381 RetVal
= GetFullPathNameW(ApplicationPathName
,
385 DPRINT("ApplicationPathName: %S, FullPath: %S\n", ApplicationPathName
,
388 /* Get the DLL Path */
389 DllPathString
= BasepGetDllPath(FullPath
, Environment
);
391 /* Initialize Strings */
392 RtlInitUnicodeString(&DllPath
, DllPathString
);
393 RtlInitUnicodeString(&ImageName
, FullPath
);
394 RtlInitUnicodeString(&CommandLine
, lpCommandLine
);
395 RtlInitUnicodeString(&CurrentDirectory
, lpCurrentDirectory
);
397 /* Initialize more Strings from the Startup Info */
398 if (StartupInfo
->lpDesktop
)
400 RtlInitUnicodeString(&Desktop
, StartupInfo
->lpDesktop
);
404 RtlInitUnicodeString(&Desktop
, L
"");
406 if (StartupInfo
->lpReserved
)
408 RtlInitUnicodeString(&Shell
, StartupInfo
->lpReserved
);
412 RtlInitUnicodeString(&Shell
, L
"");
414 if (StartupInfo
->lpTitle
)
416 RtlInitUnicodeString(&Title
, StartupInfo
->lpTitle
);
420 RtlInitUnicodeString(&Title
, L
"");
423 /* This one is special because the length can differ */
424 Runtime
.Buffer
= (LPWSTR
)StartupInfo
->lpReserved2
;
425 Runtime
.MaximumLength
= Runtime
.Length
= StartupInfo
->cbReserved2
;
427 /* Create the Parameter Block */
428 DPRINT("Creating Process Parameters: %wZ %wZ %wZ %wZ %wZ %wZ %wZ\n",
429 &ImageName
, &DllPath
, &CommandLine
, &Desktop
, &Title
, &Shell
,
431 Status
= RtlCreateProcessParameters(&ProcessParameters
,
435 &CurrentDirectory
: NULL
,
443 if (!NT_SUCCESS(Status
))
445 DPRINT1("Failed to create process parameters!\n");
449 /* Check if we got an environment. If not, use ours */
452 /* Save pointer and start lookup */
453 Environment
= ScanChar
= ProcessParameters
->Environment
;
457 /* Save pointer and start lookup */
458 Environment
= ScanChar
= OurPeb
->ProcessParameters
->Environment
;
461 /* Find the environment size */
464 if (EnvSize
&& Environment
== lpEnvironment
)
466 /* its a converted ansi environment, bypass the length calculation */
467 EnviroSize
= EnvSize
;
473 ScanChar
+= wcslen(ScanChar
) + 1;
476 /* Calculate the size of the block */
477 if (ScanChar
== Environment
)
479 EnviroSize
= 2 * sizeof(WCHAR
);
483 EnviroSize
= (ULONG
)((ULONG_PTR
)ScanChar
- (ULONG_PTR
)Environment
+ sizeof(WCHAR
));
486 DPRINT("EnvironmentSize %ld\n", EnviroSize
);
488 /* Allocate and Initialize new Environment Block */
490 ProcessParameters
->Environment
= NULL
;
491 Status
= ZwAllocateVirtualMemory(ProcessHandle
,
492 (PVOID
*)&ProcessParameters
->Environment
,
497 if (!NT_SUCCESS(Status
))
499 DPRINT1("Failed to allocate Environment Block\n");
503 /* Write the Environment Block */
504 ZwWriteVirtualMemory(ProcessHandle
,
505 ProcessParameters
->Environment
,
511 /* Write new parameters */
512 ProcessParameters
->StartingX
= StartupInfo
->dwX
;
513 ProcessParameters
->StartingY
= StartupInfo
->dwY
;
514 ProcessParameters
->CountX
= StartupInfo
->dwXSize
;
515 ProcessParameters
->CountY
= StartupInfo
->dwYSize
;
516 ProcessParameters
->CountCharsX
= StartupInfo
->dwXCountChars
;
517 ProcessParameters
->CountCharsY
= StartupInfo
->dwYCountChars
;
518 ProcessParameters
->FillAttribute
= StartupInfo
->dwFillAttribute
;
519 ProcessParameters
->WindowFlags
= StartupInfo
->dwFlags
;
520 ProcessParameters
->ShowWindowFlags
= StartupInfo
->wShowWindow
;
522 /* Write the handles only if we have to */
523 if (StartupInfo
->dwFlags
& STARTF_USESTDHANDLES
)
525 DPRINT("Using Standard Handles\n");
526 ProcessParameters
->StandardInput
= StartupInfo
->hStdInput
;
527 ProcessParameters
->StandardOutput
= StartupInfo
->hStdOutput
;
528 ProcessParameters
->StandardError
= StartupInfo
->hStdError
;
531 /* Use Special Flags for ConDllInitialize in Kernel32 */
532 if (CreationFlags
& DETACHED_PROCESS
)
534 ProcessParameters
->ConsoleHandle
= HANDLE_DETACHED_PROCESS
;
536 else if (CreationFlags
& CREATE_NO_WINDOW
)
538 ProcessParameters
->ConsoleHandle
= HANDLE_CREATE_NO_WINDOW
;
540 else if (CreationFlags
& CREATE_NEW_CONSOLE
)
542 ProcessParameters
->ConsoleHandle
= HANDLE_CREATE_NEW_CONSOLE
;
546 /* Inherit our Console Handle */
547 ProcessParameters
->ConsoleHandle
= OurPeb
->ProcessParameters
->ConsoleHandle
;
549 /* Is the shell trampling on our Handles? */
550 if (!(StartupInfo
->dwFlags
&
551 (STARTF_USESTDHANDLES
| STARTF_USEHOTKEY
| STARTF_SHELLPRIVATE
)))
553 /* Use handles from PEB, if inheriting or they are console */
554 DPRINT("Copying handles from parent\n");
555 BasepCopyHandles(ProcessParameters
,
556 OurPeb
->ProcessParameters
,
561 /* Also set the Console Flag */
562 if (CreationFlags
& CREATE_NEW_PROCESS_GROUP
)
564 ProcessParameters
->ConsoleFlags
= 1;
567 /* Allocate memory for the parameter block */
568 Size
= ProcessParameters
->Length
;
569 Status
= NtAllocateVirtualMemory(ProcessHandle
,
570 (PVOID
*)&RemoteParameters
,
575 if (!NT_SUCCESS(Status
))
577 DPRINT1("Failed to allocate Parameters Block\n");
581 /* Set the allocated size */
582 ProcessParameters
->MaximumLength
= Size
;
584 /* Handle some Parameter Flags */
585 ProcessParameters
->ConsoleFlags
= (CreationFlags
& CREATE_NEW_PROCESS_GROUP
);
586 ProcessParameters
->Flags
|= (CreationFlags
& PROFILE_USER
) ?
587 RTL_USER_PROCESS_PARAMETERS_PROFILE_USER
: 0;
588 ProcessParameters
->Flags
|= (CreationFlags
& PROFILE_KERNEL
) ?
589 RTL_USER_PROCESS_PARAMETERS_PROFILE_KERNEL
: 0;
590 ProcessParameters
->Flags
|= (CreationFlags
& PROFILE_SERVER
) ?
591 RTL_USER_PROCESS_PARAMETERS_PROFILE_SERVER
: 0;
592 ProcessParameters
->Flags
|= (NtCurrentPeb()->ProcessParameters
->Flags
&
593 RTL_USER_PROCESS_PARAMETERS_DISABLE_HEAP_CHECKS
);
595 /* Write the Parameter Block */
596 Status
= NtWriteVirtualMemory(ProcessHandle
,
599 ProcessParameters
->Length
,
602 /* Write the PEB Pointer */
603 Status
= NtWriteVirtualMemory(ProcessHandle
,
604 &Peb
->ProcessParameters
,
610 RtlFreeHeap(RtlGetProcessHeap(), 0, DllPath
.Buffer
);
611 RtlDestroyProcessParameters(ProcessParameters
);
613 DPRINT("Completed\n");
614 return STATUS_SUCCESS
;
617 /* FUNCTIONS ****************************************************************/
624 CreateProcessInternalW(HANDLE hToken
,
625 LPCWSTR lpApplicationName
,
626 LPWSTR lpCommandLine
,
627 LPSECURITY_ATTRIBUTES lpProcessAttributes
,
628 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
629 BOOL bInheritHandles
,
630 DWORD dwCreationFlags
,
631 LPVOID lpEnvironment
,
632 LPCWSTR lpCurrentDirectory
,
633 LPSTARTUPINFOW lpStartupInfo
,
634 LPPROCESS_INFORMATION lpProcessInformation
,
638 PROCESS_PRIORITY_CLASS PriorityClass
;
639 BOOLEAN FoundQuotes
= FALSE
;
640 BOOLEAN QuotesNeeded
= FALSE
;
641 BOOLEAN CmdLineIsAppName
= FALSE
;
642 UNICODE_STRING ApplicationName
= {0};
643 OBJECT_ATTRIBUTES LocalObjectAttributes
;
644 POBJECT_ATTRIBUTES ObjectAttributes
;
645 HANDLE hSection
= NULL
, hProcess
= NULL
, hThread
= NULL
, hDebug
= NULL
;
646 SECTION_IMAGE_INFORMATION SectionImageInfo
;
647 LPWSTR CurrentDirectory
= NULL
;
648 LPWSTR CurrentDirectoryPart
;
649 PROCESS_BASIC_INFORMATION ProcessBasicInfo
;
650 STARTUPINFOW StartupInfo
;
652 LPWSTR BatchCommandLine
;
654 UNICODE_STRING CommandLineString
;
656 LPWSTR QuotedCmdLine
= NULL
;
658 LPWSTR NullBuffer
= NULL
;
659 LPWSTR NameBuffer
= NULL
;
663 BOOLEAN SearchDone
= FALSE
;
664 BOOLEAN Escape
= FALSE
;
666 PPEB OurPeb
= NtCurrentPeb();
671 /* FIXME should process
672 * HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
673 * key (see http://blogs.msdn.com/oldnewthing/archive/2005/12/19/505449.aspx)
676 DPRINT("CreateProcessW: lpApplicationName: %S lpCommandLine: %S"
677 " lpEnvironment: %p lpCurrentDirectory: %S dwCreationFlags: %lx\n",
678 lpApplicationName
, lpCommandLine
, lpEnvironment
, lpCurrentDirectory
,
681 /* Flags we don't handle yet */
682 if (dwCreationFlags
& CREATE_SEPARATE_WOW_VDM
)
684 DPRINT1("CREATE_SEPARATE_WOW_VDM not handled\n");
686 if (dwCreationFlags
& CREATE_SHARED_WOW_VDM
)
688 DPRINT1("CREATE_SHARED_WOW_VDM not handled\n");
690 if (dwCreationFlags
& CREATE_FORCEDOS
)
692 DPRINT1("CREATE_FORCEDOS not handled\n");
695 /* Fail on this flag, it's only valid with the WithLogonW function */
696 if (dwCreationFlags
& CREATE_PRESERVE_CODE_AUTHZ_LEVEL
)
698 DPRINT1("Invalid flag used\n");
699 SetLastError(ERROR_INVALID_PARAMETER
);
703 /* This combination is illegal (see MSDN) */
704 if ((dwCreationFlags
& (DETACHED_PROCESS
| CREATE_NEW_CONSOLE
)) ==
705 (DETACHED_PROCESS
| CREATE_NEW_CONSOLE
))
707 DPRINT1("Invalid flag combo used\n");
708 SetLastError(ERROR_INVALID_PARAMETER
);
712 /* Another illegal combo */
713 if ((dwCreationFlags
& (CREATE_SEPARATE_WOW_VDM
| CREATE_SHARED_WOW_VDM
)) ==
714 (CREATE_SEPARATE_WOW_VDM
| CREATE_SHARED_WOW_VDM
))
716 DPRINT1("Invalid flag combo used\n");
717 SetLastError(ERROR_INVALID_PARAMETER
);
722 * We're going to modify and mask out flags and stuff in lpStartupInfo,
723 * so we'll use our own local copy for that.
725 StartupInfo
= *lpStartupInfo
;
727 /* FIXME: Use default Separate/Shared VDM Flag */
729 /* If we are inside a Job, use Separate VDM so it won't escape the Job */
730 if (!(dwCreationFlags
& CREATE_SEPARATE_WOW_VDM
))
732 if (NtIsProcessInJob(NtCurrentProcess(), NULL
))
734 /* Remove the shared flag and add the separate flag. */
735 dwCreationFlags
= (dwCreationFlags
&~ CREATE_SHARED_WOW_VDM
) |
736 CREATE_SEPARATE_WOW_VDM
;
741 * According to some sites, ShellExecuteEx uses an undocumented flag to
742 * send private handle data (such as HMONITOR or HICON). See:
743 * www.catch22.net/tuts/undoc01.asp. This implies that we can't use the
744 * standard handles anymore since we'd be overwriting this private data
746 if ((StartupInfo
.dwFlags
& STARTF_USESTDHANDLES
) &&
747 (StartupInfo
.dwFlags
& (STARTF_USEHOTKEY
| STARTF_SHELLPRIVATE
)))
749 StartupInfo
.dwFlags
&= ~STARTF_USESTDHANDLES
;
752 /* Start by zeroing out the fields */
753 RtlZeroMemory(lpProcessInformation
, sizeof(PROCESS_INFORMATION
));
755 /* Easy stuff first, convert the process priority class */
756 PriorityClass
.Foreground
= FALSE
;
757 PriorityClass
.PriorityClass
= (UCHAR
)BasepConvertPriorityClass(dwCreationFlags
);
761 /* Serach for escape sequences */
762 ScanString
= lpCommandLine
;
763 while (NULL
!= (ScanString
= wcschr(ScanString
, L
'^')))
766 if (*ScanString
== L
'\"' || *ScanString
== L
'^' || *ScanString
== L
'\"')
774 /* Get the application name and do all the proper formating necessary */
776 /* See if we have an application name (oh please let us have one!) */
777 if (!lpApplicationName
)
780 NameBuffer
= RtlAllocateHeap(RtlGetProcessHeap(),
782 MAX_PATH
* sizeof(WCHAR
));
783 if (NameBuffer
== NULL
)
785 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
789 /* This is all we have to work with :( */
790 lpApplicationName
= lpCommandLine
;
792 /* Initialize our friends at the beginning */
793 NullBuffer
= (LPWSTR
)lpApplicationName
;
794 ScanString
= (LPWSTR
)lpApplicationName
;
796 /* We will start by looking for a quote */
797 if (*ScanString
== L
'\"')
802 /* Advance past quote */
804 lpApplicationName
= ScanString
;
806 /* Find the closing quote */
809 if (*ScanString
== L
'\"' && *(ScanString
- 1) != L
'^')
812 NullBuffer
= ScanString
;
819 NullBuffer
= ScanString
;
824 /* No quotes, so we'll be looking for white space */
826 /* Reset the pointer */
827 lpApplicationName
= lpCommandLine
;
829 /* Find whitespace of Tab */
832 if (*ScanString
== ' ' || *ScanString
== '\t')
835 NullBuffer
= ScanString
;
841 NullBuffer
= ScanString
;
845 /* Set the Null Buffer */
846 SaveChar
= *NullBuffer
;
847 *NullBuffer
= UNICODE_NULL
;
849 /* Do a search for the file */
850 DPRINT("Ready for SearchPathW: %S\n", lpApplicationName
);
851 RetVal
= SearchPathW(NULL
,
856 NULL
) * sizeof(WCHAR
);
858 /* Did it find something? */
861 /* Get file attributes */
862 ULONG Attributes
= GetFileAttributesW(NameBuffer
);
863 if (Attributes
& FILE_ATTRIBUTE_DIRECTORY
)
865 /* Give it a length of 0 to fail, this was a directory. */
871 RetVal
+= sizeof(WCHAR
);
875 /* Now check if we have a file, and if the path size is OK */
876 if (!RetVal
|| RetVal
>= (MAX_PATH
* sizeof(WCHAR
)))
881 /* We failed, try to get the Path Type */
882 DPRINT("SearchPathW failed. Retval: %ld\n", RetVal
);
883 PathType
= RtlDetermineDosPathNameType_U(lpApplicationName
);
885 /* If it's not relative, try to get the error */
886 if (PathType
!= RtlPathTypeRelative
)
888 /* This should fail, and give us a detailed LastError */
889 hFile
= CreateFileW(lpApplicationName
,
891 FILE_SHARE_READ
| FILE_SHARE_WRITE
,
894 FILE_ATTRIBUTE_NORMAL
,
897 /* Did it actually NOT fail? */
898 if (hFile
!= INVALID_HANDLE_VALUE
)
902 SetLastErrorByStatus(STATUS_OBJECT_NAME_NOT_FOUND
);
907 /* Immediately set the error */
908 SetLastErrorByStatus(STATUS_OBJECT_NAME_NOT_FOUND
);
911 /* Did we already fail once? */
918 /* Not yet, cache it */
919 Error
= GetLastError();
922 /* Put back the command line */
923 *NullBuffer
= SaveChar
;
924 lpApplicationName
= NameBuffer
;
927 * If the search isn't done and we still have cmdline
928 * then start over. Ex: c:\ha ha ha\haha.exe
930 if (*ScanString
&& !SearchDone
)
932 /* Move in the buffer */
934 NullBuffer
= ScanString
;
936 /* We will have to add a quote, since there is a space*/
939 /* And we will also fake the fact we found one */
946 /* We totally failed */
950 /* Put back the command line */
951 *NullBuffer
= SaveChar
;
952 lpApplicationName
= NameBuffer
;
953 DPRINT("SearchPathW suceeded (%ld): %S\n", RetVal
, NameBuffer
);
955 else if (!lpCommandLine
|| *lpCommandLine
== UNICODE_NULL
)
957 /* We have an app name (good!) but no command line */
958 CmdLineIsAppName
= TRUE
;
959 lpCommandLine
= (LPWSTR
)lpApplicationName
;
962 /* At this point the name has been toyed with enough to be openable */
963 Status
= BasepMapFile(lpApplicationName
, &hSection
, &ApplicationName
);
965 /* Check for failure */
966 if (!NT_SUCCESS(Status
))
968 /* Could be a non-PE File */
971 /* Check if the Kernel tells us it's not even valid MZ */
972 case STATUS_INVALID_IMAGE_NE_FORMAT
:
973 case STATUS_INVALID_IMAGE_PROTECT
:
974 case STATUS_INVALID_IMAGE_NOT_MZ
:
977 /* If it's a DOS app, use VDM */
978 if ((BasepCheckDosApp(&ApplicationName
)))
980 DPRINT1("Launching VDM...\n");
981 RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer
);
982 RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName
.Buffer
);
983 return CreateProcessW(L
"ntvdm.exe",
984 (LPWSTR
)((ULONG_PTR
)lpApplicationName
), /* FIXME: Buffer must be writable!!! */
992 lpProcessInformation
);
995 /* It's a batch file */
996 Extension
= &ApplicationName
.Buffer
[ApplicationName
.Length
/
999 /* Make sure the extensions are correct */
1000 if (_wcsnicmp(Extension
, L
".bat", 4) && _wcsnicmp(Extension
, L
".cmd", 4))
1002 SetLastError(ERROR_BAD_EXE_FORMAT
);
1006 /* Calculate the length of the command line */
1007 CmdLineLength
= wcslen(CMD_STRING
) + wcslen(lpCommandLine
) + 1;
1009 /* If we found quotes, then add them into the length size */
1010 if (CmdLineIsAppName
|| FoundQuotes
) CmdLineLength
+= 2;
1011 CmdLineLength
*= sizeof(WCHAR
);
1013 /* Allocate space for the new command line */
1014 BatchCommandLine
= RtlAllocateHeap(RtlGetProcessHeap(),
1017 if (BatchCommandLine
== NULL
)
1019 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
1024 wcscpy(BatchCommandLine
, CMD_STRING
);
1025 if (CmdLineIsAppName
|| FoundQuotes
)
1027 wcscat(BatchCommandLine
, L
"\"");
1029 wcscat(BatchCommandLine
, lpCommandLine
);
1030 if (CmdLineIsAppName
|| FoundQuotes
)
1032 wcscat(BatchCommandLine
, L
"\"");
1035 /* Create it as a Unicode String */
1036 RtlInitUnicodeString(&CommandLineString
, BatchCommandLine
);
1038 /* Set the command line to this */
1039 lpCommandLine
= CommandLineString
.Buffer
;
1040 lpApplicationName
= NULL
;
1043 RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName
.Buffer
);
1044 ApplicationName
.Buffer
= NULL
;
1048 case STATUS_INVALID_IMAGE_WIN_16
:
1050 /* It's a Win16 Image, use VDM */
1051 DPRINT1("Launching VDM...\n");
1052 RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer
);
1053 RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName
.Buffer
);
1054 return CreateProcessW(L
"ntvdm.exe",
1055 (LPWSTR
)((ULONG_PTR
)lpApplicationName
), /* FIXME: Buffer must be writable!!! */
1056 lpProcessAttributes
,
1063 lpProcessInformation
);
1066 /* Invalid Image Type */
1067 SetLastError(ERROR_BAD_EXE_FORMAT
);
1072 /* Use our desktop if we didn't get any */
1073 if (!StartupInfo
.lpDesktop
)
1075 StartupInfo
.lpDesktop
= OurPeb
->ProcessParameters
->DesktopInfo
.Buffer
;
1078 /* FIXME: Check if Application is allowed to run */
1080 /* FIXME: Allow CREATE_SEPARATE only for WOW Apps, once we have that. */
1082 /* Get some information about the executable */
1083 Status
= ZwQuerySection(hSection
,
1084 SectionImageInformation
,
1086 sizeof(SectionImageInfo
),
1088 if(!NT_SUCCESS(Status
))
1090 DPRINT1("Unable to get SectionImageInformation, status 0x%x\n", Status
);
1091 SetLastErrorByStatus(Status
);
1095 /* Don't execute DLLs */
1096 if (SectionImageInfo
.ImageCharacteristics
& IMAGE_FILE_DLL
)
1098 DPRINT1("Can't execute a DLL\n");
1099 SetLastError(ERROR_BAD_EXE_FORMAT
);
1103 /* FIXME: Check for Debugger */
1105 /* FIXME: Check if Machine Type and SubSys Version Match */
1107 /* We don't support POSIX or anything else for now */
1108 if (IMAGE_SUBSYSTEM_WINDOWS_GUI
!= SectionImageInfo
.SubSystemType
&&
1109 IMAGE_SUBSYSTEM_WINDOWS_CUI
!= SectionImageInfo
.SubSystemType
)
1111 DPRINT1("Invalid subsystem %d\n", SectionImageInfo
.SubSystemType
);
1112 SetLastError(ERROR_BAD_EXE_FORMAT
);
1116 if (IMAGE_SUBSYSTEM_WINDOWS_GUI
== SectionImageInfo
.SubSystemType
)
1118 /* Do not create a console for GUI applications */
1119 dwCreationFlags
&= ~CREATE_NEW_CONSOLE
;
1120 dwCreationFlags
|= DETACHED_PROCESS
;
1123 /* Initialize the process object attributes */
1124 ObjectAttributes
= BasepConvertObjectAttributes(&LocalObjectAttributes
,
1125 lpProcessAttributes
,
1128 /* Check if we're going to be debugged */
1129 if (dwCreationFlags
& DEBUG_PROCESS
)
1131 /* FIXME: Set process flag */
1134 /* Check if we're going to be debugged */
1135 if (dwCreationFlags
& (DEBUG_PROCESS
| DEBUG_ONLY_THIS_PROCESS
))
1137 /* Connect to DbgUi */
1138 Status
= DbgUiConnectToDbg();
1139 if (!NT_SUCCESS(Status
))
1141 DPRINT1("Failed to connect to DbgUI!\n");
1142 SetLastErrorByStatus(Status
);
1146 /* Get the debug object */
1147 hDebug
= DbgUiGetThreadDebugObject();
1149 /* Check if only this process will be debugged */
1150 if (dwCreationFlags
& DEBUG_ONLY_THIS_PROCESS
)
1152 /* FIXME: Set process flag */
1156 /* Create the Process */
1157 Status
= NtCreateProcess(&hProcess
,
1161 (BOOLEAN
)bInheritHandles
,
1165 if(!NT_SUCCESS(Status
))
1167 DPRINT1("Unable to create process, status 0x%x\n", Status
);
1168 SetLastErrorByStatus(Status
);
1173 Status
= NtSetInformationProcess(hProcess
,
1174 ProcessPriorityClass
,
1176 sizeof(PROCESS_PRIORITY_CLASS
));
1177 if(!NT_SUCCESS(Status
))
1179 DPRINT1("Unable to set new process priority, status 0x%x\n", Status
);
1180 SetLastErrorByStatus(Status
);
1184 /* Set Error Mode */
1185 if (dwCreationFlags
& CREATE_DEFAULT_ERROR_MODE
)
1187 ULONG ErrorMode
= SEM_FAILCRITICALERRORS
;
1188 NtSetInformationProcess(hProcess
,
1189 ProcessDefaultHardErrorMode
,
1194 /* Convert the directory to a full path */
1195 if (lpCurrentDirectory
)
1197 /* Allocate a buffer */
1198 CurrentDirectory
= RtlAllocateHeap(RtlGetProcessHeap(),
1200 (MAX_PATH
+ 1) * sizeof(WCHAR
));
1201 if (CurrentDirectory
== NULL
)
1203 DPRINT1("Cannot allocate memory for directory name\n");
1204 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
1208 /* Get the length */
1209 if (GetFullPathNameW(lpCurrentDirectory
,
1212 &CurrentDirectoryPart
) > MAX_PATH
)
1214 DPRINT1("Directory name too long\n");
1215 SetLastError(ERROR_DIRECTORY
);
1220 /* Insert quotes if needed */
1221 if (QuotesNeeded
|| CmdLineIsAppName
)
1223 /* Allocate a buffer */
1224 QuotedCmdLine
= RtlAllocateHeap(RtlGetProcessHeap(),
1226 (wcslen(lpCommandLine
) + 2 + 1) *
1228 if (QuotedCmdLine
== NULL
)
1230 DPRINT1("Cannot allocate memory for quoted command line\n");
1231 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
1235 /* Copy the first quote */
1236 wcscpy(QuotedCmdLine
, L
"\"");
1238 /* Save a null char */
1241 SaveChar
= *NullBuffer
;
1242 *NullBuffer
= UNICODE_NULL
;
1245 /* Add the command line and the finishing quote */
1246 wcscat(QuotedCmdLine
, lpCommandLine
);
1247 wcscat(QuotedCmdLine
, L
"\"");
1249 /* Add the null char */
1252 *NullBuffer
= SaveChar
;
1253 wcscat(QuotedCmdLine
, NullBuffer
);
1256 DPRINT("Quoted CmdLine: %S\n", QuotedCmdLine
);
1261 if (QuotedCmdLine
== NULL
)
1263 QuotedCmdLine
= RtlAllocateHeap(RtlGetProcessHeap(),
1265 (wcslen(lpCommandLine
) + 1) * sizeof(WCHAR
));
1266 if (QuotedCmdLine
== NULL
)
1268 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
1271 wcscpy(QuotedCmdLine
, lpCommandLine
);
1274 ScanString
= QuotedCmdLine
;
1275 while (NULL
!= (ScanString
= wcschr(ScanString
, L
'^')))
1278 if (*ScanString
== L
'\"' || *ScanString
== L
'^' || *ScanString
== L
'\\')
1280 memmove(ScanString
-1, ScanString
, wcslen(ScanString
) * sizeof(WCHAR
) + sizeof(WCHAR
));
1285 /* Get the Process Information */
1286 Status
= NtQueryInformationProcess(hProcess
,
1287 ProcessBasicInformation
,
1289 sizeof(ProcessBasicInfo
),
1292 /* Convert the environment */
1293 if(lpEnvironment
&& !(dwCreationFlags
& CREATE_UNICODE_ENVIRONMENT
))
1295 lpEnvironment
= BasepConvertUnicodeEnvironment(&EnvSize
, lpEnvironment
);
1296 if (!lpEnvironment
) goto Cleanup
;
1299 /* Create Process Environment */
1300 RemotePeb
= ProcessBasicInfo
.PebBaseAddress
;
1301 Status
= BasepInitializeEnvironment(hProcess
,
1303 (LPWSTR
)lpApplicationName
,
1305 (QuotesNeeded
|| CmdLineIsAppName
|| Escape
) ?
1306 QuotedCmdLine
: lpCommandLine
,
1313 /* Cleanup Environment */
1314 if (lpEnvironment
&& !(dwCreationFlags
& CREATE_UNICODE_ENVIRONMENT
))
1316 RtlDestroyEnvironment(lpEnvironment
);
1319 if (!NT_SUCCESS(Status
))
1321 DPRINT1("Could not initialize Process Environment\n");
1322 SetLastErrorByStatus(Status
);
1326 /* Close the section */
1330 /* Duplicate the handles if needed */
1331 if (!bInheritHandles
&& !(StartupInfo
.dwFlags
& STARTF_USESTDHANDLES
) &&
1332 SectionImageInfo
.SubSystemType
== IMAGE_SUBSYSTEM_WINDOWS_CUI
)
1334 PRTL_USER_PROCESS_PARAMETERS RemoteParameters
;
1336 /* Get the remote parameters */
1337 Status
= NtReadVirtualMemory(hProcess
,
1338 &RemotePeb
->ProcessParameters
,
1342 if (!NT_SUCCESS(Status
))
1344 DPRINT1("Failed to read memory\n");
1348 /* Duplicate and write the handles */
1349 BasepDuplicateAndWriteHandle(hProcess
,
1350 OurPeb
->ProcessParameters
->StandardInput
,
1351 &RemoteParameters
->StandardInput
);
1352 BasepDuplicateAndWriteHandle(hProcess
,
1353 OurPeb
->ProcessParameters
->StandardOutput
,
1354 &RemoteParameters
->StandardOutput
);
1355 BasepDuplicateAndWriteHandle(hProcess
,
1356 OurPeb
->ProcessParameters
->StandardError
,
1357 &RemoteParameters
->StandardError
);
1360 /* Create the first thread */
1361 DPRINT("Creating thread for process (EntryPoint = 0x%p)\n",
1362 SectionImageInfo
.TransferAddress
);
1363 hThread
= BasepCreateFirstThread(hProcess
,
1368 if (hThread
== NULL
)
1370 DPRINT1("Could not create Initial Thread\n");
1371 /* FIXME - set last error code */
1376 Status
= BasepNotifyCsrOfCreation(dwCreationFlags
,
1377 (HANDLE
)ProcessBasicInfo
.UniqueProcessId
,
1380 if (!NT_SUCCESS(Status
))
1382 DPRINT1("CSR Notification Failed");
1383 SetLastErrorByStatus(Status
);
1387 if (!(dwCreationFlags
& CREATE_SUSPENDED
))
1389 NtResumeThread(hThread
, &Dummy
);
1393 lpProcessInformation
->dwProcessId
= (DWORD
)ClientId
.UniqueProcess
;
1394 lpProcessInformation
->dwThreadId
= (DWORD
)ClientId
.UniqueThread
;
1395 lpProcessInformation
->hProcess
= hProcess
;
1396 lpProcessInformation
->hThread
= hThread
;
1397 DPRINT("hThread[%p]: %p inside hProcess[%p]: %p\n", hThread
,
1398 ClientId
.UniqueThread
, ClientId
.UniqueProcess
, hProcess
);
1399 hProcess
= hThread
= NULL
;
1403 /* De-allocate heap strings */
1404 if (NameBuffer
) RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer
);
1405 if (ApplicationName
.Buffer
)
1406 RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName
.Buffer
);
1407 if (CurrentDirectory
) RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentDirectory
);
1408 if (QuotedCmdLine
) RtlFreeHeap(RtlGetProcessHeap(), 0, QuotedCmdLine
);
1410 /* Kill any handles still alive */
1411 if (hSection
) NtClose(hSection
);
1414 /* We don't know any more details then this */
1415 NtTerminateProcess(hProcess
, STATUS_UNSUCCESSFUL
);
1418 if (hProcess
) NtClose(hProcess
);
1420 /* Return Success */
1429 CreateProcessW(LPCWSTR lpApplicationName
,
1430 LPWSTR lpCommandLine
,
1431 LPSECURITY_ATTRIBUTES lpProcessAttributes
,
1432 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
1433 BOOL bInheritHandles
,
1434 DWORD dwCreationFlags
,
1435 LPVOID lpEnvironment
,
1436 LPCWSTR lpCurrentDirectory
,
1437 LPSTARTUPINFOW lpStartupInfo
,
1438 LPPROCESS_INFORMATION lpProcessInformation
)
1440 /* Call the internal (but exported) version */
1441 return CreateProcessInternalW(0,
1444 lpProcessAttributes
,
1451 lpProcessInformation
,
1460 CreateProcessInternalA(HANDLE hToken
,
1461 LPCSTR lpApplicationName
,
1462 LPSTR lpCommandLine
,
1463 LPSECURITY_ATTRIBUTES lpProcessAttributes
,
1464 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
1465 BOOL bInheritHandles
,
1466 DWORD dwCreationFlags
,
1467 LPVOID lpEnvironment
,
1468 LPCSTR lpCurrentDirectory
,
1469 LPSTARTUPINFOA lpStartupInfo
,
1470 LPPROCESS_INFORMATION lpProcessInformation
,
1473 PUNICODE_STRING CommandLine
= NULL
;
1474 UNICODE_STRING DummyString
;
1475 UNICODE_STRING LiveCommandLine
;
1476 UNICODE_STRING ApplicationName
;
1477 UNICODE_STRING CurrentDirectory
;
1479 STARTUPINFOW StartupInfo
;
1481 DPRINT("dwCreationFlags %x, lpEnvironment %x, lpCurrentDirectory %x, "
1482 "lpStartupInfo %x, lpProcessInformation %x\n",
1483 dwCreationFlags
, lpEnvironment
, lpCurrentDirectory
,
1484 lpStartupInfo
, lpProcessInformation
);
1486 /* Copy Startup Info */
1487 RtlMoveMemory(&StartupInfo
, lpStartupInfo
, sizeof(*lpStartupInfo
));
1489 /* Initialize all strings to nothing */
1490 LiveCommandLine
.Buffer
= NULL
;
1491 DummyString
.Buffer
= NULL
;
1492 ApplicationName
.Buffer
= NULL
;
1493 CurrentDirectory
.Buffer
= NULL
;
1494 StartupInfo
.lpDesktop
= NULL
;
1495 StartupInfo
.lpReserved
= NULL
;
1496 StartupInfo
.lpTitle
= NULL
;
1498 /* Convert the Command line */
1501 /* If it's too long, then we'll have a problem */
1502 if ((strlen(lpCommandLine
) + 1) * sizeof(WCHAR
) <
1503 NtCurrentTeb()->StaticUnicodeString
.MaximumLength
)
1505 /* Cache it in the TEB */
1506 CommandLine
= Basep8BitStringToCachedUnicodeString(lpCommandLine
);
1510 /* Use a dynamic version */
1511 Basep8BitStringToHeapUnicodeString(&LiveCommandLine
,
1517 /* The logic below will use CommandLine, so we must make it valid */
1518 CommandLine
= &DummyString
;
1521 /* Convert the Name and Directory */
1522 if (lpApplicationName
)
1524 Basep8BitStringToHeapUnicodeString(&ApplicationName
,
1527 if (lpCurrentDirectory
)
1529 Basep8BitStringToHeapUnicodeString(&CurrentDirectory
,
1530 lpCurrentDirectory
);
1533 /* Now convert Startup Strings */
1534 if (lpStartupInfo
->lpReserved
)
1536 BasepAnsiStringToHeapUnicodeString(lpStartupInfo
->lpReserved
,
1537 &StartupInfo
.lpReserved
);
1539 if (lpStartupInfo
->lpDesktop
)
1541 BasepAnsiStringToHeapUnicodeString(lpStartupInfo
->lpDesktop
,
1542 &StartupInfo
.lpDesktop
);
1544 if (lpStartupInfo
->lpTitle
)
1546 BasepAnsiStringToHeapUnicodeString(lpStartupInfo
->lpTitle
,
1547 &StartupInfo
.lpTitle
);
1550 /* Call the Unicode function */
1551 bRetVal
= CreateProcessInternalW(hToken
,
1552 ApplicationName
.Buffer
,
1553 LiveCommandLine
.Buffer
?
1554 LiveCommandLine
.Buffer
: CommandLine
->Buffer
,
1555 lpProcessAttributes
,
1560 CurrentDirectory
.Buffer
,
1562 lpProcessInformation
,
1566 RtlFreeUnicodeString(&ApplicationName
);
1567 RtlFreeUnicodeString(&LiveCommandLine
);
1568 RtlFreeUnicodeString(&CurrentDirectory
);
1569 RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo
.lpDesktop
);
1570 RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo
.lpReserved
);
1571 RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo
.lpTitle
);
1573 /* Return what Unicode did */
1578 * FUNCTION: The CreateProcess function creates a new process and its
1579 * primary thread. The new process executes the specified executable file
1582 * lpApplicationName = Pointer to name of executable module
1583 * lpCommandLine = Pointer to command line string
1584 * lpProcessAttributes = Process security attributes
1585 * lpThreadAttributes = Thread security attributes
1586 * bInheritHandles = Handle inheritance flag
1587 * dwCreationFlags = Creation flags
1588 * lpEnvironment = Pointer to new environment block
1589 * lpCurrentDirectory = Pointer to current directory name
1590 * lpStartupInfo = Pointer to startup info
1591 * lpProcessInformation = Pointer to process information
1597 CreateProcessA(LPCSTR lpApplicationName
,
1598 LPSTR lpCommandLine
,
1599 LPSECURITY_ATTRIBUTES lpProcessAttributes
,
1600 LPSECURITY_ATTRIBUTES lpThreadAttributes
,
1601 BOOL bInheritHandles
,
1602 DWORD dwCreationFlags
,
1603 LPVOID lpEnvironment
,
1604 LPCSTR lpCurrentDirectory
,
1605 LPSTARTUPINFOA lpStartupInfo
,
1606 LPPROCESS_INFORMATION lpProcessInformation
)
1608 /* Call the internal (but exported) version */
1609 return CreateProcessInternalA(0,
1612 lpProcessAttributes
,
1619 lpProcessInformation
,