narzoul / DDrawCompat

DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working at all under Windows 7

PlayNeth opened this issue · comments

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

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.

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

dbgeng
dbghelp

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)

There you go:

ddraw log

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

Still crashing sadly

ddraw log

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?

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.

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.

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)

That did the trick! Worked first try for him.

Thank you for looking into it!

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.