59{
62 SIZE_T EnvironmentSize = 0;
67 HANDLE CurrentDirectoryHandle;
70
71 DPRINT (
"RtlCreateProcessParameters\n");
72
74
76 {
83 CurrentDirectoryHandle =
NtCurrentPeb()->ProcessParameters->CurrentDirectory.Handle;
84 ConsoleHandle =
NtCurrentPeb()->ProcessParameters->ConsoleHandle;
85 ConsoleFlags =
NtCurrentPeb()->ProcessParameters->ConsoleFlags;
86 }
87 else
88 {
93 CurrentDirectoryHandle =
NULL;
95 ConsoleFlags = 0;
96 }
97
98 if (CommandLine ==
NULL)
99 CommandLine = ImagePathName;
100 if (CommandLine ==
NULL)
101 CommandLine = &EmptyString;
102 if (WindowTitle ==
NULL)
103 WindowTitle = &EmptyString;
104 if (DesktopInfo ==
NULL)
105 DesktopInfo = &EmptyString;
106 if (ShellInfo ==
NULL)
107 ShellInfo = &EmptyString;
108 if (RuntimeData ==
NULL)
109 RuntimeData = &NullString;
110
111
113
114
116
117
125
126
128 {
130 while (*EnvEnd)
131 EnvEnd +=
wcslen(EnvEnd) + 1;
133 }
134
136
137
139 if (!Param)
140 {
143 }
144
145 DPRINT (
"Process parameters allocated\n");
146
155
157
158
160 &Param->CurrentDirectory.DosPath,
163
164
165 if (Param->CurrentDirectory.DosPath.Length > 0)
166 {
167 Length = Param->CurrentDirectory.DosPath.Length /
sizeof(
WCHAR);
168 if (Param->CurrentDirectory.DosPath.Buffer[
Length-1] !=
L'\\')
169 {
170 Param->CurrentDirectory.DosPath.Buffer[
Length] =
L'\\';
171 Param->CurrentDirectory.DosPath.Buffer[
Length + 1] = 0;
172 Param->CurrentDirectory.DosPath.Length +=
sizeof(
WCHAR);
173 }
174 }
175
176
178 &Param->DllPath,
180 0);
181
182
184 &Param->ImagePathName,
185 ImagePathName,
187
188
190 &Param->CommandLine,
191 CommandLine,
193
194
196 &Param->WindowTitle,
197 WindowTitle,
198 0);
199
200
202 &Param->DesktopInfo,
203 DesktopInfo,
204 0);
205
206
208 &Param->ShellInfo,
209 ShellInfo,
210 0);
211
212
214 &Param->RuntimeData,
215 RuntimeData,
216 0);
217
218
220
221
223 {
225 Param->Environment = Dest;
226 Param->EnvironmentSize = EnvironmentSize;
227
228
230 }
231
233 *ProcessParameters = Param;
235
237}
WCHAR CurrentDirectory[1024]
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
struct _RTL_USER_PROCESS_PARAMETERS RTL_USER_PROCESS_PARAMETERS
KPROCESSOR_MODE NTAPI RtlpGetMode(VOID)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
PVOID PVOID PWCHAR PVOID Environment
static const char const char * DllPath
#define RTL_USER_PROCESS_PARAMETERS_NORMALIZED
_In_ ULONG _In_ ULONG _In_ ULONG Length
static __inline VOID RtlpCopyParameterString(PWCHAR *Ptr, PUNICODE_STRING Destination, PUNICODE_STRING Source, USHORT Size)
PRTL_USER_PROCESS_PARAMETERS NTAPI RtlDeNormalizeProcessParams(PRTL_USER_PROCESS_PARAMETERS Params)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_INSUFFICIENT_RESOURCES
NTSYSAPI void WINAPI RtlReleasePebLock(void)
NTSYSAPI void WINAPI RtlAcquirePebLock(void)