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

Not working at all under Windows 7 #318

Closed
PlayNeth opened this issue May 23, 2024 · 12 comments
Closed

Not working at all under Windows 7 #318

PlayNeth opened this issue May 23, 2024 · 12 comments

Comments

@PlayNeth
Copy link

A colleague of mine has been trying to get DDrawCompat working on his system for a while, but it never seems to work for him.

I asked him for a debug log and just by glancing at it I'm not entirely sure what's going on, but my bet is that he borked some important system files along the way and DDC is struggling to hook somehow.

Could you take a look at it? Thank you very much

OS: Windows 7
GPU: GTX 960
CPU: 3rd gen I5

ddraw log

@narzoul
Copy link
Owner

narzoul commented May 23, 2024

I have no idea, but it's definitely not a generic Windows 7 issue, because the hooking mechanism works even in a Windows 7 VM (I just double checked).

Is there a dbghelp.dll or dbgeng.dll in his game directory? If yes, try removing those. If not, please check the version numbers of those files in C:\Windows\SysWOW64. Maybe I can reproduce it with whatever version he has there.

@PlayNeth
Copy link
Author

Nothing special going on in the game's folder itself, so here's the details of those specific files:

dbgeng
dbghelp

@narzoul
Copy link
Owner

narzoul commented May 24, 2024

That's the exact same version I have in my VM, so unfortunately it doesn't help.

Let's just try to skip that problematic call. In theory, the result should be a constant anyway.
ddraw.zip (diff.txt compared to v0.5.2)

@PlayNeth
Copy link
Author

There you go:

ddraw log

@narzoul
Copy link
Owner

narzoul commented May 25, 2024

Attempt nr. 2: ddraw.zip (diff.txt compared to v0.5.2)

@PlayNeth
Copy link
Author

Still crashing sadly

ddraw log

@narzoul
Copy link
Owner

narzoul commented May 25, 2024

Thanks, at least the extra logs provide a bit more insight. There are a number of suspicious modules loaded:

C:\Program Files\Prio\prio32.dll
I assume this comes from here: https://www.prnwatch.com/prio/
I tried to install it on my VM, and sure enough, it gets injected into the process, but it doesn't seem to cause the hooking to fail.

C:\Windows\system32\d3d9.dll
C:\Windows\system32\d3d8thk.dll
C:\Windows\system32\dbghelp.dll
These are not loaded on my VM, at least not before the hooks are installed. Something must be causing them to be loaded. I tried changing ThrashDriver to dx9 in nfs4.ini, but that didn't matter either. Nevertheless, it would be good to share the nfs4.ini file to sync our settings.

C:\Users\PDA\Downloads\Need For Speed - High Stakes\DINPUT.dll
What about this one? It must be some other hook, that could very well be interfering. Where does it come from?

Is this issue present only with NFS games, or with every ddraw game in general?

@narzoul
Copy link
Owner

narzoul commented May 25, 2024

Good news: I managed to reproduce the issue after installing SilentPatch mentioned here: https://www.pcgamingwiki.com/wiki/Need_for_Speed:_High_Stakes#SilentPatch

Looks like this is what provides the dinput.dll file mentioned above.

The issue happens on Windows 7, but not on Windows 11. Anyway, this should at least make debugging it significantly easier.

@PlayNeth
Copy link
Author

Nice!

Yeah that's it, the dinput is ASILoader for his patch.

We use a custom plug&play package of the game optimized for multiplayer in the RetroRacingPoint discord, I have it set to dx7+DDC by default and it runs flawlessly for the vast majority, except for him and some other Windows 7 user that just crash on boot.

@narzoul
Copy link
Owner

narzoul commented May 25, 2024

So, the problem is this dinput.dll statically links to dbghelp.dll, but dbghelp.dll's DllMain doesn't get called before ddraw.dll's DllMain. It's supposed to create a heap with HeapCreate, which is later used by HeapAlloc in SymInitializeW, which itself is invoked by dbgeng.dll from IDebugControl::WaitForEvent. But because DllMain and thus HeapCreate is not yet called, HeapAlloc ends up getting called with a null pointer as its first argument, which causes an access violation error that breaks the debugger engine.

I don't see a good solution other than linking statically to dbgeng (which itself statically links to dbghelp), which should ensure that dbghelp is initialized before ddraw. But this solution has unfortunate downsides too. For example, some games, such as the GOG version of Settlers 4 has an outdated version of dbghelp next to the main executable, which now prevents the game from launching when DDrawCompat is used. I'm not sure how to work around that anymore.

Anyway, here's the statically linked version, which seems to work on Windows 7 even with the SilentPatch installed:
ddraw.zip (diff.txt compared to v0.5.2)

@PlayNeth
Copy link
Author

That did the trick! Worked first try for him.

Thank you for looking into it!

narzoul added a commit that referenced this issue Jul 2, 2024
@narzoul
Copy link
Owner

narzoul commented Jul 2, 2024

Fixed in v0.5.3 by removing the dbgeng.dll dependency. It's different than the fix that was posted here, but it should still work.

@narzoul narzoul closed this as completed Jul 2, 2024
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