|
@@ -161,4 +161,39 @@ Procedure TProcess.SetShowWindow (Value : TShowWindowOptions);
|
|
|
begin
|
|
|
end;
|
|
|
|
|
|
+function TIODescriptor.SysPrepareCreatedHandleForProcess(aHandle: THandle): THandle;
|
|
|
|
|
|
+begin
|
|
|
+ Result:=aHandle;
|
|
|
+end;
|
|
|
+
|
|
|
+function TIODescriptor.SysCreateFileNameHandle(const aFileName: string): THandle;
|
|
|
+
|
|
|
+const
|
|
|
+ DefaultRights = 438; // 438 = 666 octal which is rw rw rw
|
|
|
+ ModeNames : Array[Boolean] of String = ('Reading','Writing');
|
|
|
+
|
|
|
+begin
|
|
|
+ if (aFileName='') then
|
|
|
+ Raise EProcess.Create('No filename provided');
|
|
|
+ case ProcessHandleType of
|
|
|
+ phtInput: Result:=FileOpen(aFileName,fmOpenRead);
|
|
|
+ phtOutput,
|
|
|
+ phtError: if FileExists(aFileName) then
|
|
|
+ Result:=FileOpen(aFileName,fmOpenWrite or fmShareDenyNone)
|
|
|
+ else
|
|
|
+ Result:=FileCreate(aFileName,fmShareDenyNone,DefaultRights)
|
|
|
+ end;
|
|
|
+ if (Result=-1) then
|
|
|
+ Raise EProcess.CreateFmt('Could not open file "%s" for %s',[aFileName,ModeNames[ProcessHandleType<>phtInput]]);
|
|
|
+end;
|
|
|
+
|
|
|
+function TIODescriptor.SysNullFileName: string;
|
|
|
+begin
|
|
|
+ result:='NULL';
|
|
|
+end;
|
|
|
+
|
|
|
+function TIODescriptor.SysIsTypeSupported(AValue: TIOType): Boolean;
|
|
|
+begin
|
|
|
+ Result:=aValue in [ioType,iotNone];
|
|
|
+end;
|