fix: Don't let a debugger crash Bink (#1892)

Resolves a problem where attaching a debugger can cause Bink to throw an exception, crashing the game.
This commit is contained in:
KazWolfe 2024-07-04 03:03:09 -07:00 committed by GitHub
parent 336d85363e
commit 4a3e6df89e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -249,6 +249,12 @@ LONG WINAPI vectored_exception_handler(EXCEPTION_POINTERS* ex)
{ {
// pass // pass
} }
else if (ex->ExceptionRecord->ExceptionCode == 0x406D1388)
{
// VS thread namer - just let these run; they aren't a problem.
// https://learn.microsoft.com/en-us/visualstudio/debugger/tips-for-debugging-threads
return EXCEPTION_CONTINUE_EXECUTION;
}
else else
{ {
if (!is_whitelist_exception(ex->ExceptionRecord->ExceptionCode)) if (!is_whitelist_exception(ex->ExceptionRecord->ExceptionCode))

View file

@ -13,8 +13,8 @@ namespace Dalamud.Game.Internal;
[ServiceManager.EarlyLoadedService] [ServiceManager.EarlyLoadedService]
internal sealed class AntiDebug : IInternalDisposableService internal sealed class AntiDebug : IInternalDisposableService
{ {
private readonly byte[] nop = new byte[] { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90 }; private readonly byte[] nop = [0x31, 0xC0, 0x90, 0x90, 0x90, 0x90];
private byte[] original; private byte[]? original;
private IntPtr debugCheckAddress; private IntPtr debugCheckAddress;
[ServiceManager.ServiceConstructor] [ServiceManager.ServiceConstructor]
@ -44,7 +44,7 @@ internal sealed class AntiDebug : IInternalDisposableService
} }
/// <summary>Finalizes an instance of the <see cref="AntiDebug"/> class.</summary> /// <summary>Finalizes an instance of the <see cref="AntiDebug"/> class.</summary>
~AntiDebug() => this.Disable(); ~AntiDebug() => ((IInternalDisposableService)this).DisposeService();
/// <summary> /// <summary>
/// Gets a value indicating whether the anti-debugging is enabled. /// Gets a value indicating whether the anti-debugging is enabled.