MINGW now supports SetThreadExecutionState

The MINGW version we compile with in OBS supports
SetThreadExecutionState so lets use it.
Cleanup win api compat layer.

Implemented str_2_BSTR and BSTR_2_str and reformated the code a bit.