diff --git a/Dalamud.CorePlugin/PluginImpl.cs b/Dalamud.CorePlugin/PluginImpl.cs
index d352ad2c8..9026ea0dd 100644
--- a/Dalamud.CorePlugin/PluginImpl.cs
+++ b/Dalamud.CorePlugin/PluginImpl.cs
@@ -54,6 +54,7 @@ namespace Dalamud.CorePlugin
/// Initializes a new instance of the class.
///
/// Dalamud plugin interface.
+ /// Logging service.
public PluginImpl(DalamudPluginInterface pluginInterface, PluginLog log)
{
try
diff --git a/Dalamud.Injector/EntryPoint.cs b/Dalamud.Injector/EntryPoint.cs
index fbefbd92a..c4c553a47 100644
--- a/Dalamud.Injector/EntryPoint.cs
+++ b/Dalamud.Injector/EntryPoint.cs
@@ -739,10 +739,12 @@ namespace Dalamud.Injector
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
[System.Runtime.InteropServices.DllImport("c")]
- static extern ulong clock_gettime_nsec_np(int clock_id);
+#pragma warning disable SA1300
+ static extern ulong clock_gettime_nsec_np(int clockId);
+#pragma warning restore SA1300
const int CLOCK_MONOTONIC_RAW = 4;
- var rawTickCountFixed = (clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) / 1000000);
+ var rawTickCountFixed = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) / 1000000;
Log.Information("ArgumentBuilder::DeriveKey() fixing up rawTickCount from {0} to {1} on macOS", rawTickCount, rawTickCountFixed);
rawTickCount = (uint)rawTickCountFixed;
}
@@ -764,21 +766,27 @@ namespace Dalamud.Injector
gameArgumentString = string.Join(" ", gameArguments.Select(x => EncodeParameterArgument(x)));
}
- var process = GameStart.LaunchGame(Path.GetDirectoryName(gamePath), gamePath, gameArgumentString, noFixAcl, (Process p) =>
- {
- if (!withoutDalamud && mode == "entrypoint")
+ var process = GameStart.LaunchGame(
+ Path.GetDirectoryName(gamePath),
+ gamePath,
+ gameArgumentString,
+ noFixAcl,
+ p =>
{
- var startInfo = AdjustStartInfo(dalamudStartInfo, gamePath);
- Log.Information("Using start info: {0}", JsonConvert.SerializeObject(startInfo));
- if (RewriteRemoteEntryPointW(p.Handle, gamePath, JsonConvert.SerializeObject(startInfo)) != 0)
+ if (!withoutDalamud && mode == "entrypoint")
{
- Log.Error("[HOOKS] RewriteRemoteEntryPointW failed");
- throw new Exception("RewriteRemoteEntryPointW failed");
- }
+ var startInfo = AdjustStartInfo(dalamudStartInfo, gamePath);
+ Log.Information("Using start info: {0}", JsonConvert.SerializeObject(startInfo));
+ if (RewriteRemoteEntryPointW(p.Handle, gamePath, JsonConvert.SerializeObject(startInfo)) != 0)
+ {
+ Log.Error("[HOOKS] RewriteRemoteEntryPointW failed");
+ throw new Exception("RewriteRemoteEntryPointW failed");
+ }
- Log.Verbose("RewriteRemoteEntryPointW called!");
- }
- }, waitForGameWindow);
+ Log.Verbose("RewriteRemoteEntryPointW called!");
+ }
+ },
+ waitForGameWindow);
Log.Verbose("Game process started with PID {0}", process.Id);
diff --git a/Dalamud.Injector/GameStart.cs b/Dalamud.Injector/GameStart.cs
index 95e963a9a..e34048978 100644
--- a/Dalamud.Injector/GameStart.cs
+++ b/Dalamud.Injector/GameStart.cs
@@ -211,6 +211,9 @@ namespace Dalamud.Injector
}
}
+ ///
+ /// Claim a SE Debug Privilege.
+ ///
public static void ClaimSeDebug()
{
var hToken = PInvoke.INVALID_HANDLE_VALUE;
@@ -345,8 +348,6 @@ namespace Dalamud.Injector
private static class PInvoke
{
#region Constants
- public static readonly IntPtr INVALID_HANDLE_VALUE = new(-1);
-
public const string SE_DEBUG_NAME = "SeDebugPrivilege";
public const UInt32 STANDARD_RIGHTS_ALL = 0x001F0000;
@@ -369,6 +370,8 @@ namespace Dalamud.Injector
public const UInt32 ERROR_NO_TOKEN = 0x000003F0;
+ public static readonly IntPtr INVALID_HANDLE_VALUE = new(-1);
+
public enum MULTIPLE_TRUSTEE_OPERATION
{
NO_MULTIPLE_TRUSTEE,
@@ -431,7 +434,7 @@ namespace Dalamud.Injector
SecurityAnonymous,
SecurityIdentification,
SecurityImpersonation,
- SecurityDelegation
+ SecurityDelegation,
}
#endregion
@@ -485,8 +488,7 @@ namespace Dalamud.Injector
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool ImpersonateSelf(
- SECURITY_IMPERSONATION_LEVEL impersonationLevel
- );
+ SECURITY_IMPERSONATION_LEVEL impersonationLevel);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool OpenProcessToken(
@@ -496,10 +498,10 @@ namespace Dalamud.Injector
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool OpenThreadToken(
- IntPtr ThreadHandle,
- uint DesiredAccess,
- bool OpenAsSelf,
- out IntPtr TokenHandle);
+ IntPtr threadHandle,
+ uint desiredAccess,
+ bool openAsSelf,
+ out IntPtr tokenHandle);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, ref LUID lpLuid);
diff --git a/Dalamud.Injector/LegacyBlowfish.cs b/Dalamud.Injector/LegacyBlowfish.cs
index 28cc584e4..99c514954 100644
--- a/Dalamud.Injector/LegacyBlowfish.cs
+++ b/Dalamud.Injector/LegacyBlowfish.cs
@@ -1,8 +1,16 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
namespace Dalamud.Injector
{
+ [SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1124:Do not use regions", Justification = "Legacy code")]
+ [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1413:Use trailing comma in multi-line initializers", Justification = "Legacy code")]
+ [SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1519:Braces should not be omitted from multi-line child statement", Justification = "Legacy code")]
+ [SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1414:Tuple types in signatures should have element names", Justification = "Legacy code")]
+ [SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Legacy code")]
+ [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Legacy code")]
+ [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:Static elements should appear before instance elements", Justification = "Legacy code")]
internal class LegacyBlowfish
{
#region P-Array and S-Boxes
@@ -203,10 +211,9 @@ namespace Dalamud.Injector
private static readonly int Rounds = 16;
///
- /// Initialize a new blowfish.
+ /// Initializes a new instance of the class.
///
/// The key to use.
- /// Whether or not a sign confusion should be introduced during key init. This is needed for SE's implementation of blowfish.
public LegacyBlowfish(byte[] key)
{
foreach (var (i, keyFragment) in WrappingUInt32(key, this.p.Length))
@@ -306,7 +313,9 @@ namespace Dalamud.Injector
for (var j = 0; j < 4 && enumerator.MoveNext(); j++)
{
+#pragma warning disable CS0675
n = (uint)((n << 8) | (sbyte)enumerator.Current); // NOTE(goat): THIS IS A BUG! SE's implementation wrongly uses signed numbers for this, so we need to as well.
+#pragma warning restore CS0675
}
yield return (i, n);