Cleanup win api compat layer.

Implemented str_2_BSTR and BSTR_2_str and reformated the code a bit.