Fixed MSVS build.

Added missing headers, functions and types.
Still has warnings, but now library is compilable with msvs.
Compilation tested with MSVS Express 2013 Preview, MinGW 4.6.2, gcc 4.7.2 (Ubuntu).