Skip to content

Commit

Permalink
fixed DSiExecuteAndCapture; fixed scoped unit names
Browse files Browse the repository at this point in the history
  • Loading branch information
gabr42 committed Mar 2, 2021
1 parent ec92096 commit 9389bbd
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/DSiWin32.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
Christian Wimmer, Tommi Prami, Miha, Craig Peterson, Tommaso Ercole,
bero.
Creation date : 2002-10-09
Last modification : 2020-04-03
Version : 2.0
Last modification : 2021-03-02
Version : 2.0b
</pre>*)(*
History:
2.0b: 2021-03-02
- All unit names are fully scoped (when supported).
2.0a: 2021-02-05
- Read end of write pipe was passed to the child process as its input in
DSiExecuteAndCapture.
2.0: 2020-04-03
- Extracted all code depending on Vcl.Graphics into unit DSiWin32.VCL.
1.108: 2020-04-03
Expand Down Expand Up @@ -2200,14 +2205,14 @@ function UTF8Decode(const sUtf: UTF8String): WideString;
implementation

uses
Types,
ComObj,
ActiveX,
{$IFDEF DSiScopedUnitNames}System.Types{$ELSE}Types{$ENDIF},
{$IFDEF DSiScopedUnitNames}System.Win.ComObj{$ELSE}ComObj{$ENDIF},
{$IFDEF DSiScopedUnitNames}Winapi.ActiveX{$ELSE}ActiveX{$ENDIF},
{$IFDEF CONDITIONALCOMPILATION}
Variants,
{$IFDEF DSiScopedUnitNames}System.Variants{$ELSE}Variants{$ENDIF},
{$ENDIF}
TLHelp32,
MMSystem;
{$IFDEF DSiScopedUnitNames}Winapi.TLHelp32{$ELSE}TLHelp32{$ENDIF},
{$IFDEF DSiScopedUnitNames}Winapi.MMSystem{$ELSE}MMSystem{$ENDIF};

const
CAPISuffix = {$IFDEF Unicode}'W'{$ELSE}'A'{$ENDIF};
Expand Down Expand Up @@ -5152,11 +5157,13 @@ ACCESS_ALLOWED_ACE = record
security.bInheritHandle := true;
security.lpSecurityDescriptor := nil;
if CreatePipe(readPipe, writePipe, @security, 0) then begin
if not SetHandleInformation(readPipe, HANDLE_FLAG_INHERIT, 0) then
RaiseLastOSError;
buffer := AllocMem(SizeReadBuffer + 1);
FillChar(Start,Sizeof(Start),#0);
start.cb := SizeOf(start);
start.hStdOutput := writePipe;
start.hStdInput := readPipe;
start.hStdInput := 0;
start.hStdError := writePipe;
start.dwFlags := STARTF_USESTDHANDLES + STARTF_USESHOWWINDOW;
start.wShowWindow := SW_HIDE;
Expand Down Expand Up @@ -5567,7 +5574,7 @@ ACCESS_ALLOWED_ACE = record
fsCreationTime: TFileTime;
fsExitTime : TFileTime;
fsKernelTime : TFileTime;
fsUserTime : FileTime;
fsUserTime : TFileTime;
begin
Result :=
GetThreadTimes(thread, fsCreationTime, fsExitTime, fsKernelTime, fsUserTime) and
Expand Down

0 comments on commit 9389bbd

Please sign in to comment.