mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 22:04:33 +02:00
initial implementation of extended seek (0x7142 - LONG LSEEK with 64-bit file position)
This commit is contained in:
parent
15900d7827
commit
246b0037a8
@ -306,7 +306,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode)
|
|||||||
return rwblock(sft_idx, bp, n, mode);
|
return rwblock(sft_idx, bp, n, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode)
|
COUNT SftSeek2(int sft_idx, LONG new_pos, unsigned mode, UDWORD * p_result)
|
||||||
{
|
{
|
||||||
sft FAR *s = idx_to_sft(sft_idx);
|
sft FAR *s = idx_to_sft(sft_idx);
|
||||||
if (FP_OFF(s) == (size_t) -1)
|
if (FP_OFF(s) == (size_t) -1)
|
||||||
@ -347,17 +347,25 @@ COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s->sft_posit = new_pos;
|
s->sft_posit = new_pos;
|
||||||
|
*p_result = new_pos;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode)
|
||||||
|
{
|
||||||
|
UDWORD result;
|
||||||
|
return SftSeek2(sft_idx, new_pos, mode, &result);
|
||||||
|
}
|
||||||
|
|
||||||
ULONG DosSeek(unsigned hndl, LONG new_pos, COUNT mode, int *rc)
|
ULONG DosSeek(unsigned hndl, LONG new_pos, COUNT mode, int *rc)
|
||||||
{
|
{
|
||||||
int sft_idx = get_sft_idx(hndl);
|
int sft_idx = get_sft_idx(hndl);
|
||||||
|
UDWORD result;
|
||||||
|
|
||||||
/* Get the SFT block that contains the SFT */
|
/* Get the SFT block that contains the SFT */
|
||||||
*rc = SftSeek(sft_idx, new_pos, mode);
|
*rc = SftSeek2(sft_idx, new_pos, mode, &result);
|
||||||
if (*rc == SUCCESS)
|
if (*rc == SUCCESS)
|
||||||
return idx_to_sft(sft_idx)->sft_posit;
|
return result;
|
||||||
return *rc;
|
return *rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,8 +952,7 @@ dispatch:
|
|||||||
case 0x42:
|
case 0x42:
|
||||||
if (lr.AL > 2)
|
if (lr.AL > 2)
|
||||||
goto error_invalid;
|
goto error_invalid;
|
||||||
lrc = DosSeek(lr.BX, (LONG)((((ULONG) (lr.CX)) << 16) | lr.DX), lr.AL,
|
lrc = DosSeek(lr.BX, (LONG)MK_ULONG(lr.CX, lr.DX), lr.AL, &rc);
|
||||||
&rc);
|
|
||||||
if (rc == SUCCESS)
|
if (rc == SUCCESS)
|
||||||
{
|
{
|
||||||
lr.DX = (UWORD)(lrc >> 16);
|
lr.DX = (UWORD)(lrc >> 16);
|
||||||
@ -1601,8 +1600,9 @@ lfn_findclose:
|
|||||||
goto unsupp;
|
goto unsupp;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
/* EDR-DOS LFN - Long LSEEK - SET CURRENT 64-bit FILE POSITION */
|
||||||
|
case 0x42:
|
||||||
/* Win95 LFN - get file info by handle */
|
/* Win95 LFN - get file info by handle */
|
||||||
case 0x42: /* ??? */
|
|
||||||
case 0xa6: {
|
case 0xa6: {
|
||||||
/* only passed to redirector supported for now */
|
/* only passed to redirector supported for now */
|
||||||
iregs saved_r;
|
iregs saved_r;
|
||||||
@ -1621,8 +1621,11 @@ lfn_findclose:
|
|||||||
rc = DE_INVLDHNDL;
|
rc = DE_INVLDHNDL;
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
if (!(s->sft_flags & SFT_FSHARED))
|
if (!(s->sft_flags & SFT_FSHARED)) {
|
||||||
goto unsupp; /* unsupported on local fs yet */
|
if (lr.AL != 0x42) {
|
||||||
|
goto unsupp; /* unsupported on local fs yet */
|
||||||
|
}
|
||||||
|
}
|
||||||
/* call to redirector */
|
/* call to redirector */
|
||||||
saved_r = *r;
|
saved_r = *r;
|
||||||
r->ES = FP_SEG(s);
|
r->ES = FP_SEG(s);
|
||||||
@ -2201,6 +2204,16 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr)
|
|||||||
rc = DosClose(r.BX);
|
rc = DosClose(r.BX);
|
||||||
goto short_check;
|
goto short_check;
|
||||||
|
|
||||||
|
case 0x42: /* 64-bit move file pointer */
|
||||||
|
{
|
||||||
|
/* r.(DS:DX) points to 64-bit file position instead of r.(CX:DX) being 32-bit file position */
|
||||||
|
UWORD FAR *filepos = MK_FP(r.DS, r.DX);
|
||||||
|
if (*(filepos+1) != 0) /* we currently only handle lower 32 bits, upper 32 bits must be 0 */
|
||||||
|
goto error_invalid;
|
||||||
|
r.BP = (UWORD)r.CL;
|
||||||
|
r.CX = *filepos;
|
||||||
|
/* fall through to 32-bit move file pointer (0x28) */
|
||||||
|
}
|
||||||
case 0x28: /* move file pointer */
|
case 0x28: /* move file pointer */
|
||||||
/*
|
/*
|
||||||
* RBIL says: "sets user stack frame pointer to dummy buffer,
|
* RBIL says: "sets user stack frame pointer to dummy buffer,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user