Something's not right with this code --- DosBox sometimes crashes upon closing a file that had AX=5701 called prior to closing. I'm trying to find out under what circumstances it happens, but when it happens, then always upon closing a file.
Edit: it definitely has something to do with the length of the original (i.e. not within DosBox) path. Moving the offending sub-directory into the root directory makes the bug disappear, purposefully creating paths with more than 120 or so total characters triggers it.
Edit 2: It must have something to do with:
- Code: Select all
DOS_PATHLENGTH is defined in dos_system.h with a value of 80. Clearly, that is not enough for NTFS file systems. The constant is used many times elsewhere in the code, but there it is only used for virtual (mounted) paths, as far as I can tell, not host paths. It is therefore incorrect to use DOS_PATHLENGTH in this context. Looking at Open(), the correct constant that is always used elsewhere with local paths is CROSS_LEN, not DOS_PATHLENGTH. Replacing DOS_PATHLENGTH with CROSS_LEN indeed fixes the issue, which also occured in SVN Daum because that's where they are taken from.