Some minor corrections and ifdefs for win32 code
More ifdefs and misc tweaks