mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
SVN r4369
Compatible side-effect behavior of DOS in the file close function.
This commit is contained in:
@@ -168,7 +168,7 @@ bool DOS_WriteFile(uint16_t entry,uint8_t * data,uint16_t * amount,bool fcb = fa
|
||||
bool DOS_SeekFile(uint16_t entry,uint32_t * pos,uint32_t type,bool fcb = false);
|
||||
/* ert, 20100711: Locking extensions */
|
||||
bool DOS_LockFile(uint16_t entry,uint8_t mode,uint32_t pos,uint32_t size);
|
||||
bool DOS_CloseFile(uint16_t entry,bool fcb = false);
|
||||
bool DOS_CloseFile(uint16_t entry,bool fcb = false,uint8_t * refcnt = NULL);
|
||||
bool DOS_FlushFile(uint16_t entry);
|
||||
bool DOS_DuplicateEntry(uint16_t entry,uint16_t * newentry);
|
||||
bool DOS_ForceDuplicateEntry(uint16_t entry,uint16_t newentry);
|
||||
|
@@ -1371,8 +1371,8 @@ static Bitu DOS_21Handler(void) {
|
||||
}
|
||||
case 0x3e: /* CLOSE Close file */
|
||||
unmask_irq0 |= disk_io_unmask_irq0;
|
||||
if (DOS_CloseFile(reg_bx)) {
|
||||
// reg_al=0x01; /* al destroyed. Refcount */
|
||||
if (DOS_CloseFile(reg_bx, false, ®_al)) {
|
||||
/* al destroyed with pre-close refcount from sft */
|
||||
CALLBACK_SCF(false);
|
||||
} else {
|
||||
reg_ax=dos.errorcode;
|
||||
|
@@ -624,7 +624,7 @@ bool DOS_LockFile(uint16_t entry,uint8_t mode,uint32_t pos,uint32_t size) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DOS_CloseFile(uint16_t entry, bool fcb) {
|
||||
bool DOS_CloseFile(uint16_t entry, bool fcb, uint8_t * refcnt) {
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
if(Network_IsActiveResource(entry))
|
||||
return Network_CloseFile(entry);
|
||||
@@ -648,10 +648,12 @@ bool DOS_CloseFile(uint16_t entry, bool fcb) {
|
||||
DOS_PSP psp(dos.psp());
|
||||
if (!fcb) psp.SetFileHandle(entry,0xff);
|
||||
|
||||
if (Files[handle]->RemoveRef()<=0) {
|
||||
Bits refs=Files[handle]->RemoveRef();
|
||||
if (refs<=0) {
|
||||
delete Files[handle];
|
||||
Files[handle]=0;
|
||||
}
|
||||
if (refcnt!=NULL) *refcnt=static_cast<uint8_t>(refs+1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user