I checked the implementation of the device check and I don't understand what is going on on your pc.
The problem is that the connect and the getDevices command basically do the same - they call the same internal device detection routine.

This means you should either be able to get correct device number AND be able to connect all your Wiimotes, or you read 0 devices and can't connect ANY Wiimote.

If you simply connect devices with the next higher index in a loop as long as the returned handle is not NULL, you should get the very same result as with getDevices().

Please grab the consoel version again and list the first few lines here which show "OpenDevice:..." and the like.

Also try to remove the getDevices call from your code and see if the first Wiimote (best try with a single one while no others are connected) still connects on first try.