-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement File Locking #3687
Implement File Locking #3687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if the code could log (LOG_WARNING
) unsupported sharing modes if the application tries to use them.
Partial (region based) file locking is implemented now. This is required by Flight Simulator 5's addon Flight Shop and this now works on this branch.
This supports everything now (as far as I know). Just needs more testing. |
27d03a5
to
c027467
Compare
Fixed a missing region lock check in Also, not sure if we are handling child process inheritance of file handles correctly. Documentation for the full file lock (as set by sharing bits in But documentation for region lock says it should not be inherited by child processes. File handle duplication should be handled correctly. That function simply inserts a new reference to an existing |
I've done some testing and updating the top comment with games tested. Some of the games on #1489 I could not find proper images for but I tested what I could find. It looks like we are respecting the inherit bit, at least for full file locking. Partial file locking I am still unclear on if the locking process creates a child process but I cannot find a fail case in a game so I think we can cross that bridge when we come to it. This is done and ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looking good @weirddan455, just a few minor style-related comments.
In general, launching DOS programs in Win3.x is the last of our concerns. "Nice to the have", I guess, but should be right at the bottom of our priority list. Just use DOS 🤷🏻 |
True. Everything continues to work in DOS. It also breaks Window's MS-DOS prompt, which is the easiest way to reproduce the regression. In any case, Word for Windows does work on this branch |
I thought Windows support was out of scope for Staging? At least that's what Staging's web site lists as a non-goal. |
Official position seems to be DOS and Windows 3.x (including Win16 and Win32s) supported. File locking support is also required by some DOS application software so this also benefits DOS. |
It's Windows 9x specifically that's listed as a non-goal. We're supporting Windows 3.1 stuff. |
The flags are a bitfield specifically of 8 bits. They get set by an 8 bit register inside DOS interrupts. Nothing ever uses or sets anything wider than 8 bits.
This sets the flags variable that was changed to uint8_t in a previous commit. This function gets called from DOS_OpenFile which passes it a uint8_t already.
I haven't found any yet but The big distinction between Windows 3.1 and Windows 9x is that Windows 3.1 installs and runs on top of our internal DOS implementation whereas Windows 9x wants to install its own version of DOS on top of bare metal (or bare hardware emulation). This means things like the It's not so user friendly to do all that and would require a lot of work to make it so (something like DOSBox-X's GUI). |
@johnnovak A Windows install would be helpful. I was running into problems with the SB16 drivers myself. |
Read the about page carefully, man 😄 Everythig you need to know is there 😄 |
What was the name of DOS software that required file locking support (SHARE.EXE)? |
Yeah, and the guiding principle to everything we do in DOSBox should be this: does this allow to run the DOS and Win 3.x catalogue in an authentic way? DOS prompt in Win 3.x is an extreme niche; making it work brings no value in light of this goal. Similarly, it's completely beside the point to get all the possible drivers working in Win 3.x for all the hardware we support. We just need a single supported driver combo to run all the games optimally, job done. This allows us to spend our energies in a smart way on what truly matters: to get the existing DOS/Win3.x game catalogue from 1981-2000 working optimally. Running the same game with all the 47298 different Win3.x driver combos that result in the exact same end-user experience is a non-goal and a waste of our time and energy. Just talking in generics; I'm not claiming we're doing this type of busy-work now 😄
Win 95 and 98 are a huge rabbit hole, and we have enough to do in pure DOS/Win3.x land. Hence, we really don't wanna go there, IMO. Keep the scope realistic and all. Win 9x kinda sorta "worked" (works) in all DOSBox versions by fluke and pure random coincidence, but to make it work "properly", there would be lots of additional work to do. Then imagine dealing with all Win 9x game compatibility tickets... Just a hard no; we don't even wanna go there IMO. We are quite under-resourced just for the DOS / Win3.x stuff, we don't wanna take on something absolutely huge as Win 9x (to do it properly, not just half-assedly). |
SHARE.EXE has been present in MS-DOS since MS-DOS 3.1 (search for SHARE.EXE): |
I agree 100%. I'm not even sure DOSBox is the right approach at all for Win9x. Maybe DOSBox-X does a decent job, haven't tried it but all the DOS stuff we implement becomes useless and then you're also running an entirely different class of hardware. A lot of games need Pentium 2/3 class CPUs and much stronger GPUs than Voodoo. |
Absolutely, even the emulated hardware requirements are significantly different, that's an excellent point. There is overlap, but I'd say Win 9x emulation should be a distinct and separate project from DOSBox; it's really its own thing, I'm in agreement with you. Huge respect to DOSBox-X for trying to pull it off, and all the best wishes in the world & good luck, but this is not for us.
I'll do that over the coming days, ideally sometime next week. The planned outcome is a new succinct wiki page with installation steps, and a couple of ZIP archives on archive.org if someone just wants to quickly grab it and not go through the steps. |
Sounds good. Anyway, I've addressed your comments so I'll merge soon if no objections. |
Thanks! Merge away, man 😎 |
This use mentions that their accounting software's multi-user SQL back-end doesn't work under original dosbox, which might point to the lack of share support: https://www.vogons.org/viewtopic.php?f=7&t=37333&p=328571&hilit=needs%20need%20share%20exe#p328571 My hunch is that it's Peachtree Accounting, because they were massive in the early 2000's -- even their 2004 release of Peachtree Complete Accounting 11 was solely DOS based! I could only find v 8.0 on archive: https://archive.org/details/peachtree-complete-accounting-8.0-2001, but I haven't tried it w/ the latest CI builds yet. |
The DOSBox Staging team will not be held liable for any and all accounting errors. Actually I think we've had to make a statement like that before. I vaguely remember it came out that someone was using DOSBox for some engineering software and our floating-point calculations are not always 100% accurate on all platforms compared to old x86 hardware that uses 80-bit precision. So yeah, we won't be held liable for any collapsed bridges either. |
|
@Python-Exoproject Just pinging you to show off the rapid progress we're making on the Win 3.x emulation front 😎 |
Running Win9x from the DOSbox "DOS" would be a great project in itself - replicating what's done by DR-DOS WinBolt (which wasn't publicly released). From what I gather it seems for Staging is relevant (barely - if a game/software needs it) only the ticked items:
|
Peachtree Complete Accounting 9.0 runs perfectly. The startup batch file ( I suspect the The main Staging CI build and DOSBox-X both pass the SHARETEST: staging-82-alpha-peachtree.mp4dosbox-x-peachtree.mp4But older 81.1 can't run them. Not even staging-81-1-fakeshar-peachtree.mp4Unfortunately I'm not too sure how to get Microsoft's NetBUI client working (and same w/ Novel's 2.7 client + NE2000 drivers). So I wasn't able to test a real DOS-based network share. @Torinde - do you know how to share and mount a DOS directory across two DOSBox instances (either Ethernet or IPX, using either MS or Novel?) |
Probably better if you open a Discussion entry for that, but here is what I know:
DOSbox seems more oriented towards multiplayer than shared directories, I haven't tested that:
Other forks: |
Description
I've implemented locking the entire file with sharing bits in
DOS_OpenFile
andDOS_CreateFile
.There is another (completely independent from sharing bits) method that lock regions of a file. This is done through INT 21 AH = 0x5c. This requires performing a check on
DOS_ReadFile
andDOS_WriteFile
to check if the region a process is attempting to read/write to has been locked by another process.Many of the games I've tested require Win32s (who's installer does a
SHARE.EXE
check). This check failed for me on both DOSBox-X and usingFAKESHR.COM
so we are doing better than them now 😄Related issues
Fixes #1489
Manual testing
Checklist
Please tick the items as you have addressed them. Don't remove items; leave the ones that are not applicable unchecked.
I have: