CancelIoEx() private method

private CancelIoEx ( IntPtr hFile, IntPtr lpOverlapped ) : bool
hFile System.IntPtr
lpOverlapped System.IntPtr
return bool
Exemplo n.º 1
0
 public void CancelIO()
 {
     if (IsOpen)
     {
         NativeMethods.CancelIoEx(safeReadHandle.DangerousGetHandle(), IntPtr.Zero);
     }
 }
Exemplo n.º 2
0
 private static void CloseDeviceIO(IntPtr handle)
 {
     if (Environment.OSVersion.Version.Major > 5)
     {
         NativeMethods.CancelIoEx(handle, IntPtr.Zero);
     }
     NativeMethods.CloseHandle(handle);
 }
Exemplo n.º 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());
     }
 }
Exemplo n.º 4
0
 private static void CloseDeviceIO(IntPtr handle)
 {
     NativeMethods.CancelIoEx(handle, IntPtr.Zero);
     NativeMethods.CloseHandle(handle);
 }