Esempio n. 1
0
        private void refreshDeviceSelectionView()
        {
            DEIFlags flags = DEIFlags.DICFG_AllClasses;

            bool driverLessOnly = deviceSelection_DriverlessOnlyCheckBox.Checked;
            bool connnectedOnly = deviceSelection_ConnectedOnlyCheckBox.Checked;

            if (connnectedOnly)
            {
                flags = flags | DEIFlags.DICFG_Present;
            }

            if (driverLessOnly)
            {
                flags |= DEIFlags.Driverless;
            }

#if DEBUG
            flags |= DEIFlags.IncludeWindowsServices;
#endif
            cmdRemoveDevice.Enabled = false;
            gridDeviceSelection.Rows.Clear();

            if (deviceSelection_CreateNewRadio.Checked)
            {
                mCurrentDeviceItem  = new DeviceItem();
                wizMain.NextEnabled = true;
                deviceSelection_RefreshButton.Enabled = false;
                return;
            }
            deviceSelection_RefreshButton.Enabled = true;

            DeviceEnumeratorInfo deInfo = new DeviceEnumeratorInfo(flags, Handle);
            mDeviceList = deInfo.DeviceList;
            DeviceSelectionHelper.EnumerateDevices(deInfo);

            foreach (DeviceItem deviceItem in mDeviceList)
            {
                int iRow =
                    gridDeviceSelection.Rows.Add(new object[]
                {
                    "0x" + deviceItem.VendorID, "0x" + deviceItem.ProductID, deviceItem.DeviceDescription,
                    deviceItem.Manufacturer, deviceItem.mDriverless, deviceItem.mDeviceId
                });
                gridDeviceSelection.Rows[iRow].Tag = deviceItem;
                deviceItem.ResetDirty();
            }

            wizMain.NextEnabled = (gridDeviceSelection.Rows.Count > 0);
            if (wizMain.NextEnabled && mCurrentDeviceItem == null)
            {
                mCurrentDeviceItem = (DeviceItem)gridDeviceSelection.SelectedRows[0].Tag;
            }
        }
Esempio n. 2
0
        public static bool RemoveDevice(RemoveDeviceForm.RemoveDeviceOptions removeDeviceOptions,
                                        IntPtr hWnwd,
                                        DEIFlags flags)
        {
            DeviceRemoveInfo deInfo = new DeviceRemoveInfo(removeDeviceOptions, flags, hWnwd);

            EnumerateDevices(deInfo);

            if (deInfo.Removed > 0)
            {
                Wdi.UpdateDriver(removeDeviceOptions.DeviceItem.BuildInfHardwareID());
            }

            return(deInfo.Removed > 0);
        }
Esempio n. 3
0
        private void Remove()
        {
            DEIFlags flags = DEIFlags.DICFG_AllClasses | DEIFlags.IncludeWindowsServices;

            Cursor = Cursors.WaitCursor;

            rtfRemoveDeviceStatus.StatusFilter = RemoveStatusFilter;
            removeDeviceOptionGrid.Enabled     = false;
            removeCommand.Enabled = false;

            if (DefaultRemoveOptions.OnlyConnectedDevices)
            {
                flags = flags | DEIFlags.DICFG_Present;
            }

            try
            {
                mRemoveDialogResult = DialogResult.OK;
                rtfRemoveDeviceStatus.LoggingEnabled = true;
                InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Info, "enumerating devices..");
                DeviceSelectionHelper.RemoveDevice(DefaultRemoveOptions, Handle, flags);

                if (DefaultRemoveOptions.DeepClean)
                {
                    DeepClean();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Device Removal", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                rtfRemoveDeviceStatus.LoggingEnabled = false;
                Cursor = Cursors.Default;
                removeDeviceOptionGrid.Enabled = true;
            }
        }
Esempio n. 4
0
 public DeviceRemoveInfo(RemoveDeviceForm.RemoveDeviceOptions removeDeviceOptions, DEIFlags flags, IntPtr hwnd) :
     base(flags, hwnd)
 {
     mRemoveDeviceOptions = removeDeviceOptions;
 }
Esempio n. 5
0
 public DeviceEnumeratorInfo(DEIFlags flags, IntPtr hwnd)
 {
     mHwnd  = hwnd;
     mFlags = flags;
 }
        public static bool RemoveDevice(RemoveDeviceForm.RemoveDeviceOptions removeDeviceOptions,
                                        IntPtr hWnwd,
                                        DEIFlags flags)
        {
            DeviceRemoveInfo deInfo = new DeviceRemoveInfo(removeDeviceOptions, flags, hWnwd);
            EnumerateDevices(deInfo);

            if (deInfo.Removed > 0)
                Wdi.UpdateDriver(removeDeviceOptions.DeviceItem.BuildInfHardwareID());

            return deInfo.Removed > 0;
        }
 public DeviceRemoveInfo(RemoveDeviceForm.RemoveDeviceOptions removeDeviceOptions, DEIFlags flags, IntPtr hwnd)
     : base(flags, hwnd)
 {
     mRemoveDeviceOptions = removeDeviceOptions;
 }
 public DeviceEnumeratorInfo(DEIFlags flags, IntPtr hwnd)
 {
     mHwnd = hwnd;
     mFlags = flags;
 }