|
@@ -11,6 +11,10 @@ end;
|
|
Procedure TProcess.Execute;
|
|
Procedure TProcess.Execute;
|
|
|
|
|
|
Var PName,PDir : PChar;
|
|
Var PName,PDir : PChar;
|
|
|
|
+ FStartupInfo : TStartupInfo;
|
|
|
|
+ FProcessAttributes,
|
|
|
|
+ FTHreadAttributes : TSecurityAttributes;
|
|
|
|
+ FProcessInformation : TProcessInformation;
|
|
|
|
|
|
begin
|
|
begin
|
|
if poNoConsole in FCReateOptions then
|
|
if poNoConsole in FCReateOptions then
|
|
@@ -29,58 +33,62 @@ begin
|
|
FChildErrorStream:=FChildOutPutStream;
|
|
FChildErrorStream:=FChildOutPutStream;
|
|
FParentErrorStream:=FParentInputStream;
|
|
FParentErrorStream:=FParentInputStream;
|
|
end;
|
|
end;
|
|
- With FStartupInfo do
|
|
|
|
|
|
+ end;
|
|
|
|
+ With FStartupInfo do
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=FStartupInfo.dwFlags or Startf_UseStdHandles;
|
|
|
|
+ hStdInput:=FChildInputStream.Handle;
|
|
|
|
+ hStdOutput:=FChildOutPutStream.Handle;
|
|
|
|
+ hStdError:=FChildErrorStream.Handle;
|
|
|
|
+ If (FFillAttribute<>0) then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UseFillAttribute;
|
|
|
|
+ dwFillAttribute:=FFIllAttribute;
|
|
|
|
+ end;
|
|
|
|
+ If FShowWindow then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UseShowWindow;
|
|
|
|
+ // ?? dwXCountChars:=Value;
|
|
|
|
+ end;
|
|
|
|
+ if FWindowWidth<>-1 then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UseCountChars;
|
|
|
|
+ dwXCountChars:=FWindowWidth;
|
|
|
|
+ end;
|
|
|
|
+ if FWindowRows<>-1 then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UseCountChars;
|
|
|
|
+ dwYCountChars:=FWindowRows;
|
|
|
|
+ end;
|
|
|
|
+ if FWindowHeight<>-1 then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UsePosition;
|
|
|
|
+ dwYsize:=FWindowHeight;
|
|
|
|
+ end;
|
|
|
|
+ If FWindowWidth<>-1 then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UsePosition;
|
|
|
|
+ dwxsize:=FWindowWidth;
|
|
|
|
+ end;
|
|
|
|
+ IF FWindowLeft<>-1 then
|
|
|
|
+ begin
|
|
|
|
+ dwFlags:=dwFlags or Startf_UseSize;
|
|
|
|
+ dwx:=FWindowLeft;
|
|
|
|
+ end;
|
|
|
|
+ If FWindowTop<>-1 then
|
|
begin
|
|
begin
|
|
- dwFlags:=FStartupInfo.dwFlags or Startf_UseStdHandles;
|
|
|
|
- hStdInput:=FChildInputStream.Handle;
|
|
|
|
- hStdOutput:=FChildOutPutStream.Handle;
|
|
|
|
- hStdError:=FChildErrorStream.Handle;
|
|
|
|
- If (FFillAttribute<>0) then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UseFillAttribute;
|
|
|
|
- dwFillAttribute:=FFIllAttribute;
|
|
|
|
- end;
|
|
|
|
- If FShowWindow then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UseShowWindow;
|
|
|
|
- // ?? dwXCountChars:=Value;
|
|
|
|
- end;
|
|
|
|
- if FWindowWidth<>-1 then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UseCountChars;
|
|
|
|
- dwXCountChars:=Value;
|
|
|
|
- end;
|
|
|
|
- if FWindowRows<>-1 then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UseCountChars;
|
|
|
|
- dwYCountChars:=Value;
|
|
|
|
- end;
|
|
|
|
- if FWindowHeight<>-1 then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UsePosition;
|
|
|
|
- dwYsize:=Value;
|
|
|
|
- end;
|
|
|
|
- If FWindowWidth<>-1 then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UsePosition;
|
|
|
|
- dwxsize:=Value;
|
|
|
|
- end;
|
|
|
|
- IF FWindowLeft<>-1 then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UseSize;
|
|
|
|
- dwx:=Value;
|
|
|
|
- end;
|
|
|
|
- If FWindowTop<>-1 then
|
|
|
|
- begin
|
|
|
|
- dwFlags:=dwFlags or Startf_UseSize;
|
|
|
|
- dwy:=Value;
|
|
|
|
- end;
|
|
|
|
|
|
+ dwFlags:=dwFlags or Startf_UseSize;
|
|
|
|
+ dwy:=FWindowTop;
|
|
end;
|
|
end;
|
|
|
|
+ end;
|
|
If FApplicationName<>'' then PName:=Pchar(FApplicationName) else PName:=Nil;
|
|
If FApplicationName<>'' then PName:=Pchar(FApplicationName) else PName:=Nil;
|
|
If FCurrentDirectory<>'' then PName:=Pchar(FCurrentDirectory) else PDir:=Nil;
|
|
If FCurrentDirectory<>'' then PName:=Pchar(FCurrentDirectory) else PDir:=Nil;
|
|
- CreateProcess (Pname,PChar(FCommandLine),FProcessAttributes,FThreadAttributes,
|
|
|
|
|
|
+ CreateProcess (Pname,PChar(FCommandLine),@FProcessAttributes,@FThreadAttributes,
|
|
FInheritHandles,FCreationFlags,FEnvironment,PDir,@FStartupInfo,
|
|
FInheritHandles,FCreationFlags,FEnvironment,PDir,@FStartupInfo,
|
|
@fProcessInformation);
|
|
@fProcessInformation);
|
|
|
|
+ FTHreadHandle:=fProcessInformation.hthread;
|
|
|
|
+ FHandle:=fProcessInformation.hProcess;
|
|
|
|
+ FPID:=fProcessInformation.dwProcessID;
|
|
FRunning:=True;
|
|
FRunning:=True;
|
|
if (poWaitOnExit in FCreateOptions) and
|
|
if (poWaitOnExit in FCreateOptions) and
|
|
not (poRunSuspended in FCreateOptions) then
|
|
not (poRunSuspended in FCreateOptions) then
|
|
@@ -90,7 +98,7 @@ end;
|
|
Function TProcess.WaitOnExit : Dword;
|
|
Function TProcess.WaitOnExit : Dword;
|
|
|
|
|
|
begin
|
|
begin
|
|
- Result:=WaitForSingleObject (FprocessInformation.hProcess,Infinite);
|
|
|
|
|
|
+ Result:=WaitForSingleObject (FHandle,Infinite);
|
|
If Result<>Wait_Failed then
|
|
If Result<>Wait_Failed then
|
|
GetExitStatus;
|
|
GetExitStatus;
|
|
FRunning:=False;
|
|
FRunning:=False;
|