I'm looking at how windows deals with invalid parameters in some of the winmm functions and it raises some questions. Sometimes they will check the parameters and return an error code and sometimes they will let a bad parameter cause a first-chance exception and catch it and return an error code.
Is it ok to do a simple NULL pointer check and return an error rather than letting it cause an exception and catching it? If not, what's the best way to catch the exception and return the proper error code?