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

[core] fix formatting for drives with nonstandard sector size

* Issue #385
* Also bump version to 1.4.11
This commit is contained in:
Pete Batard 2014-10-28 19:16:35 +00:00
parent 432edfa9c5
commit 91565477ed
8 changed files with 43 additions and 34 deletions

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for rufus 1.4.10. # Generated by GNU Autoconf 2.68 for rufus 1.4.11.
# #
# Report bugs to <https://github.com/pbatard/rufus/issues>. # Report bugs to <https://github.com/pbatard/rufus/issues>.
# #
@ -560,8 +560,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='rufus' PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus' PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='1.4.10' PACKAGE_VERSION='1.4.11'
PACKAGE_STRING='rufus 1.4.10' PACKAGE_STRING='rufus 1.4.11'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='http://rufus.akeo.ie' PACKAGE_URL='http://rufus.akeo.ie'
@ -1203,7 +1203,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures rufus 1.4.10 to adapt to many kinds of systems. \`configure' configures rufus 1.4.11 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1269,7 +1269,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of rufus 1.4.10:";; short | recursive ) echo "Configuration of rufus 1.4.11:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1357,7 +1357,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
rufus configure 1.4.10 rufus configure 1.4.11
generated by GNU Autoconf 2.68 generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
@ -1412,7 +1412,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 1.4.10, which was It was created by rufus $as_me 1.4.11, which was
generated by GNU Autoconf 2.68. Invocation command line was generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@ $ $0 $@
@ -2227,7 +2227,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='rufus' PACKAGE='rufus'
VERSION='1.4.10' VERSION='1.4.11'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -4140,7 +4140,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by rufus $as_me 1.4.10, which was This file was extended by rufus $as_me 1.4.11, which was
generated by GNU Autoconf 2.68. Invocation command line was generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -4194,7 +4194,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
rufus config.status 1.4.10 rufus config.status 1.4.11
configured by $0, generated by GNU Autoconf 2.68, configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [1.4.10], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) AC_INIT([rufus], [1.4.11], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])

View file

@ -136,7 +136,6 @@ HANDLE GetPhysicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive)
* Return the first GUID volume name for the associated drive or NULL if not found * Return the first GUID volume name for the associated drive or NULL if not found
* See http://msdn.microsoft.com/en-us/library/cc542456.aspx * See http://msdn.microsoft.com/en-us/library/cc542456.aspx
* The returned string is allocated and must be freed * The returned string is allocated and must be freed
* TODO: a drive may have multiple volumes - should we handle those?
*/ */
char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent) char* GetLogicalName(DWORD DriveIndex, BOOL bKeepTrailingBackslash, BOOL bSilent)
{ {
@ -535,7 +534,7 @@ BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName)
int i; int i;
fake_fd._ptr = (char*)hPhysicalDrive; fake_fd._ptr = (char*)hPhysicalDrive;
fake_fd._bufsiz = 512; fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
if (!is_br(&fake_fd)) { if (!is_br(&fake_fd)) {
uprintf("%s does not have an x86 %s\n", TargetName, mbr_name); uprintf("%s does not have an x86 %s\n", TargetName, mbr_name);
@ -570,7 +569,7 @@ BOOL AnalyzePBR(HANDLE hLogicalVolume)
int i; int i;
fake_fd._ptr = (char*)hLogicalVolume; fake_fd._ptr = (char*)hLogicalVolume;
fake_fd._bufsiz = 512; fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
if (!is_br(&fake_fd)) { if (!is_br(&fake_fd)) {
uprintf("Volume does not have an x86 %s\n", pbr_name); uprintf("Volume does not have an x86 %s\n", pbr_name);
@ -900,9 +899,9 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
DriveLayoutEx.PartitionStyle = PARTITION_STYLE_GPT; DriveLayoutEx.PartitionStyle = PARTITION_STYLE_GPT;
DriveLayoutEx.PartitionCount = 1; DriveLayoutEx.PartitionCount = 1;
// At the very least, a GPT disk has 34 reserved blocks (512 bytes) at the beginning and 33 at the end. // At the very least, a GPT disk has 34 reserved sectors at the beginning and 33 at the end.
DriveLayoutEx.Type.Gpt.StartingUsableOffset.QuadPart = 34*512; DriveLayoutEx.Type.Gpt.StartingUsableOffset.QuadPart = 34 * SelectedDrive.Geometry.BytesPerSector;
DriveLayoutEx.Type.Gpt.UsableLength.QuadPart = SelectedDrive.DiskSize - (34+33)*512; DriveLayoutEx.Type.Gpt.UsableLength.QuadPart = SelectedDrive.DiskSize - (34+33) * SelectedDrive.Geometry.BytesPerSector;
DriveLayoutEx.Type.Gpt.MaxPartitionCount = MAX_GPT_PARTITIONS; DriveLayoutEx.Type.Gpt.MaxPartitionCount = MAX_GPT_PARTITIONS;
DriveLayoutEx.Type.Gpt.DiskId = CreateDisk.Gpt.DiskId; DriveLayoutEx.Type.Gpt.DiskId = CreateDisk.Gpt.DiskId;
DriveLayoutEx.PartitionEntry[0].PartitionStyle = PARTITION_STYLE_GPT; DriveLayoutEx.PartitionEntry[0].PartitionStyle = PARTITION_STYLE_GPT;

View file

@ -855,14 +855,14 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
// FormatEx rewrites the MBR and removes the LBA attribute of FAT16 // FormatEx rewrites the MBR and removes the LBA attribute of FAT16
// and FAT32 partitions - we need to correct this in the MBR // and FAT32 partitions - we need to correct this in the MBR
buf = (unsigned char*)malloc(512); buf = (unsigned char*)malloc(SelectedDrive.Geometry.BytesPerSector);
if (buf == NULL) { if (buf == NULL) {
uprintf("Could not allocate memory for MBR"); uprintf("Could not allocate memory for MBR");
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY;
goto out; goto out;
} }
if (!read_sectors(hPhysicalDrive, 512, 0, 1, buf)) { if (!read_sectors(hPhysicalDrive, SelectedDrive.Geometry.BytesPerSector, 0, 1, buf)) {
uprintf("Could not read MBR\n"); uprintf("Could not read MBR\n");
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_READ_FAULT; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_READ_FAULT;
goto out; goto out;
@ -892,14 +892,14 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
uprintf("Set bootable USB partition as 0x%02X\n", buf[0x1be]); uprintf("Set bootable USB partition as 0x%02X\n", buf[0x1be]);
} }
if (!write_sectors(hPhysicalDrive, 512, 0, 1, buf)) { if (!write_sectors(hPhysicalDrive, SelectedDrive.Geometry.BytesPerSector, 0, 1, buf)) {
uprintf("Could not write MBR\n"); uprintf("Could not write MBR\n");
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
goto out; goto out;
} }
fake_fd._ptr = (char*)hPhysicalDrive; fake_fd._ptr = (char*)hPhysicalDrive;
fake_fd._bufsiz = 512; fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
@ -953,7 +953,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
const char* using_msg = "Using %s %s partition boot record\n"; const char* using_msg = "Using %s %s partition boot record\n";
fake_fd._ptr = (char*)hLogicalVolume; fake_fd._ptr = (char*)hLogicalVolume;
fake_fd._bufsiz = 512; fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) { switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) {
case FS_FAT16: case FS_FAT16:
@ -997,7 +997,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
// Disk Drive ID needs to be corrected on XP // Disk Drive ID needs to be corrected on XP
if (!write_partition_physical_disk_drive_id_fat32(&fake_fd)) if (!write_partition_physical_disk_drive_id_fat32(&fake_fd))
break; break;
fake_fd._cnt += 6 * 512; fake_fd._cnt += 6 * SelectedDrive.Geometry.BytesPerSector;
} }
return TRUE; return TRUE;
case FS_NTFS: case FS_NTFS:
@ -1335,7 +1335,7 @@ DWORD WINAPI FormatThread(void* param)
uprintf("Bad blocks: Check failed.\n"); uprintf("Bad blocks: Check failed.\n");
if (!IS_ERROR(FormatStatus)) if (!IS_ERROR(FormatStatus))
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_BADBLOCKS_FAILURE); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_BADBLOCKS_FAILURE);
ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, 512, FALSE); ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.Geometry.BytesPerSector, FALSE);
fclose(log_fd); fclose(log_fd);
_unlink(logfile); _unlink(logfile);
goto out; goto out;
@ -1368,7 +1368,7 @@ DWORD WINAPI FormatThread(void* param)
// Especially after destructive badblocks test, you must zero the MBR/GPT completely // Especially after destructive badblocks test, you must zero the MBR/GPT completely
// before repartitioning. Else, all kind of bad things happen. // before repartitioning. Else, all kind of bad things happen.
if (!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, 512, use_large_fat32)) { if (!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.Geometry.BytesPerSector, use_large_fat32)) {
uprintf("unable to zero MBR/GPT\n"); uprintf("unable to zero MBR/GPT\n");
if (!IS_ERROR(FormatStatus)) if (!IS_ERROR(FormatStatus))
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;

View file

@ -289,14 +289,14 @@ static BOOL DefineClusterSizes(void)
// UDF (only supported for Vista and later) // UDF (only supported for Vista and later)
if (nWindowsVersion >= WINDOWS_VISTA) { if (nWindowsVersion >= WINDOWS_VISTA) {
SelectedDrive.ClusterSize[FS_UDF].Allowed = 0x00000100; SelectedDrive.ClusterSize[FS_UDF].Allowed = SINGLE_CLUSTERSIZE_DEFAULT;
SelectedDrive.ClusterSize[FS_UDF].Default = 1; SelectedDrive.ClusterSize[FS_UDF].Default = 1;
} }
// ReFS (only supported for Windows 8.1 and later and for fixed disks) // ReFS (only supported for Windows 8.1 and later and for fixed disks)
if (SelectedDrive.DiskSize >= 512*MB) { if (SelectedDrive.DiskSize >= 512*MB) {
if ((nWindowsVersion >= WINDOWS_8_1_OR_LATER) && (SelectedDrive.Geometry.MediaType == FixedMedia)) { if ((nWindowsVersion >= WINDOWS_8_1_OR_LATER) && (SelectedDrive.Geometry.MediaType == FixedMedia)) {
SelectedDrive.ClusterSize[FS_REFS].Allowed = 0x00000100; SelectedDrive.ClusterSize[FS_REFS].Allowed = SINGLE_CLUSTERSIZE_DEFAULT;
SelectedDrive.ClusterSize[FS_REFS].Default = 1; SelectedDrive.ClusterSize[FS_REFS].Default = 1;
} }
} }
@ -305,6 +305,15 @@ static BOOL DefineClusterSizes(void)
out: out:
// Only add the filesystems we can service // Only add the filesystems we can service
for (fs=0; fs<FS_MAX; fs++) { for (fs=0; fs<FS_MAX; fs++) {
// Remove all cluster sizes that are below the sector size
if (SelectedDrive.ClusterSize[fs].Allowed != SINGLE_CLUSTERSIZE_DEFAULT) {
SelectedDrive.ClusterSize[fs].Allowed &= ~(SelectedDrive.Geometry.BytesPerSector - 1);
if ((SelectedDrive.ClusterSize[fs].Default & SelectedDrive.ClusterSize[fs].Allowed) == 0)
// We lost our default => Use rightmost bit to select the new one
SelectedDrive.ClusterSize[fs].Default =
SelectedDrive.ClusterSize[fs].Allowed & (-(LONG)SelectedDrive.ClusterSize[fs].Allowed);
}
if (SelectedDrive.ClusterSize[fs].Allowed != 0) { if (SelectedDrive.ClusterSize[fs].Allowed != 0) {
tmp[0] = 0; tmp[0] = 0;
// Tell the user if we're going to use Large FAT32 or regular // Tell the user if we're going to use Large FAT32 or regular

View file

@ -53,6 +53,7 @@
#define MBR_UEFI_MARKER 0x49464555 // 'U', 'E', 'F', 'I', as a 32 bit little endian longword #define MBR_UEFI_MARKER 0x49464555 // 'U', 'E', 'F', 'I', as a 32 bit little endian longword
#define WRITE_RETRIES 3 #define WRITE_RETRIES 3
#define FS_DEFAULT FS_FAT32 #define FS_DEFAULT FS_FAT32
#define SINGLE_CLUSTERSIZE_DEFAULT 0x00000100
#define BADBLOCK_PATTERNS {0xaa, 0x55, 0xff, 0x00} #define BADBLOCK_PATTERNS {0xaa, 0x55, 0xff, 0x00}
#define LARGE_FAT32_SIZE (32*1073741824LL) // Size at which we need to use fat32format #define LARGE_FAT32_SIZE (32*1073741824LL) // Size at which we need to use fat32format
#define UDF_FORMAT_SPEED 3.1f // Speed estimate at which we expect UDF drives to be formatted (GB/s) #define UDF_FORMAT_SPEED 3.1f // Speed estimate at which we expect UDF drives to be formatted (GB/s)

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329 IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 1.4.10.517" CAPTION "Rufus 1.4.11.518"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -165,7 +165,7 @@ END
RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 1.4.10.517" CAPTION "Rufus 1.4.11.518"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -428,8 +428,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,10,517 FILEVERSION 1,4,11,518
PRODUCTVERSION 1,4,10,517 PRODUCTVERSION 1,4,11,518
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -446,13 +446,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.10.517" VALUE "FileVersion", "1.4.11.518"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.10.517" VALUE "ProductVersion", "1.4.11.518"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -179,7 +179,7 @@ static int SatAtaPassthrough(HANDLE hPhysical, ATA_PASSTHROUGH_CMD* Command, voi
int t_length = 0; /* 0 -> no data transferred */ int t_length = 0; /* 0 -> no data transferred */
uint8_t Direction; uint8_t Direction;
if (BufLen % 512 != 0) { if (BufLen % SelectedDrive.Geometry.BytesPerSector != 0) {
uprintf("SatAtaPassthrough: BufLen must be a multiple of <block size>\n"); uprintf("SatAtaPassthrough: BufLen must be a multiple of <block size>\n");
return SPT_ERROR_BUFFER; return SPT_ERROR_BUFFER;
} }