1
0
Fork 0

Don't close totally empty fcbs. Very basic check. Fixes Oubliette.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3087
This commit is contained in:
Peter Veenstra 2008-01-21 21:26:49 +00:00
parent c920ed5e8c
commit 6532a8bc74
3 changed files with 11 additions and 3 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_inc.h,v 1.72 2007-11-18 10:30:11 c2woody Exp $ */
/* $Id: dos_inc.h,v 1.73 2008-01-21 21:26:49 qbix79 Exp $ */
#ifndef DOSBOX_DOS_INC_H
#define DOSBOX_DOS_INC_H
@ -502,6 +502,7 @@ public:
bool Extended(void);
void GetAttr(Bit8u & attr);
void SetAttr(Bit8u attr);
bool Valid(void);
private:
bool extended;
PhysPt real_pt;

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_classes.cpp,v 1.53 2007-11-07 22:08:03 c2woody Exp $ */
/* $Id: dos_classes.cpp,v 1.54 2008-01-21 21:26:49 qbix79 Exp $ */
#include <string.h>
#include <stdlib.h>
@ -472,6 +472,12 @@ void DOS_FCB::FileOpen(Bit8u _fhandle) {
sSave(sFCB,date,Files[temp]->date);
}
bool DOS_FCB::Valid() {
//Very simple check for Oubliette
if(sGet(sFCB,filename[0]) == 0 && sGet(sFCB,file_handle) == 0) return false;
return true;
}
void DOS_FCB::FileClose(Bit8u & _fhandle) {
_fhandle=sGet(sFCB,file_handle);
sSave(sFCB,file_handle,0xff);

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_files.cpp,v 1.93 2007-10-20 19:13:59 c2woody Exp $ */
/* $Id: dos_files.cpp,v 1.94 2008-01-21 21:26:49 qbix79 Exp $ */
#include <string.h>
#include <stdlib.h>
@ -851,6 +851,7 @@ bool DOS_FCBOpen(Bit16u seg,Bit16u offset) {
bool DOS_FCBClose(Bit16u seg,Bit16u offset) {
DOS_FCB fcb(seg,offset);
if(!fcb.Valid()) return false;
Bit8u fhandle;
fcb.FileClose(fhandle);
DOS_CloseFile(fhandle);