Inlined dos_setdta. Various bug fixes and cleanups from Lucho and Arkady.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@941 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-05-23 14:49:11 +00:00
parent 2cdf880b85
commit 42c0af3aee
3 changed files with 21 additions and 43 deletions

View File

@ -1944,11 +1944,6 @@ VOID release_f_node(f_node_ptr fnp)
} }
#ifndef IPL #ifndef IPL
VOID dos_setdta(BYTE FAR * newdta)
{
dta = newdta;
}
COUNT dos_getfattr_fd(COUNT fd) COUNT dos_getfattr_fd(COUNT fd)
{ {
f_node_ptr fnp = xlt_fd(fd); f_node_ptr fnp = xlt_fd(fd);

View File

@ -353,7 +353,7 @@ int int21_fat32(lregs *r)
return DE_INVLDPARM; return DE_INVLDPARM;
} }
if (r->DL - 1 >= lastdrive || r->DL == 0) if (r->DL > lastdrive || r->DL == 0)
return -0x207; return -0x207;
if (r->SI == 0) if (r->SI == 0)
@ -608,7 +608,7 @@ dispatch:
/* Set DTA */ /* Set DTA */
case 0x1a: case 0x1a:
dos_setdta(FP_DS_DX); dta = FP_DS_DX;
break; break;
/* Get Default Drive Data */ /* Get Default Drive Data */
@ -907,7 +907,7 @@ dispatch:
lrc = DosSeek(lr.BX, (LONG)((((ULONG) (lr.CX)) << 16) | lr.DX), lr.AL); lrc = DosSeek(lr.BX, (LONG)((((ULONG) (lr.CX)) << 16) | lr.DX), lr.AL);
if (lrc == -1) if (lrc == -1)
{ {
lrc = -DE_INVLDHNDL; lrc = DE_INVLDHNDL;
} }
else else
{ {
@ -1266,23 +1266,16 @@ dispatch:
if (lr.AL == 7 || lr.AL == 8) if (lr.AL == 7 || lr.AL == 8)
{ {
struct cds FAR *cdsp; struct cds FAR *cdsp;
if (lr.DL < lastdrive) if (lr.DL >= lastdrive)
{ {
rc = DE_INVLDDRV; rc = DE_INVLDDRV;
goto error_exit; goto error_exit;
} }
else
{
cdsp = &CDSp[lr.DL]; cdsp = &CDSp[lr.DL];
if (lr.AL == 7) if (lr.AL == 7)
{ cdsp->cdsFlags |= CDSPHYSDRV;
cdsp->cdsFlags |= 0x100;
}
else else
{ cdsp->cdsFlags &= ~CDSPHYSDRV;
cdsp->cdsFlags &= ~0x100;
}
}
} }
else else
{ {
@ -1380,7 +1373,7 @@ dispatch:
printf("DosGetData() := %d\n", rc); printf("DosGetData() := %d\n", rc);
goto error_exit; goto error_exit;
} }
printf("DosGetData() returned successfully\n", rc); printf("DosGetData() returned successfully\n");
break; break;
#else #else
rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI); rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI);
@ -1421,15 +1414,16 @@ dispatch:
/* Get/Set Serial Number */ /* Get/Set Serial Number */
case 0x69: case 0x69:
rc = (lr.BL == 0 ? default_drive : lr.BL - 1); rc = (lr.BL == 0 ? default_drive : lr.BL - 1);
if (lr.AL == 0 || lr.AL == 1) if (lr.AL < 2)
{
if (get_cds(rc) == NULL)
{
rc = DE_INVLDDRV;
goto error_exit;
}
if (get_dpb(rc) != NULL)
{ {
UWORD saveCX = lr.CX; UWORD saveCX = lr.CX;
if (get_cds(rc) == NULL)
rc = DE_INVLDDRV;
else if (get_dpb(rc) == NULL)
goto error_invalid;
else
{
lr.CX = lr.AL == 0 ? 0x0866 : 0x0846; lr.CX = lr.AL == 0 ? 0x0866 : 0x0846;
lr.AL = 0x0d; lr.AL = 0x0d;
rc = DosDevIOctl(&lr); rc = DosDevIOctl(&lr);
@ -1437,9 +1431,7 @@ dispatch:
goto short_check; goto short_check;
} }
} }
else
goto error_invalid; goto error_invalid;
break;
/* /*
case 0x6a: see case 0x68 case 0x6a: see case 0x68
case 0x6b: dummy func: return AL=0 case 0x6b: dummy func: return AL=0
@ -1631,21 +1623,14 @@ VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r)
r->ax = dskxfer(drv, blkno, buf, nblks, mode); r->ax = dskxfer(drv, blkno, buf, nblks, mode);
if (mode == DSKWRITE) r->flags &= ~FLG_CARRY;
if (r->ax <= 0) if (r->ax != 0)
setinvld(drv);
if (r->ax > 0)
{ {
r->flags |= FLG_CARRY; r->flags |= FLG_CARRY;
--InDOS; if (mode == DSKWRITEINT26)
return; setinvld(drv);
} }
r->ax = 0;
r->flags &= ~FLG_CARRY;
--InDOS; --InDOS;
} }
/* /*
@ -1932,7 +1917,6 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
put_unsigned(r.AL, 16, 2); put_unsigned(r.AL, 16, 2);
put_string("\n"); put_string("\n");
r.FLAGS |= FLG_CARRY; r.FLAGS |= FLG_CARRY;
break;
} }
} }
} }

View File

@ -182,7 +182,6 @@ int dos_cd(char * PathName);
f_node_ptr get_f_node(void); f_node_ptr get_f_node(void);
VOID release_f_node(f_node_ptr fnp); VOID release_f_node(f_node_ptr fnp);
#define release_near_f_node(fnp) ((fnp)->f_count = 0) #define release_near_f_node(fnp) ((fnp)->f_count = 0)
VOID dos_setdta(BYTE FAR * newdta);
COUNT dos_getfattr_fd(COUNT fd); COUNT dos_getfattr_fd(COUNT fd);
COUNT dos_getfattr(BYTE * name); COUNT dos_getfattr(BYTE * name);
COUNT dos_setfattr(BYTE * name, UWORD attrp); COUNT dos_setfattr(BYTE * name, UWORD attrp);