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

[syslinux] remove unwanted 'isolinux.tmp' on error

* Also use a global 'temp_dir' variable and fix a small issue with Swedish translation
This commit is contained in:
Pete Batard 2017-07-18 12:57:22 +01:00
parent ae6fa7af39
commit 77e40d1373
5 changed files with 17 additions and 14 deletions

View file

@ -16412,7 +16412,7 @@ t MSG_292 "Välj den version av Windows du vill installera:"
t MSG_293 "Denna version stöds inte" t MSG_293 "Denna version stöds inte"
t MSG_294 "Denna version av Windows stöds inte längre av Rufus." t MSG_294 "Denna version av Windows stöds inte längre av Rufus."
t MSG_295 "Varning: Inofficiell version" t MSG_295 "Varning: Inofficiell version"
t MSG_296 "Denna version av Rufus producerades inte av original utvecklaren.\n\nÄr du säker på att du vill använda den?" t MSG_296 "Denna version av Rufus producerades inte av originalutvecklaren.\n\nÄr du säker på att du vill använda den?"
t MSG_297 "Ej komplett ISO-fil" t MSG_297 "Ej komplett ISO-fil"
t MSG_298 "ISO-filen du har valt matchar inte den angivna storleken: %s av data saknas!\n\nOm du har hämtat den här filen från internet, " t MSG_298 "ISO-filen du har valt matchar inte den angivna storleken: %s av data saknas!\n\nOm du har hämtat den här filen från internet, "
"prova då med att ladda ned filen igen och verifiera att checksumman MD5 eller SHA stämmer överens med den officiella filen.\n\n" "prova då med att ladda ned filen igen och verifiera att checksumman MD5 eller SHA stämmer överens med den officiella filen.\n\n"

View file

