CM_Get_Device_ID() private method

private CM_Get_Device_ID ( int dnDevInst, StringBuilder buffer, int bufferLen, int ulFlags ) : int
dnDevInst int
buffer StringBuilder
bufferLen int
ulFlags int
return int
示例#1
0
        internal Native.SP_DEVINFO_DATA GetInfo(int dnDevInst)
        {
            StringBuilder sb = new StringBuilder(1024);
            int           hr = Native.CM_Get_Device_ID(dnDevInst, sb, sb.Capacity, 0);

            if (hr != 0)
            {
                throw new Win32Exception(hr);
            }

            Native.SP_DEVINFO_DATA devData = new Native.SP_DEVINFO_DATA();
            devData.cbSize = Marshal.SizeOf(typeof(Native.SP_DEVINFO_DATA));
            if (!Native.SetupDiOpenDeviceInfo(_deviceInfoSet, sb.ToString(), IntPtr.Zero, 0, devData))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            return(devData);
        }