home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
PARADIS1
/
FILES.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-01-29
|
4KB
|
107 lines
(10407) Sun 26 Jan 92 15:56
By: Ruurd Pels
To: Kelly Small
Re: Run-time Error 004
St:
---------------------------------------------------------------------------
@MSGID: 2:512/23 298326da
@PID: XRS! 4.52
Howdy Kelly!
On 21 Jan 92 10:39, Kelly Small, happily tapping away at his keyboard, wrote to
Greg Belanger:
KS> Regardless of what you have in your config.sys file, the most
KS> file handles a single program can have are 20, 5 of which are
KS> swiped by DOS, leaving you 15.
IMHO, they are swiped by TP6, and secondly, you can close them if you want to.
Or am I wrong. BTW, there is a way around the 15 files max:
-+----8<--------8<--------8<--------8<--------8<--------8<--------8<------
Offset $9 in the PSP is the standard File Handle Table (FHT).
Offset $32 in the PSP is the size of the FHT.
Offset $34 in the PSP is the address of the FHT.
By relocating the FHT to a space of your own you can open as much files as
stated in the FILE= parameter in CONFIG.SYS.
const
MaxFiles = 30;
type
ParamRec = record
Len : Byte;
List : array[1..127] of Char;
end;
PSPType = record
Int32Inst : Word;
TopOfDos : Word;
Reserved1 : Byte;
DosDisp : array[1..5] of Byte;
TerminateVec : Pointer;
BreakVec : Pointer;
ErrorVec : Pointer;
ParentPSP : Word;
FHArray : array[1..20] of Byte;
EnvStrSeg : Word;
DOSStackSave : Pointer;
FHTSize : Word;
FHTAddress : Pointer;
Reserved2 : array[1..24] of Byte;
Int33 : array[1..3] of Byte;
Reserved3 : Word;
FCB1Ext : array[1..7] of Byte;
FCB1 : array[1..9] of Byte;
FCB2Ext : array[1..7] of Byte;
FCB2 : array[1..9] of Byte;
case Byte of
0: (Param: ParamRec);
1: (Dta : array[1..128] of Byte);
end;
end;
var
PSP : ^PSPType;
MyFHT : array[1..MaxFiles] of Byte;
OldFHTAddress : Pointer;
OldFHTSize : Word;
procedure ExpandFHT;
begin
with PSP^ do begin
FillChar(MyFHT, SizeOf(MyFHT), 255);
OldFHTAddress := FHTAddress;
OldFHTSize := FHTSize;
FHTAddress := @MyFHT;
FHTSize := MaxFiles;
Move(FHArray, MyFHT, 20);
end;
end;
{ Before resetting the FHT, close any files with handles > 20 }
procedure ResetFHT;
begin
with PSP^ do begin
FHTAddress := OldFHTAddress;
FHTSize := OldFHTSize;
Move(MyFHT, FHArray, 20);
end;
end;
-+----8<--------8<--------8<--------8<--------8<--------8<--------8<------
By tweaking it a bit, you must be able to make it such that you can expand the
FHT to the value set to the FILE= statement in CONFIG.SYS.
Grtz, l~) l~ l~)
l~\ l~ l~ ;-)
---
* Origin: -=*#@ Programs Are Seen Clearly As Language @#*=- (RA 2:512/23)
@PATH: 512/23 0 1007