From f5072e45dee6cb1569931085b60114019fdf5b0e Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 16 Nov 2021 17:50:20 +0000 Subject: [PATCH] [misc] update solution to VS2022 * Also fix a possible mishandling of compounded strings in safe string macros --- .github/workflows/codeql.yml | 6 ++++-- .github/workflows/coverity.yml | 6 ++++-- .github/workflows/{vs2019.yml => vs2022.yml} | 10 ++++++---- .vs/bled.vcxproj | 16 ++++++++-------- .vs/ext2fs.vcxproj | 16 ++++++++-------- .vs/getopt.vcxproj | 16 ++++++++-------- .vs/libcdio-driver.vcxproj | 16 ++++++++-------- .vs/libcdio-iso9660.vcxproj | 16 ++++++++-------- .vs/libcdio-udf.vcxproj | 16 ++++++++-------- .vs/ms-sys.vcxproj | 16 ++++++++-------- .vs/rufus.vcxproj | 16 ++++++++-------- .vs/syslinux-libfat.vcxproj | 16 ++++++++-------- .vs/syslinux-libinstaller.vcxproj | 16 ++++++++-------- .vs/syslinux-win.vcxproj | 16 ++++++++-------- README.md | 4 ++-- src/rufus.h | 4 ++-- src/rufus.rc | 10 +++++----- 17 files changed, 111 insertions(+), 105 deletions(-) rename .github/workflows/{vs2019.yml => vs2022.yml} (94%) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index accd639d..c386c0f1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -33,7 +33,7 @@ env: jobs: CodeQL-Build: - runs-on: windows-latest + runs-on: windows-2022 permissions: security-events: write @@ -48,7 +48,9 @@ jobs: languages: cpp - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@v1.1 + with: + msbuild-architecture: x64 - name: Build run: msbuild ${{env.SOLUTION_FILE_PATH}} /m /p:Configuration=${{ env.BUILD_CONFIGURATION}},Platform=${{ env.TARGET_PLATFORM }} diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index ec3777aa..d371c9ae 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -23,7 +23,7 @@ env: jobs: Coverity-Build: - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Checkout repository @@ -44,7 +44,9 @@ jobs: run: echo "${{github.workspace}}/cov-analysis-win64/bin" >> $GITHUB_PATH - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@v1.1 + with: + msbuild-architecture: x64 - name: Build with Coverity run: cov-build.exe --dir cov-int msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=${{ env.BUILD_CONFIGURATION }},Platform=${{ env.TARGET_PLATFORM }} diff --git a/.github/workflows/vs2019.yml b/.github/workflows/vs2022.yml similarity index 94% rename from .github/workflows/vs2019.yml rename to .github/workflows/vs2022.yml index 51be7c39..227d4c56 100644 --- a/.github/workflows/vs2019.yml +++ b/.github/workflows/vs2022.yml @@ -1,4 +1,4 @@ -name: VS2019 +name: VS2022 on: push: @@ -30,8 +30,8 @@ env: BUILD_CONFIGURATION: Release jobs: - VS2019-Build: - runs-on: windows-latest + VS2022-Build: + runs-on: windows-2022 strategy: matrix: @@ -45,7 +45,9 @@ jobs: submodules: recursive - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@v1.1 + with: + msbuild-architecture: x64 - name: Set ALPHA id: set_alpha diff --git a/.vs/bled.vcxproj b/.vs/bled.vcxproj index c62320af..94e9e48e 100644 --- a/.vs/bled.vcxproj +++ b/.vs/bled.vcxproj @@ -83,49 +83,49 @@ StaticLibrary Unicode - v142 + v143 StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 true true StaticLibrary Unicode - v142 + v143 true true StaticLibrary Unicode - v142 + v143 true diff --git a/.vs/ext2fs.vcxproj b/.vs/ext2fs.vcxproj index 2d7a4565..521437b2 100644 --- a/.vs/ext2fs.vcxproj +++ b/.vs/ext2fs.vcxproj @@ -122,49 +122,49 @@ StaticLibrary Unicode - v142 + v143 StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 true true StaticLibrary Unicode - v142 + v143 true true StaticLibrary Unicode - v142 + v143 true diff --git a/.vs/getopt.vcxproj b/.vs/getopt.vcxproj index 87e23b34..767adf07 100644 --- a/.vs/getopt.vcxproj +++ b/.vs/getopt.vcxproj @@ -44,39 +44,39 @@ StaticLibrary Unicode true - v142 + v143 StaticLibrary Unicode true - v142 + v143 true StaticLibrary Unicode true - v142 + v143 true StaticLibrary Unicode - v142 + v143 true StaticLibrary Unicode - v142 + v143 true true StaticLibrary Unicode - v142 + v143 true true @@ -84,12 +84,12 @@ StaticLibrary Unicode true - v142 + v143 StaticLibrary Unicode - v142 + v143 true diff --git a/.vs/libcdio-driver.vcxproj b/.vs/libcdio-driver.vcxproj index f85cd1df..1e8b35c7 100644 --- a/.vs/libcdio-driver.vcxproj +++ b/.vs/libcdio-driver.vcxproj @@ -76,53 +76,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/.vs/libcdio-iso9660.vcxproj b/.vs/libcdio-iso9660.vcxproj index 46a95741..23ac97e6 100644 --- a/.vs/libcdio-iso9660.vcxproj +++ b/.vs/libcdio-iso9660.vcxproj @@ -68,53 +68,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/.vs/libcdio-udf.vcxproj b/.vs/libcdio-udf.vcxproj index bce09968..60ce04b7 100644 --- a/.vs/libcdio-udf.vcxproj +++ b/.vs/libcdio-udf.vcxproj @@ -62,53 +62,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/.vs/ms-sys.vcxproj b/.vs/ms-sys.vcxproj index ac2ac9b6..1679bf4f 100644 --- a/.vs/ms-sys.vcxproj +++ b/.vs/ms-sys.vcxproj @@ -105,53 +105,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj index 3c8b6f47..60a14a0f 100644 --- a/.vs/rufus.vcxproj +++ b/.vs/rufus.vcxproj @@ -46,39 +46,39 @@ Application Unicode true - v142 + v143 Application Unicode true - v142 + v143 true Application Unicode true - v142 + v143 true Application Unicode - v142 + v143 true Application Unicode - v142 + v143 true true Application Unicode - v142 + v143 true true @@ -86,12 +86,12 @@ Application Unicode true - v142 + v143 Application Unicode - v142 + v143 true diff --git a/.vs/syslinux-libfat.vcxproj b/.vs/syslinux-libfat.vcxproj index 75a8a109..732904b0 100644 --- a/.vs/syslinux-libfat.vcxproj +++ b/.vs/syslinux-libfat.vcxproj @@ -59,53 +59,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/.vs/syslinux-libinstaller.vcxproj b/.vs/syslinux-libinstaller.vcxproj index 0ad40902..8af68451 100644 --- a/.vs/syslinux-libinstaller.vcxproj +++ b/.vs/syslinux-libinstaller.vcxproj @@ -58,53 +58,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/.vs/syslinux-win.vcxproj b/.vs/syslinux-win.vcxproj index 70aea334..5e77cea3 100644 --- a/.vs/syslinux-win.vcxproj +++ b/.vs/syslinux-win.vcxproj @@ -52,53 +52,53 @@ StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 true StaticLibrary true Unicode - v142 + v143 StaticLibrary true Unicode - v142 + v143 diff --git a/README.md b/README.md index 34c0bf8a..d4209e19 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Rufus: The Reliable USB Formatting Utility ========================================== -[![Build status](https://img.shields.io/github/workflow/status/pbatard/rufus/VS2019.svg?style=flat-square&label=VS2019)](https://github.com/pbatard/rufus/actions/workflows/vs2019.yml) +[![Build status](https://img.shields.io/github/workflow/status/pbatard/rufus/VS2022.svg?style=flat-square&label=VS2022)](https://github.com/pbatard/rufus/actions/workflows/vs2022.yml) [![Build status](https://img.shields.io/github/workflow/status/pbatard/rufus/MinGW.svg?style=flat-square&label=MinGW)](https://github.com/pbatard/rufus/actions/workflows/mingw.yml) [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/2172.svg?style=flat-square)](https://scan.coverity.com/projects/pbatard-rufus) [![Build contributors](https://img.shields.io/github/contributors/pbatard/rufus.svg?style=flat-square)](https://github.com/pbatard/rufus/graphs/contributors) @@ -37,7 +37,7 @@ Features Compilation ----------- -Use either Visual Studio 2019 or MinGW and then invoke the `.sln` or `configure`/`make` respectively. +Use either Visual Studio 2022 or MinGW and then invoke the `.sln` or `configure`/`make` respectively. #### Visual Studio diff --git a/src/rufus.h b/src/rufus.h index 46e8864b..c4fd23f3 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -146,7 +146,7 @@ #define safe_mm_free(p) do {_mm_free((void*)p); p = NULL;} while(0) #define safe_min(a, b) min((size_t)(a), (size_t)(b)) #define safe_strcp(dst, dst_max, src, count) do {memcpy(dst, src, safe_min(count, dst_max)); \ - ((char*)dst)[safe_min(count, dst_max)-1] = 0;} while(0) + ((char*)(dst))[safe_min(count, dst_max)-1] = 0;} while(0) #define safe_strcpy(dst, dst_max, src) safe_strcp(dst, dst_max, src, safe_strlen(src)+1) #define static_strcpy(dst, src) safe_strcpy(dst, sizeof(dst), src) #define safe_strncat(dst, dst_max, src, count) strncat(dst, src, safe_min(count, dst_max - safe_strlen(dst) - 1)) @@ -161,7 +161,7 @@ #define safe_release_dc(hDlg, hDC) do {if ((hDC != INVALID_HANDLE_VALUE) && (hDC != NULL)) {ReleaseDC(hDlg, hDC); hDC = NULL;}} while(0) #define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0) #define static_sprintf(dst, ...) safe_sprintf(dst, sizeof(dst), __VA_ARGS__) -#define safe_strlen(str) ((((char*)str)==NULL)?0:strlen(str)) +#define safe_strlen(str) ((((char*)(str))==NULL)?0:strlen(str)) #define safe_strdup _strdup #define to_windows_path(str) do { size_t __i; for (__i = 0; __i < safe_strlen(str); __i++) if (str[__i] == '/') str[__i] = '\\'; } while(0) #if defined(_MSC_VER) diff --git a/src/rufus.rc b/src/rufus.rc index d5dc5664..085f1f5a 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.18.1849" +CAPTION "Rufus 3.18.1850" 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,18,1849,0 - PRODUCTVERSION 3,18,1849,0 + FILEVERSION 3,18,1850,0 + PRODUCTVERSION 3,18,1850,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.18.1849" + VALUE "FileVersion", "3.18.1850" 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.18.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.18.1849" + VALUE "ProductVersion", "3.18.1850" END END BLOCK "VarFileInfo"