priority: rewrite to use avrt and report failure

Windows Vista and up includes some scheduling improvements for time
critical "multimedia" applications. To take advantage of this, the
thread performing multimedia operations has to register itself with the
Multimedia Class Scheduler service.

There was already some code in ao_wasapi.c to do this with the audio
event thread, but it should probably be done process-wide so that the
operating system knows that the playback thread is also time critical.

If MMCSS is disabled or not present, fall back to SetThreadPriority.
w32: use flags when calling SetErrorMode

Also don't disable the Windows Error Reporting dialog. Windows users
expect this when a program crashes.
w32: enable heap corruption detection

Enable the terminate-on-corruption feature on the default heap. This is
highly recommended for all new Windows applications and shouldn't cause
a performance hit.

See:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366705(v=vs.85).aspx
http://blogs.msdn.com/b/michael_howard/archive/2008/02/18/faq-about-heapsetinformation-in-windows-vista-and-heap-based-buffer-overruns.aspx

MPC-HC currently does the same thing:
https://trac.mpc-hc.org/wiki/windows_compatibility
w32: use safe DLL search paths everywhere

Windows applications that use LoadLibrary are vulnerable to DLL
preloading attacks if a malicious DLL with the same name as the one
being loaded is placed in the current directory. There was some code to
avoid this in ao_wasapi.c, but MSDN recommends fixing the search paths
on a process-wide basis as early as possible.

On application startup, the current directory should be removed from the
search path completely.

This change can affect how plugins are loaded in AviSynth, but it
shouldn't be a problem, since MPC-HC also does this and it's a very
popular AviSynth client.