Esempio n. 1
0
        private void Cleanup()
        {
            if (IsClosed)
            {
                return;
            }
            _isClosed = true;

            if (IsInvalid)
            {
                return;
            }

            // Save last error from P/Invoke in case the implementation of
            // ReleaseHandle trashes it (important because this ReleaseHandle could
            // occur implicitly as part of unmarshaling another P/Invoke).
            int lastError = PInvokeMarshal.GetLastWin32Error();

            ReleaseHandle();

            PInvokeMarshal.SetLastWin32Error(lastError);

            GC.SuppressFinalize(this);
        }
Esempio n. 2
0
 public static unsafe IntPtr AllocCoTaskMem(int cb)
 {
     return(PInvokeMarshal.AllocCoTaskMem(cb));
 }
Esempio n. 3
0
 public static void FreeHGlobal(IntPtr hglobal)
 {
     PInvokeMarshal.FreeHGlobal(hglobal);
 }
Esempio n. 4
0
 public static unsafe IntPtr AllocHGlobal(int cb)
 {
     return(PInvokeMarshal.AllocHGlobal(cb));
 }
Esempio n. 5
0
 public static IntPtr SecureStringToCoTaskMemUnicode(SecureString s)
 {
     return(PInvokeMarshal.SecureStringToCoTaskMemUnicode(s));
 }
Esempio n. 6
0
 internal static void SetLastWin32Error(int errorCode)
 {
     PInvokeMarshal.SetLastWin32Error(errorCode);
 }
Esempio n. 7
0
 public static void FreeBSTR(IntPtr ptr)
 {
     PInvokeMarshal.FreeBSTR(ptr);
 }
Esempio n. 8
0
 public static unsafe String PtrToStringAnsi(IntPtr ptr, int len)
 {
     return(PInvokeMarshal.PtrToStringAnsi(ptr, len));
 }
Esempio n. 9
0
 public static void SaveLastWin32Error()
 {
     PInvokeMarshal.SaveLastWin32Error();
 }
Esempio n. 10
0
 public static IntPtr ReAllocHGlobal(IntPtr pv, IntPtr cb)
 {
     return(PInvokeMarshal.MemReAlloc(pv, cb));
 }
Esempio n. 11
0
 public static IntPtr ReAllocCoTaskMem(IntPtr pv, int cb)
 {
     return(PInvokeMarshal.CoTaskMemReAlloc(pv, (IntPtr)cb));
 }
Esempio n. 12
0
 public static IntPtr AllocHGlobal(IntPtr cb)
 {
     return(PInvokeMarshal.AllocHGlobal(cb));
 }
Esempio n. 13
0
 public static void Copy(byte[] array, int startIndex, IntPtr destination, int length)
 {
     PInvokeMarshal.CopyToNative(array, startIndex, destination, length);
 }
Esempio n. 14
0
 public static IntPtr SecureStringToBSTR(SecureString s)
 {
     return(PInvokeMarshal.SecureStringToBSTR(s));
 }
Esempio n. 15
0
 public static void FreeCoTaskMem(IntPtr ptr)
 {
     PInvokeMarshal.FreeCoTaskMem(ptr);
 }
Esempio n. 16
0
 public static void ClearLastWin32Error()
 {
     PInvokeMarshal.ClearLastWin32Error();
 }
Esempio n. 17
0
 public static void Copy(IntPtr source, byte[] destination, int startIndex, int length)
 {
     PInvokeMarshal.CopyToManaged(source, destination, startIndex, length);
 }
Esempio n. 18
0
 internal static Delegate GetDelegateForFunctionPointerInternal(IntPtr ptr, Type t)
 {
     return(PInvokeMarshal.GetDelegateForFunctionPointer(ptr, t.TypeHandle));
 }
Esempio n. 19
0
 internal static IntPtr AllocBSTR(int length)
 {
     return(PInvokeMarshal.AllocBSTR(length));
 }
Esempio n. 20
0
 internal static IntPtr GetFunctionPointerForDelegateInternal(Delegate d)
 {
     return(PInvokeMarshal.GetFunctionPointerForDelegate(d));
 }
Esempio n. 21
0
 public static int GetLastWin32Error()
 {
     return(PInvokeMarshal.GetLastWin32Error());
 }
Esempio n. 22
0
 public static unsafe string PtrToStringUni(IntPtr ptr)
 {
     return(PInvokeMarshal.PtrToStringUni(ptr));
 }
Esempio n. 23
0
 public static int GetHRForException(Exception?e)
 {
     return(PInvokeMarshal.GetHRForException(e));
 }
Esempio n. 24
0
 public static IntPtr SecureStringToGlobalAllocUnicode(SecureString s)
 {
     return(PInvokeMarshal.SecureStringToGlobalAllocUnicode(s));
 }