[misc] add NTFS compression support

* Only as a cheat mode (Alt-N)
* Also fixes inconsistent MBR partition numbering
* Also update a comment in vhd.c about callback progress (thanks to Erwan)
This commit is contained in:
Pete Batard 2014-01-31 02:51:28 +00:00
parent 189e96762b
commit f424229e0f
11 changed files with 58 additions and 27 deletions

View File

@ -3,16 +3,20 @@ rufus.loc since its original version. Translators are expected to keep their
translations up to date by monitoring this file on regular basis and applying
the same changes.
!!IMPORTANT!! The changes below only tell you WHERE you need to look in the
English version, to find what has changed. But it may not give you the complete
details of the changes, especially if a message spans multiple lines.
PLEASE do not just look at this Changelog when updating your translation, but
make sure you also look at the English translation. For instance, MSG_114, that
was introduced in v1.0.8 is MORE than one line!
Remember to also update the version number for your translation ('v x.y.z')
once you have matched all the changes that occurred for the en-US translation.
!!IMPORTANT!! The changes below do NOT contain the full message and only tell
you WHERE, in the English translation, you should look to find the full message
content. PLEASE, do not just look at this Changelog when updating your
translation, but always use the English section of rufus.loc as your base.
For instance, MSG_114, that was introduced in v1.0.8 is MORE than one line!
o Version 1.0.9 (2014.01.31)
- *NEW* MSG_260 "NTFS compression"
Note: Since this is a cheat-mode message, I don't specially care if it gets translated for the next version
o Version 1.0.8 (2014.01.21)
- Changed MSG_047 "%s (%c:)" -> "Multiple Volumes" (non-updated ones have been commented out)
- *NEW* MSG_093 "IMPORTANT: THIS DRIVE CONTAINS MULTIPLE PARTITIONS OR VOLUMES!!"

View File

@ -53,7 +53,7 @@
# http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-LCID%5D.pdf
# for the LCID (0x####) codes you should use
l "en-US" "English (English)" 0x0409, 0x0809, 0x0c09, 0x1009, 0x1409, 0x1809, 0x1c09, 0x2009, 0x2409, 0x2809, 0x2c09, 0x3009, 0x3409, 0x3809, 0x3c09, 0x4009, 0x4409, 0x4809
v 1.0.8
v 1.0.9
# Main dialog
g IDD_DIALOG
@ -427,6 +427,7 @@ t MSG_256 "Fake drive detection"
t MSG_257 "Joliet support"
t MSG_258 "Rock Ridge support"
t MSG_259 "Force update"
t MSG_260 "NTFS compression"
################################################################################
############################# TRANSLATOR END COPY ##############################
################################################################################
@ -1562,7 +1563,7 @@ t MSG_259 "Forceer update"
################################################################################
l "fr-FR" "French (Français)" 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c
v 1.0.8
v 1.0.9
b "en-US"
g IDD_DIALOG
@ -1913,6 +1914,7 @@ t MSG_256 "Test de contrefaçons"
t MSG_257 "Support Joliet"
t MSG_258 "Support Rock Ridge"
t MSG_259 "Forçage de mise à jour"
t MSG_260 "Compression NTFS"
################################################################################
l "de-DE" "German (Deutsch)" 0x0407, 0x0807, 0x0c07, 0x1007, 0x1407

View File

