[fpc-pascal] TProcess does not work in Windows XP

Antonio Sanguigni a.sanguigni at gmail.com
Wed Mar 25 08:59:56 CET 2015


2015-03-25 8:41 GMT+01:00 Michael Van Canneyt <michael at freepascal.org>:
>> ---------------------- code ---------------
>> procedure TBurpClient.Run;
>> begin
>>  fOurProcess.Options := [poUsePipes] + [poNoConsole];
>>  fOurProcess.Execute;
>>  while True do
>>  begin
>>    // make sure we have room
>>    fMemStream.SetSize(fBytesRead + READ_BYTES);
>>
>>    // try reading it
>>    fNumBytes := fOurProcess.Output.Read((fMemStream.Memory +
>> fBytesRead)^, READ_BYTES);
>>    if fNumBytes > 0 then // All read() calls will block, except the final
>> one.
>
>
> I am not sure this is always correct. Various versions of windows work
> differently in this regard;
> zero (0) may be a valid return value. I suggest you check
> fOurProcess.IsRunning to break the loop.

Thank you, I will try it. But debugging I can see the problem is not
in the loop. In Windows XP fNumBytes is always zero:

fNumBytes := fOurProcess.Output.Read((fMemStream.Memory +
fBytesRead)^, READ_BYTES);

so it seems the Read of fOurProcess.Output is not giving the expected results.

In Windows 7 it's ok.

Antonio


-- 
Antonio Sanguigni alias slapshot
----------------------------------------------------------------------
Servizi informatici Windows e GNU/Linux- http://www.pieroni.biz
GioveLUG (Linux User Group) - http://www.giovelug.org



More information about the fpc-pascal mailing list