From 7e1d6fb8a9da91e9171c144566af6e2d4a3a3bb9 Mon Sep 17 00:00:00 2001 From: Luchezar Georgiev Date: Sat, 4 Dec 2004 16:48:44 +0000 Subject: [PATCH] Replace bug 1819 fix with the better patch of Jason Hood and add his Set Extended Error implementation git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1069 6ac86273-5f31-0410-b378-82cca8765d1b --- docs/contrib.txt | 1 + docs/history.txt | 5 ++++- kernel/inthndlr.c | 44 ++++++++++++++++++++++++++++++-------------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/docs/contrib.txt b/docs/contrib.txt index 6f446a5..739b7a5 100644 --- a/docs/contrib.txt +++ b/docs/contrib.txt @@ -16,6 +16,7 @@ Eric Biederman (ebiederm+eric@ccr.net) Eric Luttmann (ecl@users.sourceforge.net) Helmut Fritsch (helmut.fritsch@gcd-hs.de) James Tabor (jimtabor@infohwy.com) +Jason Hood (jadoxa@yahoo.com.au) Jens Horstmeier (Jens.Horstmeier@abg1.siemens.de) Jeremy Davis (jeremyd@computer.org) Jim Hall (jhall@freedos.org) diff --git a/docs/history.txt b/docs/history.txt index cb7a934..751fb70 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -286,6 +286,10 @@ * config.c - source: (Bernd) the codepage table rewritten into a smaller layout. - bugfix: (Bernd, Aitor) country ID for Spain set to 34 (instead 33). ++ Changes Jason + * inthndlr.c + - set FAT32 fields of FAT12/16 DPBs on Int21h/7302h. Fixes bug 1819 + - implement Set Extended Error function to help VC 4.99 with DOSLFN + Changes Lucho * exeflat.c - fix: eliminated warning by explicit cast. @@ -311,7 +315,6 @@ - set AX = ES after Int 21h/4Ah (undocumented but expected by BRUN45) (the last 2 changes needed to fix bugs discovered by Michael Devore) - added Int 2Fh/2Fh processing to set DOS version as per MS-DOS 4.0 - - set FAT32 fields of FAT12/16 DPBs on Int21h/7302h. Fixes bug 1819 * autoexec.bat now single-line for FreeCOM compatibility when EOL=LF * break.c: check_handle_break() return was undefined if no Ctrl-break * config.sys: all commands removed as they were close to defaults diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 6a244c1..c0fb420 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -196,19 +196,18 @@ int int21_fat32(lregs *r) xddp = MK_FP(r->ES, r->DI); fmemcpy(&xddp->xdd_dpb, dpb, sizeof(struct dpb)); - if (!ISFAT32(dpb)) - { /* FAT12/16 - set FAT32 fields. This helps DOSLFN 0.33+ */ - xddp->xdd_dpb.dpb_nfreeclst_un.dpb_nfreeclst_st.dpb_nfreeclst_hi = 0; - xddp->xdd_dpb.dpb_xflags = 0; - xddp->xdd_dpb.dpb_xfsinfosec = 0xFFFF; /* unknown */ - xddp->xdd_dpb.dpb_xbackupsec = 0xFFFF; - xddp->xdd_dpb.dpb_xdata = dpb->dpb_data; - xddp->xdd_dpb.dpb_xsize = dpb->dpb_size; - xddp->xdd_dpb.dpb_xfatsize = dpb->dpb_fatsize; - xddp->xdd_dpb.dpb_xrootclst = 0; /* impossible cluster number */ - xddp->xdd_dpb.dpb_xcluster = dpb->dpb_cluster; - } xddp->xdd_dpbsize = sizeof(struct dpb); + + /* if it doesn't look like an extended DPB, fill in those fields */ + if (!ISFAT32(dpb) && dpb->dpb_xsize != dpb->dpb_size) + { + xddp->xdd_dpb.dpb_nfreeclst_un.dpb_nfreeclst_st.dpb_nfreeclst_hi = + (dpb->dpb_nfreeclst == 0xFFFF ? 0xFFFF : 0); + dpb16to32(&xddp->xdd_dpb); + xddp->xdd_dpb.dpb_xfatsize = dpb->dpb_fatsize; + xddp->xdd_dpb.dpb_xcluster = (dpb->dpb_cluster == 0xFFFF ? + 0xFFFFFFFFuL : dpb->dpb_cluster); + } break; } /* Get extended free drive space */ @@ -737,6 +736,9 @@ dispatch: lr.AL = retp[1]; lr.AH = retp[2]; } +#if TOM /* Disable the much rarer case to save code size. The only MS-DOS + * utility featuring it is DOSKEY, and FreeCom almost replaces it + */ else if (retp[0] == 0x86 && /* xchg al,ah */ retp[1] == 0xc4 && retp[2] == 0x3d && /* cmp ax, xxyy */ (retp[5] == 0x75 || retp[5] == 0x74)) /* je/jne error */ @@ -744,9 +746,8 @@ dispatch: lr.AL = retp[4]; lr.AH = retp[3]; } - +#endif } - break; /* Keep Program (Terminate and stay resident) */ @@ -1222,6 +1223,21 @@ dispatch: goto error_exit; break; + /* Set Extended Error */ + case 0x0a: + { + lregs er; + fmemcpy(&er, FP_DS_DX, sizeof(er)); + CritErrCode = er.AX; + FP_SEG(CritErrDev) = er.ES; + FP_OFF(CritErrDev) = er.DI; + CritErrLocus = er.CH; + CritErrClass = er.BH; + CritErrAction = er.BL; + CLEAR_CARRY_FLAG(); + break; + } + default: CritErrCode = SUCCESS; goto error_invalid;