CopyMemory (urlmon)
Last changed: -180.214.232.93

.
Summary
Copies unmanaged memory from one location to another.

C# Signature:

    [DllImport("ntdll.dll", EntryPoint = "memcpy")]
    static extern void CopyMemory(IntPtr Destination, IntPtr Source, UIntPtr Length);

VB.NET Signature:

    <DllImport("ntdll.dll", EntryPoint:="memcpy")> _
    Friend Shared Sub CopyMemory(ByVal Destination As IntPtr, ByVal Source As IntPtr, ByVal Length As UIntPtr)
    End Sub

VB Signature:

    Declare Sub CopyMemory Alias "memcpy" Lib "ntdll.dll" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

    [DllImport("ntdll.dll", EntryPoint = "memcpy")]
    static extern unsafe void CopyMemory(byte* Destination, byte* Source, int Length);

It seems that using the EntryPoint - compiles and runs, yet doesn't always copy the memory. Without the entry point - it does.

Notes:

None.

RtlCopyMemory is (sometimes?) just a C macro expanding to memcpy, not a real exported DLL function.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation
CopyMemory on MSDN