re-fix deleting of hostwise open files (makes Alien Carnage work again without breaking Abuse)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2722
This commit is contained in:
		
							parent
							
								
									26bc8da23d
								
							
						
					
					
						commit
						af1673c6f2
					
				
					 5 changed files with 21 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: dos_system.h,v 1.36 2006-06-22 13:15:07 qbix79 Exp $ */
 | 
			
		||||
/* $Id: dos_system.h,v 1.37 2006-11-14 20:01:42 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#ifndef DOSBOX_DOS_SYSTEM_H
 | 
			
		||||
#define DOSBOX_DOS_SYSTEM_H
 | 
			
		||||
| 
						 | 
				
			
			@ -96,10 +96,14 @@ private:
 | 
			
		|||
 | 
			
		||||
class DOS_Device : public DOS_File {
 | 
			
		||||
public:
 | 
			
		||||
	DOS_Device(const DOS_Device& orig):DOS_File(orig) {devnum=orig.devnum; }
 | 
			
		||||
	DOS_Device(const DOS_Device& orig):DOS_File(orig) {
 | 
			
		||||
		devnum=orig.devnum;
 | 
			
		||||
		open=true;
 | 
			
		||||
	}
 | 
			
		||||
	DOS_Device & operator= (const DOS_Device & orig) {
 | 
			
		||||
		DOS_File::operator=(orig);
 | 
			
		||||
		devnum=orig.devnum;
 | 
			
		||||
		open=true;
 | 
			
		||||
		return *this;
 | 
			
		||||
	}
 | 
			
		||||
	DOS_Device():DOS_File(),devnum(0){};   
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: dos_files.cpp,v 1.78 2006-08-05 10:39:44 qbix79 Exp $ */
 | 
			
		||||
/* $Id: dos_files.cpp,v 1.79 2006-11-14 20:01:42 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -307,7 +307,7 @@ bool DOS_ReadFile(Bit16u entry,Bit8u * data,Bit16u * amount) {
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	if (!Files[handle]) {
 | 
			
		||||
	if (!Files[handle] || !Files[handle]->IsOpen()) {
 | 
			
		||||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			@ -330,7 +330,7 @@ bool DOS_WriteFile(Bit16u entry,Bit8u * data,Bit16u * amount) {
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	if (!Files[handle]) {
 | 
			
		||||
	if (!Files[handle] || !Files[handle]->IsOpen()) {
 | 
			
		||||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			@ -353,7 +353,7 @@ bool DOS_SeekFile(Bit16u entry,Bit32u * pos,Bit32u type) {
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	if (!Files[handle]) {
 | 
			
		||||
	if (!Files[handle] || !Files[handle]->IsOpen()) {
 | 
			
		||||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			@ -370,7 +370,9 @@ bool DOS_CloseFile(Bit16u entry) {
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	Files[handle]->Close();
 | 
			
		||||
	if (Files[handle]->IsOpen()) {
 | 
			
		||||
		Files[handle]->Close();
 | 
			
		||||
	}
 | 
			
		||||
	DOS_PSP psp(dos.psp());
 | 
			
		||||
	psp.SetFileHandle(entry,0xff);
 | 
			
		||||
	if (Files[handle]->RemoveRef()<=0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -576,7 +578,7 @@ bool DOS_DuplicateEntry(Bit16u entry,Bit16u * newentry) {
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	if (!Files[handle]) {
 | 
			
		||||
	if (!Files[handle] || !Files[handle]->IsOpen()) {
 | 
			
		||||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			@ -601,7 +603,7 @@ bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry) {
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	if (!Files[orig]) {
 | 
			
		||||
	if (!Files[orig] || !Files[orig]->IsOpen()) {
 | 
			
		||||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			@ -1037,7 +1039,7 @@ bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate)
 | 
			
		|||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
	if (!Files[handle]) {
 | 
			
		||||
	if (!Files[handle] || !Files[handle]->IsOpen()) {
 | 
			
		||||
		DOS_SetError(DOSERR_INVALID_HANDLE);
 | 
			
		||||
		return false;
 | 
			
		||||
	};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: drive_fat.cpp,v 1.18 2006-07-05 21:18:14 c2woody Exp $ */
 | 
			
		||||
/* $Id: drive_fat.cpp,v 1.19 2006-11-14 20:01:42 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -91,6 +91,7 @@ fatFile::fatFile(const char* /*name*/, Bit32u startCluster, Bit32u fileLen, fatD
 | 
			
		|||
	firstCluster = startCluster;
 | 
			
		||||
	myDrive = useDrive;
 | 
			
		||||
	filelength = fileLen;
 | 
			
		||||
	open = true;
 | 
			
		||||
	loadedSector = false;
 | 
			
		||||
	curSectOff = 0;
 | 
			
		||||
	seekpos = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* $Id: drive_local.cpp,v 1.71 2006-08-17 12:07:22 c2woody Exp $ */
 | 
			
		||||
/* $Id: drive_local.cpp,v 1.72 2006-11-14 20:01:42 c2woody Exp $ */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -160,11 +160,7 @@ bool localDrive::FileUnlink(char * name) {
 | 
			
		|||
				Bitu max = DOS_FILES;
 | 
			
		||||
				while(Files[i]->IsOpen() && max--) {
 | 
			
		||||
					Files[i]->Close();
 | 
			
		||||
					if (Files[i]->RemoveRef()<=0) {
 | 
			
		||||
						delete Files[i];
 | 
			
		||||
						Files[i]=0;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
					if (Files[i]->RemoveRef()<=0) break;
 | 
			
		||||
				}
 | 
			
		||||
				found_file=true;
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,6 +85,7 @@ Virtual_File::Virtual_File(Bit8u * in_data,Bit32u in_size) {
 | 
			
		|||
	file_pos=0;
 | 
			
		||||
	date=DOS_PackDate(2002,10,1);
 | 
			
		||||
	time=DOS_PackTime(12,34,56);
 | 
			
		||||
	open=true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Virtual_File::Read(Bit8u * data,Bit16u * size) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue