Fix the Win32 compile environment and add various changes so it will now compile