From 7745edbb926ffc9381711f40bd9140e9e9efe457 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 27 Nov 2018 11:59:19 +0000 Subject: [PATCH] [misc] use COBJMACROS for COM calls --- .vs/rufus.vcxproj | 16 ++++++++-------- configure | 2 +- configure.ac | 2 +- src/rufus.rc | 10 +++++----- src/stdlg.c | 40 ++++++++++++++++++++-------------------- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj index 1a1d0cf0..224ad4ed 100644 --- a/.vs/rufus.vcxproj +++ b/.vs/rufus.vcxproj @@ -121,7 +121,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -145,7 +145,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -170,7 +170,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -199,7 +199,7 @@ ..\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;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ProgramDatabase @@ -223,7 +223,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -247,7 +247,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -273,7 +273,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) @@ -302,7 +302,7 @@ X64 - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions) MultiThreaded Level3 ..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories) diff --git a/configure b/configure index f348f9bc..3d9980a0 100755 --- a/configure +++ b/configure @@ -3894,7 +3894,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="${saved_CFLAGS}" -AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -std=gnu99 -Wshadow -Wall -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags" +AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -std=gnu99 -Wshadow -Wall -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags" diff --git a/configure.ac b/configure.ac index 87e0dd03..2ffca801 100644 --- a/configure.ac +++ b/configure.ac @@ -62,7 +62,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [nopointersign_cflags="-Wno-pointer-sign"], [nopointersign_cflags=""]) CFLAGS="${saved_CFLAGS}" -AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -std=gnu99 -Wshadow -Wall -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags" +AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -std=gnu99 -Wshadow -Wall -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Werror-implicit-function-declaration $nopointersign_cflags" AC_SUBST([VISIBILITY_CFLAGS]) AC_SUBST([AM_CFLAGS]) diff --git a/src/rufus.rc b/src/rufus.rc index 141bc663..007c993c 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.4.1426" +CAPTION "Rufus 3.4.1427" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -394,8 +394,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,4,1426,0 - PRODUCTVERSION 3,4,1426,0 + FILEVERSION 3,4,1427,0 + PRODUCTVERSION 3,4,1427,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -413,13 +413,13 @@ BEGIN VALUE "Comments", "https://akeo.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.4.1426" + VALUE "FileVersion", "3.4.1427" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus-3.4.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.4.1426" + VALUE "ProductVersion", "3.4.1427" END END BLOCK "VarFileInfo" diff --git a/src/stdlg.c b/src/stdlg.c index 7789abe9..8f4ed7d2 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -158,7 +158,7 @@ void BrowseForFolder(void) { pfod = NULL; // Just in case goto fallback; } - hr = pfod->lpVtbl->SetOptions(pfod, FOS_PICKFOLDERS); + hr = IFileOpenDialog_SetOptions(pfod, FOS_PICKFOLDERS); if (FAILED(hr)) { uprintf("Failed to set folder option for FileOpenDialog: error %X\n", hr); goto fallback; @@ -180,19 +180,19 @@ void BrowseForFolder(void) { hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); if (SUCCEEDED(hr)) { if (wpath != NULL) { - pfod->lpVtbl->SetFolder(pfod, si_path); + IFileOpenDialog_SetFolder(pfod, si_path); } if (fname != NULL) { - pfod->lpVtbl->SetFileName(pfod, fname); + IFileOpenDialog_SetFileName(pfod, fname); } } safe_free(wpath); - hr = pfod->lpVtbl->Show(pfod, hMainDialog); + hr = IFileOpenDialog_Show(pfod, hMainDialog); if (SUCCEEDED(hr)) { - hr = pfod->lpVtbl->GetResult(pfod, &psi); + hr = IFileOpenDialog_GetResult(pfod, &psi); if (SUCCEEDED(hr)) { - psi->lpVtbl->GetDisplayName(psi, SIGDN_FILESYSPATH, &wpath); + IShellItem_GetDisplayName(psi, SIGDN_FILESYSPATH, &wpath); tmp_path = wchar_to_utf8(wpath); CoTaskMemFree(wpath); if (tmp_path == NULL) { @@ -209,12 +209,12 @@ void BrowseForFolder(void) { uprintf("Could not show FileOpenDialog: error %X\n", hr); goto fallback; } - pfod->lpVtbl->Release(pfod); + IFileOpenDialog_Release(pfod); dialog_showing--; return; fallback: if (pfod != NULL) { - pfod->lpVtbl->Release(pfod); + IFileOpenDialog_Release(pfod); } memset(&bi, 0, sizeof(BROWSEINFOW)); @@ -280,7 +280,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) } // Set the file extension filters - pfd->lpVtbl->SetFileTypes(pfd, (UINT)ext->count + 1, filter_spec); + IFileDialog_SetFileTypes(pfd, (UINT)ext->count + 1, filter_spec); if (path == NULL) { // Try to use the "Downloads" folder as the initial default directory @@ -290,7 +290,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) if (SUCCEEDED(hr)) { hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); if (SUCCEEDED(hr)) { - pfd->lpVtbl->SetDefaultFolder(pfd, si_path); + IFileDialog_SetDefaultFolder(pfd, si_path); } CoTaskMemFree(wpath); } @@ -298,7 +298,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) wpath = utf8_to_wchar(path); hr = SHCreateItemFromParsingName(wpath, NULL, &IID_IShellItem, (LPVOID)&si_path); if (SUCCEEDED(hr)) { - pfd->lpVtbl->SetFolder(pfd, si_path); + IFileDialog_SetFolder(pfd, si_path); } safe_free(wpath); } @@ -306,11 +306,11 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) // Set the default filename wfilename = utf8_to_wchar((ext->filename == NULL) ? "" : ext->filename); if (wfilename != NULL) { - pfd->lpVtbl->SetFileName(pfd, wfilename); + IFileDialog_SetFileName(pfd, wfilename); } // Display the dialog - hr = pfd->lpVtbl->Show(pfd, hMainDialog); + hr = IFileDialog_Show(pfd, hMainDialog); // Cleanup safe_free(wfilename); @@ -323,9 +323,9 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) if (SUCCEEDED(hr)) { // Obtain the result of the user's interaction with the dialog. - hr = pfd->lpVtbl->GetResult(pfd, &psiResult); + hr = IFileDialog_GetResult(pfd, &psiResult); if (SUCCEEDED(hr)) { - hr = psiResult->lpVtbl->GetDisplayName(psiResult, SIGDN_FILESYSPATH, &wpath); + hr = IShellItem_GetDisplayName(psiResult, SIGDN_FILESYSPATH, &wpath); if (SUCCEEDED(hr)) { filepath = wchar_to_utf8(wpath); CoTaskMemFree(wpath); @@ -333,7 +333,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) SetLastError(hr); uprintf("Unable to access file path: %s\n", WindowsErrorString()); } - psiResult->lpVtbl->Release(psiResult); + IShellItem_Release(psiResult); } } else if ((hr & 0xFFFF) != ERROR_CANCELLED) { // If it's not a user cancel, assume the dialog didn't show and fallback @@ -341,7 +341,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) uprintf("Could not show FileOpenDialog: %s\n", WindowsErrorString()); goto fallback; } - pfd->lpVtbl->Release(pfd); + IFileDialog_Release(pfd); dialog_showing--; return filepath; } @@ -349,7 +349,7 @@ char* FileDialog(BOOL save, char* path, const ext_t* ext, DWORD options) fallback: safe_free(filter_spec); if (pfd != NULL) { - pfd->lpVtbl->Release(pfd); + IFileDialog_Release(pfd); } memset(&ofn, 0, sizeof(ofn)); @@ -1301,14 +1301,14 @@ BOOL SetTaskbarProgressState(TASKBAR_PROGRESS_FLAGS tbpFlags) { if (ptbl == NULL) return FALSE; - return !FAILED(ptbl->lpVtbl->SetProgressState(ptbl, hMainDialog, tbpFlags)); + return !FAILED(ITaskbarList3_SetProgressState(ptbl, hMainDialog, tbpFlags)); } BOOL SetTaskbarProgressValue(ULONGLONG ullCompleted, ULONGLONG ullTotal) { if (ptbl == NULL) return FALSE; - return !FAILED(ptbl->lpVtbl->SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal)); + return !FAILED(ITaskbarList3_SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal)); } static void Reposition(HWND hDlg, int id, int dx, int dw)