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

[core] move downloads from <app_location>\rufus_files\ to %LOCALAPPDATA%\Rufus\

* While this is intended to solve the issue of saving GRUB/Syslinux files for the
  App Store version, we apply this change globally, as it allows the user to move
  the Rufus executable around while preserving access to existing downloads.
* Closes #1744
This commit is contained in:
Pete Batard 2021-05-31 16:54:11 +01:00
parent aeae66e971
commit 9d7e96e293
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
10 changed files with 47 additions and 28 deletions

View file

@ -11,7 +11,7 @@
<Identity <Identity
Name="19453.net.Rufus" Name="19453.net.Rufus"
Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740"
Version="3.14.1797.0" /> Version="3.14.1798.0" />
<Properties> <Properties>
<DisplayName>Rufus</DisplayName> <DisplayName>Rufus</DisplayName>

View file

@ -1323,7 +1323,7 @@ out:
return wintogo_index; 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, // 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 // 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. // 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) { } else if (boot_type == BT_GRUB4DOS) {
grub4dos_dst[0] = drive_name[0]; 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, uprintf("Installing: %s (Grub4DOS loader) %s", grub4dos_dst,
IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"":""); IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"":"");
if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE)) if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE))

View file

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* ISO file extraction * ISO file extraction
* Copyright © 2011-2020 Pete Batard <pete@akeo.ie> * Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
* Based on libcdio's iso & udf samples: * Based on libcdio's iso & udf samples:
* Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org> * Copyright © 2003-2014 Rocky Bernstein <rocky@gnu.org>
* *
@ -512,7 +512,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
continue; continue;
} }
print_extracted_file(psz_fullpath, file_length); print_extracted_file(psz_fullpath, file_length);
for (i=0; i<NB_OLD_C32; i++) { for (i = 0; i < NB_OLD_C32; i++) {
if (props.is_old_c32[i] && use_own_c32[i]) { if (props.is_old_c32[i] && use_own_c32[i]) {
static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]); static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]);
if (CopyFileU(tmp, psz_fullpath, FALSE)) { if (CopyFileU(tmp, psz_fullpath, FALSE)) {
@ -869,7 +869,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan)
PrintInfo(0, MSG_202); PrintInfo(0, MSG_202);
} else { } else {
uprintf("Extracting files...\n"); uprintf("Extracting files...\n");
IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_chdirU(app_data_dir));
if (total_blocks == 0) { if (total_blocks == 0) {
uprintf("Error: ISO has not been properly scanned.\n"); uprintf("Error: ISO has not been properly scanned.\n");
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_SCAN); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_SCAN);

View file

