> Microsoft has only kept the documentation for the DX8 version of EnumDevices left online
This saddens me. Who knows how much valuable info has been lost. I recall back in the days of MSDN, we had docs back to early Windows, and it was a wonderful historical record. Today's Docs site seems to keep info only for a few versions.
I have had very bad success rate with my old Windows CDROM/DVD era games. Pretty much all of them either have some kind of DRM or they run but with bugs.
When available I just buy the GOG versions instead, but even those versions sadly often have issues.
Meanwhile slightly older games from the DOS era works perfectly everywhere thanks to DOSBox. I would love to see something like that for old Windows. Merge DOSBox with WINE, someone?
Its interesting to see how bad assumptions that almost certainly held up at the time really don't any more and that leads to this bug being exposed. Modern machines have a lot more addressable devices and a failure to properly filter and using a vector ultimately leads to a bug that on the surface feels like since it works on Win98 must be caused by Windows but isn't.
I mean that's just a bad assumption no matter how anyone looks at it - if you created an array for 8 devices then just stop adding to it when you reach 8. The "a user will never have more than 8 gamepads" is a bad assumption because the logical question then is "what if they do" and the answer even back in the day would have been "the game will crash" which isn't how any code should be written. Stop processing at 8 if you are so sure there will never be more than 8, but have the most basic sanity checks.
I was quite interested in the patch -- am I right in thinking the DirectX library only exports a single function and _everything_ else is through DX interfaces?
I expected to see significantly more code, pass-through to the original DLL.
The cool part of this adventure is that the author was able to write this DLL patch purely in rust! Good testament of how far it has come. Can't wait to see more C code ported to either Golang or Rust!
Because I felt like it :) Also works for multiple versions/patchlevels.
But yeah, with the info provided it should be patchable. It's a `push esi` though, where esi has to stay 0 for a few further usages, so it's a bit more than a one-byte patch. It also wouldn't fully resolve the OOB write in the rare case where you _do_ have 9+ game controllers connected.
I feel like this is a cleaner solution. As a user you don't have to faff around running a whole application just to change 3 bytes. Just drop this file in and go.
vintagedave|3 months ago
This saddens me. Who knows how much valuable info has been lost. I recall back in the days of MSDN, we had docs back to early Windows, and it was a wonderful historical record. Today's Docs site seems to keep info only for a few versions.
bitwize|3 months ago
falcor84|3 months ago
stonemetal12|3 months ago
bayindirh|3 months ago
1313ed01|3 months ago
When available I just buy the GOG versions instead, but even those versions sadly often have issues.
Meanwhile slightly older games from the DOS era works perfectly everywhere thanks to DOSBox. I would love to see something like that for old Windows. Merge DOSBox with WINE, someone?
seritools|3 months ago
Otherwise, 86Box is a pretty good full-system emulator for everything up to the early 3D era.
As for DRM, there's various ways around it of course :)
trollbridge|3 months ago
anthk|3 months ago
PaulKeeble|3 months ago
gambiting|3 months ago
vintagedave|3 months ago
I expected to see significantly more code, pass-through to the original DLL.
seritools|3 months ago
Yup! That's why I didn't have to create a gazillion passthrough functions.
The original DLL in my modern Windows installation has these 8 exports:
The game only calls DirectInputCreateA, and the rest happens via the COM object that that function creates.xx_ns|3 months ago
Seems pretty straightforward. They hook DirectInputCreateA() and pass their own device enumeration wrapper with the offending flag removed.
purpleidea|3 months ago
Xylakant|3 months ago
xx_ns|3 months ago
Interesting article, thank you.
jebarker|3 months ago
progforlyfe|3 months ago
neonz80|3 months ago
seritools|3 months ago
But yeah, with the info provided it should be patchable. It's a `push esi` though, where esi has to stay 0 for a few further usages, so it's a bit more than a one-byte patch. It also wouldn't fully resolve the OOB write in the rare case where you _do_ have 9+ game controllers connected.
qingcharles|3 months ago
ensocode|3 months ago