diff --git a/res/appstore/Package.appxmanifest b/res/appstore/Package.appxmanifest
index 1f0b75e0..8dc06d2f 100644
--- a/res/appstore/Package.appxmanifest
+++ b/res/appstore/Package.appxmanifest
@@ -11,7 +11,7 @@
+ Version="3.14.1798.0" />
Rufus
diff --git a/src/format.c b/src/format.c
index f29e716f..6dc3547b 100644
--- a/src/format.c
+++ b/src/format.c
@@ -1323,7 +1323,7 @@ out:
return wintogo_index;
}
-// http://technet.microsoft.com/en-ie/library/jj721578.aspx
+// https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-8.1-and-8/jj721578(v=ws.11)
// As opposed to the technet guide above, we don't set internal drives offline,
// due to people wondering why they can't see them by default and we also use
// bcdedit rather than 'unattend.xml' to disable the recovery environment.
@@ -2189,7 +2189,7 @@ DWORD WINAPI FormatThread(void* param)
}
} else if (boot_type == BT_GRUB4DOS) {
grub4dos_dst[0] = drive_name[0];
- IGNORE_RETVAL(_chdirU(app_dir));
+ IGNORE_RETVAL(_chdirU(app_data_dir));
uprintf("Installing: %s (Grub4DOS loader) %s", grub4dos_dst,
IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"✓":"✗");
if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE))
diff --git a/src/iso.c b/src/iso.c
index ec58f134..82b923b2 100644
--- a/src/iso.c
+++ b/src/iso.c
@@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* ISO file extraction
- * Copyright © 2011-2020 Pete Batard
+ * Copyright © 2011-2021 Pete Batard
* Based on libcdio's iso & udf samples:
* Copyright © 2003-2014 Rocky Bernstein
*
@@ -512,7 +512,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
continue;
}
print_extracted_file(psz_fullpath, file_length);
- for (i=0; i
+ * Copyright © 2010-2021 Pete Batard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -642,6 +642,19 @@ static __inline UINT GetSystemWindowsDirectoryU(char* lpBuffer, UINT uSize)
return ret;
}
+static __inline BOOL SHGetSpecialFolderPathU(HWND hwnd, char* pszPath, int csidl, BOOL fCreate)
+{
+ BOOL ret;
+ DWORD err = ERROR_INVALID_DATA;
+ // pszPath is at least MAX_PATH characters in size
+ WCHAR wpszPath[MAX_PATH] = { 0 };
+ ret = SHGetSpecialFolderPathW(hwnd, wpszPath, csidl, fCreate);
+ err = GetLastError();
+ wchar_to_utf8_no_alloc(wpszPath, pszPath, MAX_PATH);
+ SetLastError(err);
+ return ret;
+}
+
static __inline DWORD GetTempPathU(DWORD nBufferLength, char* lpBuffer)
{
DWORD ret = 0, err = ERROR_INVALID_DATA;
diff --git a/src/net.c b/src/net.c
index 1e1597c0..80e849ea 100644
--- a/src/net.c
+++ b/src/net.c
@@ -997,7 +997,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
}
uprintf("Script signature is valid ✓");
- dwExitCode = RunCommand(cmdline, app_dir, TRUE);
+ dwExitCode = RunCommand(cmdline, app_data_dir, TRUE);
uprintf("Exited download script with code: %d", dwExitCode);
if ((dwExitCode == 0) && PeekNamedPipe(hPipe, NULL, dwPipeSize, NULL, &dwAvail, NULL) && (dwAvail != 0)) {
url = malloc(dwAvail + 1);
diff --git a/src/rufus.c b/src/rufus.c
index 4682c3c9..6beb02f8 100755
--- a/src/rufus.c
+++ b/src/rufus.c
@@ -129,6 +129,7 @@ int dialog_showing = 0, selection_default = BT_IMAGE, persistence_unit_selection
int default_fs, fs_type, boot_type, partition_type, target_type; // file system, boot type, partition type, target type
int force_update = 0, default_thread_priority = THREAD_PRIORITY_ABOVE_NORMAL;
char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH];
+char app_data_dir[MAX_PATH];
char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
char embedded_sl_version_ext[2][32];
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
@@ -982,6 +983,7 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
log_size = GetDlgItemTextU(hDlg, IDC_LOG_EDIT, log_buffer, log_size);
if (log_size != 0) {
log_size--; // remove NUL terminator
+ // TODO: Ideally we want to use user dir here
filepath = FileDialog(TRUE, app_dir, &log_ext, 0);
if (filepath != NULL) {
FileIO(TRUE, filepath, &log_buffer, &log_size);
@@ -1492,7 +1494,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
if ((partition_type == PARTITION_STYLE_MBR) && (img_report.has_grub2) && (img_report.grub2_version[0] != 0) &&
(strcmp(img_report.grub2_version, GRUB2_PACKAGE_VERSION) != 0)) {
// We may have to download a different Grub2 version if we can find one
- IGNORE_RETVAL(_chdirU(app_dir));
+ IGNORE_RETVAL(_chdirU(app_data_dir));
IGNORE_RETVAL(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR));
static_sprintf(tmp, "%s-%s/%s", grub, img_report.grub2_version, core_img);
@@ -1560,7 +1562,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
if ((partition_type == PARTITION_STYLE_MBR) && HAS_SYSLINUX(img_report)) {
if (SL_MAJOR(img_report.sl_version) < 5) {
- IGNORE_RETVAL(_chdirU(app_dir));
+ IGNORE_RETVAL(_chdirU(app_data_dir));
for (i=0; i Delete the 'rufus_files' subdirectory
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) {
- static_sprintf(tmp_path, "%s\\%s", app_dir, FILES_DIR);
+ static_sprintf(tmp_path, "%s\\%s", app_data_dir, FILES_DIR);
PrintStatus(STATUS_MSG_TIMEOUT, MSG_264, tmp_path);
SHDeleteDirectoryExU(NULL, tmp_path, FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION);
continue;
diff --git a/src/rufus.h b/src/rufus.h
index 80e60d4c..dce00e6e 100644
--- a/src/rufus.h
+++ b/src/rufus.h
@@ -115,11 +115,11 @@
#endif
#define DOWNLOAD_URL RUFUS_URL "/downloads"
#define FILES_URL RUFUS_URL "/files"
+#define FILES_DIR APPLICATION_NAME
#define FIDO_VERSION "z1"
#define SECURE_BOOT_MORE_INFO_URL "https://github.com/pbatard/rufus/wiki/FAQ#Why_do_I_need_to_disable_Secure_Boot_to_use_UEFINTFS"
#define WPPRECORDER_MORE_INFO_URL "https://github.com/pbatard/rufus/wiki/FAQ#BSODs_with_Windows_To_Go_drives_created_from_Windows_10_1809_ISOs"
#define SEVENZIP_URL "https://www.7-zip.org"
-#define FILES_DIR "rufus_files"
#define DEFAULT_ESP_MOUNT_POINT "S:\\"
#define IS_POWER_OF_2(x) ((x != 0) && (((x) & ((x) - 1)) == 0))
#define IGNORE_RETVAL(expr) do { (void)(expr); } while(0)
@@ -480,7 +480,7 @@ extern int fs_type, boot_type, partition_type, target_type;
extern unsigned long syslinux_ldlinux_len[2];
extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12];
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
-extern char *image_path, *fido_url;
+extern char app_data_dir[MAX_PATH], *image_path, *fido_url;
/*
* Shared prototypes
diff --git a/src/rufus.rc b/src/rufus.rc
index 21846d5b..9e64a037 100644
--- a/src/rufus.rc
+++ b/src/rufus.rc
@@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
-CAPTION "Rufus 3.14.1797"
+CAPTION "Rufus 3.14.1798"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 3,14,1797,0
- PRODUCTVERSION 3,14,1797,0
+ FILEVERSION 3,14,1798,0
+ PRODUCTVERSION 3,14,1798,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
- VALUE "FileVersion", "3.14.1797"
+ VALUE "FileVersion", "3.14.1798"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.14.exe"
VALUE "ProductName", "Rufus"
- VALUE "ProductVersion", "3.14.1797"
+ VALUE "ProductVersion", "3.14.1798"
END
END
BLOCK "VarFileInfo"
diff --git a/src/stdio.c b/src/stdio.c
index 530adcbb..1f49ddea 100644
--- a/src/stdio.c
+++ b/src/stdio.c
@@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* Standard User I/O Routines (logging, status, error, etc.)
* Copyright © 2020 Mattiwatti
- * Copyright © 2011-2020 Pete Batard
+ * Copyright © 2011-2021 Pete Batard
*
* 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
@@ -650,11 +650,11 @@ const char *WindowsErrorString(void)
&err_string[presize], sizeof(err_string)-(DWORD)strlen(err_string), NULL);
if (size == 0) {
format_error = GetLastError();
- if ((format_error) && (format_error != 0x13D)) // 0x13D, decode error, is returned for unknown codes
+ if ((format_error) && (format_error != ERROR_MR_MID_NOT_FOUND) && (format_error != ERROR_MUI_FILE_NOT_LOADED))
static_sprintf(err_string, "Windows error code 0x%08lX (FormatMessage error code 0x%08lX)",
error_code, format_error);
else
- static_sprintf(err_string, "Unknown error 0x%08lX", error_code);
+ static_sprintf(err_string, "Windows error code 0x%08lX", error_code);
} else {
// Microsoft may suffix CRLF to error messages, which we need to remove...
assert(presize > 2);
diff --git a/src/syslinux.c b/src/syslinux.c
index e15f1c5d..b85d7136 100644
--- a/src/syslinux.c
+++ b/src/syslinux.c
@@ -2,7 +2,7 @@
*
* Copyright 2003 Lars Munch Christensen - All Rights Reserved
* Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2012-2020 Pete Batard
+ * Copyright 2012-2021 Pete Batard
*
* Based on the Linux installer program for SYSLINUX by H. Peter Anvin
*
@@ -161,7 +161,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
/* Access a copy of the ldlinux.sys & ldlinux.bss resources (downloaded or embedded) */
if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) {
- IGNORE_RETVAL(_chdirU(app_dir));
+ IGNORE_RETVAL(_chdirU(app_data_dir));
for (i=0; i<2; i++) {
syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]);
if (syslinux_ldlinux[i] == NULL)
@@ -330,7 +330,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
uprintf("Successfully wrote Syslinux boot record");
if (boot_type == BT_SYSLINUX_V6) {
- IGNORE_RETVAL(_chdirU(app_dir));
+ IGNORE_RETVAL(_chdirU(app_data_dir));
static_sprintf(path, "%s/%s-%s", FILES_DIR, syslinux, embedded_sl_version_str[1]);
IGNORE_RETVAL(_chdir(path));
static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]);