Merge pull request #3 from lpproj/underdesk_201509

Multiple fixes
This commit is contained in:
PerditionC 2015-09-22 01:30:35 -04:00
commit 55fe761ebf
5 changed files with 64 additions and 17 deletions

View File

@ -1502,7 +1502,8 @@ STATIC BOOL LoadCountryInfo(char *filenam, UWORD ctryCode, UWORD codePage)
{"\377DBCS ", &nlsDBCSHardcoded} /* 7, not supported [yet] */ {"\377DBCS ", &nlsDBCSHardcoded} /* 7, not supported [yet] */
}; };
static struct subf_hdr hdr[8]; static struct subf_hdr hdr[8];
int fd, entries, count, i; static int entries, count;
int fd, i;
char *filename = filenam == NULL ? "\\COUNTRY.SYS" : filenam; char *filename = filenam == NULL ? "\\COUNTRY.SYS" : filenam;
BOOL rc = FALSE; BOOL rc = FALSE;

View File

@ -414,6 +414,17 @@ const char FAR *get_root(const char FAR * fname)
return fname; return fname;
} }
STATIC void ConvertPathNameToFCBName(char *FCBName, const char *PathName)
{
ConvertNameSZToName83(FCBName, (char *)FP_OFF(get_root(PathName)));
FCBName[FNAME_SIZE + FEXT_SIZE] = '\0';
}
STATIC void set_fcbname(void)
{
ConvertPathNameToFCBName(DirEntBuffer.dir_name, PriPathName);
}
/* initialize SFT fields (for open/creat) for character devices */ /* initialize SFT fields (for open/creat) for character devices */
STATIC int DeviceOpenSft(struct dhdr FAR *dhp, sft FAR *sftp) STATIC int DeviceOpenSft(struct dhdr FAR *dhp, sft FAR *sftp)
{ {
@ -490,6 +501,8 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
if (result < SUCCESS) if (result < SUCCESS)
return result; return result;
set_fcbname();
/* now get a free system file table entry */ /* now get a free system file table entry */
if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1) if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1)
return DE_TOOMANY; return DE_TOOMANY;
@ -503,6 +516,18 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */ sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
sftp->sft_attrib = attrib = attrib | D_ARCHIVE; sftp->sft_attrib = attrib = attrib | D_ARCHIVE;
/* check for a device */
if ((result & IS_DEVICE) && (dhp = IsDevice(fname)) != NULL)
{
int rc = DeviceOpenSft(dhp, sftp);
/* check the status code returned by the
* driver when we tried to open it
*/
if (rc < SUCCESS)
return rc;
return sft_idx;
}
if (result & IS_NETWORK) if (result & IS_NETWORK)
{ {
int status; int status;
@ -535,18 +560,6 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
return status; return status;
} }
/* check for a device */
if ((result & IS_DEVICE) && (dhp = IsDevice(fname)) != NULL)
{
int rc = DeviceOpenSft(dhp, sftp);
/* check the status code returned by the
* driver when we tried to open it
*/
if (rc < SUCCESS)
return rc;
return sft_idx;
}
/* First test the flags to see if the user has passed a valid */ /* First test the flags to see if the user has passed a valid */
/* file mode... */ /* file mode... */
if ((flags & O_ACCMODE) > 2) if ((flags & O_ACCMODE) > 2)
@ -919,6 +932,8 @@ COUNT DosChangeDir(BYTE FAR * s)
if (result < SUCCESS) if (result < SUCCESS)
return DE_PATHNOTFND; return DE_PATHNOTFND;
set_fcbname();
if ((FP_OFF(current_ldt) != 0xFFFF) && if ((FP_OFF(current_ldt) != 0xFFFF) &&
(strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath))) (strlen(PriPathName) >= sizeof(current_ldt->cdsCurrentPath)))
return DE_PATHNOTFND; return DE_PATHNOTFND;
@ -977,6 +992,8 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
if (rc < SUCCESS) if (rc < SUCCESS)
return rc; return rc;
set_fcbname();
/* /// Added code here to do matching against device names. /* /// Added code here to do matching against device names.
DOS findfirst will match exact device names if the DOS findfirst will match exact device names if the
filename portion (excluding the extension) contains filename portion (excluding the extension) contains
@ -1049,7 +1066,7 @@ COUNT DosFindNext(void)
/* findnext will always fail on a volume id search or device name */ /* findnext will always fail on a volume id search or device name */
if ((sda_tmp_dm.dm_attr_srch & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID if ((sda_tmp_dm.dm_attr_srch & ~(D_RDONLY | D_ARCHIVE | D_DEVICE)) == D_VOLID
|| sda_tmp_dm.dm_entry == 0xffff) || (!(sda_tmp_dm.dm_drive & 0x80) && sda_tmp_dm.dm_entry == 0xffff))
return DE_NFILES; return DE_NFILES;
memset(&SearchDir, 0, sizeof(struct dirent)); memset(&SearchDir, 0, sizeof(struct dirent));
@ -1113,6 +1130,8 @@ COUNT DosGetFattr(BYTE FAR * name)
if (PriPathName[3] == '\0') if (PriPathName[3] == '\0')
return 0x10; return 0x10;
set_fcbname();
if (result & IS_NETWORK) if (result & IS_NETWORK)
return network_redirector(REM_GETATTRZ); return network_redirector(REM_GETATTRZ);
@ -1133,6 +1152,8 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD attrp)
if (result < SUCCESS) if (result < SUCCESS)
return result; return result;
set_fcbname();
if (result & IS_NETWORK) if (result & IS_NETWORK)
return remote_setfattr(attrp); return remote_setfattr(attrp);
@ -1170,6 +1191,8 @@ COUNT DosDelete(BYTE FAR * path, int attrib)
if (result < SUCCESS) if (result < SUCCESS)
return result; return result;
set_fcbname();
if (result & IS_NETWORK) if (result & IS_NETWORK)
return network_redirector(REM_DELETE); return network_redirector(REM_DELETE);
@ -1206,6 +1229,8 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
if (result < SUCCESS) if (result < SUCCESS)
return result; return result;
set_fcbname();
if ((result & (IS_NETWORK | IS_DEVICE)) == IS_DEVICE) if ((result & (IS_NETWORK | IS_DEVICE)) == IS_DEVICE)
return DE_FILENOTFND; return DE_FILENOTFND;
@ -1220,6 +1245,8 @@ COUNT DosMkRmdir(const char FAR * dir, int action)
if (result < SUCCESS) if (result < SUCCESS)
return result; return result;
set_fcbname();
if (result & IS_NETWORK) if (result & IS_NETWORK)
return network_redirector(action == 0x39 ? REM_MKDIR : REM_RMDIR); return network_redirector(action == 0x39 ? REM_MKDIR : REM_RMDIR);
@ -1355,7 +1382,10 @@ COUNT DosTruename(const char FAR *src, char FAR *dest)
*/ */
COUNT rc = truename(src, PriPathName, CDS_MODE_ALLOW_WILDCARDS); COUNT rc = truename(src, PriPathName, CDS_MODE_ALLOW_WILDCARDS);
if (rc >= SUCCESS) if (rc >= SUCCESS)
{
fstrcpy(dest, PriPathName); fstrcpy(dest, PriPathName);
set_fcbname();
}
return rc; return rc;
} }

