- required = 0;
- SetupDiGetDeviceInterfaceDetailW( infoset, &infoData, NULL, 0,
&required, NULL );
- if (required == 0)
- {
ERR( "Failed to get required size for interface\n" );
return STATUS_UNSUCCESSFUL;
- }
- required += sizeof(WCHAR);
- data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY , required +
sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) );
I think this is redundant, SetupDiGetDeviceInterfaceDetail() will return the required length including the size of the struct.
Otherwise this patch looks correct to me.