windows: Properly handle return value of SetupDiOpenDevRegKey().

This fixes bug #499.