Пример #1
0
        public IList <DeviceNode> GetChildren()
        {
            UInt32 child;
            CR     ret = SetupApi.CM_Get_Child(out child, DevInst, 0);

            if (ret == CR.NO_SUCH_DEVNODE)
            {
                return(null);
            }
            CMException.Throw(ret, "CM_Get_Child");
            List <DeviceNode> list = new List <DeviceNode>();

            while (true)
            {
                list.Add(new DeviceNode(child));
                ret = SetupApi.CM_Get_Sibling(out child, child, 0);
                if (ret == CR.NO_SUCH_DEVNODE)
                {
                    break;
                }
                CMException.Throw(ret, "CM_Get_Sibling");
            }
            return(list);
        }