setupapi.pas should include a define for SP_DEVICE_INTERFACE_DETAIL_DATA that aligns with the default of ansi or unicode. When using TSPDeviceInterfaceData one need set the cbSize to the correct value. This needs to match with the define size. (ansi = 5, unicode = 6).