public Byte[] GetCustomProperty(String name) { using (SafeDeviceInfoSetHandle dis = SetupApi.SetupDiGetClassDevsA(IntPtr.Zero, DeviceID, IntPtr.Zero, DICFG.DEVICEINTERFACE | DICFG.ALLCLASSES)) { if (dis.IsInvalid) { throw new Win32Exception(); } SP_DEVINFO_DATA dd = new SP_DEVINFO_DATA(true); if (!SetupApi.SetupDiEnumDeviceInfo(dis, 0, ref dd)) { return(null); } RegistryValueKind propertyType; byte[] propBuffer = new byte[256]; int requiredSize; if (!SetupApi.SetupDiGetCustomDeviceProperty(dis, ref dd, name, DICUSTOMDEVPROP.NONE, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { return(null); } if (requiredSize > propBuffer.Length) { propBuffer = new Byte[requiredSize]; if (!SetupApi.SetupDiGetCustomDeviceProperty(dis, ref dd, name, DICUSTOMDEVPROP.NONE, out propertyType, propBuffer, propBuffer.Length, out requiredSize)) { throw new Win32Exception(); } } if (requiredSize < propBuffer.Length) { Array.Resize(ref propBuffer, requiredSize); } return(propBuffer); } }
public static string[] GetDevRegPropertyMultiStr( SetupApi.DeviceInfoSet devInfoSet, SetupApi.SP_DEVINFO_DATA devInfoData, SetupApi.SPDRP property) // Use this function for any 'Device Registry // Property' that returns 'REG_MULTI_SZ', // e.g. SPDRP_HARDWAREID { int propertyRegDataType; int requiredSize; // 'buffer' is 4KB but Unicode chars are 2 bytes, // hence 'buffer' can hold up to 2K chars const int BUFFER_SIZE = 4096; byte[] buffer = new byte[BUFFER_SIZE]; SetupApi.SetupDiGetDeviceRegistryProperty( devInfoSet.Get(), devInfoData, property, out propertyRegDataType, buffer, BUFFER_SIZE, out requiredSize ); return(Helpers.StringArrayFromMultiSz(buffer)); }
private static IEnumerable <string> EnumerateDevicePath(Guid guid) { var devicePathList = new List <string>(); var hDevInfo = SetupApi.SetupDiGetClassDevs(ref guid, IntPtr.Zero, IntPtr.Zero, SetupApi.DIGCF_PRESENT | SetupApi.DIGCF_DEVICEINTERFACE); var spid = new SetupApi.SP_DEVICE_INTERFACE_DATA(); spid.cbSize = Marshal.SizeOf(spid); int memberindex = 0; while (SetupApi.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, ref guid, memberindex, ref spid)) { int bufferSize = 0; SetupApi.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref spid, IntPtr.Zero, 0, ref bufferSize, IntPtr.Zero); var buffer = Marshal.AllocHGlobal(bufferSize); Marshal.WriteInt32(buffer, (IntPtr.Size == 4) ? (4 + Marshal.SystemDefaultCharSize) : 8); var da = new SetupApi.SP_DEVINFO_DATA(); da.cbSize = Marshal.SizeOf(da); SetupApi.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref spid, buffer, bufferSize, ref bufferSize, ref da); IntPtr pDevicePathName = new IntPtr(buffer.ToInt64() + 4); string pathName = Marshal.PtrToStringUni(pDevicePathName); Marshal.FreeHGlobal(buffer); buffer = IntPtr.Zero; memberindex++; Console.WriteLine(pathName); devicePathList.Add(pathName); } return(devicePathList); }
public void SetEnabled(Boolean enabled) { using (SafeDeviceInfoSetHandle dis = SetupApi.SetupDiGetClassDevsA(IntPtr.Zero, DeviceID, IntPtr.Zero, DICFG.DEVICEINTERFACE | DICFG.ALLCLASSES)) { if (dis.IsInvalid) { throw new Win32Exception(); } SP_DEVINFO_DATA dd = new SP_DEVINFO_DATA(true); if (!SetupApi.SetupDiEnumDeviceInfo(dis, 0, ref dd)) { throw new Win32Exception(); } SP_PROPCHANGE_PARAMS PropChangeParams = new SP_PROPCHANGE_PARAMS(); PropChangeParams.ClassInstallHeader.cbSize = Marshal.SizeOf(PropChangeParams.ClassInstallHeader); PropChangeParams.ClassInstallHeader.InstallFunction = UsbApi.DIF_PROPERTYCHANGE; PropChangeParams.Scope = UsbApi.DICS_FLAG_GLOBAL; // or use DICS_FLAG_CONFIGSPECIFIC to limit to current HW profile PropChangeParams.HwProfile = 0; //Current hardware profile PropChangeParams.StateChange = enabled ? UsbApi.DICS_ENABLE : UsbApi.DICS_DISABLE; if (!SetupApi.SetupDiSetClassInstallParams(dis, ref dd, ref PropChangeParams.ClassInstallHeader, Marshal.SizeOf(PropChangeParams))) { throw new Win32Exception(); } if (!SetupApi.SetupDiCallClassInstaller(UsbApi.DIF_PROPERTYCHANGE, dis, ref dd)) { throw new Win32Exception(); } } }
private async Task Listen() { tcpListener.Start(); while (true) { TcpClient client; try { client = await tcpListener.AcceptTcpClientAsync(); } catch (SocketException e) { if (e.SocketErrorCode == SocketError.Interrupted) { return; } throw; } var stream = client.GetStream(); var server = new ApiServer <T>(stream); apiServers.TryAdd(server, client); server.Disconnected += (api, _) => { if (apiServers.TryRemove((ApiServer <T>)api, out TcpClient client)) { client.Dispose(); } api.Dispose(); }; SetupApi?.Invoke(server.Api); server.Start(); } }
private static string GetDeviceName(IntPtr pDevInfoSet, SetupApi.SpDevInfoData deviceInfoData) { var hDeviceRegistryKey = SetupApi.SetupDiOpenDevRegKey(pDevInfoSet, deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE); if (hDeviceRegistryKey == IntPtr.Zero) { throw new Exception("Failed to open a registry key for device-specific configuration information"); } var deviceNameBuf = new StringBuilder(256); try { uint lpRegKeyType; var length = (uint)deviceNameBuf.Capacity; int result = RegQueryValueEx(hDeviceRegistryKey, "PortName", 0, out lpRegKeyType, deviceNameBuf, ref length); if (result != 0) { throw new Exception("Can not read registry value PortName for device " + deviceInfoData.ClassGuid); } } finally { RegCloseKey(hDeviceRegistryKey); } string deviceName = deviceNameBuf.ToString(); return(deviceName); }
public static SetupApi GetSetupApi() { SetupApi api = new SetupApi(); api.ExceptionFactory = TorizonAPIException.DefaultExceptionFactory; return(api); }
public static string GetDevRegPropertyStr( SetupApi.DeviceInfoSet devInfoSet, SetupApi.SP_DEVINFO_DATA devInfoData, SetupApi.SPDRP property) // Use this function for any 'Device Registry // Property' that returns a string, // e.g. SPDRP_CLASSGUID { int propertyRegDataType; int requiredSize; // 'buffer' is 1KB but Unicode chars are 2 bytes, // hence 'buffer' can hold up to 512 chars const int BUFFER_SIZE = 1024; byte[] buffer = new byte[BUFFER_SIZE]; SetupApi.SetupDiGetDeviceRegistryProperty( devInfoSet.Get(), devInfoData, property, out propertyRegDataType, buffer, BUFFER_SIZE, out requiredSize ); return(System.Text.Encoding.Unicode.GetString( buffer, 0, requiredSize )); }
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); }
private void timerCheckPendingInstalls_Tick(object sender, EventArgs e) { if (SetupApi.CMP_WaitNoPendingInstallEvents(0) == 0) { timerCheckPendingInstalls.Enabled = false; SynchronizationContext.Current.Post(postCloseForm, DialogResult.OK); } }
public Boolean SupportsInterface(Guid classGuid) { uint len; CR ret = SetupApi.CM_Get_Device_Interface_List_Size(out len, ref classGuid, DeviceID, 0); CMException.Throw(ret, "CM_Get_Device_Interface_List_Size"); return(len > 2); }
/// <summary> /// Gets a list of <see cref="WinUsbRegistry"/> classes for the specified interface guid. /// </summary> /// <param name="deviceInterfaceGuid">The DeviceInterfaceGUID to search for.</param> /// <param name="deviceRegistryList">A list of device paths associated with the <paramref name="deviceInterfaceGuid"/>.</param> /// <returns>True of one or more device paths was found.</returns> /// <remarks> /// Each <see cref="WinUsbRegistry"/> in the <paramref name="deviceRegistryList"/> represents a seperate WinUSB device (interface). /// </remarks> public static bool GetWinUsbRegistryList(Guid deviceInterfaceGuid, out List <WinUsbRegistry> deviceRegistryList) { deviceRegistryList = new List <WinUsbRegistry>(); int devicePathIndex = 0; SetupApi.SP_DEVICE_INTERFACE_DATA interfaceData = SetupApi.SP_DEVICE_INTERFACE_DATA.Empty; SetupApi.DeviceInterfaceDetailHelper detailHelper; SetupApi.SP_DEVINFO_DATA devInfoData = SetupApi.SP_DEVINFO_DATA.Empty; // [1] IntPtr deviceInfo = SetupApi.SetupDiGetClassDevs(ref deviceInterfaceGuid, null, IntPtr.Zero, SetupApi.DICFG.PRESENT | SetupApi.DICFG.DEVICEINTERFACE); if (deviceInfo != IntPtr.Zero) { while ((SetupApi.SetupDiEnumDeviceInterfaces(deviceInfo, null, ref deviceInterfaceGuid, devicePathIndex, ref interfaceData))) { int length = 1024; detailHelper = new SetupApi.DeviceInterfaceDetailHelper(length); bool bResult = SetupApi.SetupDiGetDeviceInterfaceDetail(deviceInfo, ref interfaceData, detailHelper.Handle, length, out length, ref devInfoData); if (bResult) { WinUsbRegistry regInfo = new WinUsbRegistry(); SetupApi.getSPDRPProperties(deviceInfo, ref devInfoData, regInfo.mDeviceProperties); // Use the actual winusb device path for SYMBOLIC_NAME_KEY. This will be used to open the device. regInfo.mDeviceProperties.Add(SYMBOLIC_NAME_KEY, detailHelper.DevicePath); #if VERY_DEBUG Debug.WriteLine(detailHelper.DevicePath); #endif regInfo.mDeviceInterfaceGuids = new Guid[] { deviceInterfaceGuid }; StringBuilder sbDeviceID = new StringBuilder(1024); if (SetupApi.CM_Get_Device_ID(devInfoData.DevInst, sbDeviceID, sbDeviceID.Capacity, 0) == SetupApi.CR.SUCCESS) { regInfo.mDeviceProperties[DEVICE_ID_KEY] = sbDeviceID.ToString(); } deviceRegistryList.Add(regInfo); } devicePathIndex++; } } if (devicePathIndex == 0) { UsbError.Error(ErrorCode.Win32Error, Marshal.GetLastWin32Error(), "GetDevicePathList", typeof(SetupApi)); } if (deviceInfo != IntPtr.Zero) { SetupApi.SetupDiDestroyDeviceInfoList(deviceInfo); } return(devicePathIndex > 0); }
public String[] GetPropertyStringArray(CMRDP property) { Byte[] buffer = GetProperty(property); if (buffer == null) { return(null); } return(SetupApi.GetAsStringArray(buffer, buffer.Length)); }
public String GetPropertyString(SPDRP property) { Byte[] buffer = GetProperty(property); if (buffer == null) { return(null); } return(SetupApi.GetAsString(buffer, buffer.Length)); }
public static void BuildMasterList() { lock (mLockSetupApiRegistry) { mMasterSetupApiDeviceList.Clear(); SetupApi.EnumClassDevs(null, SetupApi.DICFG.PRESENT | SetupApi.DICFG.ALLCLASSES, BuildMasterCallback, mMasterSetupApiDeviceList); mLastRefreshTime = DateTime.Now; } }
public String[] GetCustomPropertyStringArray(String name) { Byte[] buffer = GetCustomProperty(name); if (buffer == null) { return(null); } return(SetupApi.GetAsStringArray(buffer, buffer.Length)); }
public String GetDevicePropertyString(Guid fmtid, UInt32 pid) { Byte[] buffer = GetDeviceProperty(fmtid, pid); if (buffer == null) { return(null); } return(SetupApi.GetAsString(buffer, buffer.Length)); }
public Boolean GetStatus(out UInt32 status, out UInt32 problem) { CR ret = SetupApi.CM_Get_DevNode_Status(out status, out problem, DevInst, 0); if (ret == CR.NO_SUCH_DEVNODE) { return(false); } CMException.Throw(ret, "CM_Get_DevNode_Status"); return(true); }
public DeviceNode GetParent() { UInt32 node; CR ret = SetupApi.CM_Get_Parent(out node, DevInst, 0); if (ret == CR.NO_SUCH_DEVNODE) { return(null); } CMException.Throw(ret, "CM_Get_Parent"); return(new DeviceNode(node)); }
public static bool InstallSetupPackage(string hardwareId, string infPath) { bool bSuccess = SetupApi.UpdateDriverForPlugAndPlayDevices(IntPtr.Zero, hardwareId, infPath, SetupApi.INSTALLFLAG.FORCE, IntPtr.Zero); if (bSuccess) { InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Success, "driver update completed"); UpdateDriver(hardwareId); return(true); } // UpdateDriverForPlugAndPlayDevices FAILED ECODE setupError = (ECODE)Marshal.GetLastWin32Error(); if (setupError != ECODE.NO_SUCH_DEVINST) { InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Win32Error, "UpdateDriverForPlugAndPlayDevices failed"); return(false); } // UpdateDriverForPlugAndPlayDevices = NO_SUCH_DEVINST InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Warning, "device not detected (copying driver files for next time device is plugged in)"); StringBuilder sbDestInfFilename = new StringBuilder(1024); uint requiredSize; bSuccess = SetupApi.SetupCopyOEMInf(infPath, null, SetupApi.SPOST.SPOST_PATH, 0, sbDestInfFilename, (uint)sbDestInfFilename.Capacity, out requiredSize, null); if (!bSuccess) { InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Win32Error, "SetupCopyOEMInf failed"); } else { InfWizardStatus.Log(CategoryType.InstallSetupPackage, StatusType.Success, "copied inf to {0}", sbDestInfFilename.ToString()); } CheckRemoved(hardwareId); return(bSuccess); }
public static DeviceNode GetDevice(String deviceID) { UInt32 node; CR ret = SetupApi.CM_Locate_DevNode(out node, deviceID, 4); if (ret == CR.NO_SUCH_DEVNODE) { return(null); } CMException.Throw(ret, "CM_Locate_DevNode"); return(new DeviceNode(node)); }
public IEnumerable <HidDeviceInfo> CollectInfo() { var result = new List <HidDeviceInfo>(); Guid hidGuid; Hid.HidD_GetHidGuid(out hidGuid); var deviceInfoList = SetupApi.SetupDiGetClassDevs(ref hidGuid, null, IntPtr.Zero, Constants.DIGCF_DEVICEINTERFACE | Constants.DIGCF_PRESENT); if (deviceInfoList != IntPtr.Zero && deviceInfoList != Constants.INVALID_HANDLE_VALUE) { var deviceInfo = new SetupApi.SP_DEVICE_INTERFACE_DATA(); deviceInfo.cbSize = Marshal.SizeOf(deviceInfo); for (var i = 0; ; i++) { if (!SetupApi.SetupDiEnumDeviceInterfaces(deviceInfoList, 0, ref hidGuid, Convert.ToUInt32(i), ref deviceInfo)) { break; } var path = this.GetPath(deviceInfoList, deviceInfo); var device = new HidDevice(); if (device.Open(path)) { var attributes = device.GetAttributes(); var vendor = device.GetVendorString(); var product = device.GetProductString(); result.Add(new HidDeviceInfo( path, attributes.VendorID, attributes.ProductID, attributes.VersionString, vendor, product)); device.Close(); } } SetupApi.SetupDiDestroyDeviceInfoList(deviceInfoList); } return(result); }
public String[] GetInterfaces(Guid classGuid) { uint len; CR ret = SetupApi.CM_Get_Device_Interface_List_Size(out len, ref classGuid, DeviceID, 0); CMException.Throw(ret, "CM_Get_Device_Interface_List_Size"); if (len <= 1) { return(null); } Byte[] buffer = new Byte[2 * len]; ret = SetupApi.CM_Get_Device_Interface_List(ref classGuid, DeviceID, buffer, len, 0); CMException.Throw(ret, "CM_Get_Device_Interface_List"); return(SetupApi.GetAsStringArray(buffer, 2 * (int)len)); }
private async Task Connect(ApiClient <T> oldApi = null) { tcpClient = new TcpClient(); await tcpClient.ConnectAsync(EndPoint.Address, EndPoint.Port); var stream = tcpClient.GetStream(); client = new ApiClient <T>(stream, stream, oldApi); client.Disconnected += Client_Disconnected; if (oldApi == null) { SetupApi?.Invoke(client.Api); } client.Start(); }
public static string GetInstanceIDByKeyName(string driverKeyName) { var result = string.Empty; var h = SetupApi.SetupDiGetClassDevs(default(int), UsbConstants.REGSTR_KEY_USB, IntPtr.Zero, UsbConstants.DIGCF_PRESENT | UsbConstants.DIGCF_ALLCLASSES); if (h.ToInt32() != UsbConstants.INVALID_HANDLE_VALUE) { var ptrBuf = Marshal.AllocHGlobal(UsbConstants.BUFFER_SIZE); var keyName = string.Empty; var i = default(int); var success = default(bool); do { var da = new SpDevinfoData(); da.cbSize = Marshal.SizeOf(da); success = SetupApi.SetupDiEnumDeviceInfo(h, i, ref da); if (success) { var regType = UsbConstants.REG_SZ; var requiredSize = default(int); keyName = string.Empty; if (SetupApi.SetupDiGetDeviceRegistryProperty(h, ref da, UsbConstants.SPDRP_DRIVER, ref regType, ptrBuf, UsbConstants.BUFFER_SIZE, ref requiredSize)) { keyName = Marshal.PtrToStringAuto(ptrBuf); } if (keyName == driverKeyName) { var nBytes = UsbConstants.BUFFER_SIZE; var sb = new StringBuilder(nBytes); SetupApi.SetupDiGetDeviceInstanceId(h, ref da, sb, nBytes, out requiredSize); result = sb.ToString(); break; } } i++; } while (success); Marshal.FreeHGlobal(ptrBuf); SetupApi.SetupDiDestroyDeviceInfoList(h); } return(result); }
private void buttonInstallDriver_Click(object sender, EventArgs e) { DialogResult dr = DialogResult.OK; if (SetupApi.CMP_WaitNoPendingInstallEvents(0) != 0) { WaitForSetupForm fWait = new WaitForSetupForm(); dr = fWait.ShowDialog(this); } if (dr == DialogResult.OK) { buttonInstallDriver.Enabled = false; wizardPageFinishedEnable(false); Thread installSetupThread = new Thread(InstallSetupPackageFn); installSetupThread.Start(null); } }
private async Task Connect(ApiClient <T> oldApi = null) { pipe = new NamedPipeClientStream(ServerName, PipeName, PipeDirection.InOut, PipeOptions.Asynchronous); await pipe.ConnectAsync(cancellationToken.Token); if (cancellationToken.IsCancellationRequested) { return; } client = new ApiClient <T>(pipe, pipe, oldApi); client.Disconnected += Client_Disconnected; if (oldApi == null) { SetupApi?.Invoke(client.Api); } client.Start(); }
private static IntPtr SetupDiGetClassDevs(ref Guid guid) { // Here we populate a list of plugged-in devices matching our class GUID (DIGCF_PRESENT specifies that the list // should only contain devices which are plugged in) var returnedPointer = IntPtr.Zero; try { returnedPointer = SetupApi.SetupDiGetClassDevs(ref guid, IntPtr.Zero, IntPtr.Zero, Constants.DigcfPresent | Constants.DigcfDeviceinterface); } catch { Debug.WriteLine("SetupDiGetClassDevs failed with error code {0}", Marshal.GetLastWin32Error()); } return(returnedPointer); }
public static string GetDeviceInstanceId(string enum_device) // Returns the device instance ID of the specified device // 'enum_device' should have the following format: // <enumerator>\<device_id> { const int BUFFER_SIZE = 4096; string enumerator = enum_device.Split(new char[] { '\\' })[0]; StringBuilder deviceInstanceId = new StringBuilder(BUFFER_SIZE); SetupApi.SP_DEVINFO_DATA devInfoData; int reqSize; using (SetupApi.DeviceInfoSet devInfoSet = new SetupApi.DeviceInfoSet( IntPtr.Zero, enumerator, IntPtr.Zero, SetupApi.DiGetClassFlags.DIGCF_ALLCLASSES | SetupApi.DiGetClassFlags.DIGCF_PRESENT)) { devInfoData = Device.FindInSystem( enum_device, devInfoSet, false ); if (devInfoData == null) { return(""); } if (!SetupApi.SetupDiGetDeviceInstanceId( devInfoSet.Get(), devInfoData, deviceInstanceId, BUFFER_SIZE, out reqSize)) { Win32Error.Set("SetupDiGetDeviceInstanceId"); throw new Exception(Win32Error.GetFullErrMsg()); } } return(deviceInstanceId.ToString()); }
public static bool ChildrenInstalled(string enumName) { UInt32 devStatus; UInt32 devProblemCode; SetupApi.SP_DEVINFO_DATA devInfoData = new SetupApi.SP_DEVINFO_DATA(); devInfoData.cbSize = (uint)Marshal.SizeOf(devInfoData); using (SetupApi.DeviceInfoSet devInfoSet = new SetupApi.DeviceInfoSet( IntPtr.Zero, enumName, IntPtr.Zero, SetupApi.DiGetClassFlags.DIGCF_PRESENT | SetupApi.DiGetClassFlags.DIGCF_ALLCLASSES)) { for (uint i = 0; SetupApi.SetupDiEnumDeviceInfo( devInfoSet.Get(), i, devInfoData); ++i) { CfgMgr32.CM_Get_DevNode_Status( out devStatus, out devProblemCode, devInfoData.devInst, 0 ); if ((devStatus & (uint)SetupApi.DNFlags.DN_STARTED) == 0) { Trace.WriteLine( enumName + " child not started " + devStatus.ToString() ); return(false); } } } return(true); }