comparison USBLib/Windows/Devices/DeviceNode.cs @ 90:57b4c2f895d1

USBLib: added DeviceNode.GetStatus
author Ivo Smits <Ivo@UCIS.nl>
date Wed, 02 Apr 2014 16:24:55 +0200
parents 9096f62d18c4
children d467cd38b34e
comparison
equal deleted inserted replaced
89:9096f62d18c4 90:57b4c2f895d1
289 if (ret == CR.NO_SUCH_DEVNODE) return null; 289 if (ret == CR.NO_SUCH_DEVNODE) return null;
290 CMException.Throw(ret, "CM_Get_Parent"); 290 CMException.Throw(ret, "CM_Get_Parent");
291 return new DeviceNode(node); 291 return new DeviceNode(node);
292 } 292 }
293 293
294 public Boolean GetStatus(out UInt32 status, out UInt32 problem) {
295 CR ret = SetupApi.CM_Get_DevNode_Status(out status, out problem, DevInst, 0);
296 if (ret == CR.NO_SUCH_DEVNODE) return false;
297 CMException.Throw(ret, "CM_Get_DevNode_Status");
298 return true;
299 }
300
294 public Boolean Present { 301 public Boolean Present {
295 get { 302 get {
296 UInt32 status, problem; 303 UInt32 status, problem;
297 CR ret = SetupApi.CM_Get_DevNode_Status(out status, out problem, DevInst, 0); 304 return GetStatus(out status, out problem) && status != 25174016;
298 if (ret == CR.NO_SUCH_DEVNODE) return false;
299 CMException.Throw(ret, "CM_Get_DevNode_Status");
300 if (status == 25174016) return false;
301 return true;
302 } 305 }
303 } 306 }
304 307
305 public override bool Equals(object obj) { 308 public override bool Equals(object obj) {
306 DeviceNode other = obj as DeviceNode; 309 DeviceNode other = obj as DeviceNode;