Saner lastdrive handling.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@183 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-03-30 22:27:42 +00:00
parent 99f39bebec
commit 2799b7b810
9 changed files with 47 additions and 25 deletions

View File

@ -12,6 +12,7 @@
Bart: getdpb fixes (int 21/ah=32). Bart: getdpb fixes (int 21/ah=32).
fix carry handling in int 21/ah=5e. fix carry handling in int 21/ah=5e.
fix {get,set}_machine_name in network.c fix {get,set}_machine_name in network.c
saner lastdrive handling
+ Add Support for SHELLHIGH in config.sys + Add Support for SHELLHIGH in config.sys
2001 Mar 28 - Build 2023 2001 Mar 28 - Build 2023
+ Fixes Bug fix release 2023b: dsk.c (reported by Nagy Daniel), inthndlr and + Fixes Bug fix release 2023b: dsk.c (reported by Nagy Daniel), inthndlr and

View File

@ -40,6 +40,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.15 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.14 2001/03/30 19:30:00 bartoldeman * Revision 1.14 2001/03/30 19:30:00 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -339,7 +342,7 @@ INIT void PreConfig(void)
+ Config.cfgFiles * sizeof(sft)); + Config.cfgFiles * sizeof(sft));
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * (lastdrive)); KernelAlloc(0x58 * lastdrive);
#ifdef DEBUG #ifdef DEBUG
printf("Preliminary f_node allocated at at 0x%p\n",f_nodes); printf("Preliminary f_node allocated at at 0x%p\n",f_nodes);
@ -418,7 +421,7 @@ INIT void PostConfig(void)
+ Config.cfgFiles * sizeof(sft)); + Config.cfgFiles * sizeof(sft));
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * (lastdrive)); KernelAlloc(0x58 * lastdrive);
#ifdef DEBUG #ifdef DEBUG
@ -458,7 +461,7 @@ INIT VOID configDone(VOID)
#endif /* DEBUG */ #endif /* DEBUG */
lastdrive = nblkdev; lastdrive = nblkdev;
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * (lastdrive )); KernelAlloc(0x58 * lastdrive);
} }
first_mcb = FP_SEG(lpBase) + ((FP_OFF(lpBase) + 0x0f) >> 4); first_mcb = FP_SEG(lpBase) + ((FP_OFF(lpBase) + 0x0f) >> 4);

View File

