Replaced __typeof__ macros with BOOST_TYPEOF to solve compilation errors on windows.
Added a missing CloseHandle in readFileToFileBuffer. Many more are missing.