View File

@ -1137,6 +1137,8 @@ dispatch:
/* Dos Create New Psp & set p_size */ /* Dos Create New Psp & set p_size */
case 0x55: case 0x55:
child_psp(lr.DX, cu_psp, lr.SI); child_psp(lr.DX, cu_psp, lr.SI);
/* copy command line from the parent (required for some device loaders) */
fmemcpy(MK_FP(lr.DX, 0x80), MK_FP(cu_psp, 0x80), 128);
cu_psp = lr.DX; cu_psp = lr.DX;
break; break;

View File

@ -299,9 +299,23 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
else else
result = default_drive; result = default_drive;
dhp = IsDevice(src);
cdsEntry = get_cds(result);
if (cdsEntry == NULL)
{
/* workaround for a device prefixed with invalid drive (e.g. "@:NUL") */
/* (MS-DOS always return drive P: for invalid drive. Why P:?) */
if (dhp)
{
result = default_drive;
cdsEntry = get_cds(result); cdsEntry = get_cds(result);
if (cdsEntry == NULL) if (cdsEntry == NULL)
return DE_PATHNOTFND; return DE_PATHNOTFND;
}
else
return DE_PATHNOTFND;
}
fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS)); fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS));
tn_printf(("CDS entry: #%u @%p (%u) '%s'\n", result, cdsEntry, tn_printf(("CDS entry: #%u @%p (%u) '%s'\n", result, cdsEntry,
@ -312,7 +326,6 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
if (TempCDS.cdsFlags & CDSNETWDRV) if (TempCDS.cdsFlags & CDSNETWDRV)
result |= IS_NETWORK; result |= IS_NETWORK;
dhp = IsDevice(src); /* returns header if -char- device */
if (dhp) if (dhp)
result |= IS_DEVICE; result |= IS_DEVICE;

View File

@ -469,7 +469,8 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd)
/* rewind to start */ /* rewind to start */
SftSeek(fd, 0, 0); SftSeek(fd, 0, 0);
/* read everything, but at most 64K - sizeof(PSP) */ /* read everything, but at most 64K - sizeof(PSP) */
DosRWSft(fd, 0xff00, sp, XFR_READ); /* lpproj: some device drivers (not exe) are larger than 0xff00bytes... */
DosRWSft(fd, (mode == OVERLAY) ? 0xfffeU : 0xff00U, sp, XFR_READ);
DosCloseSft(fd, FALSE); DosCloseSft(fd, FALSE);
} }