CancelIoEx() private method

private CancelIoEx ( IntPtr hFile, IntPtr lpOverlapped ) : bool
hFile System.IntPtr
lpOverlapped System.IntPtr
return bool
Example #1
0
 public void CancelIO()
 {
     if (IsOpen)
     {
         NativeMethods.CancelIoEx(safeReadHandle.DangerousGetHandle(), IntPtr.Zero);
     }
 }
Example #2
0
 private static void CloseDeviceIO(IntPtr handle)
 {
     if (Environment.OSVersion.Version.Major > 5)
     {
         NativeMethods.CancelIoEx(handle, IntPtr.Zero);
     }
     NativeMethods.CloseHandle(handle);
 }
Example #3
0
 private void DeviceEventMonitorRemoved()
 {
     if (IsOpen)
     {
         lock (this)
         {
             idleTicks = 100;
         }
         MonitorDeviceEvents = false;
         Console.WriteLine("Cancelling IO");
         NativeMethods.CancelIoEx(safeReadHandle.DangerousGetHandle(), IntPtr.Zero);
         Console.WriteLine("Cancelled IO");
         CloseDevice();
         Console.WriteLine("Device is closed.");
     }
     if (Removed != null)
     {
         Removed();
     }
     if (Remove != null)
     {
         Remove(this, new EventArgs());
     }
 }
Example #4
0
 private static void CloseDeviceIO(IntPtr handle)
 {
     NativeMethods.CancelIoEx(handle, IntPtr.Zero);
     NativeMethods.CloseHandle(handle);
 }