Exemplo n.º 1
0
 /* close device */
 private static void Close(IntPtr handle)
 {
     /* try to close handle */
     if (Native.CloseHandle(handle) == false)
     {
         /* fail! */
         throw new Win32Exception();
     }
 }
Exemplo n.º 2
0
        /* close hid device */
        public void Close()
        {
            /* deal with file stream */
            if (_fileStream != null)
            {
                /* close stream */
                _fileStream.Close();
                /* get rid of object */
                _fileStream = null;
            }

            /* close handle */
            Native.CloseHandle(handle);
        }
Exemplo n.º 3
0
 /* dispose */
 public void Dispose()
 {
     try
     {
         /* deal with file stream */
         if (_fileStream != null)
         {
             /* close stream */
             _fileStream.Close();
             /* get rid of object */
             _fileStream = null;
             /* close handle */
             if (handle != IntPtr.Zero)
             {
                 Native.CloseHandle(handle);
             }
         }
     }
     catch (Exception ex)
     {
         handle = IntPtr.Zero;
     }
 }