Various changes to make this stuff compile under Win32 and VC++ with and