aboutsummaryrefslogtreecommitdiff
path: root/C/Util/7zipInstall/7zipInstall.c
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2023-06-21 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2023-12-17 14:59:19 +0500
commit5b39dc76f1bc82f941d5c800ab9f34407a06b53a (patch)
treefe5e17420300b715021a76328444088d32047963 /C/Util/7zipInstall/7zipInstall.c
parent93be7d4abfd4233228f58ee1fbbcd76d91be66a4 (diff)
download7zip-5b39dc76f1bc82f941d5c800ab9f34407a06b53a.tar.gz
7zip-5b39dc76f1bc82f941d5c800ab9f34407a06b53a.tar.bz2
7zip-5b39dc76f1bc82f941d5c800ab9f34407a06b53a.zip
23.0123.01
Diffstat (limited to 'C/Util/7zipInstall/7zipInstall.c')
-rw-r--r--C/Util/7zipInstall/7zipInstall.c135
1 files changed, 82 insertions, 53 deletions
diff --git a/C/Util/7zipInstall/7zipInstall.c b/C/Util/7zipInstall/7zipInstall.c
index 2649734..7f5fd19 100644
--- a/C/Util/7zipInstall/7zipInstall.c
+++ b/C/Util/7zipInstall/7zipInstall.c
@@ -1,16 +1,31 @@
1/* 7zipInstall.c - 7-Zip Installer 1/* 7zipInstall.c - 7-Zip Installer
22022-07-15 : Igor Pavlov : Public domain */ 22023-04-04 : Igor Pavlov : Public domain */
3 3
4#include "Precomp.h" 4#include "Precomp.h"
5 5
6#define SZ_ERROR_ABORT 100 6#define SZ_ERROR_ABORT 100
7 7
8#ifdef _MSC_VER 8#include "../../7zWindows.h"
9
10#if defined(_MSC_VER) && _MSC_VER < 1600
9#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 11#pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
10#endif 12#endif
11 13
12#include <windows.h> 14#ifdef Z7_OLD_WIN_SDK
15struct IShellView;
16#define SHFOLDERAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
17SHFOLDERAPI SHGetFolderPathW(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
18#define BIF_NEWDIALOGSTYLE 0x0040 // Use the new dialog layout with the ability to resize
19typedef enum {
20 SHGFP_TYPE_CURRENT = 0, // current value for user, verify it exists
21 SHGFP_TYPE_DEFAULT = 1, // default value, may not exist
22} SHGFP_TYPE;
23#endif
24#if defined(__MINGW32__) || defined(__MINGW64__)
25#include <shlobj.h>
26#else
13#include <ShlObj.h> 27#include <ShlObj.h>
28#endif
14 29
15#include "../../7z.h" 30#include "../../7z.h"
16#include "../../7zAlloc.h" 31#include "../../7zAlloc.h"
@@ -22,40 +37,46 @@
22 37
23#include "resource.h" 38#include "resource.h"
24 39
25#if defined(__GNUC__) && (__GNUC__ >= 8) 40#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
26 #pragma GCC diagnostic ignored "-Wcast-function-type" 41 // #pragma GCC diagnostic ignored "-Wcast-function-type"
42#endif
43
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
27#endif 52#endif
28 53
29#define LLL_(quote) L##quote 54#define LLL_(quote) L##quote
30#define LLL(quote) LLL_(quote) 55#define LLL(quote) LLL_(quote)
31 56
32#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
33
34#define wcscat lstrcatW 57#define wcscat lstrcatW
35#define wcslen lstrlenW 58#define wcslen (size_t)lstrlenW
36#define wcscpy lstrcpyW 59#define wcscpy lstrcpyW
37// wcsncpy() and lstrcpynW() work differently. We don't use them. 60// wcsncpy() and lstrcpynW() work differently. We don't use them.
38 61
39
40#define kInputBufSize ((size_t)1 << 18) 62#define kInputBufSize ((size_t)1 << 18)
41 63
42 64#define Z7_7ZIP_CUR_VER ((MY_VER_MAJOR << 16) | MY_VER_MINOR)
43#define _7ZIP_CUR_VER ((MY_VER_MAJOR << 16) | MY_VER_MINOR) 65#define Z7_7ZIP_DLL_VER_COMPAT ((16 << 16) | 3)
44#define _7ZIP_DLL_VER_COMPAT ((16 << 16) | 3)
45 66
46static LPCSTR const k_7zip = "7-Zip"; 67static LPCSTR const k_7zip = "7-Zip";
47 68
48static LPCWSTR const k_Reg_Software_7zip = L"Software\\7-Zip"; 69static LPCWSTR const k_Reg_Software_7zip = L"Software\\7-Zip";
49 70
50// #define _64BIT_INSTALLER 1 71// #define Z7_64BIT_INSTALLER 1
51 72
52#ifdef _WIN64 73#ifdef _WIN64
53 #define _64BIT_INSTALLER 1 74 #define Z7_64BIT_INSTALLER 1
54#endif 75#endif
55 76
56#define k_7zip_with_Ver_base L"7-Zip " LLL(MY_VERSION) 77#define k_7zip_with_Ver_base L"7-Zip " LLL(MY_VERSION)
57 78
58#ifdef _64BIT_INSTALLER 79#ifdef Z7_64BIT_INSTALLER
59 80
60 // #define USE_7ZIP_32_DLL 81 // #define USE_7ZIP_32_DLL
61 82
@@ -84,14 +105,14 @@ static LPCWSTR const k_7zip_Setup = k_7zip_with_Ver L" Setup";
84static LPCWSTR const k_Reg_Path = L"Path"; 105static LPCWSTR const k_Reg_Path = L"Path";
85 106
86static LPCWSTR const k_Reg_Path32 = L"Path" 107static LPCWSTR const k_Reg_Path32 = L"Path"
87 #ifdef _64BIT_INSTALLER 108 #ifdef Z7_64BIT_INSTALLER
88 L"64" 109 L"64"
89 #else 110 #else
90 L"32" 111 L"32"
91 #endif 112 #endif
92 ; 113 ;
93 114
94#if defined(_64BIT_INSTALLER) && !defined(_WIN64) 115#if defined(Z7_64BIT_INSTALLER) && !defined(_WIN64)
95 #define k_Reg_WOW_Flag KEY_WOW64_64KEY 116 #define k_Reg_WOW_Flag KEY_WOW64_64KEY
96#else 117#else
97 #define k_Reg_WOW_Flag 0 118 #define k_Reg_WOW_Flag 0
@@ -126,8 +147,6 @@ static WCHAR cmdError[MAX_PATH + 4];
126static WCHAR path[MAX_PATH * 2 + 40]; 147static WCHAR path[MAX_PATH * 2 + 40];
127 148
128 149
129// #define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) -= 0x20 : (c)))
130
131 150
132static void CpyAscii(wchar_t *dest, const char *s) 151static void CpyAscii(wchar_t *dest, const char *s)
133{ 152{
@@ -200,9 +219,12 @@ static DWORD GetFileVersion(LPCWSTR s)
200 return 0; 219 return 0;
201 } 220 }
202 221
203 my_GetFileVersionInfoSizeW = (Func_GetFileVersionInfoSizeW)GetProcAddress(g_version_dll_hModule, "GetFileVersionInfoSizeW"); 222 my_GetFileVersionInfoSizeW = (Func_GetFileVersionInfoSizeW) MY_CAST_FUNC GetProcAddress(g_version_dll_hModule,
204 my_GetFileVersionInfoW = (Func_GetFileVersionInfoW)GetProcAddress(g_version_dll_hModule, "GetFileVersionInfoW"); 223 "GetFileVersionInfoSizeW");
205 my_VerQueryValueW = (Func_VerQueryValueW)GetProcAddress(g_version_dll_hModule, "VerQueryValueW"); 224 my_GetFileVersionInfoW = (Func_GetFileVersionInfoW) MY_CAST_FUNC GetProcAddress(g_version_dll_hModule,
225 "GetFileVersionInfoW");
226 my_VerQueryValueW = (Func_VerQueryValueW) MY_CAST_FUNC GetProcAddress(g_version_dll_hModule,
227 "VerQueryValueW");
206 228
207 if (!my_GetFileVersionInfoSizeW 229 if (!my_GetFileVersionInfoSizeW
208 || !my_GetFileVersionInfoW 230 || !my_GetFileVersionInfoW
@@ -253,7 +275,7 @@ static int ReverseFind_PathSepar(const wchar_t *s)
253 } 275 }
254} 276}
255 277
256static WRes CreateComplexDir() 278static WRes CreateComplexDir(void)
257{ 279{
258 WCHAR s[MAX_PATH + 10]; 280 WCHAR s[MAX_PATH + 10];
259 281
@@ -287,7 +309,7 @@ static WRes CreateComplexDir()
287 { 309 {
288 size_t len = wcslen(s); 310 size_t len = wcslen(s);
289 { 311 {
290 int pos = ReverseFind_PathSepar(s); 312 const int pos = ReverseFind_PathSepar(s);
291 if (pos < 0) 313 if (pos < 0)
292 return wres; 314 return wres;
293 if ((unsigned)pos < prefixSize) 315 if ((unsigned)pos < prefixSize)
@@ -297,7 +319,7 @@ static WRes CreateComplexDir()
297 if (len == 1) 319 if (len == 1)
298 return 0; 320 return 0;
299 s[pos] = 0; 321 s[pos] = 0;
300 len = pos; 322 len = (unsigned)pos;
301 } 323 }
302 } 324 }
303 325
@@ -309,7 +331,7 @@ static WRes CreateComplexDir()
309 break; 331 break;
310 if (wres == ERROR_ALREADY_EXISTS) 332 if (wres == ERROR_ALREADY_EXISTS)
311 { 333 {
312 DWORD attrib = GetFileAttributesW(s); 334 const DWORD attrib = GetFileAttributesW(s);
313 if (attrib != INVALID_FILE_ATTRIBUTES) 335 if (attrib != INVALID_FILE_ATTRIBUTES)
314 if ((attrib & FILE_ATTRIBUTE_DIRECTORY) == 0) 336 if ((attrib & FILE_ATTRIBUTE_DIRECTORY) == 0)
315 return ERROR_ALREADY_EXISTS; 337 return ERROR_ALREADY_EXISTS;
@@ -323,7 +345,7 @@ static WRes CreateComplexDir()
323 345
324 for (;;) 346 for (;;)
325 { 347 {
326 size_t pos = wcslen(s); 348 const size_t pos = wcslen(s);
327 if (pos >= len) 349 if (pos >= len)
328 return 0; 350 return 0;
329 s[pos] = CHAR_PATH_SEPARATOR; 351 s[pos] = CHAR_PATH_SEPARATOR;
@@ -339,7 +361,7 @@ static int MyRegistry_QueryString(HKEY hKey, LPCWSTR name, LPWSTR dest)
339{ 361{
340 DWORD cnt = MAX_PATH * sizeof(name[0]); 362 DWORD cnt = MAX_PATH * sizeof(name[0]);
341 DWORD type = 0; 363 DWORD type = 0;
342 LONG res = RegQueryValueExW(hKey, name, NULL, &type, (LPBYTE)dest, (DWORD *)&cnt); 364 const LONG res = RegQueryValueExW(hKey, name, NULL, &type, (LPBYTE)dest, &cnt);
343 if (type != REG_SZ) 365 if (type != REG_SZ)
344 return False; 366 return False;
345 return res == ERROR_SUCCESS; 367 return res == ERROR_SUCCESS;
@@ -348,11 +370,11 @@ static int MyRegistry_QueryString(HKEY hKey, LPCWSTR name, LPWSTR dest)
348static int MyRegistry_QueryString2(HKEY hKey, LPCWSTR keyName, LPCWSTR valName, LPWSTR dest) 370static int MyRegistry_QueryString2(HKEY hKey, LPCWSTR keyName, LPCWSTR valName, LPWSTR dest)
349{ 371{
350 HKEY key = 0; 372 HKEY key = 0;
351 LONG res = RegOpenKeyExW(hKey, keyName, 0, KEY_READ | k_Reg_WOW_Flag, &key); 373 const LONG res = RegOpenKeyExW(hKey, keyName, 0, KEY_READ | k_Reg_WOW_Flag, &key);
352 if (res != ERROR_SUCCESS) 374 if (res != ERROR_SUCCESS)
353 return False; 375 return False;
354 { 376 {
355 BoolInt res2 = MyRegistry_QueryString(key, valName, dest); 377 const BoolInt res2 = MyRegistry_QueryString(key, valName, dest);
356 RegCloseKey(key); 378 RegCloseKey(key);
357 return res2; 379 return res2;
358 } 380 }
@@ -550,7 +572,7 @@ static void NormalizePrefix(WCHAR *s)
550 572
551 for (;; i++) 573 for (;; i++)
552 { 574 {
553 wchar_t c = s[i]; 575 const wchar_t c = s[i];
554 if (c == 0) 576 if (c == 0)
555 break; 577 break;
556 if (c == '/') 578 if (c == '/')
@@ -587,7 +609,7 @@ static LPCWSTR FindSubString(LPCWSTR s1, const char *s2)
587 return NULL; 609 return NULL;
588 for (i = 0;; i++) 610 for (i = 0;; i++)
589 { 611 {
590 Byte b = s2[i]; 612 const char b = s2[i];
591 if (b == 0) 613 if (b == 0)
592 return s1; 614 return s1;
593 if (MyWCharLower_Ascii(s1[i]) != (Byte)MyCharLower_Ascii(b)) 615 if (MyWCharLower_Ascii(s1[i]) != (Byte)MyCharLower_Ascii(b))
@@ -610,7 +632,7 @@ static void Set7zipPostfix(WCHAR *s)
610 632
611static int Install(void); 633static int Install(void);
612 634
613static void OnClose() 635static void OnClose(void)
614{ 636{
615 if (g_Install_was_Pressed && !g_Finished) 637 if (g_Install_was_Pressed && !g_Finished)
616 { 638 {
@@ -624,7 +646,13 @@ static void OnClose()
624 g_HWND = NULL; 646 g_HWND = NULL;
625} 647}
626 648
627static INT_PTR CALLBACK MyDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 649static
650#ifdef Z7_OLD_WIN_SDK
651 BOOL
652#else
653 INT_PTR
654#endif
655CALLBACK MyDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
628{ 656{
629 // UNUSED_VAR(hwnd) 657 // UNUSED_VAR(hwnd)
630 UNUSED_VAR(lParam) 658 UNUSED_VAR(lParam)
@@ -730,7 +758,7 @@ static LONG SetRegKey_Path2(HKEY parentKey)
730 return res; 758 return res;
731} 759}
732 760
733static void SetRegKey_Path() 761static void SetRegKey_Path(void)
734{ 762{
735 SetRegKey_Path2(HKEY_CURRENT_USER); 763 SetRegKey_Path2(HKEY_CURRENT_USER);
736 SetRegKey_Path2(HKEY_LOCAL_MACHINE); 764 SetRegKey_Path2(HKEY_LOCAL_MACHINE);
@@ -828,7 +856,7 @@ static void SetShellProgramsGroup(HWND hwndOwner)
828static LPCWSTR const k_Shell_Approved = L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"; 856static LPCWSTR const k_Shell_Approved = L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved";
829static LPCWSTR const k_7zip_ShellExtension = L"7-Zip Shell Extension"; 857static LPCWSTR const k_7zip_ShellExtension = L"7-Zip Shell Extension";
830 858
831static void WriteCLSID() 859static void WriteCLSID(void)
832{ 860{
833 HKEY destKey; 861 HKEY destKey;
834 LONG res; 862 LONG res;
@@ -879,12 +907,12 @@ static LPCSTR const k_ShellEx_Items[] =
879 , "Drive\\shellex\\DragDropHandlers" 907 , "Drive\\shellex\\DragDropHandlers"
880}; 908};
881 909
882static void WriteShellEx() 910static void WriteShellEx(void)
883{ 911{
884 unsigned i; 912 unsigned i;
885 WCHAR destPath[MAX_PATH + 40]; 913 WCHAR destPath[MAX_PATH + 40];
886 914
887 for (i = 0; i < ARRAY_SIZE(k_ShellEx_Items); i++) 915 for (i = 0; i < Z7_ARRAY_SIZE(k_ShellEx_Items); i++)
888 { 916 {
889 CpyAscii(destPath, k_ShellEx_Items[i]); 917 CpyAscii(destPath, k_ShellEx_Items[i]);
890 CatAscii(destPath, "\\7-Zip"); 918 CatAscii(destPath, "\\7-Zip");
@@ -968,7 +996,7 @@ static const wchar_t *GetCmdParam(const wchar_t *s)
968 quoteMode = !quoteMode; 996 quoteMode = !quoteMode;
969 continue; 997 continue;
970 } 998 }
971 if (pos >= ARRAY_SIZE(cmd) - 1) 999 if (pos >= Z7_ARRAY_SIZE(cmd) - 1)
972 exit(1); 1000 exit(1);
973 cmd[pos++] = c; 1001 cmd[pos++] = c;
974 } 1002 }
@@ -1026,7 +1054,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1026 for (;;) 1054 for (;;)
1027 { 1055 {
1028 { 1056 {
1029 wchar_t c = *s; 1057 const wchar_t c = *s;
1030 if (c == 0) 1058 if (c == 0)
1031 break; 1059 break;
1032 if (c == ' ') 1060 if (c == ' ')
@@ -1070,11 +1098,12 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1070 } 1098 }
1071 } 1099 }
1072 1100
1073 #if defined(_64BIT_INSTALLER) && !defined(_WIN64) 1101 #if defined(Z7_64BIT_INSTALLER) && !defined(_WIN64)
1074 { 1102 {
1075 BOOL isWow64 = FALSE; 1103 BOOL isWow64 = FALSE;
1076 Func_IsWow64Process func_IsWow64Process = (Func_IsWow64Process) 1104 const Func_IsWow64Process func_IsWow64Process = (Func_IsWow64Process)
1077 GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "IsWow64Process"); 1105 MY_CAST_FUNC GetProcAddress(GetModuleHandleW(L"kernel32.dll"),
1106 "IsWow64Process");
1078 1107
1079 if (func_IsWow64Process) 1108 if (func_IsWow64Process)
1080 func_IsWow64Process(GetCurrentProcess(), &isWow64); 1109 func_IsWow64Process(GetCurrentProcess(), &isWow64);
@@ -1093,7 +1122,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1093 { 1122 {
1094 HKEY key = 0; 1123 HKEY key = 0;
1095 BoolInt ok = False; 1124 BoolInt ok = False;
1096 LONG res = RegOpenKeyExW(HKEY_CURRENT_USER, k_Reg_Software_7zip, 0, KEY_READ | k_Reg_WOW_Flag, &key); 1125 const LONG res = RegOpenKeyExW(HKEY_CURRENT_USER, k_Reg_Software_7zip, 0, KEY_READ | k_Reg_WOW_Flag, &key);
1097 if (res == ERROR_SUCCESS) 1126 if (res == ERROR_SUCCESS)
1098 { 1127 {
1099 ok = MyRegistry_QueryString(key, k_Reg_Path32, path); 1128 ok = MyRegistry_QueryString(key, k_Reg_Path32, path);
@@ -1109,7 +1138,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1109 CpyAscii(path, "\\Program Files\\"); 1138 CpyAscii(path, "\\Program Files\\");
1110 #else 1139 #else
1111 1140
1112 #ifdef _64BIT_INSTALLER 1141 #ifdef Z7_64BIT_INSTALLER
1113 { 1142 {
1114 DWORD ttt = GetEnvironmentVariableW(L"ProgramW6432", path, MAX_PATH); 1143 DWORD ttt = GetEnvironmentVariableW(L"ProgramW6432", path, MAX_PATH);
1115 if (ttt == 0 || ttt > MAX_PATH) 1144 if (ttt == 0 || ttt > MAX_PATH)
@@ -1150,7 +1179,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1150 return 1; 1179 return 1;
1151 1180
1152 { 1181 {
1153 HICON hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON)); 1182 const HICON hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
1154 // SendMessage(g_HWND, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon); 1183 // SendMessage(g_HWND, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon);
1155 SendMessage(g_HWND, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon); 1184 SendMessage(g_HWND, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon);
1156 } 1185 }
@@ -1244,7 +1273,7 @@ static int Install(void)
1244 allocTempImp.Free = SzFreeTemp; 1273 allocTempImp.Free = SzFreeTemp;
1245 1274
1246 { 1275 {
1247 DWORD len = GetModuleFileNameW(NULL, sfxPath, MAX_PATH); 1276 const DWORD len = GetModuleFileNameW(NULL, sfxPath, MAX_PATH);
1248 if (len == 0 || len > MAX_PATH) 1277 if (len == 0 || len > MAX_PATH)
1249 return 1; 1278 return 1;
1250 } 1279 }
@@ -1286,7 +1315,7 @@ if (res == SZ_OK)
1286 1315
1287 for (;;) 1316 for (;;)
1288 { 1317 {
1289 wchar_t c = path[i++]; 1318 const wchar_t c = path[i++];
1290 if (c == 0) 1319 if (c == 0)
1291 break; 1320 break;
1292 if (c != ' ') 1321 if (c != ' ')
@@ -1318,7 +1347,7 @@ if (res == SZ_OK)
1318 { 1347 {
1319 lookStream.bufSize = kInputBufSize; 1348 lookStream.bufSize = kInputBufSize;
1320 lookStream.realStream = &archiveStream.vt; 1349 lookStream.realStream = &archiveStream.vt;
1321 LookToRead2_Init(&lookStream); 1350 LookToRead2_INIT(&lookStream)
1322 } 1351 }
1323 } 1352 }
1324 1353
@@ -1372,7 +1401,7 @@ if (res == SZ_OK)
1372 } 1401 }
1373 1402
1374 { 1403 {
1375 size_t len = SzArEx_GetFileNameUtf16(&db, i, NULL); 1404 const size_t len = SzArEx_GetFileNameUtf16(&db, i, NULL);
1376 if (len >= MAX_PATH) 1405 if (len >= MAX_PATH)
1377 { 1406 {
1378 res = SZ_ERROR_FAIL; 1407 res = SZ_ERROR_FAIL;
@@ -1468,8 +1497,8 @@ if (res == SZ_OK)
1468 #endif 1497 #endif
1469 ) 1498 )
1470 { 1499 {
1471 DWORD ver = GetFileVersion(path); 1500 const DWORD ver = GetFileVersion(path);
1472 fileLevel = ((ver < _7ZIP_DLL_VER_COMPAT || ver > _7ZIP_CUR_VER) ? 2 : 1); 1501 fileLevel = ((ver < Z7_7ZIP_DLL_VER_COMPAT || ver > Z7_7ZIP_CUR_VER) ? 2 : 1);
1473 tempIndex++; 1502 tempIndex++;
1474 continue; 1503 continue;
1475 } 1504 }
@@ -1537,7 +1566,7 @@ if (res == SZ_OK)
1537 #endif 1566 #endif
1538 1567
1539 { 1568 {
1540 SRes winRes2 = File_Close(&outFile); 1569 const WRes winRes2 = File_Close(&outFile);
1541 if (res != SZ_OK) 1570 if (res != SZ_OK)
1542 break; 1571 break;
1543 if (winRes2 != 0) 1572 if (winRes2 != 0)