[VIDEOPRT] Implement support for dynamically choosing V86 vs. X86 emulator on x86 32-bit builds #8451
+476
−137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose & Proposed changes
The choice is done by looking for the presence or absence of the
HKLM\System\CurrentControlSet\Control\GraphicsDrivers\DisableEmulatorregistry key. For more details, see:https://www.geoffchappell.com/studies/windows/km/hal/api/x86bios/call.htm
By default, use V86 in 32-bit Win2k3-compatible builds, otherwise (Vista+) check the presence of the registry key.
The X86 emulator routines are exported by the HAL.DLL. They are always exported by the non-x86 HAL. However, they may or may not be exported by the x86 (32-bit) HAL: on NT 5.2 and below they are not exported, while on NT 6.x (Vista+) they are.
Therefore:
in our NT <= 5.2 x86 builds, we load the routines at runtime. If they aren't found, we fail emulator support initialization and fall back to VDM V86 support.
in our NT 6.x (x86 or not) builds, we always directly link with the HAL routines, since they are guaranteed to be present there.