Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large.