Restore code for Windows compilation Try to keep as close to rc1 but still allow the change from Roumen for mingw