public class CoreDll
{
[DllImport("coredll.dll", EntryPoint = "memset", SetLastError = false)]
private static extern void memset(IntPtr dest, int c, int size);
public static bool ZeroMemory(object o)
{
try
{
GCHandle gc = GCHandle.Alloc(o, GCHandleType.Pinned);
memset(gc.AddrOfPinnedObject(), 0, Marshal.SizeOf(o));
gc.Free();
return true;
}
catch (ArgumentException)
{
return false;
}
catch (InvalidOperationException)
{
return false;
}
catch (NotImplementedException)
{
return false;
}
catch (NotSupportedException)
{
return false;
}
}
}
Declare Function ZeroMemory Lib "CoreDll.dll" (TODO) As TODO
None.
Do you know one? Please contribute it!
None.
Please add some!
Please add some!