1
0
Fork 0

added support for the don't inheritance flag and changed the psp routines to use this flag

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@980
This commit is contained in:
Peter Veenstra 2003-05-02 10:54:31 +00:00
parent 672415fcb9
commit 100f13016e
4 changed files with 22 additions and 7 deletions

View file

@ -125,6 +125,7 @@ void DOS_SetupDevices(void);
/* Execute and new process creation */
bool DOS_NewPSP(Bit16u pspseg,Bit16u size);
bool DOS_ChildPSP(Bit16u pspseg,Bit16u size);
bool DOS_Execute(char * name,PhysPt block,Bit8u flags);
bool DOS_Terminate(bool tsr);
@ -237,7 +238,7 @@ class DOS_PSP :public MemStruct {
public:
DOS_PSP (Bit16u segment) { SetPt(segment);seg=segment;psp=(sPSP *)HostMake(segment,0);};
void MakeNew (Bit16u memSize);
void CopyFileTable (DOS_PSP* srcpsp);
void CopyFileTable (DOS_PSP* srcpsp,bool createchildpsp);
Bit16u FindFreeFileEntry (void);
void CloseFiles (void);
@ -263,7 +264,7 @@ public:
void SetCommandTail (RealPt src);
bool SetNumFiles (Bit16u fileNum);
Bit16u FindEntryByHandle (Bit8u handle);
private:
#ifdef _MSC_VER
#pragma pack(1)

View file

@ -51,7 +51,7 @@ class DOS_DTA;
class DOS_File {
public:
DOS_File() { name=0; };
DOS_File():flags(0) { name=0; };
virtual ~DOS_File(){};
virtual bool Read(Bit8u * data,Bit16u * size)=0;
virtual bool Write(Bit8u * data,Bit16u * size)=0;
@ -220,7 +220,7 @@ public:
DOS_Drive_Cache dirCache;
};
enum { OPEN_READ=0,OPEN_WRITE=1,OPEN_READWRITE=2 };
enum { OPEN_READ=0,OPEN_WRITE=1,OPEN_READWRITE=2, DOS_NOT_INHERIT=128};
enum { DOS_SEEK_SET=0,DOS_SEEK_CUR=1,DOS_SEEK_END=2};

View file

@ -666,7 +666,7 @@ static Bitu DOS_21Handler(void) {
reg_al=dos.verify?1:0;
break;
case 0x55: /* Create Child PSP*/
DOS_NewPSP(reg_dx,reg_si);
DOS_ChildPSP(reg_dx,reg_si);
dos.psp = reg_dx;
break;
case 0x56: /* RENAME Rename file */

View file

@ -156,12 +156,26 @@ Bit16u DOS_PSP::FindEntryByHandle(Bit8u handle)
return 0xFF;
};
void DOS_PSP::CopyFileTable(DOS_PSP* srcpsp)
void DOS_PSP::CopyFileTable(DOS_PSP* srcpsp,bool createchildpsp)
{
/* Copy file table from calling process */
for (Bit16u i=0;i<20;i++) {
Bit8u handle = srcpsp->GetFileHandle(i);
SetFileHandle(i,handle);
if(createchildpsp)
{ //copy obeying not inherit flag.
if(Files[handle] && !(Files[handle]->flags & DOS_NOT_INHERIT))
{
SetFileHandle(i,handle);
}
else
{
SetFileHandle(i,0xff);
}
}
else
{ //normal copy so don't mind the inheritance
SetFileHandle(i,handle);
}
}
};