Beispiel #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);
        }
Beispiel #2
0
 public static int GetLastWin32Error()
 {
     return(PInvokeMarshal.GetLastWin32Error());
 }