changeset 89:9096f62d18c4

USBLib: allow to locate Windows Device Node for removed device
author Ivo Smits <Ivo@UCIS.nl>
date Wed, 12 Mar 2014 19:33:42 +0100
parents c9da306e06c9
children 57b4c2f895d1
files USBLib/Windows/Devices/DeviceNode.cs
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/USBLib/Windows/Devices/DeviceNode.cs	Tue Mar 11 17:45:48 2014 +0100
+++ b/USBLib/Windows/Devices/DeviceNode.cs	Wed Mar 12 19:33:42 2014 +0100
@@ -29,7 +29,8 @@
 		}
 		public static DeviceNode GetDevice(String deviceID) {
 			UInt32 node;
-			CR ret = SetupApi.CM_Locate_DevNode(out node, deviceID, 0);
+			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);
 		}