Added some stuff for MSVC - fixed a bug in HDR output.