Update to 7-Zip Version 19.00

- Encryption strength for 7z archives was increased the size of random
  initialization vector was increased from 64-bit to 128-bit, and the
  pseudo-random number generator was improved.
- Some bugs were fixed.
This commit is contained in:
Tino Reichardt
2019-02-22 17:11:17 +01:00
parent 34323d51e9
commit ccca7cd09d
76 changed files with 924 additions and 420 deletions

View File

@@ -1,5 +1,5 @@
/* 7zMain.c - Test application for 7z Decoder
2018-08-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -176,7 +176,7 @@ static SRes Utf16_To_Char(CBuf *buf, const UInt16 *s
char defaultChar = '_';
BOOL defUsed;
unsigned numChars = 0;
numChars = WideCharToMultiByte(codePage, 0, s, len, (char *)buf->data, size, &defaultChar, &defUsed);
numChars = WideCharToMultiByte(codePage, 0, (LPCWSTR)s, len, (char *)buf->data, size, &defaultChar, &defUsed);
if (numChars == 0 || numChars >= size)
return SZ_ERROR_FAIL;
buf->data[numChars] = 0;
@@ -202,7 +202,7 @@ static WRes MyCreateDir(const UInt16 *name)
{
#ifdef USE_WINDOWS_FILE
return CreateDirectoryW(name, NULL) ? 0 : GetLastError();
return CreateDirectoryW((LPCWSTR)name, NULL) ? 0 : GetLastError();
#else
@@ -227,7 +227,7 @@ static WRes MyCreateDir(const UInt16 *name)
static WRes OutFile_OpenUtf16(CSzFile *p, const UInt16 *name)
{
#ifdef USE_WINDOWS_FILE
return OutFile_OpenW(p, name);
return OutFile_OpenW(p, (LPCWSTR)name);
#else
CBuf buf;
WRes res;
@@ -430,7 +430,7 @@ int MY_CDECL main(int numargs, char *args[])
res = SZ_OK;
{
lookStream.buf = ISzAlloc_Alloc(&allocImp, kInputBufSize);
lookStream.buf = (Byte *)ISzAlloc_Alloc(&allocImp, kInputBufSize);
if (!lookStream.buf)
res = SZ_ERROR_MEM;
else
@@ -647,7 +647,7 @@ int MY_CDECL main(int numargs, char *args[])
We remove posix bits, if we detect posix mode field */
if ((attrib & 0xF0000000) != 0)
attrib &= 0x7FFF;
SetFileAttributesW(destPath, attrib);
SetFileAttributesW((LPCWSTR)destPath, attrib);
}
#endif
}

View File

