Board index » delphi » DPMI/DLL/BP 7.0, Hidden Buffer when using DOS-INT21/40h ?????

DPMI/DLL/BP 7.0, Hidden Buffer when using DOS-INT21/40h ?????

I have a DPMI application compiled with BP 7.0, the application consist of
an EXE file and a DLL, the DLL implements a database with file access.
In the DLL I uses the TBufStream for file Read/Write, with a buffer size of
4096 bytes.

My problem is that the TBufStream.FLUSH method don't work when the buffer
contain less then 422 bytes.

Library xx

Var
  S: TBufStream;
  Buf421: Array[1..421] Of Byte;
  Buf422: Array[1..422] Of Byte;

Procedure Save;
Begin
  S.Write(Buf421, SizeOf(Buf421));  { Writing 421 bytes to the buffer }
  S.Flush;                                     { Flush the buffer to disk,
NOTHING IS WRITTEN !!!!!! }
                                                   { But the buffer is
cleared !!! }

  S.Write(Buf422, SizeOf(Buf422));  { Writing 422 bytes to the buffer }
  S.Flush;                                      { Flush the buffer to disk
works OK !!!!!! }
End;

End. { Library }

As the example shows writing 421 bytes don't work but 422 bytes does !!!
I have debugged the TBufStream in the code where it writes to the disk via.
INT21 function 40h and the DOS function report OK in both cases !!  (CF=0
and AX=CX)

Do anyone out there have any explanation ?????

 

Re:DPMI/DLL/BP 7.0, Hidden Buffer when using DOS-INT21/40h ?????


On 25 Sep 1996 12:00:43 GMT LNI (L...@PIP.DKNET.DK) wrote:

Quote
> I have a DPMI application compiled with BP 7.0, the application consist of
> an EXE file and a DLL, the DLL implements a database with file access.
> In the DLL I uses the TBufStream for file Read/Write, with a buffer size of
> 4096 bytes.
> My problem is that the TBufStream.FLUSH method don't work when the buffer
> contain less then 422 bytes.
> Library xx
> Var
>   S: TBufStream;
>   Buf421: Array[1..421] Of Byte;
>   Buf422: Array[1..422] Of Byte;

Did you try 0-based arrays here?

Quote
> Procedure Save;
> Begin
>   S.Write(Buf421, SizeOf(Buf421));  { Writing 421 bytes to the buffer }
>   S.Flush;                                     { Flush the buffer to disk,
> NOTHING IS WRITTEN !!!!!! }
>                                                    { But the buffer is
> cleared !!! }
>   S.Write(Buf422, SizeOf(Buf422));  { Writing 422 bytes to the buffer }
>   S.Flush;                                      { Flush the buffer to disk
> works OK !!!!!! }
> End;
> End. { Library }
> As the example shows writing 421 bytes don't work but 422 bytes does !!!
> I have debugged the TBufStream in the code where it writes to the disk via.
> INT21 function 40h and the DOS function report OK in both cases !!  (CF=0
> and AX=CX)

And the passed values are also correct?

Quote
> Do anyone out there have any explanation ?????

--
*********************************************
* nin...@redline.ru, myacco...@glas.apc.org *
*********************************************

Other Threads