@ -6,7 +6,7 @@
* *
* See also: https://utf8everywhere.org * See also: https://utf8everywhere.org
* *
* Copyright © 2010-2020 Pete Batard <pete@akeo.ie> * Copyright © 2010-2021 Pete Batard <pete@akeo.ie>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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; 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) static __inline DWORD GetTempPathU(DWORD nBufferLength, char* lpBuffer)
{ {
DWORD ret = 0, err = ERROR_INVALID_DATA; DWORD ret = 0, err = ERROR_INVALID_DATA;

View file

@ -997,7 +997,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
} }
uprintf("Script signature is valid ✓"); 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); uprintf("Exited download script with code: %d", dwExitCode);
if ((dwExitCode == 0) && PeekNamedPipe(hPipe, NULL, dwPipeSize, NULL, &dwAvail, NULL) && (dwAvail != 0)) { if ((dwExitCode == 0) && PeekNamedPipe(hPipe, NULL, dwPipeSize, NULL, &dwAvail, NULL) && (dwAvail != 0)) {
url = malloc(dwAvail + 1); url = malloc(dwAvail + 1);

View file

@ -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 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; 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 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_str[2][12] = { "?.??", "?.??" };
char embedded_sl_version_ext[2][32]; char embedded_sl_version_ext[2][32];
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64]; 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); log_size = GetDlgItemTextU(hDlg, IDC_LOG_EDIT, log_buffer, log_size);
if (log_size != 0) { if (log_size != 0) {
log_size--; // remove NUL terminator log_size--; // remove NUL terminator
// TODO: Ideally we want to use user dir here
filepath = FileDialog(TRUE, app_dir, &log_ext, 0); filepath = FileDialog(TRUE, app_dir, &log_ext, 0);
if (filepath != NULL) { if (filepath != NULL) {
FileIO(TRUE, filepath, &log_buffer, &log_size); 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) && 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)) { (strcmp(img_report.grub2_version, GRUB2_PACKAGE_VERSION) != 0)) {
// We may have to download a different Grub2 version if we can find one // 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(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR)); IGNORE_RETVAL(_chdir(FILES_DIR));
static_sprintf(tmp, "%s-%s/%s", grub, img_report.grub2_version, core_img); 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 ((partition_type == PARTITION_STYLE_MBR) && HAS_SYSLINUX(img_report)) {
if (SL_MAJOR(img_report.sl_version) < 5) { if (SL_MAJOR(img_report.sl_version) < 5) {
IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_chdirU(app_data_dir));
for (i=0; i<NB_OLD_C32; i++) { for (i=0; i<NB_OLD_C32; i++) {
if (img_report.has_old_c32[i]) { if (img_report.has_old_c32[i]) {
if (!in_files_dir) { if (!in_files_dir) {
@ -1596,7 +1598,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
} else if ((img_report.sl_version != embedded_sl_version[1]) || } else if ((img_report.sl_version != embedded_sl_version[1]) ||
(safe_strcmp(img_report.sl_version_ext, embedded_sl_version_ext[1]) != 0)) { (safe_strcmp(img_report.sl_version_ext, embedded_sl_version_ext[1]) != 0)) {
// Unlike what was the case for v4 and earlier, Syslinux v5+ versions are INCOMPATIBLE with one another! // Unlike what was the case for v4 and earlier, Syslinux v5+ versions are INCOMPATIBLE with one another!
IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_chdirU(app_data_dir));
IGNORE_RETVAL(_mkdir(FILES_DIR)); IGNORE_RETVAL(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR)); IGNORE_RETVAL(_chdir(FILES_DIR));
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
@ -1662,7 +1664,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
} }
} }
} else if (boot_type == BT_SYSLINUX_V6) { } else if (boot_type == BT_SYSLINUX_V6) {
IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_chdirU(app_data_dir));
IGNORE_RETVAL(_mkdir(FILES_DIR)); IGNORE_RETVAL(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR)); IGNORE_RETVAL(_chdir(FILES_DIR));
static_sprintf(tmp, "%s-%s/%s.%s", syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]); static_sprintf(tmp, "%s-%s/%s.%s", syslinux, embedded_sl_version_str[1], ldlinux, ldlinux_ext[2]);
@ -1695,7 +1697,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
goto out; goto out;
} }
} else if (boot_type == BT_GRUB4DOS) { } else if (boot_type == BT_GRUB4DOS) {
IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_chdirU(app_data_dir));
IGNORE_RETVAL(_mkdir(FILES_DIR)); IGNORE_RETVAL(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR)); IGNORE_RETVAL(_chdir(FILES_DIR));
static_sprintf(tmp, "grub4dos-%s/grldr", GRUB4DOS_VERSION); static_sprintf(tmp, "grub4dos-%s/grldr", GRUB4DOS_VERSION);
@ -3011,7 +3013,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
for (i = 0; i < ARRAYSIZE(ps_cmd); i++) { for (i = 0; i < ARRAYSIZE(ps_cmd); i++) {
// Run the PowerShell commands // Run the PowerShell commands
static_sprintf(cmdline, "%s -NonInteractive -NoProfile -Command %s", tmp, ps_cmd[i]); static_sprintf(cmdline, "%s -NonInteractive -NoProfile -Command %s", tmp, ps_cmd[i]);
if (RunCommand(cmdline, app_dir, TRUE) != 1) if (RunCommand(cmdline, app_data_dir, TRUE) != 1)
break; break;
} }
if (i == ARRAYSIZE(ps_cmd)) { if (i == ARRAYSIZE(ps_cmd)) {
@ -3191,6 +3193,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
uprintf("Could not get temp directory: %s", WindowsErrorString()); uprintf("Could not get temp directory: %s", WindowsErrorString());
static_strcpy(temp_dir, ".\\"); static_strcpy(temp_dir, ".\\");
} }
if (!SHGetSpecialFolderPathU(NULL, app_data_dir, CSIDL_LOCAL_APPDATA, FALSE)) {
uprintf("Could not get app data directory: %s", WindowsErrorString());
static_strcpy(app_data_dir, temp_dir);
}
// Construct Sysnative ourselves as there is no GetSysnativeDirectory() call // Construct Sysnative ourselves as there is no GetSysnativeDirectory() call
// By default (64bit app running on 64 bit OS or 32 bit app running on 32 bit OS) // By default (64bit app running on 64 bit OS or 32 bit app running on 32 bit OS)
// Sysnative and System32 are the same // Sysnative and System32 are the same
@ -3640,7 +3646,7 @@ relaunch:
} }
// Alt-D => Delete the 'rufus_files' subdirectory // Alt-D => Delete the 'rufus_files' subdirectory
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { 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); PrintStatus(STATUS_MSG_TIMEOUT, MSG_264, tmp_path);
SHDeleteDirectoryExU(NULL, tmp_path, FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION); SHDeleteDirectoryExU(NULL, tmp_path, FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION);
continue; continue;

