aboutsummaryrefslogtreecommitdiff
path: root/C/Util/7zipInstall/7zipInstall.c
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2024-05-14 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2024-05-15 23:55:04 +0500
commitfc662341e6f85da78ada0e443f6116b978f79f22 (patch)
tree1be1cc402a7a9cbc18d4eeea6b141354c2d559e3 /C/Util/7zipInstall/7zipInstall.c
parent5b39dc76f1bc82f941d5c800ab9f34407a06b53a (diff)
download7zip-fc662341e6f85da78ada0e443f6116b978f79f22.tar.gz
7zip-fc662341e6f85da78ada0e443f6116b978f79f22.tar.bz2
7zip-fc662341e6f85da78ada0e443f6116b978f79f22.zip
24.0524.05
Diffstat (limited to 'C/Util/7zipInstall/7zipInstall.c')
-rw-r--r--C/Util/7zipInstall/7zipInstall.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/C/Util/7zipInstall/7zipInstall.c b/C/Util/7zipInstall/7zipInstall.c
index 7f5fd19..7d8e8c4 100644
--- a/C/Util/7zipInstall/7zipInstall.c
+++ b/C/Util/7zipInstall/7zipInstall.c
@@ -1,5 +1,5 @@
1/* 7zipInstall.c - 7-Zip Installer 1/* 7zipInstall.c - 7-Zip Installer
22023-04-04 : Igor Pavlov : Public domain */ 22024-04-05 : Igor Pavlov : Public domain */
3 3
4#include "Precomp.h" 4#include "Precomp.h"
5 5
@@ -11,6 +11,8 @@
11#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 11#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
12#endif 12#endif
13 13
14Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
15
14#ifdef Z7_OLD_WIN_SDK 16#ifdef Z7_OLD_WIN_SDK
15struct IShellView; 17struct IShellView;
16#define SHFOLDERAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE 18#define SHFOLDERAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
@@ -41,16 +43,6 @@ typedef enum {
41 // #pragma GCC diagnostic ignored "-Wcast-function-type" 43 // #pragma GCC diagnostic ignored "-Wcast-function-type"
42#endif 44#endif
43 45
44#if defined(__clang__) || defined(__GNUC__)
45typedef void (*Z7_voidFunction)(void);
46#define MY_CAST_FUNC (Z7_voidFunction)
47#elif defined(_MSC_VER) && _MSC_VER > 1920
48#define MY_CAST_FUNC (void *)
49// #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
50#else
51#define MY_CAST_FUNC
52#endif
53
54#define LLL_(quote) L##quote 46#define LLL_(quote) L##quote
55#define LLL(quote) LLL_(quote) 47#define LLL(quote) LLL_(quote)
56 48
@@ -118,11 +110,13 @@ static LPCWSTR const k_Reg_Path32 = L"Path"
118 #define k_Reg_WOW_Flag 0 110 #define k_Reg_WOW_Flag 0
119#endif 111#endif
120 112
113#ifdef USE_7ZIP_32_DLL
121#ifdef _WIN64 114#ifdef _WIN64
122 #define k_Reg_WOW_Flag_32 KEY_WOW64_32KEY 115 #define k_Reg_WOW_Flag_32 KEY_WOW64_32KEY
123#else 116#else
124 #define k_Reg_WOW_Flag_32 0 117 #define k_Reg_WOW_Flag_32 0
125#endif 118#endif
119#endif
126 120
127#define k_7zip_CLSID L"{23170F69-40C1-278A-1000-000100020000}" 121#define k_7zip_CLSID L"{23170F69-40C1-278A-1000-000100020000}"
128 122
@@ -219,11 +213,11 @@ static DWORD GetFileVersion(LPCWSTR s)
219 return 0; 213 return 0;
220 } 214 }
221 215
222 my_GetFileVersionInfoSizeW = (Func_GetFileVersionInfoSizeW) MY_CAST_FUNC GetProcAddress(g_version_dll_hModule, 216 my_GetFileVersionInfoSizeW = (Func_GetFileVersionInfoSizeW) Z7_CAST_FUNC_C GetProcAddress(g_version_dll_hModule,
223 "GetFileVersionInfoSizeW"); 217 "GetFileVersionInfoSizeW");
224 my_GetFileVersionInfoW = (Func_GetFileVersionInfoW) MY_CAST_FUNC GetProcAddress(g_version_dll_hModule, 218 my_GetFileVersionInfoW = (Func_GetFileVersionInfoW) Z7_CAST_FUNC_C GetProcAddress(g_version_dll_hModule,
225 "GetFileVersionInfoW"); 219 "GetFileVersionInfoW");
226 my_VerQueryValueW = (Func_VerQueryValueW) MY_CAST_FUNC GetProcAddress(g_version_dll_hModule, 220 my_VerQueryValueW = (Func_VerQueryValueW) Z7_CAST_FUNC_C GetProcAddress(g_version_dll_hModule,
227 "VerQueryValueW"); 221 "VerQueryValueW");
228 222
229 if (!my_GetFileVersionInfoSizeW 223 if (!my_GetFileVersionInfoSizeW
@@ -1102,7 +1096,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1102 { 1096 {
1103 BOOL isWow64 = FALSE; 1097 BOOL isWow64 = FALSE;
1104 const Func_IsWow64Process func_IsWow64Process = (Func_IsWow64Process) 1098 const Func_IsWow64Process func_IsWow64Process = (Func_IsWow64Process)
1105 MY_CAST_FUNC GetProcAddress(GetModuleHandleW(L"kernel32.dll"), 1099 Z7_CAST_FUNC_C GetProcAddress(GetModuleHandleW(L"kernel32.dll"),
1106 "IsWow64Process"); 1100 "IsWow64Process");
1107 1101
1108 if (func_IsWow64Process) 1102 if (func_IsWow64Process)
@@ -1111,7 +1105,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1111 if (!isWow64) 1105 if (!isWow64)
1112 { 1106 {
1113 if (!g_SilentMode) 1107 if (!g_SilentMode)
1114 PrintErrorMessage("This installation requires Windows " MY_CPU_NAME, NULL); 1108 PrintErrorMessage("This installation requires Windows "
1109 #ifdef MY_CPU_X86_OR_AMD64
1110 "x64"
1111 #else
1112 "64-bit"
1113 #endif
1114 , NULL);
1115 return 1; 1115 return 1;
1116 } 1116 }
1117 } 1117 }