public static unsafe void ZeroFreeGlobalAllocUnicode(IntPtr s) { if (s == IntPtr.Zero) { return; } NativeMemory.Clear((void *)s, (nuint)string.wcslen((char *)s) * sizeof(char)); FreeHGlobal(s); }
public static unsafe void ZeroFreeGlobalAllocAnsi(IntPtr s) { if (s == IntPtr.Zero) { return; } NativeMemory.Clear((void *)s, (nuint)string.strlen((byte *)s)); FreeHGlobal(s); }
public static unsafe void ZeroFreeCoTaskMemUTF8(IntPtr s) { if (s == IntPtr.Zero) { return; } NativeMemory.Clear((void *)s, (nuint)string.strlen((byte *)s)); FreeCoTaskMem(s); }
public static unsafe void ZeroFreeBSTR(IntPtr s) { if (s == IntPtr.Zero) { return; } NativeMemory.Clear((void *)s, SysStringByteLen(s)); FreeBSTR(s); }
public static unsafe IntPtr ReAllocCoTaskMem(IntPtr pv, int cb) { nuint cbNative = (nuint)(uint)cb; void *pvNative = (void *)(nint)pv; if ((cbNative == 0) && (pvNative != null)) { Interop.Sys.Free(pvNative); return(IntPtr.Zero); } return((nint)NativeMemory.Realloc((void *)(nint)pv, cbNative)); }
public static unsafe IntPtr ReAllocHGlobal(IntPtr pv, IntPtr cb) { return((nint)NativeMemory.Realloc((void *)(nint)pv, (nuint)(nint)cb)); }
public static unsafe void FreeHGlobal(IntPtr hglobal) { NativeMemory.Free((void *)(nint)hglobal); }
public static unsafe IntPtr AllocHGlobal(IntPtr cb) { return((nint)NativeMemory.Alloc((nuint)(nint)cb)); }