[format] added volume unmount and improve logic

* acquire a vomume handle and unmount the volume before anything else
* remove the volume access check after partitioning - use a small delay instead
This commit is contained in:
Pete Batard 2011-12-11 02:19:38 +00:00
parent 78ad099bf9
commit df7a0b1fc3
4 changed files with 64 additions and 65 deletions

View file

@ -155,3 +155,14 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label)
return TRUE;
}
BOOL UnmountDrive(HANDLE hDrive)
{
DWORD size;
if (!DeviceIoControl(hDrive, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &size, NULL)) {
uprintf("Could not ummount drive: %s\n", WindowsErrorString());
return FALSE;
}
return TRUE;
}