How to reproduce:
- Install ReactOS as usually.
- Install AC97 VirtualBox driver from Rapps as usually, with twice installing via Device manager and reboot.
- Replace the following drivers onto versions from XP/2003: ks.sys, portcls.sys, swenum.sys, sysaudio.sys, wdmaud.sys.
- Reboot again.
After reboot, you will see the BSOD 0x0000007F, which is UNEXPECTED_KERNEL_MODE_TRAP.
As visible in MS_audio.log, the first additional error code is 0x0000008:
According to https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x7f--unexpected-kernel-mode-trap, it's a double fault, which may be caused either by kernel stack overflow, or by hardware problem(s). But since I tested it in the VM, which seems to have emulated hardware, in this case it is definitely the kernel stack overflow.
I tried to use commands in kdbg, described in that MS article, but without success. The thread command, which is equivalent of MS's !thread, displays the problematic thread(s) correctly, but after typing bt 100, as suggested there, I got an error message that it is not yet supported. So I can't debug the issue by way from that documentation.
It seems to me that this BSOD is caused even not by PnP issues (can trap handler errors be caused by that?), so we don't need to improve anything in PnP, to fix the actual problem I guess. My arguments are, the drivers are loaded successfully during the system bootup, and the BSOD appears only when the system tries to load the used-mode (even earlier than the startup sound is played). I may be wrong, but this is only my personal guessing.
Moreover, if there are no any audio drivers installed, ReactOS is booting into desktop successfully with all these replaced drivers, without any BSODs or other errors. But in this case, the only problem is, after installing the audio driver(s), there is no sound devices detected, and the system is completely silent. Only after replacing the drivers back onto the ROS versions, and twice reinstallation and reboot, the sound became working, but if to replace the drivers again (onto MS versions), the same BSOD appers again, as in the attached log. And when I try to install AC97 driver with MS audio stack replaced, there is nothing suspicious in the log, as I see.
The problem is reproducible as well for me in 0.4.15-dev-1265-gf1a4a6e.