|
@@ -115,21 +115,21 @@ begin
|
|
CopyMemory(Result, @EnvBlock[1], Length(EnvBlock)*2);
|
|
CopyMemory(Result, @EnvBlock[1], Length(EnvBlock)*2);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Procedure InitProcessAttributes(P : TProcess; Var PA : TSecurityAttributes);
|
|
|
|
|
|
+Procedure InitProcessAttributes(P : TProcess; Out PA : TSecurityAttributes);
|
|
|
|
|
|
begin
|
|
begin
|
|
FillChar(PA,SizeOf(PA),0);
|
|
FillChar(PA,SizeOf(PA),0);
|
|
PA.nLength := SizeOf(PA);
|
|
PA.nLength := SizeOf(PA);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Procedure InitThreadAttributes(P : TProcess; Var TA : TSecurityAttributes);
|
|
|
|
|
|
+Procedure InitThreadAttributes(P : TProcess; Out TA : TSecurityAttributes);
|
|
|
|
|
|
begin
|
|
begin
|
|
FillChar(TA,SizeOf(TA),0);
|
|
FillChar(TA,SizeOf(TA),0);
|
|
TA.nLength := SizeOf(TA);
|
|
TA.nLength := SizeOf(TA);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Procedure InitStartupInfo(P : TProcess; AllDescriptorsDefault: Boolean; Var SI : STARTUPINFOW);
|
|
|
|
|
|
+Procedure InitStartupInfo(P : TProcess; AllDescriptorsDefault: Boolean; Out SI : STARTUPINFOW);
|
|
|
|
|
|
Const
|
|
Const
|
|
SWC : Array [TShowWindowOptions] of Cardinal =
|
|
SWC : Array [TShowWindowOptions] of Cardinal =
|
|
@@ -180,18 +180,20 @@ Var
|
|
FThreadAttributes : TSecurityAttributes;
|
|
FThreadAttributes : TSecurityAttributes;
|
|
FProcessInformation : TProcessInformation;
|
|
FProcessInformation : TProcessInformation;
|
|
FStartupInfo : STARTUPINFOW;
|
|
FStartupInfo : STARTUPINFOW;
|
|
- HI,HO,HE : THandle;
|
|
|
|
Cmd : TProcessString;
|
|
Cmd : TProcessString;
|
|
AllDescriptorsDefault: Boolean;
|
|
AllDescriptorsDefault: Boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ fProcessInformation:=default(TProcessInformation);
|
|
AllDescriptorsDefault :=
|
|
AllDescriptorsDefault :=
|
|
(FDescriptors[phtInput].IOType = iotDefault) and
|
|
(FDescriptors[phtInput].IOType = iotDefault) and
|
|
(FDescriptors[phtOutput].IOType = iotDefault) and
|
|
(FDescriptors[phtOutput].IOType = iotDefault) and
|
|
- (FDescriptors[phtError].IOType = iotDefault);
|
|
|
|
|
|
+ (FDescriptors[phtError].IOType = iotDefault) and
|
|
|
|
+ not (poStdErrToOutput in Options);
|
|
FDescriptors[phtInput].PrepareHandles;
|
|
FDescriptors[phtInput].PrepareHandles;
|
|
FDescriptors[phtOutput].PrepareHandles;
|
|
FDescriptors[phtOutput].PrepareHandles;
|
|
- FDescriptors[phtError].PrepareHandles;
|
|
|
|
|
|
+ if not (poStdErrToOutput in Options) then
|
|
|
|
+ FDescriptors[phtError].PrepareHandles;
|
|
WName:='';
|
|
WName:='';
|
|
WCommandLine:='';
|
|
WCommandLine:='';
|
|
WDir:='';
|
|
WDir:='';
|
|
@@ -248,7 +250,8 @@ Var
|
|
Finally
|
|
Finally
|
|
FDescriptors[phtInput].CloseTheirHandle;
|
|
FDescriptors[phtInput].CloseTheirHandle;
|
|
FDescriptors[phtOutput].CloseTheirHandle;
|
|
FDescriptors[phtOutput].CloseTheirHandle;
|
|
- FDescriptors[phtError].CloseTheirHandle;
|
|
|
|
|
|
+ if Not(poStdErrToOutPut in Options) then
|
|
|
|
+ FDescriptors[phtError].CloseTheirHandle;
|
|
end;
|
|
end;
|
|
FRunning:=True;
|
|
FRunning:=True;
|
|
Finally
|
|
Finally
|
|
@@ -314,17 +317,15 @@ end;
|
|
Function TIODescriptor.SysCreateFileNameHandle(const aFileName: string) : THandle;
|
|
Function TIODescriptor.SysCreateFileNameHandle(const aFileName: string) : THandle;
|
|
|
|
|
|
const
|
|
const
|
|
- DefaultRights = 438; // 438 = 666 octal which is rw rw rw
|
|
|
|
ModeNames : Array[Boolean] of String = ('Reading','Writing');
|
|
ModeNames : Array[Boolean] of String = ('Reading','Writing');
|
|
|
|
|
|
var
|
|
var
|
|
- FM : Integer;
|
|
|
|
Sec: SECURITY_ATTRIBUTES;
|
|
Sec: SECURITY_ATTRIBUTES;
|
|
|
|
|
|
begin
|
|
begin
|
|
if (aFileName='') then
|
|
if (aFileName='') then
|
|
Raise EProcess.Create('No filename set');
|
|
Raise EProcess.Create('No filename set');
|
|
- FillByte(sec, SizeOf(sec), 0);
|
|
|
|
|
|
+ Sec:=Default(SECURITY_ATTRIBUTES);
|
|
sec.nLength := SizeOf(Sec);
|
|
sec.nLength := SizeOf(Sec);
|
|
sec.bInheritHandle := True;
|
|
sec.bInheritHandle := True;
|
|
case ProcessHandleType of
|
|
case ProcessHandleType of
|