@@ -1,5 +1,5 @@
/* 7zipInstall.c - 7-Zip Installer
2018-08-04 : Igor Pavlov : Public domain */
2019-02-19 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -121,13 +121,51 @@ static void PrintErrorMessage(const char *s)
}
typedef DWORD (WINAPI * Func_GetFileVersionInfoSizeW)(LPCWSTR lptstrFilename, LPDWORD lpdwHandle);
typedef BOOL (WINAPI * Func_GetFileVersionInfoW)(LPCWSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData);
typedef BOOL (WINAPI * Func_VerQueryValueW)(const LPVOID pBlock, LPWSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen);
static HMODULE g_version_dll_hModule;
static DWORD GetFileVersion(LPCWSTR s)
{
DWORD size = 0;
BYTE *vi = NULL;
void *vi = NULL;
DWORD version = 0;
Func_GetFileVersionInfoSizeW my_GetFileVersionInfoSizeW;
Func_GetFileVersionInfoW my_GetFileVersionInfoW;
Func_VerQueryValueW my_VerQueryValueW;
if (!g_version_dll_hModule)
{
wchar_t buf[MAX_PATH + 100];
{
unsigned len = GetSystemDirectoryW(buf, MAX_PATH + 2);
if (len == 0 || len > MAX_PATH)
return 0;
}
{
unsigned pos = (unsigned)lstrlenW(buf);
if (buf[pos - 1] != '\\')
buf[pos++] = '\\';
lstrcpyW(buf + pos, L"version.dll");
}
g_version_dll_hModule = LoadLibraryW(buf);
if (!g_version_dll_hModule)
return 0;
}
my_GetFileVersionInfoSizeW = (Func_GetFileVersionInfoSizeW)GetProcAddress(g_version_dll_hModule, "GetFileVersionInfoSizeW");
my_GetFileVersionInfoW = (Func_GetFileVersionInfoW)GetProcAddress(g_version_dll_hModule, "GetFileVersionInfoW");
my_VerQueryValueW = (Func_VerQueryValueW)GetProcAddress(g_version_dll_hModule, "VerQueryValueW");
if (!my_GetFileVersionInfoSizeW
|| !my_GetFileVersionInfoW
|| !my_VerQueryValueW)
return 0;
size = GetFileVersionInfoSizeW(s, NULL);
size = my_GetFileVersionInfoSizeW(s, NULL);
if (size == 0)
return 0;
@@ -135,11 +173,11 @@ static DWORD GetFileVersion(LPCWSTR s)
if (!vi)
return 0;
if (GetFileVersionInfoW(s, 0, size, vi))
if (my_GetFileVersionInfoW(s, 0, size, vi))
{
VS_FIXEDFILEINFO *fi = NULL;
UINT fiLen = 0;
if (VerQueryValueW(vi, L"\\", (LPVOID *)&fi, &fiLen))
if (my_VerQueryValueW(vi, L"\\", (LPVOID *)&fi, &fiLen))
version = fi->dwFileVersionMS;
}
@@ -1103,7 +1141,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
static BoolInt GetErrorMessage(DWORD errorCode, WCHAR *message)
{
LPVOID msgBuf;
LPWSTR msgBuf;
if (FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
@@ -1201,7 +1239,7 @@ if (res == SZ_OK)
if (res == SZ_OK)
{
lookStream.buf = ISzAlloc_Alloc(&allocImp, kInputBufSize);
lookStream.buf = (Byte *)ISzAlloc_Alloc(&allocImp, kInputBufSize);
if (!lookStream.buf)
res = SZ_ERROR_MEM;
else
@@ -1272,7 +1310,7 @@ if (res == SZ_OK)
temp = path + pathLen;
SzArEx_GetFileNameUtf16(&db, i, temp);
SzArEx_GetFileNameUtf16(&db, i, (UInt16 *)temp);
if (!g_SilentMode)
SetWindowTextW(g_InfoLine_HWND, temp);

View File

@@ -1,8 +1,6 @@
PROG = 7zipInstall.exe
MY_FIXED = 1
LIBS = $(LIBS) version.lib
!IFDEF _64BIT_INSTALLER
CFLAGS = $(CFLAGS) -D_64BIT_INSTALLER
!ENDIF

View File

@@ -1,5 +1,5 @@
/* 7zipUninstall.c - 7-Zip Uninstaller
2018-08-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -517,7 +517,7 @@ static void AddPathParam(wchar_t *dest, const wchar_t *src)
static BoolInt GetErrorMessage(DWORD errorCode, WCHAR *message)
{
LPVOID msgBuf;
LPWSTR msgBuf;
if (FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM

View File

@@ -1,5 +1,5 @@
/* SfxSetup.c - 7z SFX Setup
2018-08-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -379,7 +379,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
if (res == SZ_OK)
{
lookStream.buf = ISzAlloc_Alloc(&allocImp, kInputBufSize);
lookStream.buf = (Byte *)ISzAlloc_Alloc(&allocImp, kInputBufSize);
if (!lookStream.buf)
res = SZ_ERROR_MEM;
else
@@ -420,7 +420,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
temp = path + pathLen;
SzArEx_GetFileNameUtf16(&db, i, temp);
SzArEx_GetFileNameUtf16(&db, i, (UInt16 *)temp);
{
res = SzArEx_Extract(&db, &lookStream.vt, i,
&blockIndex, &outBuffer, &outBufferSize,
@@ -527,7 +527,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
{
WCHAR *temp = path + pathLen;
UInt32 j;
SzArEx_GetFileNameUtf16(&db, executeFileIndex, temp);
SzArEx_GetFileNameUtf16(&db, executeFileIndex, (UInt16 *)temp);
for (j = 0; temp[j] != 0; j++)
if (temp[j] == '/')
temp[j] = CHAR_PATH_SEPARATOR;