Merge nicolasff:b9a16b5ad5 in, fixing for Win32

Now we should be up to master with upstream for an easier merge.