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

Move midi implementation to user mode #3

Open
pachuco opened this issue Jul 29, 2023 · 2 comments
Open

Move midi implementation to user mode #3

pachuco opened this issue Jul 29, 2023 · 2 comments

Comments

@pachuco
Copy link

pachuco commented Jul 29, 2023

Midi implementation in win2k kernel mode + user-provided file is a rather dangerous combination.

Mostly because the midi implementation doesn't sanitize the bank format. At least, I've gotten the NT4 extracted implementation to crash program with garbage data(reading bank out of a naked malloc, lol).

Adition to suggestion, user mode component should send FM writes one buffer at a time(flushing) to reduce context switches.

Of course, as a bonus, this lets the user diddle with the implementation.

@leecher1337
Copy link
Owner

Not much we can do about it, Win2k driver architecture is like it is.

NT4 did a lot of stuff in Usermode, even GDI (via CSRSS), which sucked big time, because it's insanely slow, that's why i.e. GDI also was moved to kernel mode in Win2k (Win32k.sys) and the stupid concept with running all the stuff in usermode was given up.
I guess the same applies to sound architecture.

@pachuco
Copy link
Author

pachuco commented Aug 4, 2023

Then maybe at least, sanitation for patches loaded from file. This comes to mind:

  1. Check if bank filesize is at least the size of offset table(2 * 128 * sizeof USHORT).
  2. For each offset, check if offset(relative to 0 or table end? I forgets) + patch size(36 or 72) <= filesize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants