Virtu/Library/MarshalHelpers.cs
Sean Fausett 365e5723c1 Deleted all svn:eol-style properties on files.
--HG--
extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4050811
2010-08-28 11:34:14 +00:00

36 lines
1.2 KiB
C#

using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Security;
namespace Jellyfish.Library
{
public static class MarshalHelpers
{
[SecurityCritical]
public static void FillMemory(IntPtr buffer, int bufferSize, byte value)
{
NativeMethods.FillMemory(buffer, (IntPtr)bufferSize, value);
}
[SecurityCritical]
public static void ZeroMemory(IntPtr buffer, int bufferSize)
{
NativeMethods.ZeroMemory(buffer, (IntPtr)bufferSize);
}
[SecurityCritical]
[SuppressUnmanagedCodeSecurity]
private static class NativeMethods
{
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport("kernel32.dll", SetLastError = true)]
public static extern void FillMemory(IntPtr destination, IntPtr length, byte fill);
[SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport("kernel32.dll", SetLastError = true)]
public static extern void ZeroMemory(IntPtr destination, IntPtr length);
}
}
}