public RemoveDeviceForm(DeviceItem deviceItem, bool onlyConnectedDevices) : this() { mDeviceItem = deviceItem; DefaultRemoveOptions = new RemoveDeviceOptions(mDeviceItem); DefaultRemoveOptions.OnlyConnectedDevices = onlyConnectedDevices; warningLabel.Text = resInfWizard.REMOVE_DEVICE_WARNING; removeDeviceOptionGrid.SelectedObject = DefaultRemoveOptions; }
public static int EnumerateDevices(DeviceEnumeratorInfo deviceEnumeratorInfo) { int devIndex; const uint CM_PROB_PHANTOM = (0x0000002D); // The devinst currently exists only in the registry // Initialize the SP_DEVINFO_DATA structure SetupApi.SP_DEVINFO_DATA devInfoData = new SetupApi.SP_DEVINFO_DATA(); devInfoData.cbSize = (uint)Marshal.SizeOf(typeof(SetupApi.SP_DEVINFO_DATA)); // Used to parse the DeviceID tokens. RegHardwareID regHardwareID = RegHardwareID.GlobalInstance; // Used as a buffer for: // * SetupDiGetDeviceRegistryProperty // * CM_Get_Device_ID // * SetupDiGetCustomDeviceProperty // * SetupDiGetDeviceProperty byte[] propBuffer = new byte[1024]; // List all connected USB devices IntPtr pDevInfo = SetupApi.SetupDiGetClassDevs(0, "USB", deviceEnumeratorInfo.Hwnd, deviceEnumeratorInfo.DICFGFlags); if (pDevInfo == IntPtr.Zero || pDevInfo == new IntPtr(-1)) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Win32Error, "SetupDiGetClassDevs Failed!"); return(-1); } for (devIndex = 0;; devIndex++) { if (!SetupApi.SetupDiEnumDeviceInfo(pDevInfo, devIndex, ref devInfoData)) { // Reached the end of the eviceInfo list. InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "device enumeration complete."); break; } DeviceItem deviceItem = new DeviceItem(); // SPDRP_DRIVER seems to do a better job at detecting driverless devices than // SPDRP_INSTALL_STATE RegistryValueKind propertyType; int requiredSize; if (SetupApi.SetupDiGetDeviceRegistryProperty(pDevInfo, ref devInfoData, SetupApi.SPDRP.DRIVER, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { deviceItem.mDriverless = false; // Read all string values from the registry driver key IntPtr hKey = SetupApi.SetupDiOpenDevRegKey(pDevInfo, ref devInfoData, 1, 0, DevKeyType.DRV, (int)RegistryKeyPermissionCheck.ReadSubTree); if (hKey != IntPtr.Zero && hKey != new IntPtr(-1)) { int index = 0; int nameLength = 255; int dataLength = 1023; deviceItem.mDriverRegistryList = new Dictionary <string, object>(); StringBuilder sbName = new StringBuilder(nameLength + 1); StringBuilder sbValue = new StringBuilder(dataLength + 1); RegistryValueKind regValueType; while (SetupApi.RegEnumValue(hKey, index, sbName, ref nameLength, IntPtr.Zero, out regValueType, sbValue, ref dataLength) == 0) { if (regValueType == RegistryValueKind.String) { deviceItem.mDriverRegistryList.Add(sbName.ToString(), sbValue.ToString()); } // Get next key/value index index++; // Reset max lengths nameLength = 255; dataLength = 1023; } SetupApi.RegCloseKey(hKey); } } else { deviceItem.mDriverless = true; } // [trobinson] patch uint status; uint pbmNumber; deviceItem.mIsConnected = (SetupApi.CM_Get_DevNode_Status(out status, out pbmNumber, devInfoData.DevInst, 0) != SetupApi.CR.NO_SUCH_DEVNODE); if (deviceItem.mIsConnected) { deviceItem.mIsConnected = ((pbmNumber & CM_PROB_PHANTOM) != CM_PROB_PHANTOM); } //if (deviceItem.mDriverless && !deviceItem.mIsConnected) // deviceItem.mDriverless = false; // Find only the ones that are driverless if (deviceEnumeratorInfo.DriverlessOnly && !deviceItem.mDriverless) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "skipping non driverless device."); continue; } // Driverless devices will return an error InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "driverless device found."); // Eliminate USB hubs by checking the driver string if (!SetupApi.SetupDiGetDeviceRegistryProperty(pDevInfo, ref devInfoData, SetupApi.SPDRP.SERVICE, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Warning, "failed getting SPDRP.SERVICE"); deviceItem.mServiceName = String.Empty; } else { deviceItem.mServiceName = GetAsAutoString(propBuffer); } bool bContinue = true; foreach (string skipServiceName in mSkipServiceNames) { if (deviceItem.mServiceName.Trim().ToLower() == skipServiceName) { bContinue = false; break; } } if (!bContinue && deviceEnumeratorInfo.SkipWindowsServices) { continue; } //if (!bContinue) // continue; deviceItem.mIsSkipServiceName = !bContinue; string[] saHardwareIDs; // Retrieve the hardware ID if (!SetupApi.SetupDiGetDeviceRegistryProperty(out saHardwareIDs, pDevInfo, ref devInfoData, SetupApi.SPDRP.HARDWAREID)) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Win32Error, "failed getting SPDRP.HARDWAREID"); continue; } if (saHardwareIDs.Length == 0) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Error, "device does not have any hardware ids"); continue; } for (int hwid = 0; hwid < saHardwareIDs.Length; hwid++) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "found hardware ID ({0}/{1}): {2}", hwid + 1, saHardwareIDs.Length, saHardwareIDs[hwid]); } // Get Device ID SetupApi.CR r = SetupApi.CM_Get_Device_ID(devInfoData.DevInst, propBuffer, propBuffer.Length, 0); if (r != SetupApi.CR.SUCCESS) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Error, "CM_Get_Device_ID:Failed retrieving simple path for device index: {0} HWID:{1} CR error {2}", devIndex, saHardwareIDs[0], r); continue; } deviceItem.mDeviceId = GetAsAutoString(propBuffer); InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "{0} USB device {1}: {2}", deviceItem.mDriverless ? "Driverless" : deviceItem.mServiceName, devIndex, deviceItem.mDeviceId); string sDeviceDescription; if (SetupApi.WindowsVersion < WindowsVersionType.WINDOWS_7) { // On Vista and earlier, we can use SPDRP_DEVICEDESC bContinue = SetupApi.SetupDiGetDeviceRegistryProperty(out sDeviceDescription, pDevInfo, ref devInfoData, SetupApi.SPDRP.DEVICEDESC); if (!bContinue) { sDeviceDescription = string.Empty; } } else { // On Windows 7, the information we want ("Bus reported device description") is // accessed through DEVPKEY_Device_BusReportedDeviceDesc try { bContinue = SetupApi.SetupDiGetDeviceProperty(pDevInfo, ref devInfoData, SetupApi.DEVPKEY_Device_BusReportedDeviceDesc, out propertyType, propBuffer, propBuffer.Length, out requiredSize, 0); } catch (DllNotFoundException) { //if (SetupDiGetDeviceProperty == NULL) InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Warning, "Failed to locate SetupDiGetDeviceProperty() is Setupapi.dll"); bContinue = false; } if (bContinue) { sDeviceDescription = GetAsAutoString(propBuffer); } else { // fallback to SPDRP_DEVICEDESC (USB husb still use it) bContinue = SetupApi.SetupDiGetDeviceRegistryProperty(out sDeviceDescription, pDevInfo, ref devInfoData, SetupApi.SPDRP.DEVICEDESC); if (!bContinue) { sDeviceDescription = string.Empty; } } } if (!bContinue) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Warning | StatusType.Win32Error, "Failed reading read device description for {0}: {1}", devIndex, deviceItem.mDeviceId); } deviceItem.DeviceDescription = sDeviceDescription; deviceItem.BaseFilename = sDeviceDescription; MatchCollection matches = regHardwareID.Matches(saHardwareIDs[0]); foreach (Match match in matches) { foreach (NamedGroup namedGroup in RegHardwareID.NAMED_GROUPS) { RegHardwareID.ENamedGroups groupEnum = (RegHardwareID.ENamedGroups)namedGroup.GroupNumber; Group group = match.Groups[(int)groupEnum]; if (!group.Success) { continue; } switch (groupEnum) { case RegHardwareID.ENamedGroups.Vid: deviceItem.VendorID = group.Value; break; case RegHardwareID.ENamedGroups.Pid: deviceItem.ProductID = group.Value; break; case RegHardwareID.ENamedGroups.Rev: //deviceItem.Rev = group.Value; break; case RegHardwareID.ENamedGroups.MI: deviceItem.MI = group.Value; if (deviceItem.MI != string.Empty) { deviceItem.DeviceDescription += String.Format(" (Interface #{0})", deviceItem.mMI); } break; default: throw new ArgumentOutOfRangeException(); } } } if (deviceItem.mVid == 0 && deviceItem.mPid == 0) { continue; } string sManufacturer; if (!SetupApi.SetupDiGetDeviceRegistryProperty(out sManufacturer, pDevInfo, ref devInfoData, SetupApi.SPDRP.MFG)) { sManufacturer = string.Empty; } deviceItem.Manufacturer = sManufacturer; string[] deviceInterfaceGuids = new string[0]; if (SetupApi.SetupDiGetCustomDeviceProperty(pDevInfo, ref devInfoData, "DeviceInterfaceGUIDs", SetupApi.DICUSTOMDEVPROP.NONE, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { deviceInterfaceGuids = GetAsAutoStringArray(propBuffer, requiredSize); } if (deviceInterfaceGuids.Length > 0) { deviceItem.DeviceInterfaceGuid = deviceInterfaceGuids[0]; } if (!deviceEnumeratorInfo.DeviceFound(deviceItem, pDevInfo, ref devInfoData)) { break; } InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "device description: {0}", deviceItem.DeviceDescription); } SetupApi.SetupDiDestroyDeviceInfoList(pDevInfo); return(devIndex); }
public static int EnumerateDevices(DeviceEnumeratorInfo deviceEnumeratorInfo) { int devIndex; const uint CM_PROB_PHANTOM = (0x0000002D); // The devinst currently exists only in the registry // Initialize the SP_DEVINFO_DATA structure SetupApi.SP_DEVINFO_DATA devInfoData = new SetupApi.SP_DEVINFO_DATA(); devInfoData.cbSize = (uint) Marshal.SizeOf(typeof (SetupApi.SP_DEVINFO_DATA)); // Used to parse the DeviceID tokens. RegHardwareID regHardwareID = RegHardwareID.GlobalInstance; // Used as a buffer for: // * SetupDiGetDeviceRegistryProperty // * CM_Get_Device_ID // * SetupDiGetCustomDeviceProperty // * SetupDiGetDeviceProperty byte[] propBuffer = new byte[1024]; // List all connected USB devices IntPtr pDevInfo = SetupApi.SetupDiGetClassDevs(0, "USB", deviceEnumeratorInfo.Hwnd, deviceEnumeratorInfo.DICFGFlags); if (pDevInfo == IntPtr.Zero || pDevInfo == new IntPtr(-1)) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Win32Error, "SetupDiGetClassDevs Failed!"); return -1; } for (devIndex = 0;; devIndex++) { if (!SetupApi.SetupDiEnumDeviceInfo(pDevInfo, devIndex, ref devInfoData)) { // Reached the end of the eviceInfo list. InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "device enumeration complete."); break; } DeviceItem deviceItem = new DeviceItem(); // SPDRP_DRIVER seems to do a better job at detecting driverless devices than // SPDRP_INSTALL_STATE RegistryValueKind propertyType; int requiredSize; if (SetupApi.SetupDiGetDeviceRegistryProperty(pDevInfo, ref devInfoData, SetupApi.SPDRP.DRIVER, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { deviceItem.mDriverless = false; // Read all string values from the registry driver key IntPtr hKey = SetupApi.SetupDiOpenDevRegKey(pDevInfo, ref devInfoData, 1, 0, DevKeyType.DRV, (int) RegistryKeyPermissionCheck.ReadSubTree); if (hKey != IntPtr.Zero && hKey != new IntPtr(-1)) { int index = 0; int nameLength = 255; int dataLength = 1023; deviceItem.mDriverRegistryList = new Dictionary<string, object>(); StringBuilder sbName = new StringBuilder(nameLength + 1); StringBuilder sbValue = new StringBuilder(dataLength + 1); RegistryValueKind regValueType; while (SetupApi.RegEnumValue(hKey, index, sbName, ref nameLength, IntPtr.Zero, out regValueType, sbValue, ref dataLength) == 0) { if (regValueType == RegistryValueKind.String) deviceItem.mDriverRegistryList.Add(sbName.ToString(), sbValue.ToString()); // Get next key/value index index++; // Reset max lengths nameLength = 255; dataLength = 1023; } SetupApi.RegCloseKey(hKey); } } else { deviceItem.mDriverless = true; } // [trobinson] patch uint status; uint pbmNumber; deviceItem.mIsConnected = (SetupApi.CM_Get_DevNode_Status(out status, out pbmNumber, devInfoData.DevInst, 0) != SetupApi.CR.NO_SUCH_DEVNODE); if (deviceItem.mIsConnected) deviceItem.mIsConnected = ((pbmNumber & CM_PROB_PHANTOM) != CM_PROB_PHANTOM); //if (deviceItem.mDriverless && !deviceItem.mIsConnected) // deviceItem.mDriverless = false; // Find only the ones that are driverless if (deviceEnumeratorInfo.DriverlessOnly && !deviceItem.mDriverless) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "skipping non driverless device."); continue; } // Driverless devices will return an error InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "driverless device found."); // Eliminate USB hubs by checking the driver string if (!SetupApi.SetupDiGetDeviceRegistryProperty(pDevInfo, ref devInfoData, SetupApi.SPDRP.SERVICE, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Warning, "failed getting SPDRP.SERVICE"); deviceItem.mServiceName = String.Empty; } else { deviceItem.mServiceName = GetAsAutoString(propBuffer); } bool bContinue = true; foreach (string skipServiceName in mSkipServiceNames) { if (deviceItem.mServiceName.Trim().ToLower() == skipServiceName) { bContinue = false; break; } } if (!bContinue && deviceEnumeratorInfo.SkipWindowsServices) continue; //if (!bContinue) // continue; deviceItem.mIsSkipServiceName = !bContinue; string[] saHardwareIDs; // Retrieve the hardware ID if (!SetupApi.SetupDiGetDeviceRegistryProperty(out saHardwareIDs, pDevInfo, ref devInfoData, SetupApi.SPDRP.HARDWAREID)) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Win32Error, "failed getting SPDRP.HARDWAREID"); continue; } if (saHardwareIDs.Length == 0) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Error, "device does not have any hardware ids"); continue; } for (int hwid = 0; hwid < saHardwareIDs.Length; hwid++) InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "found hardware ID ({0}/{1}): {2}", hwid + 1, saHardwareIDs.Length, saHardwareIDs[hwid]); // Get Device ID SetupApi.CR r = SetupApi.CM_Get_Device_ID(devInfoData.DevInst, propBuffer, propBuffer.Length, 0); if (r != SetupApi.CR.SUCCESS) { InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Error, "CM_Get_Device_ID:Failed retrieving simple path for device index: {0} HWID:{1} CR error {2}", devIndex, saHardwareIDs[0], r); continue; } deviceItem.mDeviceId = GetAsAutoString(propBuffer); InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "{0} USB device {1}: {2}", deviceItem.mDriverless ? "Driverless" : deviceItem.mServiceName, devIndex, deviceItem.mDeviceId); string sDeviceDescription; if (SetupApi.WindowsVersion < WindowsVersionType.WINDOWS_7) { // On Vista and earlier, we can use SPDRP_DEVICEDESC bContinue = SetupApi.SetupDiGetDeviceRegistryProperty(out sDeviceDescription, pDevInfo, ref devInfoData, SetupApi.SPDRP.DEVICEDESC); if (!bContinue) sDeviceDescription = string.Empty; } else { // On Windows 7, the information we want ("Bus reported device description") is // accessed through DEVPKEY_Device_BusReportedDeviceDesc try { bContinue = SetupApi.SetupDiGetDeviceProperty(pDevInfo, ref devInfoData, SetupApi.DEVPKEY_Device_BusReportedDeviceDesc, out propertyType, propBuffer, propBuffer.Length, out requiredSize, 0); } catch (DllNotFoundException) { //if (SetupDiGetDeviceProperty == NULL) InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Warning, "Failed to locate SetupDiGetDeviceProperty() is Setupapi.dll"); bContinue = false; } if (bContinue) { sDeviceDescription = GetAsAutoString(propBuffer); } else { // fallback to SPDRP_DEVICEDESC (USB husb still use it) bContinue = SetupApi.SetupDiGetDeviceRegistryProperty(out sDeviceDescription, pDevInfo, ref devInfoData, SetupApi.SPDRP.DEVICEDESC); if (!bContinue) sDeviceDescription = string.Empty; } } if (!bContinue) InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Warning | StatusType.Win32Error, "Failed reading read device description for {0}: {1}", devIndex, deviceItem.mDeviceId); deviceItem.DeviceDescription = sDeviceDescription; deviceItem.BaseFilename = sDeviceDescription; MatchCollection matches = regHardwareID.Matches(saHardwareIDs[0]); foreach (Match match in matches) { foreach (NamedGroup namedGroup in RegHardwareID.NAMED_GROUPS) { RegHardwareID.ENamedGroups groupEnum = (RegHardwareID.ENamedGroups) namedGroup.GroupNumber; Group group = match.Groups[(int) groupEnum]; if (!group.Success) continue; switch (groupEnum) { case RegHardwareID.ENamedGroups.Vid: deviceItem.VendorID = group.Value; break; case RegHardwareID.ENamedGroups.Pid: deviceItem.ProductID = group.Value; break; case RegHardwareID.ENamedGroups.Rev: //deviceItem.Rev = group.Value; break; case RegHardwareID.ENamedGroups.MI: deviceItem.MI = group.Value; if (deviceItem.MI!=string.Empty) deviceItem.DeviceDescription += String.Format(" (Interface #{0})", deviceItem.mMI); break; default: throw new ArgumentOutOfRangeException(); } } } if (deviceItem.mVid == 0 && deviceItem.mPid == 0) continue; string sManufacturer; if (!SetupApi.SetupDiGetDeviceRegistryProperty(out sManufacturer, pDevInfo, ref devInfoData, SetupApi.SPDRP.MFG)) { sManufacturer = string.Empty; } deviceItem.Manufacturer = sManufacturer; string[] deviceInterfaceGuids=new string[0]; if (SetupApi.SetupDiGetCustomDeviceProperty(pDevInfo, ref devInfoData, "DeviceInterfaceGUIDs", SetupApi.DICUSTOMDEVPROP.NONE, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { deviceInterfaceGuids = GetAsAutoStringArray(propBuffer, requiredSize); } if (deviceInterfaceGuids.Length > 0) deviceItem.DeviceInterfaceGuid = deviceInterfaceGuids[0]; if (!deviceEnumeratorInfo.DeviceFound(deviceItem, pDevInfo, ref devInfoData)) break; InfWizardStatus.Log(CategoryType.EnumerateDevices, StatusType.Info, "device description: {0}", deviceItem.DeviceDescription); } SetupApi.SetupDiDestroyDeviceInfoList(pDevInfo); return devIndex; }
public override bool DeviceFound(DeviceItem item, IntPtr pDeviceInfoSet, ref SetupApi.SP_DEVINFO_DATA DeviceInfoData) { if (mRemoveDeviceOptions.RemoveByVidPid) { if (item.VendorID.ToLower() != mRemoveDeviceOptions.DeviceItem.VendorID.ToLower() || item.ProductID.ToLower() != mRemoveDeviceOptions.DeviceItem.ProductID.ToLower()) return true; } else { if (item.mDeviceId != mRemoveDeviceOptions.DeviceItem.mDeviceId) return true; } bool bUninstalled; if (SetupApi.WindowsVersion >= WindowsVersionType.WINDOWS_7) { if ((bUninstalled=SetupApi.DiUninstallDevice(IntPtr.Zero, pDeviceInfoSet, ref DeviceInfoData, 0, IntPtr.Zero))==true) mRemoved++; else InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Warning|StatusType.Win32Error, "failed uninstalling device."); } else { if ((bUninstalled=SetupApi.SetupDiRemoveDevice(pDeviceInfoSet, ref DeviceInfoData))==true) mRemoved++; else InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Warning|StatusType.Win32Error, "failed uninstalling device."); } if (bUninstalled) { InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Success, "device uninstall complete"); } object oInfFileName; if (item.mDriverRegistryList != null && !item.mIsSkipServiceName) { if (item.mDriverRegistryList.TryGetValue("InfPath", out oInfFileName)) { if (!(SetupApi.SetupUninstallOEMInf(oInfFileName.ToString(), SetupApi.SUOI.FORCEDELETE, IntPtr.Zero))) InfWizardStatus.Log(CategoryType.RemoveDevice, StatusType.Warning | StatusType.Win32Error, "SetupUninstallOEMInf failed"); } } return mRemoveDeviceOptions.RemoveByVidPid; }
public virtual bool DeviceFound(DeviceItem item, IntPtr pDeviceInfoSet, ref SetupApi.SP_DEVINFO_DATA DeviceInfoData) { deviceList.Add(item); return true; // true to continue enumerating }
public InfWriter(DeviceItem deviceItem, DriverResource driverResource) { mDeviceItem = deviceItem; mDriverResource = driverResource; }
public static bool FindSkipServicePredicate(DeviceItem obj) { return(obj.mIsSkipServiceName); }
private void loadProfile(string fileName, bool quiet) { try { FileInfo fiDest = new FileInfo(fileName); FileStream fsDest = fiDest.Open(FileMode.Open, FileAccess.Read); DeviceItemProfile deviceItemProfile = DeviceItem.Load(fsDest); mCurrentDeviceItem = deviceItemProfile.DeviceItem; fsDest.Close(); if (DriverResManager.Check()) { wizMain.NextTo(wizardPageConfigDevice); return; } MessageBox.Show(this, "Driver resources were not found."); } catch (Exception ex) { if (!quiet) MessageBox.Show(ex.ToString(), "Failed loading profile."); } }
public static void Save(DeviceItem deviceItem, Stream streamDest) { DeviceItemProfile deviceItemProfile = new DeviceItemProfile(deviceItem); BinFormatter.Serialize(streamDest, deviceItemProfile); }
public DeviceItemProfile(DeviceItem deviceItem) { this.deviceItem = deviceItem; }
public static bool FindSkipServicePredicate(DeviceItem obj) { return obj.mIsSkipServiceName; }
public static bool FindDriverlessPredicate(DeviceItem obj) { return obj.mDriverless; }
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; }
public RemoveDeviceOptions(DeviceItem deviceItem) { mDeviceItem = deviceItem; }
public static bool FindDriverlessPredicate(DeviceItem obj) { return(obj.mDriverless); }
private void gridDeviceSelection_SelectionChanged(object sender, EventArgs e) { if (gridDeviceSelection.SelectedRows.Count>0) { mCurrentDeviceItem = (DeviceItem) gridDeviceSelection.CurrentRow.Tag; wizMain.NextEnabled = true; cmdRemoveDevice.Enabled = true; return; } wizMain.NextEnabled = false; cmdRemoveDevice.Enabled = false; }