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,但地址为空。