@ -82,7 +82,6 @@ static const char* grub_dirname = "/boot/grub/i386-pc";
static const char* grub_cfg = "grub.cfg"; static const char* grub_cfg = "grub.cfg";
static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf" }; static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf" };
static const char* arch_cfg[] = { "archiso_sys32.cfg", "archiso_sys64.cfg" }; static const char* arch_cfg[] = { "archiso_sys32.cfg", "archiso_sys64.cfg" };
static const char* isolinux_tmp = ".\\isolinux.tmp";
static const char* isolinux_bin[] = { "isolinux.bin", "boot.bin" }; static const char* isolinux_bin[] = { "isolinux.bin", "boot.bin" };
static const char* pe_dirname[] = { "/i386", "/minint" }; static const char* pe_dirname[] = { "/i386", "/minint" };
static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" }; static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" };
@ -789,6 +788,8 @@ out:
uprintf(" Will use '%s' for Syslinux", img_report.cfg_path); uprintf(" Will use '%s' for Syslinux", img_report.cfg_path);
// Extract all of the isolinux.bin files we found to identify their versions // Extract all of the isolinux.bin files we found to identify their versions
for (i=0; i<isolinux_path.Index; i++) { for (i=0; i<isolinux_path.Index; i++) {
char isolinux_tmp[MAX_PATH];
static_sprintf(isolinux_tmp, "%s\\isolinux.tmp", temp_dir);
size = (size_t)ExtractISOFile(src_iso, isolinux_path.String[i], isolinux_tmp, FILE_ATTRIBUTE_NORMAL); size = (size_t)ExtractISOFile(src_iso, isolinux_path.String[i], isolinux_tmp, FILE_ATTRIBUTE_NORMAL);
if (size == 0) { if (size == 0) {
uprintf(" Could not access %s", isolinux_path.String[i]); uprintf(" Could not access %s", isolinux_path.String[i]);
@ -821,8 +822,8 @@ out:
} }
} }
free(buf); free(buf);
_unlink(isolinux_tmp);
} }
_unlink(isolinux_tmp);
} }
if (img_report.sl_version != 0) { if (img_report.sl_version != 0) {
static_sprintf(img_report.sl_version_str, "%d.%02d", static_sprintf(img_report.sl_version_str, "%d.%02d",

View file

@ -94,7 +94,7 @@ HINSTANCE hMainInstance;
HWND hMainDialog, hLangToolbar = NULL, hUpdatesDlg = NULL; HWND hMainDialog, hLangToolbar = NULL, hUpdatesDlg = NULL;
MY_BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 }; MY_BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 };
GetTickCount64_t pfGetTickCount64 = NULL; GetTickCount64_t pfGetTickCount64 = NULL;
char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_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* image_path = NULL; char* image_path = NULL;
float fScale = 1.0f; float fScale = 1.0f;
int default_fs; int default_fs;
@ -3103,7 +3103,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
uprintf("Could not access UTF-16 args"); uprintf("Could not access UTF-16 args");
} }
// Retrieve the current application directory as well as the system & sysnative dirs // Retrieve various app & system directories
if (GetCurrentDirectoryU(sizeof(app_dir), app_dir) == 0) { if (GetCurrentDirectoryU(sizeof(app_dir), app_dir) == 0) {
uprintf("Could not get current directory: %s", WindowsErrorString()); uprintf("Could not get current directory: %s", WindowsErrorString());
app_dir[0] = 0; app_dir[0] = 0;
@ -3112,6 +3112,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
uprintf("Could not get system directory: %s", WindowsErrorString()); uprintf("Could not get system directory: %s", WindowsErrorString());
safe_strcpy(system_dir, sizeof(system_dir), "C:\\Windows\\System32"); safe_strcpy(system_dir, sizeof(system_dir), "C:\\Windows\\System32");
} }
if (GetTempPathU(sizeof(temp_dir), temp_dir) == 0) {
uprintf("Could not get temp directory: %s", WindowsErrorString());
safe_strcpy(temp_dir, sizeof(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
@ -3169,9 +3173,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
uprintf("loc file not found in current directory - embedded one will be used"); uprintf("loc file not found in current directory - embedded one will be used");
loc_data = (BYTE*)GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_LC_RUFUS_LOC), _RT_RCDATA, "embedded.loc", &loc_size, FALSE); loc_data = (BYTE*)GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_LC_RUFUS_LOC), _RT_RCDATA, "embedded.loc", &loc_size, FALSE);
if ( (GetTempPathU(sizeof(tmp_path), tmp_path) == 0) if ( (GetTempFileNameU(temp_dir, APPLICATION_NAME, 0, loc_file) == 0) || (loc_file[0] == 0) ) {
|| (GetTempFileNameU(tmp_path, APPLICATION_NAME, 0, loc_file) == 0)
|| (loc_file[0] == 0) ) {
// Last ditch effort to get a loc file - just extract it to the current directory // Last ditch effort to get a loc file - just extract it to the current directory
safe_strcpy(loc_file, sizeof(loc_file), rufus_loc); safe_strcpy(loc_file, sizeof(loc_file), rufus_loc);
} }

View file

@ -382,7 +382,7 @@ extern HWND hMainDialog, hLogDlg, hStatus, hDeviceList, hCapacity;
extern HWND hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog; extern HWND hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
extern HWND hInfo, hProgress, hDiskID, hStatusToolbar; extern HWND hInfo, hProgress, hDiskID, hStatusToolbar;
extern float fScale; extern float fScale;
extern char szFolderPath[MAX_PATH], app_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; extern char* image_path;
extern DWORD FormatStatus, DownloadStatus, MainThreadId; extern DWORD FormatStatus, DownloadStatus, MainThreadId;
extern BOOL PromptOnError; extern BOOL PromptOnError;

View file

@ -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.16.1138" CAPTION "Rufus 2.16.1139"
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
@ -366,8 +366,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,16,1138,0 FILEVERSION 2,16,1139,0
PRODUCTVERSION 2,16,1138,0 PRODUCTVERSION 2,16,1139,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -384,13 +384,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.16.1138" VALUE "FileVersion", "2.16.1139"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2017 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.16.1138" VALUE "ProductVersion", "2.16.1139"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"