Hans Leidekker (@hans) commented about dlls/msi/media.c:
msi_free( tmppathW ); return ERROR_OUTOFMEMORY; }
msi_disable_fs_redirection( data->package ); if (!GetTempFileNameW(tmppathW, L"msi", 0, tmpfileW)) tmpfileW[0] = 0; msi_free( tmppathW ); handle = CreateFileW(tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL);
msi_revert_fs_redirection( data->package ); if (handle != INVALID_HANDLE_VALUE && msi_move_file( data->package, path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) &&
There's msi_create_file() and msi_delete_file() which handle redirection, that could be reused here. Maybe add a msi_create_temp_filename() wrapper around GetTempFileNameW() for consistency.