aboutsummaryrefslogtreecommitdiff
path: root/C/Util/7z
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/7z
parent5b39dc76f1bc82f941d5c800ab9f34407a06b53a (diff)
download7zip-24.05.tar.gz
7zip-24.05.tar.bz2
7zip-24.05.zip
24.0524.05
Diffstat (limited to '')
-rw-r--r--C/Util/7z/7z.dsp8
-rw-r--r--C/Util/7z/7zMain.c45
-rw-r--r--C/Util/7z/Precomp.h13
-rw-r--r--C/Util/7z/makefile8
-rw-r--r--C/Util/7zipInstall/7zipInstall.c32
-rw-r--r--C/Util/7zipInstall/Precomp.h13
-rw-r--r--C/Util/7zipInstall/makefile9
-rw-r--r--C/Util/7zipInstall/resource.rc5
-rw-r--r--C/Util/7zipUninstall/7zipUninstall.c75
-rw-r--r--C/Util/7zipUninstall/Precomp.h13
-rw-r--r--C/Util/7zipUninstall/resource.rc5
11 files changed, 127 insertions, 99 deletions
diff --git a/C/Util/7z/7z.dsp b/C/Util/7z/7z.dsp
index 11e1b03..474c660 100644
--- a/C/Util/7z/7z.dsp
+++ b/C/Util/7z/7z.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
42# PROP Ignore_Export_Lib 0 42# PROP Ignore_Export_Lib 0
43# PROP Target_Dir "" 43# PROP Target_Dir ""
44# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c 44# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
45# ADD CPP /nologo /MD /W4 /WX /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /D "Z7_PPMD_SUPPORT" /FAcs /Yu"Precomp.h" /FD /c 45# ADD CPP /nologo /MD /W4 /WX /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /D "Z7_PPMD_SUPPORT" /D "Z7_EXTRACT_ONLY" /FAcs /Yu"Precomp.h" /FD /c
46# ADD BASE RSC /l 0x419 /d "NDEBUG" 46# ADD BASE RSC /l 0x419 /d "NDEBUG"
47# ADD RSC /l 0x419 /d "NDEBUG" 47# ADD RSC /l 0x419 /d "NDEBUG"
48BSC32=bscmake.exe 48BSC32=bscmake.exe
@@ -67,7 +67,7 @@ LINK32=link.exe
67# PROP Ignore_Export_Lib 0 67# PROP Ignore_Export_Lib 0
68# PROP Target_Dir "" 68# PROP Target_Dir ""
69# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c 69# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
70# ADD CPP /nologo /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_SZ_ALLOC_DEBUG2" /D "_SZ_NO_INT_64_A" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /D "Z7_PPMD_SUPPORT" /Yu"Precomp.h" /FD /GZ /c 70# ADD CPP /nologo /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_SZ_ALLOC_DEBUG2" /D "_SZ_NO_INT_64_A" /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /D "Z7_PPMD_SUPPORT" /D "Z7_EXTRACT_ONLY" /Yu"Precomp.h" /FD /GZ /c
71# ADD BASE RSC /l 0x419 /d "_DEBUG" 71# ADD BASE RSC /l 0x419 /d "_DEBUG"
72# ADD RSC /l 0x419 /d "_DEBUG" 72# ADD RSC /l 0x419 /d "_DEBUG"
73BSC32=bscmake.exe 73BSC32=bscmake.exe
@@ -234,6 +234,10 @@ SOURCE=.\Precomp.c
234# End Source File 234# End Source File
235# Begin Source File 235# Begin Source File
236 236
237SOURCE=..\..\Precomp.h
238# End Source File
239# Begin Source File
240
237SOURCE=.\Precomp.h 241SOURCE=.\Precomp.h
238# End Source File 242# End Source File
239# End Group 243# End Group
diff --git a/C/Util/7z/7zMain.c b/C/Util/7z/7zMain.c
index 547920a..6baf979 100644
--- a/C/Util/7z/7zMain.c
+++ b/C/Util/7z/7zMain.c
@@ -1,20 +1,11 @@
1/* 7zMain.c - Test application for 7z Decoder 1/* 7zMain.c - Test application for 7z Decoder
22023-04-04 : Igor Pavlov : Public domain */ 22024-02-28 : Igor Pavlov : Public domain */
3 3
4#include "Precomp.h" 4#include "Precomp.h"
5 5
6#include <stdio.h> 6#include <stdio.h>
7#include <string.h> 7#include <string.h>
8 8
9#include "../../CpuArch.h"
10
11#include "../../7z.h"
12#include "../../7zAlloc.h"
13#include "../../7zBuf.h"
14#include "../../7zCrc.h"
15#include "../../7zFile.h"
16#include "../../7zVersion.h"
17
18#ifndef USE_WINDOWS_FILE 9#ifndef USE_WINDOWS_FILE
19/* for mkdir */ 10/* for mkdir */
20#ifdef _WIN32 11#ifdef _WIN32
@@ -32,6 +23,15 @@
32#endif 23#endif
33#endif 24#endif
34 25
26#include "../../7zFile.h"
27#include "../../7z.h"
28#include "../../7zAlloc.h"
29#include "../../7zBuf.h"
30#include "../../7zCrc.h"
31#include "../../7zVersion.h"
32
33#include "../../CpuArch.h"
34
35#define kInputBufSize ((size_t)1 << 18) 35#define kInputBufSize ((size_t)1 << 18)
36 36
37static const ISzAlloc g_Alloc = { SzAlloc, SzFree }; 37static const ISzAlloc g_Alloc = { SzAlloc, SzFree };
@@ -168,12 +168,12 @@ static SRes Utf16_To_Char(CBuf *buf, const UInt16 *s
168 #endif 168 #endif
169 ) 169 )
170{ 170{
171 unsigned len = 0; 171 size_t len = 0;
172 for (len = 0; s[len] != 0; len++) {} 172 for (len = 0; s[len] != 0; len++) {}
173 173
174 #ifndef MY_USE_UTF8 174 #ifndef MY_USE_UTF8
175 { 175 {
176 const unsigned size = len * 3 + 100; 176 const size_t size = len * 3 + 100;
177 if (!Buf_EnsureSize(buf, size)) 177 if (!Buf_EnsureSize(buf, size))
178 return SZ_ERROR_MEM; 178 return SZ_ERROR_MEM;
179 { 179 {
@@ -320,21 +320,20 @@ static void UIntToStr_2(char *s, unsigned value)
320// typedef long BOOL; 320// typedef long BOOL;
321typedef int BOOL; 321typedef int BOOL;
322 322
323typedef struct _FILETIME 323typedef struct
324{ 324{
325 DWORD dwLowDateTime; 325 DWORD dwLowDateTime;
326 DWORD dwHighDateTime; 326 DWORD dwHighDateTime;
327} FILETIME; 327} FILETIME;
328 328
329static LONG TIME_GetBias() 329static LONG TIME_GetBias(void)
330{ 330{
331 const time_t utc = time(NULL); 331 const time_t utc = time(NULL);
332 struct tm *ptm = localtime(&utc); 332 struct tm *ptm = localtime(&utc);
333 const int localdaylight = ptm->tm_isdst; /* daylight for local timezone */ 333 const int localdaylight = ptm->tm_isdst; /* daylight for local timezone */
334 ptm = gmtime(&utc); 334 ptm = gmtime(&utc);
335 ptm->tm_isdst = localdaylight; /* use local daylight, not that of Greenwich */ 335 ptm->tm_isdst = localdaylight; /* use local daylight, not that of Greenwich */
336 const LONG bias = (int)(mktime(ptm) - utc); 336 return (int)(mktime(ptm) - utc);
337 return bias;
338} 337}
339 338
340#define TICKS_PER_SEC 10000000 339#define TICKS_PER_SEC 10000000
@@ -359,11 +358,11 @@ static BOOL WINAPI FileTimeToLocalFileTime(const FILETIME *fileTime, FILETIME *l
359static const UInt32 kNumTimeQuantumsInSecond = 10000000; 358static const UInt32 kNumTimeQuantumsInSecond = 10000000;
360static const UInt32 kFileTimeStartYear = 1601; 359static const UInt32 kFileTimeStartYear = 1601;
361static const UInt32 kUnixTimeStartYear = 1970; 360static const UInt32 kUnixTimeStartYear = 1970;
362static const UInt64 kUnixTimeOffset =
363 (UInt64)60 * 60 * 24 * (89 + 365 * (kUnixTimeStartYear - kFileTimeStartYear));
364 361
365static Int64 Time_FileTimeToUnixTime64(const FILETIME *ft) 362static Int64 Time_FileTimeToUnixTime64(const FILETIME *ft)
366{ 363{
364 const UInt64 kUnixTimeOffset =
365 (UInt64)60 * 60 * 24 * (89 + 365 * (kUnixTimeStartYear - kFileTimeStartYear));
367 const UInt64 winTime = GET_TIME_64(ft); 366 const UInt64 winTime = GET_TIME_64(ft);
368 return (Int64)(winTime / kNumTimeQuantumsInSecond) - (Int64)kUnixTimeOffset; 367 return (Int64)(winTime / kNumTimeQuantumsInSecond) - (Int64)kUnixTimeOffset;
369} 368}
@@ -384,8 +383,10 @@ static void FILETIME_To_timespec(const FILETIME *ft, struct MY_ST_TIMESPEC *ts)
384 if (sec2 == sec) 383 if (sec2 == sec)
385 { 384 {
386 ts->tv_sec = sec2; 385 ts->tv_sec = sec2;
387 const UInt64 winTime = GET_TIME_64(ft); 386 {
388 ts->tv_nsec = (long)((winTime % 10000000) * 100); 387 const UInt64 winTime = GET_TIME_64(ft);
388 ts->tv_nsec = (long)((winTime % 10000000) * 100);
389 }
389 return; 390 return;
390 } 391 }
391 } 392 }
@@ -429,7 +430,7 @@ static void ConvertFileTimeToString(const CNtfsFileTime *nTime, char *s)
429{ 430{
430 unsigned year, mon, hour, min, sec; 431 unsigned year, mon, hour, min, sec;
431 Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 432 Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
432 unsigned t; 433 UInt32 t;
433 UInt32 v; 434 UInt32 v;
434 // UInt64 v64 = nt->Low | ((UInt64)nt->High << 32); 435 // UInt64 v64 = nt->Low | ((UInt64)nt->High << 32);
435 UInt64 v64; 436 UInt64 v64;
@@ -461,7 +462,7 @@ static void ConvertFileTimeToString(const CNtfsFileTime *nTime, char *s)
461 ms[1] = 29; 462 ms[1] = 29;
462 for (mon = 0;; mon++) 463 for (mon = 0;; mon++)
463 { 464 {
464 const unsigned d = ms[mon]; 465 const UInt32 d = ms[mon];
465 if (v < d) 466 if (v < d)
466 break; 467 break;
467 v -= d; 468 v -= d;
diff --git a/C/Util/7z/Precomp.h b/C/Util/7z/Precomp.h
index bc8fa21..13a41ef 100644
--- a/C/Util/7z/Precomp.h
+++ b/C/Util/7z/Precomp.h
@@ -1,14 +1,13 @@
1/* Precomp.h -- StdAfx 1/* Precomp.h -- Precomp
22023-03-04 : Igor Pavlov : Public domain */ 22024-01-23 : Igor Pavlov : Public domain */
3 3
4#ifndef ZIP7_INC_PRECOMP_H 4// #ifndef ZIP7_INC_PRECOMP_LOC_H
5#define ZIP7_INC_PRECOMP_H 5// #define ZIP7_INC_PRECOMP_LOC_H
6 6
7#if defined(_MSC_VER) && _MSC_VER >= 1800 7#if defined(_MSC_VER) && _MSC_VER >= 1800
8#pragma warning(disable : 4464) // relative include path contains '..' 8#pragma warning(disable : 4464) // relative include path contains '..'
9#endif 9#endif
10 10
11#include "../../Compiler.h" 11#include "../../Precomp.h"
12#include "../../7zTypes.h"
13 12
14#endif 13// #endif
diff --git a/C/Util/7z/makefile b/C/Util/7z/makefile
index dfc560e..987f065 100644
--- a/C/Util/7z/makefile
+++ b/C/Util/7z/makefile
@@ -5,8 +5,6 @@ PROG = 7zDec.exe
5C_OBJS = \ 5C_OBJS = \
6 $O\7zAlloc.obj \ 6 $O\7zAlloc.obj \
7 $O\7zBuf.obj \ 7 $O\7zBuf.obj \
8 $O\7zCrc.obj \
9 $O\7zCrcOpt.obj \
10 $O\7zFile.obj \ 8 $O\7zFile.obj \
11 $O\7zDec.obj \ 9 $O\7zDec.obj \
12 $O\7zArcIn.obj \ 10 $O\7zArcIn.obj \
@@ -25,10 +23,14 @@ C_OBJS = \
257Z_OBJS = \ 237Z_OBJS = \
26 $O\7zMain.obj \ 24 $O\7zMain.obj \
27 25
26!include "../../../CPP/7zip/Crc.mak"
27!include "../../../CPP/7zip/LzmaDec.mak"
28
28OBJS = \ 29OBJS = \
29 $O\Precomp.obj \ 30 $O\Precomp.obj \
30 $(7Z_OBJS) \ 31 $(7Z_OBJS) \
31 $(C_OBJS) \ 32 $(C_OBJS) \
33 $(ASM_OBJS) \
32 34
33!include "../../../CPP/Build.mak" 35!include "../../../CPP/Build.mak"
34 36
@@ -38,3 +40,5 @@ $(C_OBJS): ../../$(*B).c
38 $(CCOMPL_USE) 40 $(CCOMPL_USE)
39$O\Precomp.obj: Precomp.c 41$O\Precomp.obj: Precomp.c
40 $(CCOMPL_PCH) 42 $(CCOMPL_PCH)
43
44!include "../../Asm_c.mak"
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 }
diff --git a/C/Util/7zipInstall/Precomp.h b/C/Util/7zipInstall/Precomp.h
index bc8fa21..13a41ef 100644
--- a/C/Util/7zipInstall/Precomp.h
+++ b/C/Util/7zipInstall/Precomp.h
@@ -1,14 +1,13 @@
1/* Precomp.h -- StdAfx 1/* Precomp.h -- Precomp
22023-03-04 : Igor Pavlov : Public domain */ 22024-01-23 : Igor Pavlov : Public domain */
3 3
4#ifndef ZIP7_INC_PRECOMP_H 4// #ifndef ZIP7_INC_PRECOMP_LOC_H
5#define ZIP7_INC_PRECOMP_H 5// #define ZIP7_INC_PRECOMP_LOC_H
6 6
7#if defined(_MSC_VER) && _MSC_VER >= 1800 7#if defined(_MSC_VER) && _MSC_VER >= 1800
8#pragma warning(disable : 4464) // relative include path contains '..' 8#pragma warning(disable : 4464) // relative include path contains '..'
9#endif 9#endif
10 10
11#include "../../Compiler.h" 11#include "../../Precomp.h"
12#include "../../7zTypes.h"
13 12
14#endif 13// #endif
diff --git a/C/Util/7zipInstall/makefile b/C/Util/7zipInstall/makefile
index 18e2783..424bd6c 100644
--- a/C/Util/7zipInstall/makefile
+++ b/C/Util/7zipInstall/makefile
@@ -19,9 +19,6 @@ C_OBJS = \
19 $O\7zAlloc.obj \ 19 $O\7zAlloc.obj \
20 $O\7zArcIn.obj \ 20 $O\7zArcIn.obj \
21 $O\7zBuf.obj \ 21 $O\7zBuf.obj \
22 $O\7zBuf2.obj \
23 $O\7zCrc.obj \
24 $O\7zCrcOpt.obj \
25 $O\7zFile.obj \ 22 $O\7zFile.obj \
26 $O\7zDec.obj \ 23 $O\7zDec.obj \
27 $O\7zStream.obj \ 24 $O\7zStream.obj \
@@ -34,11 +31,17 @@ C_OBJS = \
34OBJS = \ 31OBJS = \
35 $(MAIN_OBJS) \ 32 $(MAIN_OBJS) \
36 $(C_OBJS) \ 33 $(C_OBJS) \
34 $(ASM_OBJS) \
37 $O\resource.res 35 $O\resource.res
38 36
37!include "../../../CPP/7zip/Crc.mak"
38# !include "../../../CPP/7zip/LzmaDec.mak"
39
39!include "../../../CPP/Build.mak" 40!include "../../../CPP/Build.mak"
40 41
41$(MAIN_OBJS): $(*B).c 42$(MAIN_OBJS): $(*B).c
42 $(COMPL_O1) 43 $(COMPL_O1)
43$(C_OBJS): ../../$(*B).c 44$(C_OBJS): ../../$(*B).c
44 $(COMPL_O1) 45 $(COMPL_O1)
46
47!include "../../Asm_c.mak"
diff --git a/C/Util/7zipInstall/resource.rc b/C/Util/7zipInstall/resource.rc
index df6474e..40ed580 100644
--- a/C/Util/7zipInstall/resource.rc
+++ b/C/Util/7zipInstall/resource.rc
@@ -1,5 +1,6 @@
1#include <winnt.h> 1#include <windows.h>
2#include <WinUser.h> 2// #include <winnt.h>
3// #include <WinUser.h>
3#include <CommCtrl.h> 4#include <CommCtrl.h>
4 5
5#define USE_COPYRIGHT_CR 6#define USE_COPYRIGHT_CR
diff --git a/C/Util/7zipUninstall/7zipUninstall.c b/C/Util/7zipUninstall/7zipUninstall.c
index 8bc18b3..e7051e2 100644
--- a/C/Util/7zipUninstall/7zipUninstall.c
+++ b/C/Util/7zipUninstall/7zipUninstall.c
@@ -1,10 +1,11 @@
1/* 7zipUninstall.c - 7-Zip Uninstaller 1/* 7zipUninstall.c - 7-Zip Uninstaller
22022-07-15 : Igor Pavlov : Public domain */ 22024-03-21 : 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#include "../../7zTypes.h"
8#include "../../7zWindows.h" 9#include "../../7zWindows.h"
9 10
10#if defined(_MSC_VER) && _MSC_VER < 1600 11#if defined(_MSC_VER) && _MSC_VER < 1600
@@ -31,16 +32,7 @@ typedef enum {
31 32
32#include "resource.h" 33#include "resource.h"
33 34
34#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
35 // #pragma GCC diagnostic ignored "-Wcast-function-type"
36#endif
37 35
38#if defined(_MSC_VER) && _MSC_VER > 1920
39#define MY_CAST_FUNC (void *)
40// #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
41#else
42#define MY_CAST_FUNC
43#endif
44 36
45 37
46#define LLL_(quote) L##quote 38#define LLL_(quote) L##quote
@@ -101,11 +93,13 @@ static LPCWSTR const k_Reg_Path32 = L"Path"
101 #define k_Reg_WOW_Flag 0 93 #define k_Reg_WOW_Flag 0
102#endif 94#endif
103 95
96#ifdef USE_7ZIP_32_DLL
104#ifdef _WIN64 97#ifdef _WIN64
105 #define k_Reg_WOW_Flag_32 KEY_WOW64_32KEY 98 #define k_Reg_WOW_Flag_32 KEY_WOW64_32KEY
106#else 99#else
107 #define k_Reg_WOW_Flag_32 0 100 #define k_Reg_WOW_Flag_32 0
108#endif 101#endif
102#endif
109 103
110#define k_7zip_CLSID L"{23170F69-40C1-278A-1000-000100020000}" 104#define k_7zip_CLSID L"{23170F69-40C1-278A-1000-000100020000}"
111 105
@@ -124,9 +118,19 @@ static HWND g_Path_HWND;
124static HWND g_InfoLine_HWND; 118static HWND g_InfoLine_HWND;
125static HWND g_Progress_HWND; 119static HWND g_Progress_HWND;
126 120
127// WINADVAPI 121// RegDeleteKeyExW is supported starting from win2003sp1/xp-pro-x64
122// Z7_WIN32_WINNT_MIN < 0x0600 // Vista
123#if !defined(Z7_WIN32_WINNT_MIN) \
124 || Z7_WIN32_WINNT_MIN < 0x0502 /* < win2003 */ \
125 || Z7_WIN32_WINNT_MIN == 0x0502 && !defined(_M_AMD64)
126#define Z7_USE_DYN_RegDeleteKeyExW
127#endif
128
129#ifdef Z7_USE_DYN_RegDeleteKeyExW
130Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
128typedef LONG (APIENTRY *Func_RegDeleteKeyExW)(HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired, DWORD Reserved); 131typedef LONG (APIENTRY *Func_RegDeleteKeyExW)(HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired, DWORD Reserved);
129static Func_RegDeleteKeyExW func_RegDeleteKeyExW; 132static Func_RegDeleteKeyExW func_RegDeleteKeyExW;
133#endif
130 134
131static WCHAR cmd[MAX_PATH + 4]; 135static WCHAR cmd[MAX_PATH + 4];
132static WCHAR cmdError[MAX_PATH + 4]; 136static WCHAR cmdError[MAX_PATH + 4];
@@ -247,13 +251,18 @@ static LONG MyRegistry_OpenKey_ReadWrite(HKEY parentKey, LPCWSTR name, HKEY *des
247 251
248static LONG MyRegistry_DeleteKey(HKEY parentKey, LPCWSTR name) 252static LONG MyRegistry_DeleteKey(HKEY parentKey, LPCWSTR name)
249{ 253{
250 #if k_Reg_WOW_Flag != 0 254#if k_Reg_WOW_Flag != 0
251 if (func_RegDeleteKeyExW) 255#ifdef Z7_USE_DYN_RegDeleteKeyExW
252 return func_RegDeleteKeyExW(parentKey, name, k_Reg_WOW_Flag, 0); 256 if (!func_RegDeleteKeyExW)
253 return E_FAIL; 257 return E_FAIL;
254 #else 258 return func_RegDeleteKeyExW
259#else
260 return RegDeleteKeyExW
261#endif
262 (parentKey, name, k_Reg_WOW_Flag, 0);
263#else
255 return RegDeleteKeyW(parentKey, name); 264 return RegDeleteKeyW(parentKey, name);
256 #endif 265#endif
257} 266}
258 267
259#ifdef USE_7ZIP_32_DLL 268#ifdef USE_7ZIP_32_DLL
@@ -278,13 +287,18 @@ static LONG MyRegistry_OpenKey_ReadWrite_32(HKEY parentKey, LPCWSTR name, HKEY *
278 287
279static LONG MyRegistry_DeleteKey_32(HKEY parentKey, LPCWSTR name) 288static LONG MyRegistry_DeleteKey_32(HKEY parentKey, LPCWSTR name)
280{ 289{
281 #if k_Reg_WOW_Flag_32 != 0 290#if k_Reg_WOW_Flag_32 != 0
282 if (func_RegDeleteKeyExW) 291#ifdef Z7_USE_DYN_RegDeleteKeyExW
283 return func_RegDeleteKeyExW(parentKey, name, k_Reg_WOW_Flag_32, 0); 292 if (!func_RegDeleteKeyExW)
284 return E_FAIL; 293 return E_FAIL;
285 #else 294 return func_RegDeleteKeyExW
295#else
296 return RegDeleteKeyExW
297#endif
298 (parentKey, name, k_Reg_WOW_Flag_32, 0);
299#else
286 return RegDeleteKeyW(parentKey, name); 300 return RegDeleteKeyW(parentKey, name);
287 #endif 301#endif
288} 302}
289 303
290#endif 304#endif
@@ -930,14 +944,17 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
930 UNUSED_VAR(lpCmdLine) 944 UNUSED_VAR(lpCmdLine)
931 UNUSED_VAR(nCmdShow) 945 UNUSED_VAR(nCmdShow)
932 946
933 #ifndef UNDER_CE 947#ifndef UNDER_CE
934 CoInitialize(NULL); 948 CoInitialize(NULL);
935 #endif 949#endif
936 950
937 #ifndef UNDER_CE 951#ifndef UNDER_CE
938 func_RegDeleteKeyExW = (Func_RegDeleteKeyExW) MY_CAST_FUNC 952#ifdef Z7_USE_DYN_RegDeleteKeyExW
939 GetProcAddress(GetModuleHandleW(L"advapi32.dll"), "RegDeleteKeyExW"); 953 func_RegDeleteKeyExW =
940 #endif 954 (Func_RegDeleteKeyExW) Z7_CAST_FUNC_C GetProcAddress(GetModuleHandleW(L"advapi32.dll"),
955 "RegDeleteKeyExW");
956#endif
957#endif
941 958
942 { 959 {
943 const wchar_t *s = GetCommandLineW(); 960 const wchar_t *s = GetCommandLineW();
diff --git a/C/Util/7zipUninstall/Precomp.h b/C/Util/7zipUninstall/Precomp.h
index bc8fa21..13a41ef 100644
--- a/C/Util/7zipUninstall/Precomp.h
+++ b/C/Util/7zipUninstall/Precomp.h
@@ -1,14 +1,13 @@
1/* Precomp.h -- StdAfx 1/* Precomp.h -- Precomp
22023-03-04 : Igor Pavlov : Public domain */ 22024-01-23 : Igor Pavlov : Public domain */
3 3
4#ifndef ZIP7_INC_PRECOMP_H 4// #ifndef ZIP7_INC_PRECOMP_LOC_H
5#define ZIP7_INC_PRECOMP_H 5// #define ZIP7_INC_PRECOMP_LOC_H
6 6
7#if defined(_MSC_VER) && _MSC_VER >= 1800 7#if defined(_MSC_VER) && _MSC_VER >= 1800
8#pragma warning(disable : 4464) // relative include path contains '..' 8#pragma warning(disable : 4464) // relative include path contains '..'
9#endif 9#endif
10 10
11#include "../../Compiler.h" 11#include "../../Precomp.h"
12#include "../../7zTypes.h"
13 12
14#endif 13// #endif
diff --git a/C/Util/7zipUninstall/resource.rc b/C/Util/7zipUninstall/resource.rc
index 00bdcc0..79400c6 100644
--- a/C/Util/7zipUninstall/resource.rc
+++ b/C/Util/7zipUninstall/resource.rc
@@ -1,5 +1,6 @@
1#include <winnt.h> 1#include <windows.h>
2#include <WinUser.h> 2// #include <winnt.h>
3// #include <WinUser.h>
3#include <CommCtrl.h> 4#include <CommCtrl.h>
4 5
5#define USE_COPYRIGHT_CR 6#define USE_COPYRIGHT_CR