Fix FCB problems with int21/ah=27,28 (RandomBlockIO)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@715 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
11e163096d
commit
fdb58291c4
@ -337,19 +337,26 @@ void FcbCalcRec(xfcb FAR * lpXfcb)
|
|||||||
lpFcb->fcb_curec = lpFcb->fcb_rndm & 127;
|
lpFcb->fcb_curec = lpFcb->fcb_rndm & 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
UBYTE FcbRandomBlockIO(xfcb FAR * lpXfcb, COUNT nRecords, int mode)
|
UBYTE FcbRandomBlockIO(xfcb FAR * lpXfcb, UWORD *nRecords, int mode)
|
||||||
{
|
{
|
||||||
UCOUNT recno = 0;
|
unsigned recno;
|
||||||
UBYTE nErrorCode;
|
UBYTE nErrorCode = FCB_SUCCESS;
|
||||||
|
|
||||||
FcbCalcRec(lpXfcb);
|
FcbCalcRec(lpXfcb);
|
||||||
|
|
||||||
/* Convert to fcb if necessary */
|
/* Convert to fcb if necessary */
|
||||||
lpFcb = ExtFcbToFcb(lpXfcb);
|
lpFcb = ExtFcbToFcb(lpXfcb);
|
||||||
|
|
||||||
do
|
for (recno = 0; recno < *nRecords; recno++)
|
||||||
nErrorCode = FcbReadWrite(lpXfcb, recno++, mode);
|
{
|
||||||
while ((--nRecords > 0) && (nErrorCode == 0));
|
nErrorCode = FcbReadWrite(lpXfcb, recno, mode);
|
||||||
|
/* end-of-file, partial read should count last record */
|
||||||
|
if (nErrorCode == FCB_ERR_EOF)
|
||||||
|
recno++;
|
||||||
|
if (nErrorCode != FCB_SUCCESS)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*nRecords = recno;
|
||||||
|
|
||||||
/* Now update the fcb */
|
/* Now update the fcb */
|
||||||
lpFcb->fcb_rndm = FcbRec();
|
lpFcb->fcb_rndm = FcbRec();
|
||||||
|
@ -658,12 +658,12 @@ dispatch:
|
|||||||
|
|
||||||
/* Read random record(s) using FCB */
|
/* Read random record(s) using FCB */
|
||||||
case 0x27:
|
case 0x27:
|
||||||
lr.AL = FcbRandomBlockIO(FP_DS_DX, lr.CX, XFR_READ);
|
lr.AL = FcbRandomBlockIO(FP_DS_DX, &lr.CX, XFR_READ);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Write random record(s) using FCB */
|
/* Write random record(s) using FCB */
|
||||||
case 0x28:
|
case 0x28:
|
||||||
lr.AL = FcbRandomBlockIO(FP_DS_DX, lr.CX, XFR_WRITE);
|
lr.AL = FcbRandomBlockIO(FP_DS_DX, &lr.CX, XFR_WRITE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Parse File Name */
|
/* Parse File Name */
|
||||||
|
@ -210,7 +210,7 @@ const BYTE FAR *GetNameField(const BYTE FAR * lpFileName, BYTE FAR * lpDestField
|
|||||||
UBYTE FcbReadWrite(xfcb FAR *, UCOUNT, int);
|
UBYTE FcbReadWrite(xfcb FAR *, UCOUNT, int);
|
||||||
UBYTE FcbGetFileSize(xfcb FAR * lpXfcb);
|
UBYTE FcbGetFileSize(xfcb FAR * lpXfcb);
|
||||||
void FcbSetRandom(xfcb FAR * lpXfcb);
|
void FcbSetRandom(xfcb FAR * lpXfcb);
|
||||||
UBYTE FcbRandomBlockIO(xfcb FAR * lpXfcb, COUNT nRecords, int mode);
|
UBYTE FcbRandomBlockIO(xfcb FAR * lpXfcb, UWORD *nRecords, int mode);
|
||||||
UBYTE FcbRandomIO(xfcb FAR * lpXfcb, int mode);
|
UBYTE FcbRandomIO(xfcb FAR * lpXfcb, int mode);
|
||||||
UBYTE FcbOpen(xfcb FAR * lpXfcb, unsigned flags);
|
UBYTE FcbOpen(xfcb FAR * lpXfcb, unsigned flags);
|
||||||
int FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive);
|
int FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive);
|
||||||
|
Loading…
Reference in New Issue
Block a user