mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
throw around some unchecked because warnings
This commit is contained in:
parent
e0585a2feb
commit
2542ec7bcd
1 changed files with 20 additions and 14 deletions
|
|
@ -582,6 +582,8 @@ public static unsafe class MemoryHelper
|
|||
/// <param name="memoryAddress">The memory address to read from.</param>
|
||||
/// <param name="value">The read in bytes.</param>
|
||||
public static void ReadProcessMemory(IntPtr memoryAddress, ref byte[] value)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var length = value.Length;
|
||||
var result = NativeFunctions.ReadProcessMemory((IntPtr)0xFFFFFFFF, memoryAddress, value, length, out _);
|
||||
|
|
@ -593,6 +595,7 @@ public static unsafe class MemoryHelper
|
|||
if (last > 0)
|
||||
throw new MemoryReadException($"Unable to read memory at 0x{memoryAddress.ToInt64():X} of length {length} (error={last})");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes raw data to a specified memory address via Windows API calls.
|
||||
|
|
@ -601,6 +604,8 @@ public static unsafe class MemoryHelper
|
|||
/// <param name="memoryAddress">The memory address to write to.</param>
|
||||
/// <param name="data">The bytes to write to memoryAddress.</param>
|
||||
public static void WriteProcessMemory(IntPtr memoryAddress, byte[] data)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var length = data.Length;
|
||||
var result = NativeFunctions.WriteProcessMemory((IntPtr)0xFFFFFFFF, memoryAddress, data, length, out _);
|
||||
|
|
@ -612,6 +617,7 @@ public static unsafe class MemoryHelper
|
|||
if (last > 0)
|
||||
throw new MemoryWriteException($"Unable to write memory at 0x{memoryAddress.ToInt64():X} of length {length} (error={last})");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue