misc: Replace references to IntPtr/UIntPtr with nint/nuint + code cleanups.
This commit is contained in:
@@ -7,42 +7,42 @@ namespace Ryujinx.Memory.WindowsShared
|
||||
[SupportedOSPlatform("windows")]
|
||||
static partial class WindowsApi
|
||||
{
|
||||
public static readonly IntPtr InvalidHandleValue = new(-1);
|
||||
public static readonly IntPtr CurrentProcessHandle = new(-1);
|
||||
public static readonly nint InvalidHandleValue = new(-1);
|
||||
public static readonly nint CurrentProcessHandle = new(-1);
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
public static partial IntPtr VirtualAlloc(
|
||||
IntPtr lpAddress,
|
||||
IntPtr dwSize,
|
||||
public static partial nint VirtualAlloc(
|
||||
nint lpAddress,
|
||||
nint dwSize,
|
||||
AllocationType flAllocationType,
|
||||
MemoryProtection flProtect);
|
||||
|
||||
[LibraryImport("KernelBase.dll", SetLastError = true)]
|
||||
public static partial IntPtr VirtualAlloc2(
|
||||
IntPtr process,
|
||||
IntPtr lpAddress,
|
||||
IntPtr dwSize,
|
||||
public static partial nint VirtualAlloc2(
|
||||
nint process,
|
||||
nint lpAddress,
|
||||
nint dwSize,
|
||||
AllocationType flAllocationType,
|
||||
MemoryProtection flProtect,
|
||||
IntPtr extendedParameters,
|
||||
nint extendedParameters,
|
||||
ulong parameterCount);
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static partial bool VirtualProtect(
|
||||
IntPtr lpAddress,
|
||||
IntPtr dwSize,
|
||||
nint lpAddress,
|
||||
nint dwSize,
|
||||
MemoryProtection flNewProtect,
|
||||
out MemoryProtection lpflOldProtect);
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static partial bool VirtualFree(IntPtr lpAddress, IntPtr dwSize, AllocationType dwFreeType);
|
||||
public static partial bool VirtualFree(nint lpAddress, nint dwSize, AllocationType dwFreeType);
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true, EntryPoint = "CreateFileMappingW")]
|
||||
public static partial IntPtr CreateFileMapping(
|
||||
IntPtr hFile,
|
||||
IntPtr lpFileMappingAttributes,
|
||||
public static partial nint CreateFileMapping(
|
||||
nint hFile,
|
||||
nint lpFileMappingAttributes,
|
||||
FileMapProtection flProtect,
|
||||
uint dwMaximumSizeHigh,
|
||||
uint dwMaximumSizeLow,
|
||||
@@ -50,35 +50,35 @@ namespace Ryujinx.Memory.WindowsShared
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static partial bool CloseHandle(IntPtr hObject);
|
||||
public static partial bool CloseHandle(nint hObject);
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
public static partial IntPtr MapViewOfFile(
|
||||
IntPtr hFileMappingObject,
|
||||
public static partial nint MapViewOfFile(
|
||||
nint hFileMappingObject,
|
||||
uint dwDesiredAccess,
|
||||
uint dwFileOffsetHigh,
|
||||
uint dwFileOffsetLow,
|
||||
IntPtr dwNumberOfBytesToMap);
|
||||
nint dwNumberOfBytesToMap);
|
||||
|
||||
[LibraryImport("KernelBase.dll", SetLastError = true)]
|
||||
public static partial IntPtr MapViewOfFile3(
|
||||
IntPtr hFileMappingObject,
|
||||
IntPtr process,
|
||||
IntPtr baseAddress,
|
||||
public static partial nint MapViewOfFile3(
|
||||
nint hFileMappingObject,
|
||||
nint process,
|
||||
nint baseAddress,
|
||||
ulong offset,
|
||||
IntPtr dwNumberOfBytesToMap,
|
||||
nint dwNumberOfBytesToMap,
|
||||
ulong allocationType,
|
||||
MemoryProtection dwDesiredAccess,
|
||||
IntPtr extendedParameters,
|
||||
nint extendedParameters,
|
||||
ulong parameterCount);
|
||||
|
||||
[LibraryImport("kernel32.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static partial bool UnmapViewOfFile(IntPtr lpBaseAddress);
|
||||
public static partial bool UnmapViewOfFile(nint lpBaseAddress);
|
||||
|
||||
[LibraryImport("KernelBase.dll", SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static partial bool UnmapViewOfFile2(IntPtr process, IntPtr lpBaseAddress, ulong unmapFlags);
|
||||
public static partial bool UnmapViewOfFile2(nint process, nint lpBaseAddress, ulong unmapFlags);
|
||||
|
||||
[LibraryImport("kernel32.dll")]
|
||||
public static partial uint GetLastError();
|
||||
|
||||
Reference in New Issue
Block a user