@ -614,7 +614,7 @@ int GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSyst
AnalyzeMBR(hPhysical);
for (i=0; i<DriveLayout->PartitionCount; i++) {
if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) {
uprintf("Partition %d:\n", DriveLayout->PartitionEntry[i].PartitionNumber);
uprintf("Partition %d:\n", i+1);
part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType;
uprintf(" Type: %s (0x%02x)\r\n Size: %s (%lld bytes)\r\n Start Sector: %d, Boot: %s, Recognized: %s\n",
((part_type==0x07)&&(FileSystemName[0]!=0))?FileSystemName:GetPartitionType(part_type), part_type,

View File

@ -56,7 +56,7 @@ static int task_number = 0;
extern const int nb_steps[FS_MAX];
extern uint32_t dur_mins, dur_secs;
static int fs_index = 0;
BOOL force_large_fat32 = FALSE;
BOOL force_large_fat32 = FALSE, enable_ntfs_compression = FALSE;
static BOOL WritePBR(HANDLE hLogicalDrive);
/*
@ -662,6 +662,7 @@ static BOOL FormatDrive(DWORD DriveIndex)
{
BOOL r = FALSE;
PF_DECL(FormatEx);
PF_DECL(EnableVolumeCompression);
char FSType[32];
char *locale, *VolumeName = NULL;
WCHAR* wVolumeName = NULL;
@ -678,18 +679,22 @@ static BOOL FormatDrive(DWORD DriveIndex)
} else {
PrintStatus(0, TRUE, MSG_222, FSType);
}
VolumeName = GetLogicalName(DriveIndex, FALSE, TRUE);
VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE);
wVolumeName = utf8_to_wchar(VolumeName);
if (wVolumeName == NULL) {
uprintf("Could not read volume name\n");
goto out;
}
// Hey, nice consistency here, Microsoft! - FormatEx() fails if wVolumeName has
// a trailing backslash, but EnableCompression() fails without...
wVolumeName[wcslen(wVolumeName)-1] = 0; // Remove trailing backslash
// LoadLibrary("fmifs.dll") appears to changes the locale, which can lead to
// problems with tolower(). Make sure we restore the locale. For more details,
// see http://comments.gmane.org/gmane.comp.gnu.mingw.user/39300
locale = setlocale(LC_ALL, NULL);
PF_INIT_OR_OUT(FormatEx, fmifs);
PF_INIT(EnableVolumeCompression, fmifs);
setlocale(LC_ALL, locale);
GetWindowTextW(hFileSystem, wFSType, ARRAYSIZE(wFSType));
@ -714,8 +719,19 @@ static BOOL FormatDrive(DWORD DriveIndex)
format_percent = 0.0f;
task_number = 0;
fs_index = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
pfFormatEx(wVolumeName, SelectedDrive.Geometry.MediaType, wFSType, wLabel,
IsChecked(IDC_QUICKFORMAT), ulClusterSize, FormatExCallback);
if ((fs == FS_NTFS) && (enable_ntfs_compression) && (pfEnableVolumeCompression != NULL)) {
wVolumeName[wcslen(wVolumeName)] = '\\'; // Add trailing backslash back again
if (pfEnableVolumeCompression(wVolumeName, FPF_COMPRESSED)) {
uprintf("Enabled NTFS compression\n");
} else {
uprintf("Could not enable NTFS compression: %s\n", WindowsErrorString());
}
}
if (!IS_ERROR(FormatStatus)) {
uprintf("Format completed.\n");
r = TRUE;

View File

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* Formatting function calls
* Copyright © 2007-2009 Tom Thornhill/Ridgecrop
* Copyright © 2011-2013 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2014 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -97,12 +97,12 @@ typedef LONG (WINAPI *Chkdsk_t)(
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383357.aspx */
typedef enum {
FPF_COMPRESSED = 0x01
FPF_COMPRESSED = 0x01
} FILE_SYSTEM_PROP_FLAG;
typedef BOOLEAN (WINAPI* EnableVolumeCompression_t)(
WCHAR* DriveRoot,
ULONG CompressionFlags // FILE_SYSTEM_PROP_FLAG
WCHAR* DriveRoot,
ULONG CompressionFlags // FILE_SYSTEM_PROP_FLAG
);
/* Large FAT32 */

View File

@ -358,6 +358,7 @@ const loc_control_id control_id[] = {
LOC_CTRL(MSG_257),
LOC_CTRL(MSG_258),
LOC_CTRL(MSG_259),
LOC_CTRL(MSG_260),
LOC_CTRL(MSG_MAX),
LOC_CTRL(IDOK),
LOC_CTRL(IDCANCEL),

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo This file recreates localization_data.c according resource.h
echo This file recreates localization_data.h according resource.h
echo
# check that sed is available

View File

@ -377,7 +377,8 @@
#define MSG_257 3257
#define MSG_258 3258
#define MSG_259 3259
#define MSG_MAX 3260
#define MSG_260 3260
#define MSG_MAX 3261
// Next default values for new objects
//

View File

@ -117,7 +117,7 @@ static BOOL log_displayed = FALSE;
static BOOL iso_provided = FALSE;
static BOOL user_notified = FALSE;
static BOOL relaunch = FALSE;
extern BOOL force_large_fat32, enable_joliet, enable_rockridge;
extern BOOL force_large_fat32, enable_joliet, enable_rockridge, enable_ntfs_compression;
static int selection_default;
static loc_cmd* selected_locale = NULL;
static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
@ -2479,6 +2479,12 @@ relaunch:
PrintStatus2000(lmprintf(MSG_256), detect_fakes);
continue;
}
// Alt N => Enable NTFS compression
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'N')) {
enable_ntfs_compression = !enable_ntfs_compression;
PrintStatus2000(lmprintf(MSG_260), enable_ntfs_compression);
continue;
}
// Alt-R => Remove all the registry keys created by Rufus
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) {
PrintStatus(2000, FALSE, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249);

View File

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

View File

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Virtual Disk Handling functions
* Copyright © 2013 Pete Batard <pete@akeo.ie>
* Copyright © 2013-2014 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -96,7 +96,8 @@ BOOL WimExtractCheck(void)
// Extract a file from a WIM image using wimgapi.dll (Windows 7 or later)
// NB: Don't bother trying to get progress from a WIM callback - it doesn't work!
// NB: if you want progress from a WIM callback, you must run the WIM API call in its own thread
// (which we don't do here) as it won't work otherwise. Thanks go to Erwan for figuring this out!
static BOOL WimExtractFile_API(const char* image, int index, const char* src, const char* dst)
{
BOOL r = FALSE;