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.CrashHandlerShow = json.value("CrashHandlerShow", config.CrashHandlerShow);
|
||||||
|
config.NoExceptionHandlers = json.value("NoExceptionHandlers", config.NoExceptionHandlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DalamudStartInfo::from_envvars() {
|
void DalamudStartInfo::from_envvars() {
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ struct DalamudStartInfo {
|
||||||
std::set<std::string> BootUnhookDlls{};
|
std::set<std::string> BootUnhookDlls{};
|
||||||
|
|
||||||
bool CrashHandlerShow = false;
|
bool CrashHandlerShow = false;
|
||||||
|
bool NoExceptionHandlers = false;
|
||||||
|
|
||||||
friend void from_json(const nlohmann::json&, DalamudStartInfo&);
|
friend void from_json(const nlohmann::json&, DalamudStartInfo&);
|
||||||
void from_envvars();
|
void from_envvars();
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,9 @@ DWORD WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
|
||||||
// ============================== VEH ======================================== //
|
// ============================== VEH ======================================== //
|
||||||
|
|
||||||
logging::I("Initializing 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");
|
logging::I("=> VEH was disabled, running on wine");
|
||||||
} else if (g_startInfo.BootVehEnabled) {
|
} else if (g_startInfo.BootVehEnabled) {
|
||||||
if (veh::add_handler(g_startInfo.BootVehFull, g_startInfo.WorkingDirectory))
|
if (veh::add_handler(g_startInfo.BootVehFull, g_startInfo.WorkingDirectory))
|
||||||
|
|
|
||||||
|
|
@ -17,38 +17,6 @@ public record DalamudStartInfo
|
||||||
// ignored
|
// 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>
|
/// <summary>
|
||||||
/// Gets or sets the working directory of the XIVLauncher installations.
|
/// Gets or sets the working directory of the XIVLauncher installations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -169,4 +137,9 @@ public record DalamudStartInfo
|
||||||
/// Gets or sets a value indicating whether to show crash handler console window.
|
/// Gets or sets a value indicating whether to show crash handler console window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CrashHandlerShow { get; set; }
|
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-plugin");
|
||||||
args.Remove("--no-3rd-plugin");
|
args.Remove("--no-3rd-plugin");
|
||||||
args.Remove("--crash-handler-console");
|
args.Remove("--crash-handler-console");
|
||||||
|
args.Remove("--no-exception-handlers");
|
||||||
|
|
||||||
var mainCommand = args[1].ToLowerInvariant();
|
var mainCommand = args[1].ToLowerInvariant();
|
||||||
if (mainCommand.Length > 0 && mainCommand.Length <= 6 && "inject"[..mainCommand.Length] == mainCommand)
|
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.NoLoadThirdPartyPlugins = args.Contains("--no-3rd-plugin");
|
||||||
// startInfo.BootUnhookDlls = new List<string>() { "kernel32.dll", "ntdll.dll", "user32.dll" };
|
// startInfo.BootUnhookDlls = new List<string>() { "kernel32.dll", "ntdll.dll", "user32.dll" };
|
||||||
startInfo.CrashHandlerShow = args.Contains("--crash-handler-console");
|
startInfo.CrashHandlerShow = args.Contains("--crash-handler-console");
|
||||||
|
startInfo.NoExceptionHandlers = args.Contains("--no-exception-handlers");
|
||||||
|
|
||||||
return startInfo;
|
return startInfo;
|
||||||
}
|
}
|
||||||
|
|
@ -434,7 +436,7 @@ namespace Dalamud.Injector
|
||||||
Console.WriteLine("Verbose logging:\t[-v]");
|
Console.WriteLine("Verbose logging:\t[-v]");
|
||||||
Console.WriteLine("Show Console:\t[--console] [--crash-handler-console]");
|
Console.WriteLine("Show Console:\t[--console] [--crash-handler-console]");
|
||||||
Console.WriteLine("Enable ETW:\t[--etw]");
|
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("Show messagebox:\t[--msgbox1], [--msgbox2], [--msgbox3]");
|
||||||
Console.WriteLine("No plugins:\t[--no-plugin] [--no-3rd-plugin]");
|
Console.WriteLine("No plugins:\t[--no-plugin] [--no-3rd-plugin]");
|
||||||
Console.WriteLine("Logging:\t[--logname=<logfile suffix>] [--logpath=<log base directory>]");
|
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 gameVerStr = File.ReadAllText(Path.Combine(ffxivDir, "ffxivgame.ver"));
|
||||||
var gameVer = GameVersion.Parse(gameVerStr);
|
var gameVer = GameVersion.Parse(gameVerStr);
|
||||||
|
|
||||||
return new DalamudStartInfo(startInfo)
|
return startInfo with
|
||||||
{
|
{
|
||||||
GameVersion = gameVer,
|
GameVersion = gameVer,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ public sealed class EntryPoint
|
||||||
LogLevelSwitch.MinimumLevel = configuration.LogLevel;
|
LogLevelSwitch.MinimumLevel = configuration.LogLevel;
|
||||||
|
|
||||||
// Log any unhandled exception.
|
// Log any unhandled exception.
|
||||||
|
if (!info.NoExceptionHandlers)
|
||||||
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
|
||||||
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
|
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
|
||||||
|
|
||||||
|
|
@ -196,6 +197,7 @@ public sealed class EntryPoint
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
TaskScheduler.UnobservedTaskException -= OnUnobservedTaskException;
|
TaskScheduler.UnobservedTaskException -= OnUnobservedTaskException;
|
||||||
|
if (!info.NoExceptionHandlers)
|
||||||
AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;
|
AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;
|
||||||
|
|
||||||
Log.Information("Session has ended.");
|
Log.Information("Session has ended.");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue