From edf98624fbe105eb45da3c67798dba04ae5bd679 Mon Sep 17 00:00:00 2001 From: Jim Tabor Date: Fri, 26 May 2000 19:25:19 +0000 Subject: [PATCH] Read History file for Change info git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@27 6ac86273-5f31-0410-b378-82cca8765d1b --- docs/history.txt | 29 ++++++ kernel/chario.c | 15 +-- kernel/config.c | 15 +-- kernel/console.asm | 23 +++-- kernel/dosfns.c | 222 ++++++++++++++++++++++++--------------------- kernel/dosnames.c | 44 ++------- kernel/dsk.c | 21 ++++- kernel/fatdir.c | 28 +++--- kernel/fcbfns.c | 47 ++-------- kernel/io.asm | 5 +- kernel/main.c | 20 ++-- kernel/network.c | 18 ++-- kernel/newstuff.c | 42 +++++++++ kernel/proto.h | 10 +- kernel/task.c | 10 +- 15 files changed, 312 insertions(+), 237 deletions(-) diff --git a/docs/history.txt b/docs/history.txt index b1565a4..8b30a47 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -1,3 +1,32 @@ +2000 May 26 - Build 2020 +-------- James Tabor (jimtabor@infohwy.com) + Code Clean up and Now the Release. + +2000 May 26 - Build 2020 +-------- James Tabor (jimtabor@infohwy.com) ++ Fixed IsDevice is used in FcbFns.c and DosFns.c. I removed IsDevice + from DosNames.c an placed it in DosFns.c. FcbFns had dup code + and it was removed. This fixed all the functions using IsDevice. + + Truename works now. I consider it dangerous and brain damaged. + Note: + truename X:\DIR\con -> X:/CON, note the '/'. + truename foo*.* -> X:\DIR\FOO?????.??? + truename *.*\*.*\*.* -> ????????.???\????????.???\????????.??? + truename *.*\*.**\*.* -> endless Loop + I will fix this later ;^) + + Found InitPSP running 3 time. On the 2'nd run the standard handles + were closed with out DosClose. Now Device Drivers can Print out + there startup info. + ++ Added New IOCTL code in Dsk.c. + +2000 May 26 - Build 2020 +-------- James Tabor (jimtabor@infohwy.com) ++ Fix Kolyan Ksenev (7207@mx.csd.tsu.ru) (nik0la@acm.org) + found Major bugs in Task.c and chario.c. + 2000 May 25 - Build 2020 -------- James Tabor (jimtabor@infohwy.com) + Fixed Project history. diff --git a/kernel/chario.c b/kernel/chario.c index 75083e2..45aa2be 100644 --- a/kernel/chario.c +++ b/kernel/chario.c @@ -36,6 +36,9 @@ static BYTE *charioRcsId = "$Id$"; /* * $Log$ + * Revision 1.4 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.3 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -142,9 +145,9 @@ struct dhdr FAR *finddev(UWORD attr_mask) /* return dev/null if no matching driver found */ return &nul_dev; } -/* - VOID cso(COUNT c) - { + +VOID cso(COUNT c) +{ BYTE buf = c; struct dhdr FAR *lpDevice; @@ -157,14 +160,14 @@ struct dhdr FAR *finddev(UWORD attr_mask) lpDevice = (struct dhdr FAR *)finddev(ATTR_CONOUT)); if (CharReqHdr.r_status & S_ERROR) char_error(&CharReqHdr, lpDevice); - } - */ +} + VOID sto(COUNT c) { static COUNT scratch; /* make this static to save stack space */ - DosWrite(STDOUT, 1, (BYTE FAR *) & c, (COUNT FAR *) scratch); + DosWrite(STDOUT, 1, (BYTE FAR *) & c, (COUNT FAR *) &scratch); } VOID mod_sto(REG UCOUNT c) diff --git a/kernel/config.c b/kernel/config.c index 23a385a..f8dfae4 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -39,6 +39,9 @@ static BYTE *RcsId = "$Id$"; /* * $Log$ + * Revision 1.4 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.3 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -790,12 +793,12 @@ INIT static VOID Device(BYTE * pLine) if (DosExec(3, &eb, szBuf) == SUCCESS) { - while (FP_OFF(dhp) != 0xFFFF) - { - next_dhp = MK_FP(FP_SEG(dhp), FP_OFF(dhp->dh_next)); - dhp->dh_next = nul_dev.dh_next; - link_dhdr(&nul_dev, dhp, pLine); - dhp = next_dhp; + /* Link in device driver and save nul_dev pointer to next */ + next_dhp = dhp->dh_next = nul_dev.dh_next; + nul_dev.dh_next = dhp; + + if(init_device(dhp, pLine)){ + nul_dev.dh_next = next_dhp; /* return orig pointer if error */ } } else diff --git a/kernel/console.asm b/kernel/console.asm index bc2a6eb..9673def 100644 --- a/kernel/console.asm +++ b/kernel/console.asm @@ -28,6 +28,9 @@ ; $Header$ ; ; $Log$ +; Revision 1.4 2000/05/26 19:25:19 jimtabor +; Read History file for Change info +; ; Revision 1.3 2000/05/25 20:56:21 jimtabor ; Fixed project history ; @@ -216,16 +219,16 @@ IntRetn: iret - global _cso -_cso - push bp - mov bp,sp - push ax - mov ax,[bp+4] - int 29h - pop ax - pop bp - retn +; global _cso +;_cso +; push bp +; mov bp,sp +; push ax +; mov ax,[bp+4] +; int 29h +; pop ax +; pop bp +; retn global _int29_handler _int29_handler: diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 17ddd01..2987e6a 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -34,6 +34,9 @@ static BYTE *dosfnsRcsId = "$Id$"; /* * $Log$ + * Revision 1.5 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.4 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -134,9 +137,7 @@ static BYTE *dosfnsRcsId = "$Id$"; sft FAR *get_sft(COUNT); WORD get_free_hndl(VOID); sft FAR *get_free_sft(WORD FAR *); -BYTE FAR *get_root(BYTE FAR *); BOOL cmatch(COUNT, COUNT, COUNT); -BOOL fnmatch(BYTE FAR *, BYTE FAR *, COUNT, COUNT); struct f_node FAR *xlt_fd(COUNT); @@ -220,8 +221,8 @@ UCOUNT GenericRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err, } /* - * Do remote first or return error. - * must have been opened from remote. + * Do remote first or return error. + * must have been opened from remote. */ if (s->sft_flags & SFT_FSHARED) { @@ -338,6 +339,7 @@ UCOUNT DosWrite(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err) *err = DE_ACCESS; return 0; } + if (s->sft_flags & SFT_FSHARED) { WriteCount = Remote_RW(REM_WRITE, n, bp, s, err); @@ -510,40 +512,57 @@ COUNT SftSeek(sft FAR *s, LONG new_pos, COUNT mode) if (s->sft_flags & SFT_FSHARED) { - if (mode == 2) { - /* seek from end of file */ - int2f_Remote_call(REM_LSEEK, 0, (UWORD) FP_SEG(new_pos), (UWORD) FP_OFF(new_pos), (VOID FAR *) s, 0, (VOID FAR *)&data); - s->sft_posit = data; - - return SUCCESS; + /* seek from end of file */ + if (mode == 2) { +/* + * RB list has it as Note: + * this function is called by the DOS 3.1+ kernel, but only when seeking + * from the end of a file opened with sharing modes set in such a manner + * that another process is able to change the size of the file while it + * is already open + * Tested this with Shsucdx ver 0.06 and 1.0. Both now work. + * Lredir via mfs.c from DosEMU works when writing appended files. + * Mfs.c looks for these mode bits set, so here is my best guess.;^) + */ + if ((s->sft_mode & SFT_MDENYREAD) || (s->sft_mode & SFT_MDENYNONE)) + { + int2f_Remote_call(REM_LSEEK, 0, (UWORD) FP_SEG(new_pos), (UWORD) FP_OFF(new_pos), (VOID FAR *) s, 0, (VOID FAR *)&data); + s->sft_posit = data; + return SUCCESS; + } + else + { + s->sft_posit = s->sft_size - new_pos; + return SUCCESS; + } } - if (mode == 0) { - s->sft_posit = new_pos; - return SUCCESS; + if (mode == 0) { + s->sft_posit = new_pos; + return SUCCESS; } - if (mode == 1) { - s->sft_posit += new_pos; - return SUCCESS; + if (mode == 1) { + s->sft_posit += new_pos; + return SUCCESS; } return DE_INVLDFUNC; - } + } - /* Do special return for character devices */ - if (s->sft_flags & SFT_FDEVICE) - { + /* Do special return for character devices */ + if (s->sft_flags & SFT_FDEVICE) + { s->sft_posit = 0l; - return SUCCESS; - } - else - { + return SUCCESS; + } + else + { LONG result = dos_lseek(s->sft_status, new_pos, mode); if (result < 0l) return (int)result; else { s->sft_posit = result; - return SUCCESS; - } - } + return SUCCESS; + } + } } COUNT DosSeek(COUNT hndl, LONG new_pos, COUNT mode, ULONG * set_pos) @@ -603,7 +622,7 @@ static sft FAR *get_free_sft(WORD FAR * sft_idx) return (sft FAR *) - 1; } -static BYTE FAR *get_root(BYTE FAR * fname) +BYTE FAR *get_root(BYTE FAR * fname) { BYTE FAR *froot; REG WORD length; @@ -629,7 +648,7 @@ static BOOL cmatch(COUNT s, COUNT d, COUNT mode) return s == d; } -static BOOL fnmatch(BYTE FAR * s, BYTE FAR * d, COUNT n, COUNT mode) +BOOL fnmatch(BYTE FAR * s, BYTE FAR * d, COUNT n, COUNT mode) { while (n--) { @@ -649,7 +668,7 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib) WORD i; COUNT result, drive; - /* get a free handle */ + /* get a free handle */ if ((hndl = get_free_hndl()) == 0xff) return DE_TOOMANY; @@ -657,25 +676,9 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib) if ((sftp = get_free_sft((WORD FAR *) & sft_idx)) == (sft FAR *) - 1) return DE_TOOMANY; - /* check for a device */ - froot = get_root(fname); - for (i = 0; i < FNAME_SIZE; i++) - { - if (*froot != '\0' && *froot != '.') - PriPathName[i] = *froot++; - else - break; - } - - for (; i < FNAME_SIZE; i++) - PriPathName[i] = ' '; - - /* if we have an extension, can't be a device */ - if (*froot != '.') - { - for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next) - { - if (fnmatch((BYTE FAR *) PriPathName, (BYTE FAR *) dhp->dh_name, FNAME_SIZE, FALSE)) + /* check for a device */ + dhp = IsDevice(fname); + if ( dhp ) { sftp->sft_count += 1; sftp->sft_mode = SFT_MRDWR; @@ -683,13 +686,11 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib) sftp->sft_flags = ((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF; sftp->sft_psp = cu_psp; - fbcopy((BYTE FAR *) PriPathName, sftp->sft_name, FNAME_SIZE + FEXT_SIZE); + fbcopy((BYTE FAR *) SecPathName, sftp->sft_name, FNAME_SIZE + FEXT_SIZE); sftp->sft_dev = dhp; p->ps_filetab[hndl] = sft_idx; return hndl; } - } - } drive = get_verify_drive(fname); if(drive < 0) { @@ -834,24 +835,8 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode) return DE_TOOMANY; /* check for a device */ - froot = get_root(fname); - for (i = 0; i < FNAME_SIZE; i++) - { - if (*froot != '\0' && *froot != '.') - PriPathName[i] = *froot++; - else - break; - } - - for (; i < FNAME_SIZE; i++) - PriPathName[i] = ' '; - - /* if we have an extension, can't be a device */ - if (*froot != '.') - { - for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next) - { - if (fnmatch((BYTE FAR *) PriPathName, (BYTE FAR *) dhp->dh_name, FNAME_SIZE, FALSE)) + dhp = IsDevice(fname); + if ( dhp ) { sftp->sft_count += 1; sftp->sft_mode = mode; @@ -859,18 +844,15 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode) sftp->sft_flags = ((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF; sftp->sft_psp = cu_psp; - fbcopy((BYTE FAR *) PriPathName, sftp->sft_name, FNAME_SIZE + FEXT_SIZE); + fbcopy((BYTE FAR *) SecPathName, sftp->sft_name, FNAME_SIZE + FEXT_SIZE); sftp->sft_dev = dhp; sftp->sft_date = dos_getdate(); sftp->sft_time = dos_gettime(); - p->ps_filetab[hndl] = sft_idx; return hndl; } - } - } - drive = get_verify_drive(fname); + drive = get_verify_drive(fname); if (drive < 0) { return drive; } @@ -988,9 +970,9 @@ VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps, { int2f_Remote_call(REM_GETSPACE, 0, 0, 0, cdsp, 0, &rg); - *spc = (COUNT) rg[0]; - *nc = (COUNT) rg[1]; - *bps = (COUNT) rg[2]; + *spc = (COUNT) rg[0]; + *nc = (COUNT) rg[1]; + *bps = (COUNT) rg[2]; *navc = (COUNT) rg[3]; return; } @@ -1031,7 +1013,7 @@ COUNT DosGetCuDir(COUNT drive, BYTE FAR * s) } cdsp = &CDSp->cds_table[drive]; - current_ldt = cdsp; + current_ldt = cdsp; if (!(cdsp->cdsFlags & CDSNETWDRV) && (cdsp->cdsDpb == 0)) { return DE_INVLDDRV; @@ -1067,7 +1049,7 @@ COUNT DosChangeDir(BYTE FAR * s) { #if defined(CHDIR_DEBUG) printf("Remote Chdir: n='"); - p = s; while(*p) print("%c", *p++); + p = s; while(*p) printf("%c", *p++); printf("' p='"); p = PriPathName; while(*p) printf("%c", *p++); printf("'\n"); @@ -1076,7 +1058,7 @@ COUNT DosChangeDir(BYTE FAR * s) #if defined(CHDIR_DEBUG) printf("status = %04x, new_path='", result); p = cdsd->cdsCurrentPath; while(p) printf("%c", *p++) - print("'\n"); + printf("'\n"); #endif result = -result; if (result != SUCCESS) { @@ -1103,7 +1085,6 @@ COUNT DosChangeDir(BYTE FAR * s) COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name) { - SAttr = (BYTE) attr; return dos_findfirst(attr, name); } @@ -1180,13 +1161,11 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp) struct cds FAR *last_cds; BYTE FAR * p; -#if 0 - if (IsDevice(name)) { + if (IsDevice(name)) { return DE_PATHNOTFND; } -#endif - drive = get_verify_drive(name); + drive = get_verify_drive(name); if (drive < 0) { return drive; } @@ -1216,12 +1195,12 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp) struct cds FAR *last_cds; BYTE FAR *p; -#if 0 - if (IsDevice(name)) { + if (IsDevice(name) ) { + printf("SetAtt\n"); return DE_PATHNOTFND; } -#endif - drive = get_verify_drive(name); + + drive = get_verify_drive(name); if (drive < 0) { return drive; } @@ -1258,11 +1237,11 @@ BYTE DosSelectDrv(BYTE drv) COUNT DosDelete(BYTE FAR *path) { COUNT result, drive; -/* - if (IsDevice(path)) { + + if (IsDevice(path)) { return DE_PATHNOTFND; } - */ + drive = get_verify_drive(path); if (drive < 0) { return drive; @@ -1284,11 +1263,11 @@ COUNT DosDelete(BYTE FAR *path) COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2) { COUNT result, drive1, drive2; -/* + if (IsDevice(path1) || IsDevice(path2)) { - return DE_PATHNOTFND; + return DE_PATHNOTFND; } - */ + drive1 = get_verify_drive(path1); result = truename(path1, PriPathName, FALSE); if (result != SUCCESS) { @@ -1315,11 +1294,11 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2) COUNT DosMkdir(BYTE FAR * dir) { COUNT result, drive; -/* - if (IsDevice(dir)) { + + if (IsDevice(dir)) { return DE_PATHNOTFND; } - */ + drive = get_verify_drive(dir); if (drive < 0) { return drive; @@ -1341,11 +1320,11 @@ COUNT DosMkdir(BYTE FAR * dir) COUNT DosRmdir(BYTE FAR * dir) { COUNT result, drive; -/* - if (IsDevice(dir)) { + + if (IsDevice(dir)) { return DE_PATHNOTFND; } - */ + drive = get_verify_drive(dir); if (drive < 0) { return drive; @@ -1363,3 +1342,42 @@ COUNT DosRmdir(BYTE FAR * dir) } return result; } + +/* + * This seems to work well. + */ + +struct dhdr FAR * IsDevice(BYTE FAR * fname) +{ + struct dhdr FAR *dhp; + BYTE FAR *froot; + WORD i; + + /* check for a device */ + froot = get_root(fname); + for (i = 0; i < FNAME_SIZE; i++) + { + if (*froot != '\0' && *froot != '.') + SecPathName[i] = *froot++; + else + break; + } + + for (; i < FNAME_SIZE; i++) + SecPathName[i] = ' '; + + SecPathName[i] = 0; + /* if we have an extension, can't be a device */ + if (*froot != '.') + { + for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next) + { + if (fnmatch((BYTE FAR *) SecPathName, (BYTE FAR *) dhp->dh_name, FNAME_SIZE, FALSE)) + { + return dhp; + } + } + } + return (struct dhdr FAR *)0; +} + diff --git a/kernel/dosnames.c b/kernel/dosnames.c index d34551d..9daf82f 100644 --- a/kernel/dosnames.c +++ b/kernel/dosnames.c @@ -36,6 +36,9 @@ static BYTE *dosnamesRcsId = "$Id$"; /* * $Log$ + * Revision 1.4 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.3 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -46,6 +49,9 @@ static BYTE *dosnamesRcsId = "$Id$"; * The FreeDOS Kernel. A DOS kernel that aims to be 100% compatible with * MS-DOS. Distributed under the GNU GPL. * + * Revision 1.2 2000/05/08 04:29:59 jimtabor + * Update CVS to 2020 + * * Revision 1.4 2000/03/31 05:40:09 jtabor * Added Eric W. Biederman Patches * @@ -339,44 +345,6 @@ COUNT ParseDosPath(BYTE FAR * lpszFileName, return SUCCESS; } -BOOL IsDevice(BYTE FAR * pszFileName) -{ - REG struct dhdr FAR *dhp = (struct dhdr FAR *)&nul_dev; - BYTE szName[FNAME_SIZE]; - - /* break up the name first */ - if (ParseDosName(pszFileName, - (COUNT *) 0, TempBuffer, szName, (BYTE *) 0, FALSE) - != SUCCESS) - return FALSE; - SpacePad(szName, FNAME_SIZE); - - /* Test 1 - does it start with a \dev or /dev */ - if ((strcmp(szName, "/dev") == 0) - || (strcmp(szName, "\\dev") == 0)) - return TRUE; - - /* Test 2 - is it on the device chain? */ - for (; -1l != (LONG) dhp; dhp = dhp->dh_next) - { - COUNT nIdx; - - /* Skip if not char device */ - if (!(dhp->dh_attr & ATTR_CHAR)) - continue; - - /* now compare */ - for (nIdx = 0; nIdx < FNAME_SIZE; ++nIdx) - { - if (dhp->dh_name[nIdx] != szName[nIdx]) - break; - } - if (nIdx >= FNAME_SIZE) - return TRUE; - } - - return FALSE; -} VOID DosTrimPath(BYTE FAR * lpszPathNamep) { diff --git a/kernel/dsk.c b/kernel/dsk.c index e6123c0..a4d0c92 100644 --- a/kernel/dsk.c +++ b/kernel/dsk.c @@ -33,6 +33,9 @@ static BYTE *dskRcsId = "$Id$"; /* * $Log$ + * Revision 1.6 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.5 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -160,6 +163,12 @@ static struct FS_info BYTE fs_fstype[8]; }; +static struct Access_info +{ + BYTE AI_spec; + BYTE AI_Flag; +}; + static struct media_info miarray[NDEV]; /* Internal media info structs */ static struct FS_info fsarray[NDEV]; static bpb bpbarray[NDEV]; /* BIOS parameter blocks */ @@ -603,8 +612,10 @@ static WORD IoctlQueblk(rqptr rp) { switch(rp->r_count){ case 0x0846: + case 0x0847: case 0x0860: case 0x0866: + case 0x0867: break; default: return S_ERROR; @@ -667,8 +678,6 @@ static WORD Genblkdev(rqptr rp) gioc->ioc_fstype[i] = fs->fs_fstype[i]; } break; - - case 0x0846: /* set volume serial number */ { struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans; @@ -686,6 +695,14 @@ static WORD Genblkdev(rqptr rp) return (dskerr(ret)); } break; + case 0x0867: /* get access flag, always on*/ + { + struct Access_info FAR * ai = (struct Access_info FAR *) rp->r_trans; + ai->AI_Flag = 1; + } + break; + case 0x0847: /* set access flag, no real use*/ + break; default: return S_ERROR; } diff --git a/kernel/fatdir.c b/kernel/fatdir.c index 22e90e1..431bff7 100644 --- a/kernel/fatdir.c +++ b/kernel/fatdir.c @@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$"; /* * $Log$ + * Revision 1.5 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.4 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -198,11 +201,14 @@ struct f_node FAR *dir_open(BYTE FAR * dirname) /* Generate full path name */ ParseDosPath(dirname, (COUNT *) 0, pszPath, (BYTE FAR *) & cdsp->cdsCurrentPath[x]); +/* for testing only for now */ +#if 0 if ((cdsp->cdsFlags & CDSNETWDRV)) { printf("FailSafe %x \n", Int21AX); return fnp; } +#endif if (TempCDS.cdsDpb == 0) { @@ -210,12 +216,6 @@ struct f_node FAR *dir_open(BYTE FAR * dirname) return NULL; } -/* if (drive > lastdrive) - { - release_f_node(fnp); - return NULL; - } - */ fnp->f_dpb = (struct dpb *)TempCDS.cdsDpb; /* Perform all directory common handling after all special */ @@ -565,7 +565,6 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name) REG COUNT i; COUNT nDrive; BYTE *p; - struct cds FAR *cdsp; BYTE FAR *ptr; static BYTE local_name[FNAME_SIZE + 1], @@ -600,9 +599,10 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name) if (nDrive > lastdrive) { return DE_INVLDDRV; } - cdsp = &CDSp->cds_table[nDrive]; + current_ldt = &CDSp->cds_table[nDrive]; + SAttr = (BYTE) attr; - if (cdsp->cdsFlags & CDSNETWDRV) + if (current_ldt->cdsFlags & CDSNETWDRV) { if (Remote_find(REM_FINDFIRST, attr, name, dmp) != 0) return DE_FILENOTFND; @@ -718,7 +718,6 @@ COUNT dos_findnext(void) BYTE FAR *p; BYTE FAR *q; COUNT nDrive; - struct cds FAR *cdsp; /* assign our match parameters pointer. */ dmp = (dmatch FAR *) dta; @@ -726,26 +725,27 @@ COUNT dos_findnext(void) /* * The new version of SHSUCDX 1.0 looks at the dm_drive byte to * test 40h. I used RamView to see location MSD 116:04be and - * FD f61:04be, the byte set with 0xc4 = Remote/Network drive 4. + * FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4. * Ralf Brown docs for dos 4eh say bit 7 set == remote so what is * bit 6 for? SHSUCDX Mod info say "test redir not network bit". + * Just to confuse the rest, MSCDEX sets bit 5 too. * * So, assume bit 6 is redirector and bit 7 is network. * jt */ - nDrive = dmp->dm_drive & 0x3f; + nDrive = dmp->dm_drive & 0x1f; if (nDrive > lastdrive) { return DE_INVLDDRV; } - cdsp = &CDSp->cds_table[nDrive]; + current_ldt = &CDSp->cds_table[nDrive]; #if 0 printf("findnext: %c %s\n", nDrive + 'A', (cdsp->cdsFlags & CDSNETWDRV)?"remote":"local"); #endif - if (cdsp->cdsFlags & CDSNETWDRV) + if (current_ldt->cdsFlags & CDSNETWDRV) { if (Remote_find(REM_FINDNEXT, 0, 0, dmp) != 0) return DE_FILENOTFND; diff --git a/kernel/fcbfns.c b/kernel/fcbfns.c index 5d7f630..c728a3c 100644 --- a/kernel/fcbfns.c +++ b/kernel/fcbfns.c @@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$"; /* * $Log$ + * Revision 1.4 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.3 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -117,8 +120,6 @@ void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive); sft FAR *FcbGetSft(COUNT SftIndex); VOID FcbNextRecord(fcb FAR * lpFcb); sft FAR *FcbGetFreeSft(WORD FAR * sft_idx); -BOOL FcbFnameMatch(BYTE FAR * s, BYTE FAR * d, COUNT n, COUNT mode); -BOOL FcbCharMatch(COUNT s, COUNT d, COUNT mode); BOOL FcbCalcRec(xfcb FAR * lpXfcb); VOID MoveDirInfo(dmatch FAR * lpDmatch, struct dirent FAR * lpDir); #else @@ -128,8 +129,6 @@ void FcbNameInit(); sft FAR *FcbGetSft(); VOID FcbNextRecord(); sft FAR *FcbGetFreeSft(); -BOOL FcbFnameMatch(); -BOOL FcbCharMatch(); BOOL FcbCalcRec(); VOID MoveDirInfo(); #endif @@ -644,12 +643,9 @@ BOOL FcbCreate(xfcb FAR * lpXfcb) /* check for a device */ /* if we have an extension, can't be a device */ - if (IsDevice(PriPathName)) + dhp = IsDevice(PriPathName); + if (dhp) { - for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next) - { - if (FcbFnameMatch((BYTE FAR *) PriPathName, (BYTE FAR *) dhp->dh_name, FNAME_SIZE, FALSE)) - { sftp->sft_count += 1; sftp->sft_mode = O_RDWR; sftp->sft_attrib = 0; @@ -666,8 +662,6 @@ BOOL FcbCreate(xfcb FAR * lpXfcb) lpFcb->fcb_time = dos_gettime(); lpFcb->fcb_rndm = 0; return TRUE; - } - } } sftp->sft_status = dos_creat(PriPathName, 0); if (sftp->sft_status >= 0) @@ -769,28 +763,6 @@ void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive) pszBuffer[nDrvIdx + nFnameIdx + nFextIdx] = '\0'; } -/* Ascii only file name match routines */ -static BOOL FcbCharMatch(COUNT s, COUNT d, COUNT mode) -{ - if (s >= 'a' && s <= 'z') - s -= 'a' - 'A'; - if (d >= 'a' && d <= 'z') - d -= 'a' - 'A'; - if (mode && s == '?' && (d >= 'A' && s <= 'Z')) - return TRUE; - return s == d; -} - -static BOOL FcbFnameMatch(BYTE FAR * s, BYTE FAR * d, COUNT n, COUNT mode) -{ - while (n--) - { - if (!FcbCharMatch(*s++, *d++, mode)) - return FALSE; - } - return TRUE; -} - BOOL FcbOpen(xfcb FAR * lpXfcb) { WORD sft_idx; @@ -807,12 +779,9 @@ BOOL FcbOpen(xfcb FAR * lpXfcb) /* check for a device */ /* if we have an extension, can't be a device */ - if (IsDevice(PriPathName)) + dhp = IsDevice(PriPathName); + if (dhp ) { - for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next) - { - if (FcbFnameMatch((BYTE FAR *) PriPathName, (BYTE FAR *) dhp->dh_name, FNAME_SIZE, FALSE)) - { sftp->sft_count += 1; sftp->sft_mode = O_RDWR; sftp->sft_attrib = 0; @@ -829,8 +798,6 @@ BOOL FcbOpen(xfcb FAR * lpXfcb) lpFcb->fcb_time = dos_gettime(); lpFcb->fcb_rndm = 0; return TRUE; - } - } } fbcopy((BYTE FAR *) & lpFcb->fcb_fname, (BYTE FAR *) & sftp->sft_name, FNAME_SIZE + FEXT_SIZE); if ((FcbDrive < 0) || (FcbDrive > lastdrive)) { diff --git a/kernel/io.asm b/kernel/io.asm index 6a84f06..b725b04 100644 --- a/kernel/io.asm +++ b/kernel/io.asm @@ -28,6 +28,9 @@ ; $Header$ ; ; $Log$ +; Revision 1.4 2000/05/26 19:25:19 jimtabor +; Read History file for Change info +; ; Revision 1.3 2000/05/25 20:56:21 jimtabor ; Fixed project history ; @@ -190,7 +193,7 @@ _clk_dev equ $ global _blk_dev _blk_dev equ $ dd -1 - dw 0000h ; block device + dw 00c2h ; block device with ioctl dw GenStrategy dw blk_entry global _nblk_rel diff --git a/kernel/main.c b/kernel/main.c index 9f585db..573b3c2 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -39,6 +39,9 @@ static BYTE *mainRcsId = "$Id$"; /* * $Log$ + * Revision 1.5 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.4 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -189,6 +192,9 @@ INIT static VOID init_kernel(void) /* Fake int 21h stack frame */ user_r = (iregs FAR *) DOS_PSP + 0xD0; +/* Set Init DTA to Tempbuffer */ + dta = (BYTE FAR *) &TempBuffer; + #ifndef KDB for (i = 0x20; i <= 0x3f; i++) setvec(i, empty_handler); @@ -425,7 +431,7 @@ extern BYTE FAR *lpBase; /* If cmdLine is NULL, this is an internal driver */ -VOID init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine) +BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine) { request rq; ULONG memtop = ((ULONG) ram_top) << 10; @@ -443,6 +449,11 @@ VOID init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine) rq.r_firstunit = nblkdev; execrh((request FAR *) & rq, dhp); +/* + * Added needed Error handle + */ + if (rq.r_status & S_ERROR) + return TRUE; if (cmdLine) lpBase = rq.r_endaddr; @@ -471,14 +482,9 @@ VOID init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine) } } DPBp = &blk_devices[0]; + return FALSE; } -struct dhdr FAR *link_dhdr(struct dhdr FAR * lp, struct dhdr FAR * dhp, BYTE FAR * cmdLine) -{ - lp->dh_next = dhp; - init_device(dhp, cmdLine); - return dhp; -} INIT static void InitIO(void) { diff --git a/kernel/network.c b/kernel/network.c index 3d1e267..6bfaa09 100644 --- a/kernel/network.c +++ b/kernel/network.c @@ -36,6 +36,9 @@ static BYTE *RcsId = "$Id$"; /* * $Log$ + * Revision 1.5 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.4 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -109,17 +112,16 @@ UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * e /* */ -COUNT Remote_find(UWORD func, UWORD attrib, BYTE FAR * name, REG dmatch FAR * dmp) +COUNT Remote_find(UWORD func, UWORD attrib, BYTE FAR * name, REG dmatch FAR * dmp ) { - COUNT i, - x; - char FAR *p, - *q; + COUNT i, x; + char FAR *p, *q; + VOID FAR * test; struct dirent FAR *SDp = (struct dirent FAR *) &SearchDir; if (func == REM_FINDFIRST) { - SAttr = (BYTE) attrib; + test = (VOID FAR *) current_ldt; i = truename(name, PriPathName, FALSE); if (i != SUCCESS) { return i; @@ -132,11 +134,13 @@ COUNT Remote_find(UWORD func, UWORD attrib, BYTE FAR * name, REG dmatch FAR * dm printf("'\n"); #endif } + else + test = (VOID FAR *) &TempBuffer; fsncopy(dta, (BYTE FAR *) &TempBuffer, 21); p = dta; dta = (BYTE FAR *) &TempBuffer; - i = int2f_Remote_call(func, 0, 0, 0, 0, 0, 0); + i = int2f_Remote_call(func, 0, 0, 0, test, 0, 0); dta = p; fsncopy((BYTE FAR *) &TempBuffer[0], &dta[0], 21); diff --git a/kernel/newstuff.c b/kernel/newstuff.c index 0b450d3..af9ede0 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -31,6 +31,9 @@ static BYTE *mainRcsId = "$Id$"; /* * $Log$ + * Revision 1.5 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.4 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -224,9 +227,13 @@ COUNT get_verify_drive(char FAR *src) COUNT truename(char FAR * src, char FAR * dest, COUNT t) { static char buf[128] = "A:\\\0\0\0\0\0\0\0\0\0"; + static char Name[8] = " "; char *bufp = buf + 3; COUNT i, n, x = 2; struct cds FAR *cdsp; + struct dhdr FAR *dhp; + BYTE FAR *froot; + WORD d; dest[0] = '\0'; @@ -247,6 +254,37 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t) buf[0] = default_drive + 'A'; i = buf[0] - 'A'; +/* + Code repoff from dosfns.c + MSD returns X:/CON for truename con. Not X:\CON +*/ + /* check for a device */ + froot = get_root(src); + for (d = 0; d < FNAME_SIZE; d++) + { + if (*froot != '\0' && *froot != '.') + Name[d] = *froot++; + else + break; + } + + for (; d < FNAME_SIZE; d++) + Name[d] = ' '; + + /* if we have an extension, can't be a device */ + if (*froot != '.') + { + for (dhp = (struct dhdr FAR *)&nul_dev; dhp != (struct dhdr FAR *)-1; dhp = dhp->dh_next) + { + if (fnmatch((BYTE FAR *) &Name, (BYTE FAR *) dhp->dh_name, FNAME_SIZE, FALSE)) + { + buf[2] ='/'; + for (d = 0; d < FNAME_SIZE || Name[d] == ' '; d++) + *bufp++ = Name[d]; + goto exit_tn; + } + } + } cdsp = &CDSp->cds_table[i]; current_ldt = cdsp; @@ -278,6 +316,8 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t) } else src++; + +move_name: /* * The code here is brain dead. It works long as the calling * function are operating with in normal parms. @@ -371,6 +411,8 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t) if (bufp == buf + 2) ++bufp; +exit_tn: + *bufp++ = 0; /* finally, uppercase everything */ diff --git a/kernel/proto.h b/kernel/proto.h index 565616e..c5b9193 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$"; /* * $Log$ + * Revision 1.4 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.3 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -186,6 +189,8 @@ INIT VOID mcb_init(mcb FAR * mcbp, UWORD size); INIT VOID strcat(REG BYTE * d, REG BYTE * s); /* dosfns.c */ +BYTE FAR *get_root(BYTE FAR *); +BOOL fnmatch(BYTE FAR *, BYTE FAR *, COUNT, COUNT); BOOL check_break(void); UCOUNT GenericRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err, BOOL force_binary); @@ -213,6 +218,7 @@ COUNT DosDelete(BYTE FAR *path); COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2); COUNT DosMkdir(BYTE FAR * dir); COUNT DosRmdir(BYTE FAR * dir); +struct dhdr FAR * IsDevice(BYTE FAR * FileName); /*dosidle.asm */ VOID DosIdle_int(void); @@ -221,7 +227,6 @@ VOID DosIdle_int(void); VOID SpacePad(BYTE *, COUNT); COUNT ParseDosName(BYTE FAR *, COUNT *, BYTE *, BYTE *, BYTE *, BOOL); COUNT ParseDosPath(BYTE FAR *, COUNT *, BYTE *, BYTE FAR *); -BOOL IsDevice(BYTE FAR * FileName); /* dsk.c */ COUNT blk_driver(rqptr rp); @@ -349,8 +354,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err); /* main.c */ INIT VOID main(void); -INIT VOID init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine); -INIT struct dhdr FAR *link_dhdr(struct dhdr FAR * lp, struct dhdr FAR * dhp, BYTE FAR * cmdLine); +INIT BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine); /* memmgr.c */ seg far2para(VOID FAR * p); diff --git a/kernel/task.c b/kernel/task.c index 976ddfa..671e6b4 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$"; /* * $Log$ + * Revision 1.4 2000/05/26 19:25:19 jimtabor + * Read History file for Change info + * * Revision 1.3 2000/05/25 20:56:21 jimtabor * Fixed project history * @@ -475,7 +478,7 @@ static COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode) if (mode == OVERLAY) /* memory already allocated */ sp = MK_FP(mem, 0); else - { /* test the filesize against the allocated memory */ + { /* test the filesize against the allocated memory */ sp = MK_FP(mem, sizeof(psp)); /* This is a potential problem, what to do with .COM files larger than @@ -890,6 +893,11 @@ COUNT FAR init_call_DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp) VOID InitPSP(VOID) { psp FAR *p = MK_FP(DOS_PSP, 0); +/* + Fixed Device Driver Print output. + */ + if(p->ps_exit == 0x000020cd) + return; new_psp(p, 0); }