From 9dfa31db0390c47622e37bb52286e010afaead5f Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 31 Mar 2021 12:27:19 +0100 Subject: [PATCH] [appstore] improve AppStore version detection * Also fix ESP prompt no longer appearing --- .vs/rufus.vcxproj | 16 ++++++++-------- res/appstore/Package.appxmanifest | 2 +- src/rufus.c | 30 +++++++++++++++--------------- src/rufus.rc | 10 +++++----- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj index bd4ec373..55644a25 100644 --- a/.vs/rufus.vcxproj +++ b/.vs/rufus.vcxproj @@ -121,7 +121,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -146,7 +146,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -172,7 +172,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -202,7 +202,7 @@ ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ProgramDatabase @@ -227,7 +227,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -253,7 +253,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -281,7 +281,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -312,7 +312,7 @@ X64 - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) + SOLUTION=$(SolutionName);_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) diff --git a/res/appstore/Package.appxmanifest b/res/appstore/Package.appxmanifest index 5c0420ca..98615653 100644 --- a/res/appstore/Package.appxmanifest +++ b/res/appstore/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="3.14.1748.0" /> Rufus diff --git a/src/rufus.c b/src/rufus.c index 06a2094f..b803e7fa 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -22,7 +22,6 @@ #include #endif - #include #include #include @@ -52,6 +51,9 @@ #include "../res/grub/grub_version.h" #include "../res/grub2/grub2_version.h" +#define rufus 0 +#define appstore 1 + enum bootcheck_return { BOOTCHECK_PROCEED = 0, BOOTCHECK_CANCEL = -1, @@ -134,6 +136,7 @@ char *archive_path = NULL, image_option_txt[128], *fido_url = NULL; StrArray DriveId, DriveName, DriveLabel, DriveHub, BlockingProcess, ImageList; // Number of steps for each FS for FCC_STRUCTURE_PROGRESS const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10, 1, 1, 1, 1 }; +const char* appstore_chunk[2] = { "\\WindowsApps\\19453.net.Rufus", "y8nh7bq2a8dtt\\rufus" }; const char* flash_type[BADLOCKS_PATTERN_TYPES] = { "SLC", "MLC", "TLC" }; // TODO: Remember to update copyright year in stdlg's AboutCallback() WM_INITDIALOG, @@ -1446,10 +1449,6 @@ static DWORD WINAPI BootCheckThread(LPVOID param) goto out; } - // If the selected target doesn't include include BIOS, skip file downloads for GRUB/Syslinux - if (target_type != TT_BIOS) - goto uefi_target; - if ((img_report.projected_size < MAX_ISO_TO_ESP_SIZE * MB) && HAS_REGULAR_EFI(img_report) && (partition_type == PARTITION_STYLE_GPT) && IS_FAT(fs_type)) { // The ISO is small enough to be written as an ESP and we are using GPT @@ -1463,6 +1462,10 @@ static DWORD WINAPI BootCheckThread(LPVOID param) write_as_esp = TRUE; } + // If the selected target doesn't include BIOS, skip file downloads for GRUB/Syslinux + if (target_type != TT_BIOS) + goto uefi_target; + 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 @@ -3176,16 +3179,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } #endif - // Look for a rufus.app file in the current app directory - // Since Microsoft makes it downright impossible to pass an arg in the app manifest - // and the automated VS2019 package building process doesn't like renaming the .exe - // right under its nose (else we would use the same trick as for portable vs regular) - // we use yet another workaround to detect if we are running the AppStore version... - static_sprintf(ini_path, "%s\\rufus.app", app_dir); - if (PathFileExistsU(ini_path)) { - appstore_version = TRUE; - goto skip_args_processing; - } +#if (SOLUTION == appstore) + appstore_version = TRUE; + for (i = 0; i < ARRAYSIZE(appstore_chunk); i++) + if (strstr(app_dir, appstore_chunk[0]) == NULL) + goto out; + goto skip_args_processing; +#endif // We have to process the arguments before we acquire the lock and process the locale PF_INIT(__wgetmainargs, Msvcrt); diff --git a/src/rufus.rc b/src/rufus.rc index 3a556ee8..6340f79b 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.1747" +CAPTION "Rufus 3.14.1748" 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,1747,0 - PRODUCTVERSION 3,14,1747,0 + FILEVERSION 3,14,1748,0 + PRODUCTVERSION 3,14,1748,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.1747" + VALUE "FileVersion", "3.14.1748" 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.1747" + VALUE "ProductVersion", "3.14.1748" END END BLOCK "VarFileInfo"