[ntfs] fix creation of Windows 7 bootable USB from XP

* When using Win7 installation ISOs, XP would return the error:
  [0x00000456] The media in the drive may have changed
* This seems to be due to unmounting of the drive before writing
  the PBR
* Also, our ms-sys/NTFS code wasn't identifying NTFS properly on XP
This commit is contained in:
Pete Batard 2012-02-24 18:51:33 +00:00
parent 352a796eff
commit b03065b1f5
3 changed files with 12 additions and 14 deletions

View file

@ -66,7 +66,6 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command,
case FCC_PROGRESS:
percent = (DWORD*)pData;
PrintStatus(0, FALSE, "Formatting: %d%% completed.", *percent);
// uprintf("%d percent completed.\n", *percent);
UpdateProgress(OP_FORMAT, 1.0f * (*percent));
break;
case FCC_STRUCTURE_PROGRESS: // No progress on quick format
@ -611,10 +610,8 @@ DWORD WINAPI FormatThread(LPVOID param)
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED;
goto out;
}
// Make sure the volume is dismounted before writing the PBR
// This is especially critical, as NTFS will only be made bootable
// after the FS is re-mounted by Windows
UnmountDrive(hLogicalVolume);
// NB: if you unmount the logical volume here, XP will report error:
// [0x00000456] The media in the drive may have changed
PrintStatus(0, TRUE, "Writing partition boot record...");
if (!WritePBR(hLogicalVolume)) {
if (!FormatStatus)
@ -668,6 +665,7 @@ DWORD WINAPI FormatThread(LPVOID param)
}
if (IsChecked(IDC_SET_ICON))
SetAutorun(drive_name);
UpdateProgress(OP_DOS, -1.0f);
// Issue another complete remount before we exit, to ensure we're clean
RemountVolume(drive_name[0]);
}