如何使用SetupDiGetDeviceRegistryProperty获取设备的地址?

时间:2017-06-13 05:09:47

标签: c# pinvoke

StringBuilder address = new StringBuilder();
address.Capacity = (int)DIGCF.MAX_DEV_LEN;
bool res2 = SetupDiGetDeviceRegistryProperty(
                hDevInfo,
                ref DeviceInfoData,
                (UInt32)DIGCF.SPDRP_ADDRESS,
                0,
                address,
                (UInt32)DIGCF.MAX_DEV_LEN,
                IntPtr.Zero);

Console.WriteLine("res:"+res2);
if(res2) {
    Console.WriteLine(address);
}

我的代码在上面,返回为true,但地址为空。

0 个答案:

没有答案