From ab53a50c490e0c78e31d6d2ff1ebef457b98dfa5 Mon Sep 17 00:00:00 2001 From: Eric Auer Date: Sat, 28 Jul 2007 19:03:40 +0000 Subject: [PATCH] Mktemp (21.5a) only inserts leading backslash in temp file name if no directory given in template if DOS version is 5. Older and newer DOS versions just use no dirspec in that case. This helps ftp.sac.sk/pub/sac/pack/iup067.zip exepacker which tries to rename the temp file to a file in current directory. Prepared Truename (21.60) to return 0 if okay, 3a00 if char dev (and not JOIN / network?). May need further coding to actually have the intended effect...? Note: The shell TRUENAME command may change names for display! Changed the "true DOS version" for FAT16 kernels from 5.0 to 6.22 to reflect the updates in 21.5a and 21.60, other 5 / 6 differences are not simply in the kernel but more in COUNTRY, KEYB, HIMEM, SMARTDRV, DBLSPACE, EMM386, COMMAND and so on. In addition, 6.22 is a popular version number to report :-). git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1345 6ac86273-5f31-0410-b378-82cca8765d1b --- hdr/version.h | 6 +++--- kernel/inthndlr.c | 5 +++-- kernel/newstuff.c | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/hdr/version.h b/hdr/version.h index b155673..ccdbb63 100644 --- a/hdr/version.h +++ b/hdr/version.h @@ -38,14 +38,14 @@ static BYTE *date_hRcsId = #define MAJOR_RELEASE 7 #define MINOR_RELEASE 10 #else -#define MAJOR_RELEASE 5 -#define MINOR_RELEASE 00 +#define MAJOR_RELEASE 6 +#define MINOR_RELEASE 22 #endif #define REVISION_SEQ 38 /* returned in BL by int 21 function 30 */ #define OEM_ID 0xfd /* FreeDOS, returned in BH by int 21 30 */ -#define SOURCE_DATE_STRING "Jul 21 2007" /* DATE OF THE NEWEST SOURCE FILE */ +#define SOURCE_DATE_STRING "Jul 28 2007" /* DATE OF THE NEWEST SOURCE FILE */ /* #define KERNEL_VERSION_STRING "1.1.35" formerly used in os_release text */ #define KERNEL_BUILD_STRING "2038pre/2036svn" /* used in os_release string */ diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 7d3ca2c..4fc0f74 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1311,12 +1311,13 @@ dispatch: CritErrCode = -rc; /* Maybe set */ SET_CARRY_FLAG(); } - r->AX = -rc; + r->AX = -rc; /* okay because we use real_exit */ goto real_exit; } case 0x60: /* TRUENAME */ rc = DosTruename(MK_FP(lr.DS, lr.SI), adjust_far(FP_ES_DI)); + lr.AX = rc; goto short_check; #ifdef TSC @@ -1562,7 +1563,7 @@ error_exit: error_carry: SET_CARRY_FLAG(); exit_dispatch: - fmemcpy(r, &lr, sizeof(lregs) - 4); + fmemcpy(r, &lr, sizeof(lregs) - 4); /* copy lr -> r but exclude flags */ r->DS = lr.DS; r->ES = lr.ES; real_exit:; diff --git a/kernel/newstuff.c b/kernel/newstuff.c index bc73c9c..620109d 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -76,8 +76,10 @@ long DosMkTmp(BYTE FAR * pathname, UWORD attr) int loop; ptmp = pathname + fstrlen(pathname); - if (ptmp == pathname || (ptmp[-1] != '\\' && ptmp[-1] != '/')) - *ptmp++ = '\\'; + if (os_major == 5) { /* clone some bad habit of MS DOS 5.0 only */ + if (ptmp == pathname || (ptmp[-1] != '\\' && ptmp[-1] != '/')) + *ptmp++ = '\\'; + } ptmp[8] = '\0'; randvar = ((unsigned long)dos_getdate() << 16) | dos_gettime(); @@ -352,7 +354,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) if (cdsEntry->cdsFlags & CDSNETWDRV) result |= IS_NETWORK; - dhp = IsDevice(src); + dhp = IsDevice(src); /* returns header if -char- device */ if (dhp) result |= IS_DEVICE; @@ -605,6 +607,15 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) dest[2] != '/' && !dir_exists(dest)) return DE_PATHNOTFND; + /* Note: Not reached on error or if JOIN or QRemote_Fn (2f.1123) matched */ + if (mode==CDS_MODE_ALLOW_WILDCARDS) /* DosTruename mode */ + { + /* in other words: result & 0x60 = 0x20...: */ + if (os_major==6 && (result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) + result = 0x3a00; /* MS DOS 6.22, according to RBIL: AH=3a if char dev */ + else + result = 0; /* AL is 00, 2f, 5c, or last-of-cdsEntry->cdsCurrentPath? */ + } tn_printf(("Physical path: \"%s\"\n", dest)); return result; }