WIP: Windows fixes

* We're defining ```lseek``` before first undefining it (mingw). Compiler spews a lot of warnings.
* We're using ```size_t``` and ```unsigned long``` interchangeably (not ok for 64-bit Windows)
* Mutex used by ```_InterlockedExchange``` should be volatile!