Attempting to use the kernel32 function SecureZeroMemory
, using the code below, fails, with System.EntryPointNotFoundException
- even though it is well documented here, on PInvoke, and here, on SO. Running completely normal Windows 10 Pro, on target .NET Framework 4.7.2.
/// <summary>
/// A kernel32 function that destroys all values in a block of memory
/// </summary>
/// <param name="destination">The pointer to the start of the block to be zeroed</param>
/// <param name="length">The number of bytes to zero</param>
/// <returns></returns>
[DllImport("kernel32.dll", CharSet = CharSet.Auto, EntryPoint = "RtlSecureZeroMemory")]
public static extern void SecureZeroMemory(IntPtr destination, IntPtr length);