예제 #1
0
파일: Marshal.cs 프로젝트: Maximys/runtime
 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);
 }
예제 #2
0
파일: Marshal.cs 프로젝트: Maximys/runtime
 public static unsafe void ZeroFreeGlobalAllocAnsi(IntPtr s)
 {
     if (s == IntPtr.Zero)
     {
         return;
     }
     NativeMemory.Clear((void *)s, (nuint)string.strlen((byte *)s));
     FreeHGlobal(s);
 }
예제 #3
0
파일: Marshal.cs 프로젝트: Maximys/runtime
 public static unsafe void ZeroFreeCoTaskMemUTF8(IntPtr s)
 {
     if (s == IntPtr.Zero)
     {
         return;
     }
     NativeMemory.Clear((void *)s, (nuint)string.strlen((byte *)s));
     FreeCoTaskMem(s);
 }
예제 #4
0
파일: Marshal.cs 프로젝트: Maximys/runtime
 public static unsafe void ZeroFreeBSTR(IntPtr s)
 {
     if (s == IntPtr.Zero)
     {
         return;
     }
     NativeMemory.Clear((void *)s, SysStringByteLen(s));
     FreeBSTR(s);
 }
예제 #5
0
        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));
        }
예제 #6
0
 public static unsafe IntPtr ReAllocHGlobal(IntPtr pv, IntPtr cb)
 {
     return((nint)NativeMemory.Realloc((void *)(nint)pv, (nuint)(nint)cb));
 }
예제 #7
0
 public static unsafe void FreeHGlobal(IntPtr hglobal)
 {
     NativeMemory.Free((void *)(nint)hglobal);
 }
예제 #8
0
 public static unsafe IntPtr AllocHGlobal(IntPtr cb)
 {
     return((nint)NativeMemory.Alloc((nuint)(nint)cb));
 }