From ae3d48ab339319b15015e33b32fd571703b30d06 Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Thu, 30 Apr 2009 05:16:31 +0000 Subject: [PATCH] Change how DosGetExtFree checks for drive so int 21h/7303h more lax about path given, support driver specifier with or without slash (C: or C:\) and just slash (\) for current drive (does allow some additional bogus paths to return success) git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1369 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/dosfns.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 0223148..0a8c3ed 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -884,7 +884,6 @@ UWORD DosGetFree(UBYTE drive, UWORD * navc, UWORD * bps, UWORD * nc) } #ifdef WITHFAT32 -/* network names like \\SERVER\C aren't supported yet */ #define IS_SLASH(ch) (ch == '\\' || ch == '/') COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp) { @@ -892,13 +891,19 @@ COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp) struct cds FAR *cdsp; UCOUNT rg[4]; - if (IS_SLASH(DriveString[0]) || !IS_SLASH(DriveString[2]) - || DriveString[1] != ':') - return DE_INVLDDRV; + /* + DriveString should be in form of "C:", "C:\", "\", + where "\" is treated as a request for the current drive, + or network name in form "\\SERVER\share" + however, network names like \\SERVER\C aren't supported yet + */ + cdsp = NULL; + if (DriveString[1] == ':') + cdsp = get_cds(DosUpFChar(*DriveString) - 'A'); /* assume drive specified */ + else if (IS_SLASH(DriveString[0]) && !IS_SLASH(DriveString[1])) + cdsp = get_cds(default_drive); /* use current drive */ - cdsp = get_cds(DosUpFChar(*DriveString) - 'A'); - - if (cdsp == NULL) + if (cdsp == NULL) /* either error, really bad string, or network name */ return DE_INVLDDRV; if (cdsp->cdsFlags & CDSNETWDRV)