189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
-
+
-
+
|
si.cb = sizeof(si);
si.hStdInput = _writePipe[0];
si.hStdOutput = _readPipe[1];
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
si.dwFlags |= STARTF_USESTDHANDLES;
length = argumentsString.UTF16StringLength;
argumentsCopy = of_alloc(length + 1,
argumentsCopy = OFAllocMemory(length + 1,
sizeof(OFChar16));
memcpy(argumentsCopy, argumentsString.UTF16String,
(length + 1) * 2);
@try {
if (!CreateProcessW(program.UTF16String,
argumentsCopy, NULL, NULL, TRUE,
CREATE_UNICODE_ENVIRONMENT,
[self of_wideEnvironmentForDictionary:
environment], NULL, &si, &pi))
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
} @finally {
free(argumentsCopy);
OFFreeMemory(argumentsCopy);
}
} else {
OFStringEncoding encoding = [OFLocale encoding];
STARTUPINFO si;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
|