Example 11
Some of the APIs need to return data unmanaged
[DllImport("Setupapi.dll", CharSet=CharSet.Auto, SetLastError = true)] public static extern bool SetupDiGetDeviceInstanceId( int DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData, [MarshalAs(UnmanagedType.LPWStr)] String DeviceInstanceId, int DeviceInstanceIdSize, ref int RequiredSize);