@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
* /// Added SHARE support. 2000/09/04 Ron Cemer * /// Added SHARE support. 2000/09/04 Ron Cemer
* *
* $Log$ * $Log$
* Revision 1.13 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.12 2001/03/30 19:30:06 bartoldeman * Revision 1.12 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -1117,7 +1120,7 @@ VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
drive = (drive == 0 ? default_drive : drive - 1); drive = (drive == 0 ? default_drive : drive - 1);
/* first check for valid drive */ /* first check for valid drive */
if (drive < 0 || drive > (lastdrive - 1)) if (drive < 0 || drive >= lastdrive)
{ {
*spc = -1; *spc = -1;
return; return;
@ -1166,7 +1169,7 @@ COUNT DosGetCuDir(COUNT drive, BYTE FAR * s)
drive = (drive == 0 ? default_drive : drive - 1); drive = (drive == 0 ? default_drive : drive - 1);
/* first check for valid drive */ /* first check for valid drive */
if (drive < 0 || drive > (lastdrive - 1)) { if (drive < 0 || drive >= lastdrive) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }

View File

@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.12 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.11 2001/03/21 02:56:25 bartoldeman * Revision 1.11 2001/03/21 02:56:25 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -202,7 +205,7 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
{ {
drive = default_drive; drive = default_drive;
} }
if (drive > (lastdrive-1)) { if (drive >= lastdrive) {
release_f_node(fnp); release_f_node(fnp);
return NULL; return NULL;
} }
@ -618,7 +621,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
else else
nDrive = default_drive; nDrive = default_drive;
if (nDrive > (lastdrive -1)) { if (nDrive >= lastdrive) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
current_ldt = &CDSp->cds_table[nDrive]; current_ldt = &CDSp->cds_table[nDrive];
@ -799,7 +802,7 @@ COUNT dos_findnext(void)
*/ */
nDrive = dmp->dm_drive & 0x1f; nDrive = dmp->dm_drive & 0x1f;
if (nDrive > (lastdrive -1)) { if (nDrive >= lastdrive) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
current_ldt = &CDSp->cds_table[nDrive]; current_ldt = &CDSp->cds_table[nDrive];
@ -825,7 +828,7 @@ COUNT dos_findnext(void)
/* Force the fnode into read-write mode */ /* Force the fnode into read-write mode */
fnp->f_mode = RDWR; fnp->f_mode = RDWR;
if (dmp->dm_drive > (lastdrive)) { if (dmp->dm_drive >= lastdrive) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
/* Select the default to help non-drive specified path */ /* Select the default to help non-drive specified path */

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.7 2001/03/21 02:56:26 bartoldeman * Revision 1.7 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -152,7 +155,7 @@ VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps,
printf("FGDD\n"); printf("FGDD\n");
/* first check for valid drive */ /* first check for valid drive */
if ((drive < 0) || (drive > (lastdrive -1)) || (drive > NDEVS)) if ((drive < 0) || (drive >= lastdrive) || (drive >= NDEVS))
{ {
*spc = -1; *spc = -1;
return; return;
@ -235,7 +238,7 @@ WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb)
if (Drive < 'A' || Drive > 'Z') if (Drive < 'A' || Drive > 'Z')
return PARSE_RET_BADDRIVE; return PARSE_RET_BADDRIVE;
Drive -= ('A' - 1); Drive -= ('A' - 1);
if (Drive > (lastdrive -1)) if (Drive >= lastdrive)
return PARSE_RET_BADDRIVE; return PARSE_RET_BADDRIVE;
else else
lpFcb->fcb_drive = Drive; lpFcb->fcb_drive = Drive;
@ -804,7 +807,7 @@ BOOL FcbOpen(xfcb FAR * lpXfcb)
return TRUE; return TRUE;
} }
fbcopy((BYTE FAR *) & lpFcb->fcb_fname, (BYTE FAR *) & sftp->sft_name, FNAME_SIZE + FEXT_SIZE); fbcopy((BYTE FAR *) & lpFcb->fcb_fname, (BYTE FAR *) & sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
if ((FcbDrive < 0) || (FcbDrive > (lastdrive -1))) { if ((FcbDrive < 0) || (FcbDrive >= lastdrive)) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
if (CDSp->cds_table[FcbDrive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[FcbDrive].cdsFlags & CDSNETWDRV) {
@ -850,7 +853,7 @@ BOOL FcbDelete(xfcb FAR * lpXfcb)
/* Build a traditional DOS file name */ /* Build a traditional DOS file name */
CommonFcbInit(lpXfcb, PriPathName, &FcbDrive); CommonFcbInit(lpXfcb, PriPathName, &FcbDrive);
if ((FcbDrive < 0) || (FcbDrive > (lastdrive -1))) { if ((FcbDrive < 0) || (FcbDrive >= lastdrive)) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
current_ldt = &CDSp->cds_table[FcbDrive]; current_ldt = &CDSp->cds_table[FcbDrive];

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.18 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.17 2001/03/30 19:30:06 bartoldeman * Revision 1.17 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -631,7 +634,7 @@ dispatch:
/* Get default DPB */ /* Get default DPB */
case 0x1f: case 0x1f:
if (default_drive <= (lastdrive -1)) if (default_drive < lastdrive)
{ {
struct dpb FAR *dpb = (struct dpb FAR *)CDSp->cds_table[default_drive].cdsDpb; struct dpb FAR *dpb = (struct dpb FAR *)CDSp->cds_table[default_drive].cdsDpb;
if (dpb == 0) if (dpb == 0)
@ -840,7 +843,7 @@ dispatch:
/* Get DPB */ /* Get DPB */
case 0x32: case 0x32:
r->DL = ( r->DL == 0 ? default_drive : r->DL - 1); r->DL = ( r->DL == 0 ? default_drive : r->DL - 1);
if (r->DL <= (lastdrive - 1)) if (r->DL < lastdrive)
{ {
struct dpb FAR *dpb = CDSp->cds_table[r->DL].cdsDpb; struct dpb FAR *dpb = CDSp->cds_table[r->DL].cdsDpb;
if (dpb == 0 || if (dpb == 0 ||
@ -1517,13 +1520,13 @@ dispatch:
switch (r->AL) switch (r->AL)
{ {
case 0x07: case 0x07:
if (r->DL <= (lastdrive -1)) { if (r->DL < lastdrive) {
CDSp->cds_table[r->DL].cdsFlags |= 0x100; CDSp->cds_table[r->DL].cdsFlags |= 0x100;
} }
break; break;
case 0x08: case 0x08:
if (r->DL <= (lastdrive -1)) { if (r->DL < lastdrive) {
CDSp->cds_table[r->DL].cdsFlags &= ~0x100; CDSp->cds_table[r->DL].cdsFlags &= ~0x100;
} }
break; break;
@ -1680,7 +1683,7 @@ dispatch:
/* Get/Set Serial Number */ /* Get/Set Serial Number */
case 0x69: case 0x69:
rc = ( r->BL == 0 ? default_drive : r->BL - 1); rc = ( r->BL == 0 ? default_drive : r->BL - 1);
if (rc <= (lastdrive -1)) if (rc < lastdrive)
{ {
UWORD saveCX = r->CX; UWORD saveCX = r->CX;
if (CDSp->cds_table[rc].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[rc].cdsFlags & CDSNETWDRV) {
@ -1881,7 +1884,7 @@ VOID int2526_handler(WORD mode, struct int25regs FAR * r)
drv = r->ax; drv = r->ax;
if (drv >= (lastdrive - 1)) if (drv >= lastdrive)
{ {
r->ax = 0x202; r->ax = 0x202;
r->flags |= FLG_CARRY; r->flags |= FLG_CARRY;

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.7 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.6 2000/06/21 18:16:46 jimtabor * Revision 1.6 2000/06/21 18:16:46 jimtabor
* Add UMB code, patch, and code fixes * Add UMB code, patch, and code fixes
* *
@ -164,7 +167,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
dev = ( r->BL == 0 ? default_drive : r->BL - 1); dev = ( r->BL == 0 ? default_drive : r->BL - 1);
if (dev > (lastdrive -1)) if (dev >= lastdrive)
{ {
*err = DE_INVLDDRV; *err = DE_INVLDDRV;
return 0; return 0;

View File

@ -39,8 +39,8 @@ static BYTE *mainRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.11 2001/03/30 20:11:14 bartoldeman * Revision 1.12 2001/03/30 22:27:42 bartoldeman
* Truly got DOS=HIGH reporting for INT21/AX=0x3306 working now. * Saner lastdrive handling.
* *
* Revision 1.10 2001/03/30 19:30:06 bartoldeman * Revision 1.10 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
@ -552,7 +552,7 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
pblk_devices->dpb_subunit = Index; pblk_devices->dpb_subunit = Index;
pblk_devices->dpb_device = dhp; pblk_devices->dpb_device = dhp;
pblk_devices->dpb_flags = M_CHANGED; pblk_devices->dpb_flags = M_CHANGED;
if ((CDSp != 0) && (nblkdev <= lastdrive)) if ((CDSp != 0) && (nblkdev < lastdrive))
{ {
CDSp->cds_table[nblkdev].cdsDpb = pblk_devices; CDSp->cds_table[nblkdev].cdsDpb = pblk_devices;
CDSp->cds_table[nblkdev].cdsFlags = CDSPHYSDRV; CDSp->cds_table[nblkdev].cdsFlags = CDSPHYSDRV;

View File

@ -31,6 +31,9 @@ static BYTE *mainRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.9 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling.
*
* Revision 1.8 2000/08/06 05:50:17 jimtabor * Revision 1.8 2000/08/06 05:50:17 jimtabor
* Add new files and update cvs with patches and changes * Add new files and update cvs with patches and changes
* *
@ -220,7 +223,7 @@ COUNT get_verify_drive(char FAR *src)
} }
else else
drive = default_drive; drive = default_drive;
if ((drive < 0) || (drive > lastdrive)) { if ((drive < 0) || (drive >= lastdrive)) {
drive = DE_INVLDDRV; drive = DE_INVLDDRV;
} }
return drive; return drive;
@ -255,7 +258,7 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
{ {
buf[0] = (src[0] | 0x20) + 'A' - 'a'; buf[0] = (src[0] | 0x20) + 'A' - 'a';
if (buf[0] > lastdrive + 'A') if (buf[0] >= lastdrive + 'A')
return DE_PATHNOTFND; return DE_PATHNOTFND;
src += 2; src += 2;