Adjustable "files" setting in DOSBox

In the time of DOS, the operating system severely limited how many files could be open simultaneously. The default amount was a ridiculously low of 8 open files, so most people made use of the system's ability to customise the limit by adding a setting to config.sys. A common (and sensible) value was "files=20".

DOSBox does an excellent job of emulating a DOS PC, including some of its quirks. DOSBox' default limit is at a generous 127 files open at any one time. Unfortunately, thu only way to change this limit is by altering the DOSBox source code and doing your own build. The default of 127 is more than enough for all but the most extreme cases. Such cases do exist, but when a program complains about "insufficient files" it is more commonly an indication of something being wrong with that particular program/installation or even a bug in DOSBox itself.

To be able to determine what the problem may be, I hereby present a simple patch that makes the files limit configurable through the configuration file. The patch file as well as a pre-built binary for MS Windows can be downloaded below.

The setting can be adjusted by adding a line such as "files=200" to the [dos] section of the configuration file. Be sure to use values in the range of 128..255 only. Anything below the default of 127 would be useless. Anything below 20 would be silly. A value of 0 or fewer would be stupid and anything above 255 can potentially cause data corruption, so don't even try.

If you're interested in trying this out, you can download either the source code patch or the pre-built binary for Windows.

Tags:

Comments

puzdir

It helped that patch when dealing with running DOS program "Process Control" written in Clarion 2.1. The problem was that:
1. When you run the program loads into memory at the same time more than 130 files
2. To generate a report program lacked the lower DOS memory.

Original DOSBOX decided the second issue, but this patch is decided first.

DOSBox 0.74

Hi mate,
great work!!! Is it posible use it in DOSBox 0.74?

Bruno

Hello can you implement something similar to the limitation of the EMS memory used by the emm386 in the config.sys file.
I can only get about a max of 8 free EMS pages on my applications build in Borland Pascal.

Best Regards,
Bruno Sousa

gonzalo

Hello, i'm using dosbox in ubuntu 12.04. I can't open more than 15 files simultaneously, do you have any idea why? As you said the file limit should be 127.

Steven Don

15 files seems a little limited. What program are you trying to run?

gonzalo

I'm trying to run an old clinic database program. I've made a little c program which opens files to test that, it turns out that dosbox and dosemu have the same limit (15 files). The thing is my old clinic program needs to open more than 15 to work. Thanks for your help.

Ciro Albarelli

I lived one year with this error "dos error 4" and the solution was just a click away!
Thank you, thank you, thank you!

Clipper 5 Programmer Jurassic

Hysteria

Thank you very much! Great job man, big respect!

Cesar

Hi, I have in [dos] section the files=127 but still have "dos error 4", hange to 200 and the fail persist, what can I do???

Thank You!

CJH

It works!!!!!!!!! Frickin A!!!!!!!!

Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CJH

I know the internet is full of scams and viruses. So I know the first impression of anyone reading this will be to distrust me. That's OK. I would too. But trust me. I may save you a lot of time.

If you are getting dos error 4, you have an issue with too many files open. It is easy to fix. The above concept of placing "files=255" into the [dos] section of the dosbox config file will do it.

However, you may find that simple fix doesn't work. What the hxxx... ???!!

I am CJH from above from an earlier post... I dealt with this problem on another laptop in the past, and it fixed immediately.

Today, I needed to upgrade another laptop. Fix didn't work. What the hell!??? I tried everything.

Turns out, my version of dosbox on THIS laptop was old or something, I don't know.

So... At the top of this page is a link to a "binary" of dosbox. It is simply another version of the dosbox.exe. If you are still having problems, grab it. Copy it over top of the dosbox.exe you already have. Run it. It will run, and it will delete your old config file. That sucks. But the good news is, modify the new config file to your needs, add in your mount, and set your files, and omg, you will be back in business!!!! The binary for dosbox.exe above works, and it will read the config file made, and it will deal with the files= issue if you set it properly in the [dos] part of the dosbox config file.

In a million years, I would never have imagined the version of dosbox I had originally was buiggered. It was. The above binary fixed it.

I am using a laptop that is running Windows 7, Home version.

Now if you will excuse me, I've done my daily pay it forward, ; ), and I need to get on with my life... ; )

Cheers!!!!!

CJH

Manas Mitra

The patch for "files=" worked perfectly.

titan

Version 0.74 with patch https://yadi.sk/d/ba5lTLdnt4uLt

Post a comment