Updated to build with MSVC 2010.
Use SetLastError() and GetLastError() on Windows.
Omit unnecessary new-line.