[misc] update UEFI:NTFS partition detection

This commit is contained in:
Pete Batard 2016-04-28 10:09:43 +02:00
parent 43d9ac046b
commit d4c518a4ae
3 changed files with 9 additions and 12 deletions

View File

@ -57,7 +57,6 @@ const GUID PARTITION_SYSTEM_GUID =
* Globals
*/
RUFUS_DRIVE_INFO SelectedDrive;
size_t uefi_ntfs_size = 0;
/*
* The following methods get or set the AutoMount setting (which is different from AutoRun)
@ -684,9 +683,6 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
if (hPhysical == INVALID_HANDLE_VALUE)
return 0;
if (uefi_ntfs_size == 0)
uefi_ntfs_size = GetResourceSize(hMainInstance, MAKEINTRESOURCEA(IDR_UEFI_NTFS), _RT_RCDATA, "uefi-ntfs.img");
r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
NULL, 0, geometry, sizeof(geometry), &size, NULL);
if (!r || size <= 0) {
@ -734,7 +730,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys
if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) {
part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType;
isUefiNtfs = (i == 1) && (part_type == 0xef) &&
(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart == uefi_ntfs_size);
(DriveLayout->PartitionEntry[i].PartitionLength.QuadPart <= 1*MB);
suprintf("Partition %d%s:\n", i+1, isUefiNtfs?" (UEFI:NTFS)":"");
for (j=0; j<ARRAYSIZE(mbr_mountable); j++) {
if (part_type == mbr_mountable[j]) {
@ -1029,6 +1025,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
{
const char* PartitionTypeName[2] = { "MBR", "GPT" };
unsigned char* buffer;
size_t uefi_ntfs_size = 0;
CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}};
DRIVE_LAYOUT_INFORMATION_EX4 DriveLayoutEx = {0};
BOOL r;
@ -1038,7 +1035,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
PrintInfoDebug(0, MSG_238, PartitionTypeName[partition_style]);
if ((extra_partitions & XP_UEFI_NTFS) && (uefi_ntfs_size == 0)) {
if (extra_partitions & XP_UEFI_NTFS) {
uefi_ntfs_size = GetResourceSize(hMainInstance, MAKEINTRESOURCEA(IDR_UEFI_NTFS), _RT_RCDATA, "uefi-ntfs.img");
if (uefi_ntfs_size == 0)
return FALSE;

View File

@ -2778,7 +2778,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
BOOL previous_enable_HDDs = FALSE;
BYTE *loc_data;
DWORD loc_size, size;
char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH], ini_flags[] = "rb";
char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH] = "", ini_flags[] = "rb";
char *tmp, *locale_name = NULL, **argv = NULL;
wchar_t **wenv, **wargv;
PF_TYPE_DECL(CDECL, int, __wgetmainargs, (int*, wchar_t***, wchar_t***, int, int*));

View File

@ -33,7 +33,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
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.9.892"
CAPTION "Rufus 2.9.893"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,9,892,0
PRODUCTVERSION 2,9,892,0
FILEVERSION 2,9,893,0
PRODUCTVERSION 2,9,893,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.9.892"
VALUE "FileVersion", "2.9.893"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.9.892"
VALUE "ProductVersion", "2.9.893"
END
END
BLOCK "VarFileInfo"