Skip to content
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

NEXLOAD2: seems the current logic of OS nextload and nexload2 leaks file handles #10

Open
ped7g opened this issue Nov 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ped7g
Copy link
Owner

ped7g commented Nov 2, 2024

gist of discord chat: there's file handle of the dot command itself which is still left open when doing "execute nex code", even when nex file header is set to close file handle of the nex file (and even if it would be set to keep it, the dot command handle should be probably closed?)

discord chat snippet:

Yep, if HEADER_FILEHANDLEADDR is zero, nexload calls F_CLOSE on the handle of the .nex file it F_OPENed earlier. There is also the handle of the dot command itself, which the OS deliberately leaves open when dots are exited with rst $20 as nexload does. This is meant for games that are written as dot command loaders to be able to load additional resources after exiting the loader.
lesg — Today at 14:05
@SevenFFF is the issue likely to be with the handle for the dot command itself?
SevenFFF — Today at 14:05
Yes
Arguably nexload should be calling M_GETHANDLE to get nexload own handle’s, and then F_CLOSEing that too before exiting 
Unfortunately you can’t call M_GETHANDLE yourself, it only works inside the dot command
You can brute force call F_CLOSE on all 16 handles yourself. If you’re not planning to exit to the OS and you don’t have mode 1 interrupts running, this would be safe to do

todo: verify this and research if it makes sense to close the dot command FH and how.

@ped7g ped7g added the bug Something isn't working label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant