COUNT DosSetFtime(COUNT hndl, date FAR * dp, time FAR * tp) { sft FAR *s; sfttbl FAR *sp; /* Test that the handle is valid */ if (hndl < 0) return DE_INVLDHNDL; /* Get the SFT block that contains the SFT */ if ((s = get_sft(hndl)) == (sft FAR *) - 1) return DE_INVLDHNDL; /* If this is not opened another error */ if (s->sft_count == 0) return DE_ACCESS; /* If SFT entry refers to a device, do nothing */ if (s->sft_flags & SFT_FDEVICE) return SUCCESS; if (s->sft_flags & SFT_FSHARED) { s->sft_date = *dp; s->sft_time = *tp; return SUCCESS; } /* call file system handler */ return dos_setftime(s->sft_status, dp, tp); }
BOOL FcbClose(xfcb FAR * lpXfcb) { sft FAR *s; /* Convert to fcb if necessary */ lpFcb = ExtFcbToFcb(lpXfcb); /* Get the SFT block that contains the SFT */ if ((s = FcbGetSft(lpFcb->fcb_sftno)) == (sft FAR *) - 1) return FALSE; /* If this is not opened another error */ if (s->sft_count == 0) return FALSE; if (s->sft_flags & SFT_FSHARED) { int2f_Remote_call(REM_CLOSE, 0, 0, 0, (VOID FAR *) s, 0, 0); } /* now just drop the count if a device, else */ /* call file system handler */ if (s->sft_flags & SFT_FDEVICE) { s->sft_count -= 1; return TRUE; } else { s->sft_count -= 1; if (s->sft_count > 0) return SUCCESS; else { /* change time and set file size */ dos_setftime(s->sft_status, (date FAR *) & lpFcb->fcb_date, (time FAR *) & lpFcb->fcb_time); dos_setfsize(s->sft_status, lpFcb->fcb_fsize); return dos_close(s->sft_status) == SUCCESS; } } }