Wine on the other hand doesn't return an error when there are no devices. I haven't looked at the data it returns but it must be uninitialized garbage because there is no device to return the capabilities of.
not exactly. The wave mapper itself (dlls/winmm/wavemap/wavemap.c, function wodGetCaps) does return something.
After stepping through the code, the line that I changed is the line that should have returned the error but didn't. The existing code basically is: if the requested device is the default device and the default device is not set to a valid device, return an error.
it's not the default device, it's the mapper. It's up to the mapper to actually pick up what is supposed to be the default device. The existing code does (lolvldrv.c, in MMDRV_GetById): - in the current class of device (in your case wave out), if the ID is the one of the mapper, and a mapper exists for the class, then use the device of the mapper as the real device
That's why I suggested that wavemap is more likely to be fixed rather than winmm itself. I do think that what windows do for waveOutGetDevCaps(-1...) is: - in winmm, get -1 as the mapper and pass the WODM_GETDEVCAPS to the mapper driver - in wavemap, while handling WODM_GETDEVCAPS, pass the message to the default device This last part is broken right now (from what you report). It should then pass the WODM_GETDEVCAPS to the actual default device (it already does it if first waveOutGetDevCaps is called with a handle and not a device ID), instead of returning values for the mapper (which is not very sensible).
A+