public static SecurityAuditHelper.SafeHGlobalHandle AllocHGlobal(int cb) { SecurityAuditHelper.SafeHGlobalHandle handle = new SecurityAuditHelper.SafeHGlobalHandle(); RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { IntPtr ptr = Marshal.AllocHGlobal(cb); handle.SetHandle(ptr); } return(handle); }
public static SecurityAuditHelper.SafeHGlobalHandle AllocHGlobal(byte[] bytes) { SecurityAuditHelper.SafeHGlobalHandle handle = AllocHGlobal(bytes.Length); Marshal.Copy(bytes, 0, handle.DangerousGetHandle(), bytes.Length); return(handle); }
public static SecurityAuditHelper.SafeHGlobalHandle AllocHGlobal(int cb) { SecurityAuditHelper.SafeHGlobalHandle handle = new SecurityAuditHelper.SafeHGlobalHandle(); RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { IntPtr ptr = Marshal.AllocHGlobal(cb); handle.SetHandle(ptr); } return handle; }