[Win 10] Initing joystick causes ~45s hang in SDL_DINPUT_JoystickDetect

OS: Windows 10 Pro N. Version 1703. OS Build 15063.674.
SDL: 2.0.7 (also seems to also affect 2.0.6, haven’t tried with 2.0.5)
Most recent versions of mixer and net are also used.

I’m not sure what the prerequisites to this occurring are, but after running my PC long enough (or some other factor I haven’t found yet), calling SDL_Init(SDL_INIT_JOYSTICK) or SDL_InitSubSystem(SDL_INIT_JOYSTICK) causes the program calling it to hang for around 40-45s. Once it happens the first time, it will happen 100% of the time without fail until I restart my computer or log out and in. Removing the call will cause the program to run without issue.

Context: https://github.com/team-eternity/eternity/blob/sdl2/source/sdl/i_main.cpp#L61-L73

EDIT: Debugging properly with the SDL2 source, it appears this occurs on the first line of SDL_DINPUT_JoystickDetect:
IDirectInput8_EnumDevices(dinput, DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, pContext, DIEDFL_ATTACHEDONLY);