View file

@ -115,11 +115,11 @@
#endif #endif
#define DOWNLOAD_URL RUFUS_URL "/downloads" #define DOWNLOAD_URL RUFUS_URL "/downloads"
#define FILES_URL RUFUS_URL "/files" #define FILES_URL RUFUS_URL "/files"
#define FILES_DIR APPLICATION_NAME
#define FIDO_VERSION "z1" #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 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 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 SEVENZIP_URL "https://www.7-zip.org"
#define FILES_DIR "rufus_files"
#define DEFAULT_ESP_MOUNT_POINT "S:\\" #define DEFAULT_ESP_MOUNT_POINT "S:\\"
#define IS_POWER_OF_2(x) ((x != 0) && (((x) & ((x) - 1)) == 0)) #define IS_POWER_OF_2(x) ((x != 0) && (((x) & ((x) - 1)) == 0))
#define IGNORE_RETVAL(expr) do { (void)(expr); } while(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 unsigned long syslinux_ldlinux_len[2];
extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12]; 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 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 * Shared prototypes

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
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 3.14.1797" CAPTION "Rufus 3.14.1798"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,14,1797,0 FILEVERSION 3,14,1798,0
PRODUCTVERSION 3,14,1797,0 PRODUCTVERSION 3,14,1798,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.14.1797" VALUE "FileVersion", "3.14.1798"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.14.exe" VALUE "OriginalFilename", "rufus-3.14.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.14.1797" VALUE "ProductVersion", "3.14.1798"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* Standard User I/O Routines (logging, status, error, etc.) * Standard User I/O Routines (logging, status, error, etc.)
* Copyright © 2020 Mattiwatti <mattiwatti@gmail.com> * Copyright © 2020 Mattiwatti <mattiwatti@gmail.com>
* Copyright © 2011-2020 Pete Batard <pete@akeo.ie> * Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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); &err_string[presize], sizeof(err_string)-(DWORD)strlen(err_string), NULL);
if (size == 0) { if (size == 0) {
format_error = GetLastError(); 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)", static_sprintf(err_string, "Windows error code 0x%08lX (FormatMessage error code 0x%08lX)",
error_code, format_error); error_code, format_error);
else else
static_sprintf(err_string, "Unknown error 0x%08lX", error_code); static_sprintf(err_string, "Windows error code 0x%08lX", error_code);
} else { } else {
// Microsoft may suffix CRLF to error messages, which we need to remove... // Microsoft may suffix CRLF to error messages, which we need to remove...
assert(presize > 2); assert(presize > 2);

View file

@ -2,7 +2,7 @@
* *
* Copyright 2003 Lars Munch Christensen - All Rights Reserved * Copyright 2003 Lars Munch Christensen - All Rights Reserved
* Copyright 1998-2008 H. Peter Anvin - 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 * 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) */ /* Access a copy of the ldlinux.sys & ldlinux.bss resources (downloaded or embedded) */
if ((syslinux_ldlinux_len[0] != 0) && (syslinux_ldlinux_len[1] != 0)) { 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++) { for (i=0; i<2; i++) {
syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]); syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]);
if (syslinux_ldlinux[i] == NULL) 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"); uprintf("Successfully wrote Syslinux boot record");
if (boot_type == BT_SYSLINUX_V6) { 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]); static_sprintf(path, "%s/%s-%s", FILES_DIR, syslinux, embedded_sl_version_str[1]);
IGNORE_RETVAL(_chdir(path)); IGNORE_RETVAL(_chdir(path));
static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]); static_sprintf(path, "%C:\\%s.%s", drive_letter, ldlinux, ldlinux_ext[2]);