@@ -50,6 +50,9 @@ public static partial class Kernel32
50
50
/// <para>The function fails if the requested read operation crosses into an area of the process that is inaccessible.</para>
51
51
/// </returns>
52
52
[ SuppressUnmanagedCodeSecurity ]
53
+ #if NET5_0_OR_GREATER
54
+ [ SuppressGCTransition ]
55
+ #endif
53
56
#if NET7_0_OR_GREATER
54
57
[ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
55
58
[ return : MarshalAs ( UnmanagedType . Bool ) ]
@@ -97,6 +100,9 @@ public static extern bool ReadProcessMemory(IntPtr hProcess, UIntPtr lpBaseAddre
97
100
/// </para>
98
101
/// </returns>
99
102
[ SuppressUnmanagedCodeSecurity ]
103
+ #if NET5_0_OR_GREATER
104
+ [ SuppressGCTransition ]
105
+ #endif
100
106
#if NET7_0_OR_GREATER
101
107
[ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
102
108
[ return : MarshalAs ( UnmanagedType . Bool ) ]
@@ -281,6 +287,9 @@ public static extern bool WriteProcessMemory(IntPtr hProcess, UIntPtr lpBaseAddr
281
287
/// </para>
282
288
/// </returns>
283
289
[ SuppressUnmanagedCodeSecurity ]
290
+ #if NET5_0_OR_GREATER
291
+ [ SuppressGCTransition ]
292
+ #endif
284
293
#if NET7_0_OR_GREATER
285
294
[ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
286
295
public static partial nuint VirtualAllocEx ( IntPtr hProcess , UIntPtr lpAddress , UIntPtr dwSize ,
@@ -372,6 +381,9 @@ public static extern nuint VirtualAllocEx(IntPtr hProcess, UIntPtr lpAddress, UI
372
381
/// </para>
373
382
/// </returns>
374
383
[ SuppressUnmanagedCodeSecurity ]
384
+ #if NET5_0_OR_GREATER
385
+ [ SuppressGCTransition ]
386
+ #endif
375
387
#if NET7_0_OR_GREATER
376
388
[ LibraryImport ( "kernel32.dll" ) ]
377
389
[ return : MarshalAs ( UnmanagedType . Bool ) ]
@@ -426,6 +438,9 @@ public static extern bool VirtualFreeEx(IntPtr hProcess, UIntPtr lpAddress, UInt
426
438
/// <para>If the function fails, the return value is zero. To get extended error information, call <c>GetLastError</c>.</para>
427
439
/// </returns>
428
440
[ SuppressUnmanagedCodeSecurity ]
441
+ #if NET5_0_OR_GREATER
442
+ [ SuppressGCTransition ]
443
+ #endif
429
444
#if NET7_0_OR_GREATER
430
445
[ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
431
446
[ return : MarshalAs ( UnmanagedType . Bool ) ]
@@ -610,6 +625,9 @@ public static extern bool VirtualProtectEx(IntPtr hProcess, UIntPtr lpAddress, U
610
625
/// </para>
611
626
/// </returns>
612
627
[ SuppressUnmanagedCodeSecurity ]
628
+ #if NET5_0_OR_GREATER
629
+ [ SuppressGCTransition ]
630
+ #endif
613
631
#if NET7_0_OR_GREATER
614
632
[ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
615
633
public static partial nuint VirtualAlloc ( UIntPtr lpAddress , UIntPtr dwSize ,
@@ -699,6 +717,9 @@ public static extern nuint VirtualAlloc(UIntPtr lpAddress, UIntPtr dwSize,
699
717
/// </para>
700
718
/// </returns>
701
719
[ SuppressUnmanagedCodeSecurity ]
720
+ #if NET5_0_OR_GREATER
721
+ [ SuppressGCTransition ]
722
+ #endif
702
723
#if NET7_0_OR_GREATER
703
724
[ LibraryImport ( "kernel32.dll" ) ]
704
725
[ return : MarshalAs ( UnmanagedType . Bool ) ]
@@ -752,6 +773,9 @@ public static extern nuint VirtualAlloc(UIntPtr lpAddress, UIntPtr dwSize,
752
773
/// <para>If the function fails, the return value is zero. To get extended error information, call <c>GetLastError</c>.</para>
753
774
/// </returns>
754
775
[ SuppressUnmanagedCodeSecurity ]
776
+ #if NET5_0_OR_GREATER
777
+ [ SuppressGCTransition ]
778
+ #endif
755
779
#if NET7_0_OR_GREATER
756
780
[ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
757
781
[ return : MarshalAs ( UnmanagedType . Bool ) ]
0 commit comments