mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] update UEFI:NTFS partition detection
This commit is contained in:
parent
43d9ac046b
commit
d4c518a4ae
3 changed files with 9 additions and 12 deletions
|
@ -57,7 +57,6 @@ const GUID PARTITION_SYSTEM_GUID =
|
||||||
* Globals
|
* Globals
|
||||||
*/
|
*/
|
||||||
RUFUS_DRIVE_INFO SelectedDrive;
|
RUFUS_DRIVE_INFO SelectedDrive;
|
||||||
size_t uefi_ntfs_size = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following methods get or set the AutoMount setting (which is different from AutoRun)
|
* 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)
|
if (hPhysical == INVALID_HANDLE_VALUE)
|
||||||
return 0;
|
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,
|
r = DeviceIoControl(hPhysical, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
|
||||||
NULL, 0, geometry, sizeof(geometry), &size, NULL);
|
NULL, 0, geometry, sizeof(geometry), &size, NULL);
|
||||||
if (!r || size <= 0) {
|
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) {
|
if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) {
|
||||||
part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType;
|
part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType;
|
||||||
isUefiNtfs = (i == 1) && (part_type == 0xef) &&
|
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)":"");
|
suprintf("Partition %d%s:\n", i+1, isUefiNtfs?" (UEFI:NTFS)":"");
|
||||||
for (j=0; j<ARRAYSIZE(mbr_mountable); j++) {
|
for (j=0; j<ARRAYSIZE(mbr_mountable); j++) {
|
||||||
if (part_type == 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" };
|
const char* PartitionTypeName[2] = { "MBR", "GPT" };
|
||||||
unsigned char* buffer;
|
unsigned char* buffer;
|
||||||
|
size_t uefi_ntfs_size = 0;
|
||||||
CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}};
|
CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}};
|
||||||
DRIVE_LAYOUT_INFORMATION_EX4 DriveLayoutEx = {0};
|
DRIVE_LAYOUT_INFORMATION_EX4 DriveLayoutEx = {0};
|
||||||
BOOL r;
|
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]);
|
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");
|
uefi_ntfs_size = GetResourceSize(hMainInstance, MAKEINTRESOURCEA(IDR_UEFI_NTFS), _RT_RCDATA, "uefi-ntfs.img");
|
||||||
if (uefi_ntfs_size == 0)
|
if (uefi_ntfs_size == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -2778,7 +2778,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
BOOL previous_enable_HDDs = FALSE;
|
BOOL previous_enable_HDDs = FALSE;
|
||||||
BYTE *loc_data;
|
BYTE *loc_data;
|
||||||
DWORD loc_size, size;
|
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;
|
char *tmp, *locale_name = NULL, **argv = NULL;
|
||||||
wchar_t **wenv, **wargv;
|
wchar_t **wenv, **wargv;
|
||||||
PF_TYPE_DECL(CDECL, int, __wgetmainargs, (int*, wchar_t***, wchar_t***, int, int*));
|
PF_TYPE_DECL(CDECL, int, __wgetmainargs, (int*, wchar_t***, wchar_t***, int, int*));
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 2.9.892"
|
CAPTION "Rufus 2.9.893"
|
||||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||||
|
@ -320,8 +320,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,9,892,0
|
FILEVERSION 2,9,893,0
|
||||||
PRODUCTVERSION 2,9,892,0
|
PRODUCTVERSION 2,9,893,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -338,13 +338,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", "2.9.892"
|
VALUE "FileVersion", "2.9.893"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2016 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", "2.9.892"
|
VALUE "ProductVersion", "2.9.893"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue