1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[core] fix "Requesting Disk Access" issue with Syslinux/NTFS

* See http://reboot.pro/topic/17902-rufus-v130-has-been-released/?p=190958
* Also fix non continuation of format operation after Syslinux has been downloaded
* Also fix missing Syslinux installation for ReactOS
This commit is contained in:
Pete Batard 2015-02-26 00:15:13 +00:00
parent d22933636c
commit 785150dcb2
5 changed files with 40 additions and 84 deletions

View file

@ -1812,7 +1812,8 @@ DWORD WINAPI FormatThread(void* param)
goto out;
}
} else if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) ||
((dt == DT_ISO) && (HAS_SYSLINUX(iso_report)) && (!allow_dual_uefi_bios) && (IS_FAT(fs))) ) {
((dt == DT_ISO) && (HAS_SYSLINUX(iso_report) || IS_REACTOS(iso_report)) &&
(!allow_dual_uefi_bios) && (IS_FAT(fs))) ) {
if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
}

View file

@ -1452,7 +1452,7 @@ static BOOL BootCheck(void)
IGNORE_RETVAL(_mkdir(tmp));
static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]);
PrintInfo(0, MSG_085, tmp);
if (DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog))
if (DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog) == 0)
return FALSE;
}
}

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.632"
CAPTION "Rufus 2.0.633"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -157,7 +157,7 @@ END
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.632"
CAPTION "Rufus 2.0.633"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -283,7 +283,7 @@ END
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.0.632"
CAPTION "Rufus 2.0.633"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -415,7 +415,7 @@ END
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.0.632"
CAPTION "Rufus 2.0.633"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -671,8 +671,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,632,0
PRODUCTVERSION 2,0,632,0
FILEVERSION 2,0,633,0
PRODUCTVERSION 2,0,633,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -689,13 +689,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.0.632"
VALUE "FileVersion", "2.0.633"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.0.632"
VALUE "ProductVersion", "2.0.633"
END
END
BLOCK "VarFileInfo"

View file

@ -74,8 +74,10 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
{
HANDLE f_handle = INVALID_HANDLE_VALUE;
HANDLE d_handle = INVALID_HANDLE_VALUE;
DWORD bytes_read;
DWORD bytes_written;
DWORD bytes_read, bytes_written, err;
S_NTFSSECT_VOLINFO vol_info;
LARGE_INTEGER vcn, lba, len;
S_NTFSSECT_EXTENT extent;
BOOL r = FALSE;
FILE* fd;
size_t length;
@ -184,13 +186,11 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
sectors = (libfat_sector_t*) calloc(ldlinux_sectors, sizeof *sectors);
if (sectors == NULL)
goto out;
if (fs_type == FS_NTFS) {
DWORD err;
S_NTFSSECT_VOLINFO vol_info;
LARGE_INTEGER vcn, lba, len;
S_NTFSSECT_EXTENT extent;
switch (fs_type) {
case FS_NTFS:
static_sprintf(tmp, "%C:\\", drive_letter);
vol_info.Handle = d_handle;
err = NtfsSectGetVolumeInfo(tmp, &vol_info);
if (err != ERROR_SUCCESS) {
uprintf("Could not fetch NTFS volume info");
@ -215,24 +215,30 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
nsectors++;
}
}
goto map_done;
}
fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (fs == NULL) {
uprintf("Syslinux FAT access error\n");
break;
case FS_FAT16:
case FS_FAT32:
case FS_EXFAT:
fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
if (fs == NULL) {
uprintf("Syslinux FAT access error\n");
goto out;
}
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
secp = sectors;
nsectors = 0;
s = libfat_clustertosector(fs, ldlinux_cluster);
while (s && nsectors < ldlinux_sectors) {
*secp++ = s;
nsectors++;
s = libfat_nextsector(fs, s);
}
libfat_close(fs);
break;
default:
uprintf("Unsupported Syslinux filesystem\n");
goto out;
}
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
secp = sectors;
nsectors = 0;
s = libfat_clustertosector(fs, ldlinux_cluster);
while (s && nsectors < ldlinux_sectors) {
*secp++ = s;
nsectors++;
s = libfat_nextsector(fs, s);
}
libfat_close(fs);
map_done:
/* Patch ldlinux.sys and the boot sector */
syslinux_patch(sectors, nsectors, 0, 0, NULL, NULL);

View file

@ -93,52 +93,6 @@ DWORD M_NTFSSECT_API NtfsSectGetFileVcnExtent(
return rc;
}
/* Internal use only */
static DWORD NtfsSectGetVolumeHandle(
CHAR * VolumeName,
S_NTFSSECT_VOLINFO * VolumeInfo
) {
#define M_VOL_PREFIX "\\\\.\\"
CHAR volname[sizeof M_VOL_PREFIX - 1 + MAX_PATH + 1] = M_VOL_PREFIX;
CHAR * const volname_short = volname + sizeof M_VOL_PREFIX - 1;
CHAR * c;
DWORD rc;
/* Prefix "\\.\" onto the passed volume name */
strcpy(volname + sizeof M_VOL_PREFIX - 1, VolumeName);
/* Find the last non-null character */
for (c = volname_short; *c; ++c)
;
/* Remove trailing back-slash */
if (c[-1] == '\\')
c[-1] = 0;
/* Open the volume */
VolumeInfo->Handle = CreateFileA(
volname,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL
);
rc = GetLastError();
if (VolumeInfo->Handle == INVALID_HANDLE_VALUE) {
M_ERR("Unable to open volume handle!");
goto err_handle;
}
return ERROR_SUCCESS;
CloseHandle(VolumeInfo->Handle);
err_handle:
return rc;
}
DWORD M_NTFSSECT_API NtfsSectGetVolumeInfo(
CHAR * VolumeName,
S_NTFSSECT_VOLINFO * VolumeInfo
@ -150,10 +104,6 @@ DWORD M_NTFSSECT_API NtfsSectGetVolumeInfo(
if (!VolumeName || !VolumeInfo)
return ERROR_INVALID_PARAMETER;
rc = NtfsSectGetVolumeHandle(VolumeName, VolumeInfo);
if (rc != ERROR_SUCCESS)
goto err_handle;
rc = NtfsSectLoadXpFuncs(&xp_funcs);
if (rc != ERROR_SUCCESS)
goto err_xp_funcs;
@ -189,7 +139,6 @@ DWORD M_NTFSSECT_API NtfsSectGetVolumeInfo(
CloseHandle(VolumeInfo->Handle);
VolumeInfo->Handle = INVALID_HANDLE_VALUE;
}
err_handle:
return rc;
}