TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mario Semo
from: Paul Edwards
date: 1996-10-21 03:04:44
subject: C600BUG.TXT

PE> There is a bug in the MSC 6.0 runtime library, e.g. the 
PE> file LLIBCEP.LIB.  The bug is that in the open() function 
PE> (which is called by fopen), they first of all call DosOpen, 
PE> and then check that the file handle returned by DosOpen is 
PE> less than their internal limit of the number of FILE handles 

MS> exactly. here's the source:

Thankyou!

MS> call    DOSOPEN         ; try to open

MS> CheckHandle:

MS> ;       Check to see that the handle returned is in the range supported
MS> ;       by the compiler.  If not, return no more files error.

MS> mov     ax,[Fh]
MS> cmp     ax,__nfile      ; is file handle out of range?
MS> jb      OpenOk          ; nope, its ok

PE> Unfortunately MSC 6.0 checks the file handle < _NFILE in 
PE> three separate locations - open(), read() and write().  

MS> but they are comparing with a variable. (_nfile initialized in crt0dat.asm)

Yes, but they shouldn't be doing that comparison AT ALL.  The file handle
returned by DosOpen() is purely DosOpen's business, MSC shouldn't be
questioning it, whether it be 5 or 5000.

PE> There may be others, too.  At time of writing, the only 

MS> i will send you a list of all usages of _nfile in MS-C libary source code 
MS> as netmail (105 lines)

Look forward to it.

PE> On c1.exe (from MSC 6.00A), dated 1995-09-21 (?!) size 
PE> 146928 bytes, this translates to:

MS> here's my c1.exe:

MS> Directory of D:\c600\BINP
MS> 15.08.90  11.30     146928           0  C1.EXE

Thanks, I've updated that.  And I'll put this excerpt of code into my bug
report too.  Thanks for your help.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.