mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Add injector option to not apply any exception handlers (#1541)
* Add injector option to not apply any exception handlers * Log as warning if NoExceptionHandlers is set
This commit is contained in:
parent
70249a4db0
commit
5777745ab3
6 changed files with 18 additions and 37 deletions
|
|
@ -103,6 +103,7 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
|
|||
}
|
||||
|
||||
config.CrashHandlerShow = json.value("CrashHandlerShow", config.CrashHandlerShow);
|
||||
config.NoExceptionHandlers = json.value("NoExceptionHandlers", config.NoExceptionHandlers);
|
||||
}
|
||||
|
||||
void DalamudStartInfo::from_envvars() {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ struct DalamudStartInfo {
|
|||
std::set<std::string> BootUnhookDlls{};
|
||||
|
||||
bool CrashHandlerShow = false;
|
||||
bool NoExceptionHandlers = false;
|
||||
|
||||
friend void from_json(const nlohmann::json&, DalamudStartInfo&);
|
||||
void from_envvars();
|
||||
|
|
|
|||
|
|
@ -133,7 +133,9 @@ DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
|
|||
// ============================== VEH ======================================== //
|
||||
|
||||
logging::I("Initializing VEH...");
|
||||
if (utils::is_running_on_wine()) {
|
||||
if (g_startInfo.NoExceptionHandlers) {
|
||||
logging::W("=> Exception handlers are disabled from DalamudStartInfo.");
|
||||
} else if (utils::is_running_on_wine()) {
|
||||
logging::I("=> VEH was disabled, running on wine");
|
||||
} else if (g_startInfo.BootVehEnabled) {
|
||||
if (veh::add_handler(g_startInfo.BootVehFull, g_startInfo.WorkingDirectory))
|
||||
|
|
|
|||
|
|
@ -17,38 +17,6 @@ public record DalamudStartInfo
|
|||
// ignored
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DalamudStartInfo"/> class.
|
||||
/// </summary>
|
||||
/// <param name="other">Object to copy values from.</param>
|
||||
public DalamudStartInfo(DalamudStartInfo other)
|
||||
{
|
||||
this.WorkingDirectory = other.WorkingDirectory;
|
||||
this.ConfigurationPath = other.ConfigurationPath;
|
||||
this.LogPath = other.LogPath;
|
||||
this.LogName = other.LogName;
|
||||
this.PluginDirectory = other.PluginDirectory;
|
||||
this.AssetDirectory = other.AssetDirectory;
|
||||
this.Language = other.Language;
|
||||
this.GameVersion = other.GameVersion;
|
||||
this.DelayInitializeMs = other.DelayInitializeMs;
|
||||
this.TroubleshootingPackData = other.TroubleshootingPackData;
|
||||
this.NoLoadPlugins = other.NoLoadPlugins;
|
||||
this.NoLoadThirdPartyPlugins = other.NoLoadThirdPartyPlugins;
|
||||
this.BootLogPath = other.BootLogPath;
|
||||
this.BootShowConsole = other.BootShowConsole;
|
||||
this.BootDisableFallbackConsole = other.BootDisableFallbackConsole;
|
||||
this.BootWaitMessageBox = other.BootWaitMessageBox;
|
||||
this.BootWaitDebugger = other.BootWaitDebugger;
|
||||
this.BootVehEnabled = other.BootVehEnabled;
|
||||
this.BootVehFull = other.BootVehFull;
|
||||
this.BootEnableEtw = other.BootEnableEtw;
|
||||
this.BootDotnetOpenProcessHookMode = other.BootDotnetOpenProcessHookMode;
|
||||
this.BootEnabledGameFixes = other.BootEnabledGameFixes;
|
||||
this.BootUnhookDlls = other.BootUnhookDlls;
|
||||
this.CrashHandlerShow = other.CrashHandlerShow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the working directory of the XIVLauncher installations.
|
||||
/// </summary>
|
||||
|
|
@ -169,4 +137,9 @@ public record DalamudStartInfo
|
|||
/// Gets or sets a value indicating whether to show crash handler console window.
|
||||
/// </summary>
|
||||
public bool CrashHandlerShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to disable all kinds of global exception handlers.
|
||||
/// </summary>
|
||||
public bool NoExceptionHandlers { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ namespace Dalamud.Injector
|
|||
args.Remove("--no-plugin");
|
||||
args.Remove("--no-3rd-plugin");
|
||||
args.Remove("--crash-handler-console");
|
||||
args.Remove("--no-exception-handlers");
|
||||
|
||||
var mainCommand = args[1].ToLowerInvariant();
|
||||
if (mainCommand.Length > 0 && mainCommand.Length <= 6 && "inject"[..mainCommand.Length] == mainCommand)
|
||||
|
|
@ -393,6 +394,7 @@ namespace Dalamud.Injector
|
|||
startInfo.NoLoadThirdPartyPlugins = args.Contains("--no-3rd-plugin");
|
||||
// startInfo.BootUnhookDlls = new List<string>() { "kernel32.dll", "ntdll.dll", "user32.dll" };
|
||||
startInfo.CrashHandlerShow = args.Contains("--crash-handler-console");
|
||||
startInfo.NoExceptionHandlers = args.Contains("--no-exception-handlers");
|
||||
|
||||
return startInfo;
|
||||
}
|
||||
|
|
@ -434,7 +436,7 @@ namespace Dalamud.Injector
|
|||
Console.WriteLine("Verbose logging:\t[-v]");
|
||||
Console.WriteLine("Show Console:\t[--console] [--crash-handler-console]");
|
||||
Console.WriteLine("Enable ETW:\t[--etw]");
|
||||
Console.WriteLine("Enable VEH:\t[--veh], [--veh-full]");
|
||||
Console.WriteLine("Enable VEH:\t[--veh], [--veh-full], [--no-exception-handlers]");
|
||||
Console.WriteLine("Show messagebox:\t[--msgbox1], [--msgbox2], [--msgbox3]");
|
||||
Console.WriteLine("No plugins:\t[--no-plugin] [--no-3rd-plugin]");
|
||||
Console.WriteLine("Logging:\t[--logname=<logfile suffix>] [--logpath=<log base directory>]");
|
||||
|
|
@ -889,7 +891,7 @@ namespace Dalamud.Injector
|
|||
var gameVerStr = File.ReadAllText(Path.Combine(ffxivDir, "ffxivgame.ver"));
|
||||
var gameVer = GameVersion.Parse(gameVerStr);
|
||||
|
||||
return new DalamudStartInfo(startInfo)
|
||||
return startInfo with
|
||||
{
|
||||
GameVersion = gameVer,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ public sealed class EntryPoint
|
|||
LogLevelSwitch.MinimumLevel = configuration.LogLevel;
|
||||
|
||||
// Log any unhandled exception.
|
||||
if (!info.NoExceptionHandlers)
|
||||
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
||||
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
|
||||
|
||||
|
|
@ -196,6 +197,7 @@ public sealed class EntryPoint
|
|||
finally
|
||||
{
|
||||
TaskScheduler.UnobservedTaskException -= OnUnobservedTaskException;
|
||||
if (!info.NoExceptionHandlers)
|
||||
AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;
|
||||
|
||||
Log.Information("Session has ended.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue