-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Kernel32.cs
64 lines (51 loc) · 1.97 KB
/
Kernel32.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#region Copyright
///////////////////////////////////////////////////////////////////////////////
// File: Kernel32.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2021 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////
#endregion
#region Usings
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Security;
#endregion
namespace KGySoft.Drawing.WinApi
{
[SecurityCritical]
internal static class Kernel32
{
#region NativeMethods class
[SuppressMessage("ReSharper", "MemberHidesStaticFromOuterClass")]
[SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "ReSharper issue")]
private static class NativeMethods
{
#region Methods
/// <summary>
/// Copies a block of memory from one location to another.
/// </summary>
/// <param name="dest">A pointer to the starting address of the copied block's destination.</param>
/// <param name="src">A pointer to the starting address of the block of memory to copy.</param>
/// <param name="length">The size of the block of memory to copy, in bytes.</param>
[DllImport("kernel32.dll", EntryPoint =
#if NETFRAMEWORK
"CopyMemory"
#else
"RtlCopyMemory"
#endif
)]
internal static extern void CopyMemory(IntPtr dest, IntPtr src, int length);
#endregion
}
#endregion
#region Methods
internal static void CopyMemory(IntPtr dest, IntPtr src, int length) => NativeMethods.CopyMemory(dest, src, length);
#endregion
}
}