¶Bug in XInput/DirectInput detection sample
MSDN has code to detect whether a controller device enumerated by the DirectInput API is also an XInput device, so that programs can avoid reporting the same controller twice when both APIs are supported:
Be warned, there is a memory leak in the supplied IsXInputDevice() function: the VARIANT returned by IWbemClassObject::Get() needs to be freed with VariantClear() after the device string is checked. This is hard to notice if you just drop in the code, as it only triggers on device enumeration and that likely only happens on startup or when a device change notification is received. I only noticed it because I temporarily modified my device enumeration code to run in a loop to see how fast (or slow) the WMI-based check would be.