This commit is contained in:
Igor Pavlov
2019-03-04 01:27:14 +00:00
committed by glachancecmaisonneuve
parent 5d7485c7d9
commit 5c10d25476
75 changed files with 2075 additions and 1688 deletions

17
.gitignore vendored
View File

@@ -1,18 +1 @@
*.o
out
7zAll/x64/
*.pdb
*.tlog
*.obj
*.user
*.log
*.pch
*.idb
x64/
*.exe
*.res
*.dll
*.lib
*.exp
*.sfx
*.txt

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 18
#define MY_VER_MINOR 06
#define MY_VER_MAJOR 19
#define MY_VER_MINOR 00
#define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "18.06"
#define MY_VERSION_NUMBERS "19.00"
#define MY_VERSION MY_VERSION_NUMBERS
#ifdef MY_CPU_NAME
@@ -10,7 +10,7 @@
#define MY_VERSION_CPU MY_VERSION
#endif
#define MY_DATE "2018-12-30"
#define MY_DATE "2019-02-21"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"

View File

@@ -1,5 +1,5 @@
/* Bcj2Enc.c -- BCJ2 Encoder (Converter for x86 code)
2018-07-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -253,7 +253,7 @@ void Bcj2Enc_Encode(CBcj2Enc *p)
{
const Byte *src = p->src;
const Byte *srcLim = p->srcLim;
unsigned finishMode = p->finishMode;
EBcj2Enc_FinishMode finishMode = p->finishMode;
p->src = p->temp;
p->srcLim = p->temp + p->tempPos;

View File

@@ -1,5 +1,5 @@
/* CpuArch.c -- CPU specific code
2018-07-04: Igor Pavlov : Public domain */
2018-02-18: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -197,4 +197,22 @@ BoolInt CPU_Is_Aes_Supported()
return (p.c >> 25) & 1;
}
BoolInt CPU_IsSupported_PageGB()
{
Cx86cpuid cpuid;
if (!x86cpuid_CheckAndRead(&cpuid))
return False;
{
UInt32 d[4] = { 0 };
MyCPUID(0x80000000, &d[0], &d[1], &d[2], &d[3]);
if (d[0] < 0x80000001)
return False;
}
{
UInt32 d[4] = { 0 };
MyCPUID(0x80000001, &d[0], &d[1], &d[2], &d[3]);
return (d[3] >> 26) & 1;
}
}
#endif

View File

@@ -1,5 +1,5 @@
/* CpuArch.h -- CPU specific code
2018-07-04 : Igor Pavlov : Public domain */
2018-02-18 : Igor Pavlov : Public domain */
#ifndef __CPU_ARCH_H
#define __CPU_ARCH_H
@@ -327,6 +327,7 @@ int x86cpuid_GetFirm(const Cx86cpuid *p);
BoolInt CPU_Is_InOrder();
BoolInt CPU_Is_Aes_Supported();
BoolInt CPU_IsSupported_PageGB();
#endif

View File

@@ -1,5 +1,5 @@
/* DllSecur.c -- DLL loading security
2016-10-04 : Igor Pavlov : Public domain */
2018-02-21 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -28,10 +28,31 @@ static const char * const g_Dlls =
"CRYPTBASE\0"
"OLEACC\0"
"CLBCATQ\0"
"VERSION\0"
;
#endif
void My_SetDefaultDllDirectories()
{
#ifndef UNDER_CE
OSVERSIONINFO vi;
vi.dwOSVersionInfoSize = sizeof(vi);
GetVersionEx(&vi);
if (!GetVersionEx(&vi) || vi.dwMajorVersion != 6 || vi.dwMinorVersion != 0)
{
Func_SetDefaultDllDirectories setDllDirs = (Func_SetDefaultDllDirectories)
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
if (setDllDirs)
if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS))
return;
}
#endif
}
void LoadSecurityDlls()
{
#ifndef UNDER_CE
@@ -70,7 +91,7 @@ void LoadSecurityDlls()
for (;;)
{
char c = *dll++;
buf[pos + k] = c;
buf[pos + k] = (Byte)c;
k++;
if (c == 0)
break;

View File

@@ -1,5 +1,5 @@
/* DllSecur.h -- DLL loading for security
2016-06-08 : Igor Pavlov : Public domain */
2018-02-19 : Igor Pavlov : Public domain */
#ifndef __DLL_SECUR_H
#define __DLL_SECUR_H
@@ -10,6 +10,7 @@ EXTERN_C_BEGIN
#ifdef _WIN32
void My_SetDefaultDllDirectories();
void LoadSecurityDlls();
#endif

View File

@@ -1,5 +1,5 @@
/* Lzma2Dec.c -- LZMA2 Decoder
2018-07-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
/* #define SHOW_DEBUG_INFO */
@@ -314,15 +314,15 @@ ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
while (p->state != LZMA2_STATE_ERROR)
{
if (p->state == LZMA2_STATE_FINISHED)
return LZMA_STATUS_FINISHED_WITH_MARK;
return (ELzma2ParseStatus)LZMA_STATUS_FINISHED_WITH_MARK;
if (outSize == 0 && !checkFinishBlock)
return LZMA_STATUS_NOT_FINISHED;
return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;
if (p->state != LZMA2_STATE_DATA && p->state != LZMA2_STATE_DATA_CONT)
{
if (*srcLen == inSize)
return LZMA_STATUS_NEEDS_MORE_INPUT;
return (ELzma2ParseStatus)LZMA_STATUS_NEEDS_MORE_INPUT;
(*srcLen)++;
p->state = Lzma2Dec_UpdateState(p, *src++);
@@ -344,7 +344,7 @@ ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
// checkFinishBlock is true. So we expect that block must be finished,
// We can return LZMA_STATUS_NOT_SPECIFIED or LZMA_STATUS_NOT_FINISHED here
// break;
return LZMA_STATUS_NOT_FINISHED;
return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;
}
if (p->state == LZMA2_STATE_DATA)
@@ -354,7 +354,7 @@ ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
}
if (outSize == 0)
return LZMA_STATUS_NOT_FINISHED;
return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;
{
SizeT inCur = inSize - *srcLen;
@@ -362,7 +362,7 @@ ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
if (LZMA2_IS_UNCOMPRESSED_STATE(p))
{
if (inCur == 0)
return LZMA_STATUS_NEEDS_MORE_INPUT;
return (ELzma2ParseStatus)LZMA_STATUS_NEEDS_MORE_INPUT;
if (inCur > p->unpackSize)
inCur = p->unpackSize;
if (inCur > outSize)
@@ -381,7 +381,7 @@ ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
if (inCur == 0)
{
if (p->packSize != 0)
return LZMA_STATUS_NEEDS_MORE_INPUT;
return (ELzma2ParseStatus)LZMA_STATUS_NEEDS_MORE_INPUT;
}
else if (p->state == LZMA2_STATE_DATA)
{
@@ -418,7 +418,7 @@ ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p,
}
p->state = LZMA2_STATE_ERROR;
return LZMA_STATUS_NOT_SPECIFIED;
return (ELzma2ParseStatus)LZMA_STATUS_NOT_SPECIFIED;
}

View File

@@ -1,5 +1,5 @@
/* Lzma2DecMt.c -- LZMA2 Decoder Multi-thread
2018-07-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -265,7 +265,7 @@ static void Lzma2DecMt_MtCallback_Parse(void *obj, unsigned coderIndex, CMtDecCa
t->outPreSize = 0;
// t->blockWasFinished = False;
// t->finishedWithMark = False;
t->parseStatus = LZMA_STATUS_NOT_SPECIFIED;
t->parseStatus = (ELzma2ParseStatus)LZMA_STATUS_NOT_SPECIFIED;
t->state = MTDEC_PARSE_CONTINUE;
t->inCodeSize = 0;

View File

@@ -1,5 +1,5 @@
/* LzmaEnc.c -- LZMA Encoder
2018-12-29: Igor Pavlov : Public domain */
2019-01-10: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -1497,9 +1497,9 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
// here we can allow skip_items in p->opt, if we don't check (nextOpt->price < kInfinityPrice)
// 18.new.06
if (nextOpt->price < kInfinityPrice
if ((nextOpt->price < kInfinityPrice
// && !IsLitState(state)
&& matchByte == curByte
&& matchByte == curByte)
|| litPrice > nextOpt->price
)
litPrice = 0;

View File

@@ -1,5 +1,5 @@
/* MtDec.c -- Multi-thread Decoder
2018-07-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -88,12 +88,13 @@ static WRes ArEvent_OptCreate_And_Reset(CEvent *p)
}
typedef struct
struct __CMtDecBufLink
{
void *next;
struct __CMtDecBufLink *next;
void *pad[3];
} CMtDecBufLink;
};
typedef struct __CMtDecBufLink CMtDecBufLink;
#define MTDEC__LINK_DATA_OFFSET sizeof(CMtDecBufLink)
#define MTDEC__DATA_PTR_FROM_LINK(link) ((Byte *)(link) + MTDEC__LINK_DATA_OFFSET)

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,44 +1,42 @@
PROG = 7zipInstall.exe
MY_FIXED = 1
LIBS = $(LIBS) version.lib
!IFDEF _64BIT_INSTALLER
CFLAGS = $(CFLAGS) -D_64BIT_INSTALLER
!ENDIF
CFLAGS = $(CFLAGS) -D_LZMA_SIZE_OPT
CFLAGS = $(CFLAGS) \
-D_7Z_NO_METHOD_LZMA2 \
-D_7Z_NO_METHODS_FILTERS
MAIN_OBJS = \
$O\7zipInstall.obj \
C_OBJS = \
$O\7zAlloc.obj \
$O\7zArcIn.obj \
$O\7zBuf.obj \
$O\7zBuf2.obj \
$O\7zCrc.obj \
$O\7zCrcOpt.obj \
$O\7zFile.obj \
$O\7zDec.obj \
$O\7zStream.obj \
$O\Bcj2.obj \
$O\CpuArch.obj \
$O\DllSecur.obj \
$O\LzmaDec.obj \
OBJS = \
$(MAIN_OBJS) \
$(C_OBJS) \
$O\resource.res
!include "../../../CPP/Build.mak"
$(MAIN_OBJS): $(*B).c
$(COMPL_O1)
$(C_OBJS): ../../$(*B).c
$(COMPL_O1)
PROG = 7zipInstall.exe
MY_FIXED = 1
!IFDEF _64BIT_INSTALLER
CFLAGS = $(CFLAGS) -D_64BIT_INSTALLER
!ENDIF
CFLAGS = $(CFLAGS) -D_LZMA_SIZE_OPT
CFLAGS = $(CFLAGS) \
-D_7Z_NO_METHOD_LZMA2 \
-D_7Z_NO_METHODS_FILTERS
MAIN_OBJS = \
$O\7zipInstall.obj \
C_OBJS = \
$O\7zAlloc.obj \
$O\7zArcIn.obj \
$O\7zBuf.obj \
$O\7zBuf2.obj \
$O\7zCrc.obj \
$O\7zCrcOpt.obj \
$O\7zFile.obj \
$O\7zDec.obj \
$O\7zStream.obj \
$O\Bcj2.obj \
$O\CpuArch.obj \
$O\DllSecur.obj \
$O\LzmaDec.obj \
OBJS = \
$(MAIN_OBJS) \
$(C_OBJS) \
$O\resource.res
!include "../../../CPP/Build.mak"
$(MAIN_OBJS): $(*B).c
$(COMPL_O1)
$(C_OBJS): ../../$(*B).c
$(COMPL_O1)

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,4 +1,4 @@
EXPORTS
LzmaCompress
LzmaUncompress
EXPORTS
LzmaCompress
LzmaUncompress

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;

View File

@@ -1,5 +1,5 @@
/* XzDec.c -- Xz Decode
2018-12-29 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -245,7 +245,7 @@ SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, int encodeMode, ISzAllocP
CBraState *decoder;
if (id < XZ_ID_Delta || id > XZ_ID_SPARC)
return SZ_ERROR_UNSUPPORTED;
decoder = p->p;
decoder = (CBraState *)p->p;
if (!decoder)
{
decoder = (CBraState *)ISzAlloc_Alloc(alloc, sizeof(CBraState));
@@ -400,7 +400,7 @@ static SRes Lzma2State_Code2(void *pp, Byte *dest, SizeT *destLen, const Byte *s
res = Lzma2Dec_DecodeToBuf(&spec->decoder, dest, destLen, src, srcLen, (ELzmaFinishMode)finishMode, &status2);
// *wasFinished = (status2 == LZMA_STATUS_FINISHED_WITH_MARK);
// ECoderStatus values are identical to ELzmaStatus values of LZMA2 decoder
*status = status2;
*status = (ECoderStatus)status2;
return res;
}

View File

@@ -1,5 +1,5 @@
/* XzEnc.c -- Xz Encode
2018-07-04 : Igor Pavlov : Public domain */
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -366,7 +366,7 @@ static SRes SeqInFilter_Read(const ISeqInStream *pp, void *data, size_t *size)
SRes res;
*size = sizeOriginal;
res = p->StateCoder.Code2(p->StateCoder.p,
data, size,
(Byte *)data, size,
p->buf + p->curPos, &srcLen,
p->srcWasFinished, CODER_FINISH_ANY,
&status);

View File

@@ -355,7 +355,9 @@ HRESULT CDecoder::Decode(
unsigned i;
#if !defined(_7ZIP_ST)
bool mt_wasUsed = false;
#endif
for (i = 0; i < folderInfo.Coders.Size(); i++)
{

View File

@@ -1,12 +1,12 @@
EXPORTS
CreateObject PRIVATE
GetHandlerProperty PRIVATE
GetNumberOfFormats PRIVATE
GetHandlerProperty2 PRIVATE
GetIsArc PRIVATE
SetCodecs PRIVATE
SetLargePageMode PRIVATE
SetCaseSensitive PRIVATE
EXPORTS
CreateObject PRIVATE
GetHandlerProperty PRIVATE
GetNumberOfFormats PRIVATE
GetHandlerProperty2 PRIVATE
GetIsArc PRIVATE
SetCodecs PRIVATE
SetLargePageMode PRIVATE
SetCaseSensitive PRIVATE

View File

@@ -1,19 +1,19 @@
EXPORTS
CreateObject PRIVATE
GetHandlerProperty PRIVATE
GetNumberOfFormats PRIVATE
GetHandlerProperty2 PRIVATE
GetIsArc PRIVATE
GetNumberOfMethods PRIVATE
GetMethodProperty PRIVATE
CreateDecoder PRIVATE
CreateEncoder PRIVATE
GetHashers PRIVATE
SetCodecs PRIVATE
SetLargePageMode PRIVATE
SetCaseSensitive PRIVATE
EXPORTS
CreateObject PRIVATE
GetHandlerProperty PRIVATE
GetNumberOfFormats PRIVATE
GetHandlerProperty2 PRIVATE
GetIsArc PRIVATE
GetNumberOfMethods PRIVATE
GetMethodProperty PRIVATE
CreateDecoder PRIVATE
CreateEncoder PRIVATE
GetHashers PRIVATE
SetCodecs PRIVATE
SetLargePageMode PRIVATE
SetCaseSensitive PRIVATE

View File

@@ -733,7 +733,13 @@ HRESULT CDatabase::Open()
RINOK(OpenProgressFat());
if ((Fat[0] & 0xFF) != Header.MediaType)
return S_FALSE;
{
// that case can mean error in FAT,
// but xdf file: (MediaType == 0xF0 && Fat[0] == 0xFF9)
// 19.00: so we use non-strict check
if ((Fat[0] & 0xFF) < 0xF0)
return S_FALSE;
}
RINOK(ReadDir(-1, Header.RootCluster, 0));

View File

@@ -41,9 +41,8 @@ static const UInt32 k_Signature32 = 0x00004550;
static HRESULT CalcCheckSum(ISequentialInStream *stream, UInt32 size, UInt32 excludePos, UInt32 &res)
{
const UInt32 kBufSizeMax = (UInt32)1 << 16;
UInt32 bufSize = MyMin(kBufSizeMax, size);
bufSize += (bufSize & 1);
const UInt32 kBufSizeMax = (UInt32)1 << 15;
UInt32 bufSize = kBufSizeMax;
CByteBuffer buffer(bufSize);
Byte *buf = buffer;
UInt32 sum = 0;
@@ -58,9 +57,6 @@ static HRESULT CalcCheckSum(ISequentialInStream *stream, UInt32 size, UInt32 exc
size_t processed = rem;
RINOK(ReadStream(stream, buf, &processed));
if ((processed & 1) != 0)
buf[processed] = 0;
for (unsigned j = 0; j < 4; j++)
{
UInt32 e = excludePos + j;
@@ -72,11 +68,30 @@ static HRESULT CalcCheckSum(ISequentialInStream *stream, UInt32 size, UInt32 exc
}
}
for (size_t i = 0; i < processed; i += 2)
const unsigned kStep = (1 << 4);
{
sum += Get16(buf + i);
sum = (sum + (sum >> 16)) & 0xFFFF;
for (size_t i = processed; (i & (kStep - 1)) != 0; i++)
buf[i] = 0;
}
{
const Byte *buf2 = buf;
const Byte *bufLimit = buf + processed;
UInt64 sum2 = 0;
for (; buf2 < bufLimit; buf2 += kStep)
{
UInt64 sum3 = (UInt64)Get32(buf2)
+ Get32(buf2 + 4)
+ Get32(buf2 + 8)
+ Get32(buf2 + 12);
sum2 += sum3;
}
sum2 = (UInt32)(sum2) + (UInt64)(sum2 >> 32);
UInt32 sum3 = ((UInt32)sum2 + (UInt32)(sum2 >> 32));
sum += (sum3 & 0xFFFF) + (sum3 >> 16);
sum = (sum & 0xFFFF) + (sum >> 16);
sum = (sum & 0xFFFF) + (sum >> 16);
}
pos += (UInt32)processed;
if (rem != processed)
break;

View File

@@ -7,6 +7,7 @@
#include "../../../Common/ComTry.h"
#include "../../../Common/IntToString.h"
#include "../../../Common/MyBuffer2.h"
#include "../../../Common/UTFConvert.h"
#include "../../../Windows/PropVariantUtils.h"
@@ -104,37 +105,6 @@ static const char * const g_LinkTypes[] =
static const char g_ExtraTimeFlags[] = { 'u', 'M', 'C', 'A', 'n' };
template <unsigned alignMask>
struct CAlignedBuffer
{
Byte *_buf;
Byte *_bufBase;
size_t _size;
CAlignedBuffer(): _buf(NULL), _bufBase(NULL), _size(0) {}
~CAlignedBuffer() { ::MyFree(_bufBase); }
public:
operator Byte *() { return _buf; }
operator const Byte *() const { return _buf; }
void AllocAtLeast(size_t size)
{
if (_buf && _size >= size)
return;
::MyFree(_bufBase);
_buf = NULL;
_size = 0;
_bufBase = (Byte *)::MyAlloc(size + alignMask);
if (_bufBase)
{
_size = size;
// _buf = (Byte *)(((uintptr_t)_bufBase + alignMask) & ~(uintptr_t)alignMask);
_buf = (Byte *)(((ptrdiff_t)_bufBase + alignMask) & ~(ptrdiff_t)alignMask);
}
}
};
static unsigned ReadVarInt(const Byte *p, size_t maxSize, UInt64 *val)
{
*val = 0;
@@ -578,7 +548,7 @@ STDMETHODIMP COutStreamWithHash::Write(const void *data, UInt32 size, UInt32 *pr
class CInArchive
{
CAlignedBuffer<AES_BLOCK_SIZE - 1> _buf;
CAlignedBuffer _buf;
size_t _bufSize;
size_t _bufPos;
ISequentialInStream *_stream;
@@ -586,7 +556,7 @@ class CInArchive
NCrypto::NRar5::CDecoder *m_CryptoDecoderSpec;
CMyComPtr<ICompressFilter> m_CryptoDecoder;
CLASS_NO_COPY(CInArchive)
HRESULT ReadStream_Check(void *data, size_t size);
@@ -610,6 +580,8 @@ public:
UInt64 DataSize;
};
CInArchive() {}
HRESULT ReadBlockHeader(CHeader &h);
bool ReadFileHeader(const CHeader &header, CItem &item);
void AddToSeekValue(UInt64 addValue)

View File

@@ -6,6 +6,7 @@
#include "../../../Common/ComTry.h"
#include "../../../Common/IntToString.h"
#include "../../../Common/MyBuffer2.h"
#include "../../../Common/UTFConvert.h"
#include "../../../Windows/PropVariantUtils.h"
@@ -136,8 +137,7 @@ class CInArchive
NHeader::NBlock::CBlock m_BlockHeader;
NCrypto::NRar3::CDecoder *m_RarAESSpec;
CMyComPtr<ICompressFilter> m_RarAES;
CByteBuffer m_DecryptedData;
Byte *m_DecryptedDataAligned;
CAlignedBuffer m_DecryptedDataAligned;
UInt32 m_DecryptedDataSize;
bool m_CryptoMode;
UInt32 m_CryptoPos;
@@ -553,11 +553,12 @@ HRESULT CInArchive::GetNextItem(CItem &item, ICryptoGetTextPassword *getTextPass
m_RarAESSpec->SetPassword((const Byte *)buffer, len * 2);
const UInt32 kDecryptedBufferSize = (1 << 12);
if (m_DecryptedData.Size() == 0)
if (m_DecryptedDataAligned.Size() == 0)
{
const UInt32 kAlign = 16;
m_DecryptedData.Alloc(kDecryptedBufferSize + kAlign);
m_DecryptedDataAligned = (Byte *)((ptrdiff_t)((Byte *)m_DecryptedData + kAlign - 1) & ~(ptrdiff_t)(kAlign - 1));
// const UInt32 kAlign = 16;
m_DecryptedDataAligned.AllocAtLeast(kDecryptedBufferSize);
if (!m_DecryptedDataAligned.IsAllocated())
return E_OUTOFMEMORY;
}
RINOK(m_RarAES->Init());
size_t decryptedDataSizeT = kDecryptedBufferSize;

View File

@@ -791,20 +791,24 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
void CHandler::AddCommentString(const char *name, UInt32 pos)
{
UString s;
const Byte *buf = _bufs[0];
if (pos < _h.HeaderSize)
return;
for (UInt32 i = pos;; i += 2)
if (pos >= _h.OffsetToCapsuleBody)
return;
UInt32 limit = (_h.OffsetToCapsuleBody - pos) & ~(UInt32)1;
const Byte *buf = _bufs[0] + pos;
for (UInt32 i = 0;;)
{
if (s.Len() > (1 << 16) || i >= _h.OffsetToCapsuleBody)
if (s.Len() > (1 << 16) || i >= limit)
return;
wchar_t c = Get16(buf + i);
i += 2;
if (c == 0)
{
i += 2;
if (i >= _h.OffsetToCapsuleBody)
if (i >= limit)
return;
c = Get16(buf + i);
i += 2;
if (c == 0)
break;
s.Add_LF();

View File

@@ -671,7 +671,7 @@ void CHeader::SetDefaultFields(bool useLZX)
ChunkSize = kChunkSize;
ChunkSizeBits = kChunkSizeBits;
}
g_RandomGenerator.Generate(Guid, 16);
MY_RAND_GEN(Guid, 16);
PartNumber = 1;
NumParts = 1;
NumImages = 1;

View File

@@ -1,227 +1,220 @@
PROG = 7za.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS)
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE
!ENDIF
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\CrcReg.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
$O\XzCrc64Init.obj \
$O\XzCrc64Reg.obj \
$O\Sha1Reg.obj \
$O\Sha256Reg.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\PropVariantUtils.obj \
$O\Synchronization.obj \
$O\System.obj \
$O\TimeUtils.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\CWrappers.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
$O\LimitedStreams.obj \
$O\MemBlocks.obj \
$O\MethodId.obj \
$O\MethodProps.obj \
$O\OffsetStream.obj \
$O\OutBuffer.obj \
$O\OutMemStream.obj \
$O\ProgressMt.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
$O\VirtThread.obj \
AR_OBJS = \
$O\Bz2Handler.obj \
$O\DeflateProps.obj \
$O\GzHandler.obj \
$O\LzmaHandler.obj \
$O\SplitHandler.obj \
$O\XzHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\DummyOutStream.obj \
$O\FindSignature.obj \
$O\HandlerOut.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
7Z_OBJS = \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zEncode.obj \
$O\7zExtract.obj \
$O\7zFolderInStream.obj \
$O\7zHandler.obj \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
$O\7zRegister.obj \
CAB_OBJS = \
$O\CabBlockInStream.obj \
$O\CabHandler.obj \
$O\CabHeader.obj \
$O\CabIn.obj \
$O\CabRegister.obj \
TAR_OBJS = \
$O\TarHandler.obj \
$O\TarHandlerOut.obj \
$O\TarHeader.obj \
$O\TarIn.obj \
$O\TarOut.obj \
$O\TarUpdate.obj \
$O\TarRegister.obj \
ZIP_OBJS = \
$O\ZipAddCommon.obj \
$O\ZipHandler.obj \
$O\ZipHandlerOut.obj \
$O\ZipIn.obj \
$O\ZipItem.obj \
$O\ZipOut.obj \
$O\ZipUpdate.obj \
$O\ZipRegister.obj \
COMPRESS_OBJS = \
$O\Bcj2Coder.obj \
$O\Bcj2Register.obj \
$O\BcjCoder.obj \
$O\BcjRegister.obj \
$O\BitlDecoder.obj \
$O\BranchMisc.obj \
$O\BranchRegister.obj \
$O\ByteSwap.obj \
$O\BZip2CRC.obj \
$O\BZip2Decoder.obj \
$O\BZip2Encoder.obj \
$O\BZip2Register.obj \
$O\CopyCoder.obj \
$O\CopyRegister.obj \
$O\Deflate64Register.obj \
$O\DeflateDecoder.obj \
$O\DeflateEncoder.obj \
$O\DeflateRegister.obj \
$O\DeltaFilter.obj \
$O\ImplodeDecoder.obj \
$O\Lzma2Decoder.obj \
$O\Lzma2Encoder.obj \
$O\Lzma2Register.obj \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
$O\LzOutWindow.obj \
$O\LzxDecoder.obj \
$O\PpmdDecoder.obj \
$O\PpmdEncoder.obj \
$O\PpmdRegister.obj \
$O\PpmdZip.obj \
$O\QuantumDecoder.obj \
$O\ShrinkDecoder.obj \
$O\XzDecoder.obj \
$O\XzEncoder.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
$O\HmacSha1.obj \
$O\MyAes.obj \
$O\MyAesReg.obj \
$O\Pbkdf2HmacSha1.obj \
$O\RandGen.obj \
$O\WzAes.obj \
$O\ZipCrypto.obj \
$O\ZipStrong.obj \
C_OBJS = \
$O\7zStream.obj \
$O\Alloc.obj \
$O\Bcj2.obj \
$O\Bcj2Enc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\BwtSort.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\HuffEnc.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma2Dec.obj \
$O\Lzma2DecMt.obj \
$O\Lzma2Enc.obj \
$O\LzmaDec.obj \
$O\LzmaEnc.obj \
$O\MtCoder.obj \
$O\MtDec.obj \
$O\Ppmd7.obj \
$O\Ppmd7Dec.obj \
$O\Ppmd7Enc.obj \
$O\Ppmd8.obj \
$O\Ppmd8Dec.obj \
$O\Ppmd8Enc.obj \
$O\Sha1.obj \
$O\Sha256.obj \
$O\Sort.obj \
$O\Threads.obj \
$O\Xz.obj \
$O\XzDec.obj \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../UI/Console/Console.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
!include "../../Crc64.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"
PROG = 7za.exe
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\CrcReg.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
$O\XzCrc64Init.obj \
$O\XzCrc64Reg.obj \
$O\Sha1Reg.obj \
$O\Sha256Reg.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\PropVariantUtils.obj \
$O\Synchronization.obj \
$O\System.obj \
$O\TimeUtils.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\CWrappers.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
$O\LimitedStreams.obj \
$O\MemBlocks.obj \
$O\MethodId.obj \
$O\MethodProps.obj \
$O\OffsetStream.obj \
$O\OutBuffer.obj \
$O\OutMemStream.obj \
$O\ProgressMt.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
$O\VirtThread.obj \
AR_OBJS = \
$O\Bz2Handler.obj \
$O\DeflateProps.obj \
$O\GzHandler.obj \
$O\LzmaHandler.obj \
$O\SplitHandler.obj \
$O\XzHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\DummyOutStream.obj \
$O\FindSignature.obj \
$O\HandlerOut.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
7Z_OBJS = \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zEncode.obj \
$O\7zExtract.obj \
$O\7zFolderInStream.obj \
$O\7zHandler.obj \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
$O\7zRegister.obj \
CAB_OBJS = \
$O\CabBlockInStream.obj \
$O\CabHandler.obj \
$O\CabHeader.obj \
$O\CabIn.obj \
$O\CabRegister.obj \
TAR_OBJS = \
$O\TarHandler.obj \
$O\TarHandlerOut.obj \
$O\TarHeader.obj \
$O\TarIn.obj \
$O\TarOut.obj \
$O\TarUpdate.obj \
$O\TarRegister.obj \
ZIP_OBJS = \
$O\ZipAddCommon.obj \
$O\ZipHandler.obj \
$O\ZipHandlerOut.obj \
$O\ZipIn.obj \
$O\ZipItem.obj \
$O\ZipOut.obj \
$O\ZipUpdate.obj \
$O\ZipRegister.obj \
COMPRESS_OBJS = \
$O\Bcj2Coder.obj \
$O\Bcj2Register.obj \
$O\BcjCoder.obj \
$O\BcjRegister.obj \
$O\BitlDecoder.obj \
$O\BranchMisc.obj \
$O\BranchRegister.obj \
$O\ByteSwap.obj \
$O\BZip2CRC.obj \
$O\BZip2Decoder.obj \
$O\BZip2Encoder.obj \
$O\BZip2Register.obj \
$O\CopyCoder.obj \
$O\CopyRegister.obj \
$O\Deflate64Register.obj \
$O\DeflateDecoder.obj \
$O\DeflateEncoder.obj \
$O\DeflateRegister.obj \
$O\DeltaFilter.obj \
$O\ImplodeDecoder.obj \
$O\Lzma2Decoder.obj \
$O\Lzma2Encoder.obj \
$O\Lzma2Register.obj \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
$O\LzOutWindow.obj \
$O\LzxDecoder.obj \
$O\PpmdDecoder.obj \
$O\PpmdEncoder.obj \
$O\PpmdRegister.obj \
$O\PpmdZip.obj \
$O\QuantumDecoder.obj \
$O\ShrinkDecoder.obj \
$O\XzDecoder.obj \
$O\XzEncoder.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
$O\HmacSha1.obj \
$O\MyAes.obj \
$O\MyAesReg.obj \
$O\Pbkdf2HmacSha1.obj \
$O\RandGen.obj \
$O\WzAes.obj \
$O\ZipCrypto.obj \
$O\ZipStrong.obj \
C_OBJS = \
$O\7zStream.obj \
$O\Alloc.obj \
$O\Bcj2.obj \
$O\Bcj2Enc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\BwtSort.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\HuffEnc.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma2Dec.obj \
$O\Lzma2DecMt.obj \
$O\Lzma2Enc.obj \
$O\LzmaDec.obj \
$O\LzmaEnc.obj \
$O\MtCoder.obj \
$O\MtDec.obj \
$O\Ppmd7.obj \
$O\Ppmd7Dec.obj \
$O\Ppmd7Enc.obj \
$O\Ppmd8.obj \
$O\Ppmd8Dec.obj \
$O\Ppmd8Enc.obj \
$O\Sha1.obj \
$O\Sha256.obj \
$O\Sort.obj \
$O\Threads.obj \
$O\Xz.obj \
$O\XzDec.obj \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../UI/Console/Console.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
!include "../../Crc64.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"

View File

@@ -1,158 +1,154 @@
PROG = 7zr.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS) -DPROG_VARIANT_R
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE
!ENDIF
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\CrcReg.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\Sha256Reg.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
$O\XzCrc64Init.obj \
$O\XzCrc64Reg.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Synchronization.obj \
$O\System.obj \
$O\TimeUtils.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\CWrappers.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodId.obj \
$O\MethodProps.obj \
$O\OffsetStream.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
$O\VirtThread.obj \
AR_OBJS = \
$O\LzmaHandler.obj \
$O\SplitHandler.obj \
$O\XzHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\DummyOutStream.obj \
$O\HandlerOut.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
7Z_OBJS = \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zEncode.obj \
$O\7zExtract.obj \
$O\7zFolderInStream.obj \
$O\7zHandler.obj \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zRegister.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
COMPRESS_OBJS = \
$O\Bcj2Coder.obj \
$O\Bcj2Register.obj \
$O\BcjCoder.obj \
$O\BcjRegister.obj \
$O\BranchMisc.obj \
$O\BranchRegister.obj \
$O\ByteSwap.obj \
$O\CopyCoder.obj \
$O\CopyRegister.obj \
$O\DeltaFilter.obj \
$O\Lzma2Decoder.obj \
$O\Lzma2Encoder.obj \
$O\Lzma2Register.obj \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
$O\XzDecoder.obj \
$O\XzEncoder.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
$O\MyAes.obj \
$O\MyAesReg.obj \
$O\RandGen.obj \
C_OBJS = \
$O\7zStream.obj \
$O\Alloc.obj \
$O\Bcj2.obj \
$O\Bcj2Enc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma2Dec.obj \
$O\Lzma2DecMt.obj \
$O\Lzma2Enc.obj \
$O\LzmaDec.obj \
$O\LzmaEnc.obj \
$O\MtCoder.obj \
$O\MtDec.obj \
$O\Sha256.obj \
$O\Sort.obj \
$O\Threads.obj \
$O\Xz.obj \
$O\XzDec.obj \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../UI/Console/Console.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
!include "../../Crc64.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"
PROG = 7zr.exe
CFLAGS = $(CFLAGS) \
-DPROG_VARIANT_R \
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\CrcReg.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\Sha256Reg.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
$O\XzCrc64Init.obj \
$O\XzCrc64Reg.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Synchronization.obj \
$O\System.obj \
$O\TimeUtils.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\CWrappers.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodId.obj \
$O\MethodProps.obj \
$O\OffsetStream.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
$O\VirtThread.obj \
AR_OBJS = \
$O\LzmaHandler.obj \
$O\SplitHandler.obj \
$O\XzHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\DummyOutStream.obj \
$O\HandlerOut.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
7Z_OBJS = \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zEncode.obj \
$O\7zExtract.obj \
$O\7zFolderInStream.obj \
$O\7zHandler.obj \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zRegister.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
COMPRESS_OBJS = \
$O\Bcj2Coder.obj \
$O\Bcj2Register.obj \
$O\BcjCoder.obj \
$O\BcjRegister.obj \
$O\BranchMisc.obj \
$O\BranchRegister.obj \
$O\ByteSwap.obj \
$O\CopyCoder.obj \
$O\CopyRegister.obj \
$O\DeltaFilter.obj \
$O\Lzma2Decoder.obj \
$O\Lzma2Encoder.obj \
$O\Lzma2Register.obj \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
$O\XzDecoder.obj \
$O\XzEncoder.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
$O\MyAes.obj \
$O\MyAesReg.obj \
$O\RandGen.obj \
C_OBJS = \
$O\7zStream.obj \
$O\Alloc.obj \
$O\Bcj2.obj \
$O\Bcj2Enc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma2Dec.obj \
$O\Lzma2DecMt.obj \
$O\Lzma2Enc.obj \
$O\LzmaDec.obj \
$O\LzmaEnc.obj \
$O\MtCoder.obj \
$O\MtDec.obj \
$O\Sha256.obj \
$O\Sort.obj \
$O\Threads.obj \
$O\Xz.obj \
$O\XzDec.obj \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../UI/Console/Console.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
!include "../../Crc64.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"

View File

@@ -1,91 +1,81 @@
PROG = 7zFM.exe
CFLAGS = $(CFLAGS) \
-DLANG \
-DNEW_FOLDER_INTERFACE \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
!ELSE
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib Mpr.lib Gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE
!ENDIF
!include "../Format7zF/Arc.mak"
!include "../../UI/FileManager/FM.mak"
COMMON_OBJS = $(COMMON_OBJS) \
$O\CommandLineParser.obj \
$O\Lang.obj \
$O\ListFileUtils.obj \
$O\Random.obj \
WIN_OBJS = $(WIN_OBJS) \
$O\Clipboard.obj \
$O\CommonDialog.obj \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileLink.obj \
$O\MemoryGlobal.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
$O\ComboBox.obj \
$O\Dialog.obj \
$O\ListView.obj \
$O\PropertyPage.obj \
$O\Window2.obj \
7ZIP_COMMON_OBJS = $(7ZIP_COMMON_OBJS) \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveName.obj \
$O\ArchiveOpenCallback.obj \
$O\Bench.obj \
$O\CompressCall2.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\HashCalc.obj \
$O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
$O\SortUtils.obj \
$O\TempFiles.obj \
$O\Update.obj \
$O\UpdateAction.obj \
$O\UpdateCallback.obj \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
EXPLORER_OBJS = \
$O\ContextMenu.obj \
$O\MyMessages.obj \
$O\RegistryContextMenu.obj \
GUI_OBJS = \
$O\BenchmarkDialog.obj \
$O\CompressDialog.obj \
$O\ExtractDialog.obj \
$O\ExtractGUI.obj \
$O\HashGUI.obj \
$O\UpdateCallbackGUI.obj \
$O\UpdateCallbackGUI2.obj \
$O\UpdateGUI.obj \
!include "../../7zip.mak"
PROG = 7zFM.exe
!include "../Format7zF/Arc.mak"
!include "../../UI/FileManager/FM.mak"
COMMON_OBJS = $(COMMON_OBJS) \
$O\CommandLineParser.obj \
$O\Lang.obj \
$O\ListFileUtils.obj \
$O\Random.obj \
WIN_OBJS = $(WIN_OBJS) \
$O\Clipboard.obj \
$O\CommonDialog.obj \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileLink.obj \
$O\MemoryGlobal.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
$O\ComboBox.obj \
$O\Dialog.obj \
$O\ListView.obj \
$O\PropertyPage.obj \
$O\Window2.obj \
7ZIP_COMMON_OBJS = $(7ZIP_COMMON_OBJS) \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveName.obj \
$O\ArchiveOpenCallback.obj \
$O\Bench.obj \
$O\CompressCall2.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\HashCalc.obj \
$O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
$O\SortUtils.obj \
$O\TempFiles.obj \
$O\Update.obj \
$O\UpdateAction.obj \
$O\UpdateCallback.obj \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
EXPLORER_OBJS = \
$O\ContextMenu.obj \
$O\MyMessages.obj \
$O\RegistryContextMenu.obj \
GUI_OBJS = \
$O\BenchmarkDialog.obj \
$O\CompressDialog.obj \
$O\ExtractDialog.obj \
$O\ExtractGUI.obj \
$O\HashGUI.obj \
$O\UpdateCallbackGUI.obj \
$O\UpdateCallbackGUI2.obj \
$O\UpdateGUI.obj \
!include "../../7zip.mak"

View File

@@ -1,60 +1,59 @@
PROG = lzma.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS)
CURRENT_OBJS = \
$O\LzmaAlone.obj \
COMPRESS_OBJS = \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\CrcReg.obj \
$O\IntToString.obj \
$O\MyString.obj \
$O\NewHandler.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\MyVector.obj
WIN_OBJS = \
$O\FileIO.obj \
$O\PropVariant.obj \
$O\System.obj
7ZIP_COMMON_OBJS = \
$O\CWrappers.obj \
$O\CreateCoder.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\MethodProps.obj \
$O\OutBuffer.obj \
$O\StreamUtils.obj \
UI_COMMON_OBJS = \
$O\Bench.obj \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
$O\BenchCon.obj \
C_OBJS = \
$O\Alloc.obj \
$O\Bra86.obj \
$O\CpuArch.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma86Dec.obj \
$O\Lzma86Enc.obj \
$O\LzmaDec.obj \
$O\LzmaEnc.obj \
$O\Threads.obj \
!include "../../Crc.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"
PROG = lzma.exe
MY_CONSOLE = 1
CURRENT_OBJS = \
$O\LzmaAlone.obj \
COMPRESS_OBJS = \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\CrcReg.obj \
$O\IntToString.obj \
$O\MyString.obj \
$O\NewHandler.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\MyVector.obj
WIN_OBJS = \
$O\FileIO.obj \
$O\PropVariant.obj \
$O\System.obj
7ZIP_COMMON_OBJS = \
$O\CWrappers.obj \
$O\CreateCoder.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\MethodProps.obj \
$O\OutBuffer.obj \
$O\StreamUtils.obj \
UI_COMMON_OBJS = \
$O\Bench.obj \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
$O\BenchCon.obj \
C_OBJS = \
$O\Alloc.obj \
$O\Bra86.obj \
$O\CpuArch.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma86Dec.obj \
$O\Lzma86Enc.obj \
$O\LzmaDec.obj \
$O\LzmaEnc.obj \
$O\Threads.obj \
!include "../../Crc.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"

View File

@@ -1,135 +1,134 @@
PROG = 7zCon.sfx
MY_CONSOLE = 1
MY_FIXED = 1
CFLAGS = $(CFLAGS) \
-DEXTRACT_ONLY \
-DNO_READ_FROM_CODER \
-D_SFX \
-D_CONSOLE \
CURRENT_OBJS = \
$O\SfxCon.obj \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
$O\ExtractCallbackConsole.obj \
$O\List.obj \
$O\MainAr.obj \
$O\OpenCallbackConsole.obj \
$O\PercentPrinter.obj \
$O\UserInputUtils.obj \
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\StringConvert.obj \
$O\Wildcard.obj \
$O\UTFConvert.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Synchronization.obj \
$O\System.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\CWrappers.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\VirtThread.obj \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
$O\DefaultName.obj \
$O\LoadCodecs.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
AR_OBJS = \
$O\SplitHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
7Z_OBJS = \
$O\7zDecode.obj \
$O\7zExtract.obj \
$O\7zHandler.obj \
$O\7zIn.obj \
$O\7zRegister.obj \
COMPRESS_OBJS = \
$O\Bcj2Coder.obj \
$O\Bcj2Register.obj \
$O\BcjCoder.obj \
$O\BcjRegister.obj \
$O\BranchMisc.obj \
$O\BranchRegister.obj \
$O\CopyCoder.obj \
$O\CopyRegister.obj \
$O\DeltaFilter.obj \
$O\Lzma2Decoder.obj \
$O\Lzma2Register.obj \
$O\LzmaDecoder.obj \
$O\LzmaRegister.obj \
$O\PpmdDecoder.obj \
$O\PpmdRegister.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
$O\MyAes.obj \
C_OBJS = \
$O\Alloc.obj \
$O\Bcj2.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\Lzma2DecMt.obj \
$O\LzmaDec.obj \
$O\MtDec.obj \
$O\Ppmd7.obj \
$O\Ppmd7Dec.obj \
$O\Sha256.obj \
$O\Threads.obj \
!include "../../Aes.mak"
!include "../../Crc.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"
PROG = 7zCon.sfx
MY_CONSOLE = 1
MY_FIXED = 1
CFLAGS = $(CFLAGS) \
-DEXTRACT_ONLY \
-DNO_READ_FROM_CODER \
-D_SFX \
CURRENT_OBJS = \
$O\SfxCon.obj \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
$O\ExtractCallbackConsole.obj \
$O\List.obj \
$O\MainAr.obj \
$O\OpenCallbackConsole.obj \
$O\PercentPrinter.obj \
$O\UserInputUtils.obj \
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\StringConvert.obj \
$O\Wildcard.obj \
$O\UTFConvert.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Synchronization.obj \
$O\System.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\CWrappers.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\VirtThread.obj \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
$O\DefaultName.obj \
$O\LoadCodecs.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
AR_OBJS = \
$O\SplitHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
7Z_OBJS = \
$O\7zDecode.obj \
$O\7zExtract.obj \
$O\7zHandler.obj \
$O\7zIn.obj \
$O\7zRegister.obj \
COMPRESS_OBJS = \
$O\Bcj2Coder.obj \
$O\Bcj2Register.obj \
$O\BcjCoder.obj \
$O\BcjRegister.obj \
$O\BranchMisc.obj \
$O\BranchRegister.obj \
$O\CopyCoder.obj \
$O\CopyRegister.obj \
$O\DeltaFilter.obj \
$O\Lzma2Decoder.obj \
$O\Lzma2Register.obj \
$O\LzmaDecoder.obj \
$O\LzmaRegister.obj \
$O\PpmdDecoder.obj \
$O\PpmdRegister.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
$O\MyAes.obj \
C_OBJS = \
$O\Alloc.obj \
$O\Bcj2.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\Lzma2DecMt.obj \
$O\LzmaDec.obj \
$O\MtDec.obj \
$O\Ppmd7.obj \
$O\Ppmd7Dec.obj \
$O\Sha256.obj \
$O\Threads.obj \
!include "../../Aes.mak"
!include "../../Crc.mak"
!include "../../LzmaDec.mak"
!include "../../7zip.mak"

View File

@@ -7,6 +7,23 @@
#include "FilterCoder.h"
#include "StreamUtils.h"
#ifdef _WIN32
#define alignedMidBuffer_Alloc g_MidAlloc
#else
#define alignedMidBuffer_Alloc g_AlignedAlloc
#endif
CAlignedMidBuffer::~CAlignedMidBuffer()
{
ISzAlloc_Free(&alignedMidBuffer_Alloc, _buf);
}
void CAlignedMidBuffer::AllocAligned(size_t size)
{
ISzAlloc_Free(&alignedMidBuffer_Alloc, _buf);
_buf = (Byte *)ISzAlloc_Alloc(&alignedMidBuffer_Alloc, size);
}
/*
AES filters need 16-bytes alignment for HARDWARE-AES instructions.
So we call IFilter::Filter(, size), where (size != 16 * N) only for last data block.
@@ -36,7 +53,7 @@ HRESULT CFilterCoder::Alloc()
size = kMinSize;
if (!_buf || _bufSize != size)
{
AllocAlignedMask(size, 16 - 1);
AllocAligned(size);
if (!_buf)
return E_OUTOFMEMORY;
_bufSize = size;

View File

@@ -19,41 +19,11 @@
struct CAlignedMidBuffer
{
#ifdef _WIN32
Byte *_buf;
CAlignedMidBuffer(): _buf(NULL) {}
~CAlignedMidBuffer() { ::MidFree(_buf); }
void AllocAlignedMask(size_t size, size_t)
{
::MidFree(_buf);
_buf = (Byte *)::MidAlloc(size);
}
#else
Byte *_bufBase;
Byte *_buf;
CAlignedMidBuffer(): _bufBase(NULL), _buf(NULL) {}
~CAlignedMidBuffer() { ::MidFree(_bufBase); }
void AllocAlignedMask(size_t size, size_t alignMask)
{
::MidFree(_bufBase);
_buf = NULL;
_bufBase = (Byte *)::MidAlloc(size + alignMask);
if (_bufBase)
{
// _buf = (Byte *)(((uintptr_t)_bufBase + alignMask) & ~(uintptr_t)alignMask);
_buf = (Byte *)(((ptrdiff_t)_bufBase + alignMask) & ~(ptrdiff_t)alignMask);
}
}
#endif
~CAlignedMidBuffer();
void AllocAligned(size_t size);
};
class CFilterCoder:

View File

@@ -1,6 +1,6 @@
EXPORTS
CreateObject PRIVATE
GetNumberOfMethods PRIVATE
GetMethodProperty PRIVATE
CreateDecoder PRIVATE
CreateEncoder PRIVATE
EXPORTS
CreateObject PRIVATE
GetNumberOfMethods PRIVATE
GetMethodProperty PRIVATE
CreateDecoder PRIVATE
CreateEncoder PRIVATE

View File

@@ -164,8 +164,8 @@ STDMETHODIMP CEncoder::ResetInitVector()
{
for (unsigned i = 0; i < sizeof(_iv); i++)
_iv[i] = 0;
_ivSize = 8;
g_RandomGenerator.Generate(_iv, _ivSize);
_ivSize = 16;
MY_RAND_GEN(_iv, _ivSize);
return S_OK;
}

View File

@@ -1,4 +1,4 @@
EXPORTS
CreateObject PRIVATE
GetNumberOfMethods PRIVATE
GetMethodProperty PRIVATE
EXPORTS
CreateObject PRIVATE
GetNumberOfMethods PRIVATE
GetMethodProperty PRIVATE

View File

@@ -2,14 +2,44 @@
#include "StdAfx.h"
#include "RandGen.h"
#ifndef USE_STATIC_SYSTEM_RAND
#ifndef _7ZIP_ST
#include "../../Windows/Synchronization.h"
#endif
#include "RandGen.h"
#ifndef _WIN32
#ifdef _WIN32
#ifdef _WIN64
#define USE_STATIC_RtlGenRandom
#endif
#ifdef USE_STATIC_RtlGenRandom
#include <ntsecapi.h>
EXTERN_C_BEGIN
#ifndef RtlGenRandom
#define RtlGenRandom SystemFunction036
BOOLEAN WINAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
#endif
EXTERN_C_END
#else
EXTERN_C_BEGIN
typedef BOOLEAN (WINAPI * Func_RtlGenRandom)(PVOID RandomBuffer, ULONG RandomBufferLength);
EXTERN_C_END
#endif
#else
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define USE_POSIX_TIME
#define USE_POSIX_TIME2
#endif
@@ -21,11 +51,9 @@
#endif
#endif
// This is not very good random number generator.
// Please use it only for salt.
// First generated data block depends from timer and processID.
// The seed and first generated data block depend from processID,
// theadID, timer and system random generator, if available.
// Other generated data blocks depend from previous state
// Maybe it's possible to restore original timer value from generated value.
#define HASH_UPD(x) Sha256_Update(&hash, (const Byte *)&x, sizeof(x));
@@ -34,25 +62,102 @@ void CRandomGenerator::Init()
CSha256 hash;
Sha256_Init(&hash);
unsigned numIterations = 1000;
{
#ifndef UNDER_CE
const unsigned kNumIterations_Small = 100;
const unsigned kBufSize = 32;
Byte buf[kBufSize];
#endif
#ifdef _WIN32
DWORD w = ::GetCurrentProcessId();
HASH_UPD(w);
w = ::GetCurrentThreadId();
HASH_UPD(w);
#ifdef UNDER_CE
/*
if (CeGenRandom(kBufSize, buf))
{
numIterations = kNumIterations_Small;
Sha256_Update(&hash, buf, kBufSize);
}
*/
#elif defined(USE_STATIC_RtlGenRandom)
if (RtlGenRandom(buf, kBufSize))
{
numIterations = kNumIterations_Small;
Sha256_Update(&hash, buf, kBufSize);
}
#else
{
HMODULE hModule = ::LoadLibrary(TEXT("Advapi32.dll"));
if (hModule)
{
// SystemFunction036() is real name of RtlGenRandom() function
Func_RtlGenRandom my_RtlGenRandom = (Func_RtlGenRandom)GetProcAddress(hModule, "SystemFunction036");
if (my_RtlGenRandom)
{
if (my_RtlGenRandom(buf, kBufSize))
{
numIterations = kNumIterations_Small;
Sha256_Update(&hash, buf, kBufSize);
}
}
::FreeLibrary(hModule);
}
}
#endif
#else
pid_t pid = getpid();
HASH_UPD(pid);
pid = getppid();
HASH_UPD(pid);
{
int f = open("/dev/urandom", O_RDONLY);
unsigned numBytes = kBufSize;
if (f >= 0)
{
do
{
int n = read(f, buf, numBytes);
if (n <= 0)
break;
Sha256_Update(&hash, buf, n);
numBytes -= n;
}
while (numBytes);
close(f);
if (numBytes == 0)
numIterations = kNumIterations_Small;
}
}
/*
{
int n = getrandom(buf, kBufSize, 0);
if (n > 0)
{
Sha256_Update(&hash, buf, n);
if (n == kBufSize)
numIterations = kNumIterations_Small;
}
}
*/
#endif
}
#ifdef _DEBUG
numIterations = 2;
#endif
for (unsigned i = 0; i <
#ifdef _DEBUG
2;
#else
1000;
#endif
i++)
do
{
#ifdef _WIN32
LARGE_INTEGER v;
@@ -85,6 +190,8 @@ void CRandomGenerator::Init()
Sha256_Update(&hash, _buff, SHA256_DIGEST_SIZE);
}
}
while (--numIterations);
Sha256_Final(&hash, _buff);
_needInit = false;
}
@@ -122,3 +229,5 @@ void CRandomGenerator::Generate(Byte *data, unsigned size)
}
CRandomGenerator g_RandomGenerator;
#endif

View File

@@ -5,6 +5,21 @@
#include "../../../C/Sha256.h"
#ifdef _WIN64
// #define USE_STATIC_SYSTEM_RAND
#endif
#ifdef USE_STATIC_SYSTEM_RAND
#ifdef _WIN32
#include <ntsecapi.h>
#define MY_RAND_GEN(data, size) RtlGenRandom(data, size)
#else
#define MY_RAND_GEN(data, size) getrandom(data, size, 0)
#endif
#else
class CRandomGenerator
{
Byte _buff[SHA256_DIGEST_SIZE];
@@ -18,4 +33,8 @@ public:
extern CRandomGenerator g_RandomGenerator;
#define MY_RAND_GEN(data, size) g_RandomGenerator.Generate(data, size)
#endif
#endif

View File

@@ -96,7 +96,7 @@ STDMETHODIMP CBaseCoder::Init()
HRESULT CEncoder::WriteHeader(ISequentialOutStream *outStream)
{
unsigned saltSize = _key.GetSaltSize();
g_RandomGenerator.Generate(_key.Salt, saltSize);
MY_RAND_GEN(_key.Salt, saltSize);
Init2();
RINOK(WriteStream(outStream, _key.Salt, saltSize));
return WriteStream(outStream, _key.PwdVerifComputed, kPwdVerifSize);

View File

@@ -49,7 +49,7 @@ HRESULT CEncoder::WriteHeader_Check16(ISequentialOutStream *outStream, UInt16 cr
PKZIP 2.0+ used 1 byte CRC check. It's more secure.
We also use 1 byte CRC. */
g_RandomGenerator.Generate(h, kHeaderSize - 1);
MY_RAND_GEN(h, kHeaderSize - 1);
// h[kHeaderSize - 2] = (Byte)(crc);
h[kHeaderSize - 1] = (Byte)(crc >> 8);

View File

@@ -85,13 +85,14 @@ HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream, UInt32 crc, UInt64 u
return E_NOTIMPL;
RINOK(ReadStream_FALSE(inStream, temp, 4));
_remSize = GetUi32(temp);
const UInt32 kAlign = 16;
// const UInt32 kAlign = 16;
if (_remSize < 16 || _remSize > (1 << 18))
return E_NOTIMPL;
if (_remSize + kAlign > _buf.Size())
if (_remSize > _bufAligned.Size())
{
_buf.Alloc(_remSize + kAlign);
_bufAligned = (Byte *)((ptrdiff_t)((Byte *)_buf + kAlign - 1) & ~(ptrdiff_t)(kAlign - 1));
_bufAligned.AllocAtLeast(_remSize);
if (!(Byte *)_bufAligned)
return E_OUTOFMEMORY;
}
return ReadStream_FALSE(inStream, _bufAligned, _remSize);
}

View File

@@ -3,7 +3,7 @@
#ifndef __CRYPTO_ZIP_STRONG_H
#define __CRYPTO_ZIP_STRONG_H
#include "../../Common/MyBuffer.h"
#include "../../Common/MyBuffer2.h"
#include "../IPassword.h"
@@ -35,8 +35,7 @@ class CBaseCoder:
{
protected:
CKeyInfo _key;
CByteBuffer _buf;
Byte *_bufAligned;
CAlignedBuffer _bufAligned;
public:
STDMETHOD(Init)();
STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);

View File

@@ -1,28 +1,28 @@
PROG = 7zcl.exe
MY_CONSOLE = 1
CURRENT_OBJS = \
$O\Client7z.obj \
COMMON_OBJS = \
$O\IntToString.obj \
$O\NewHandler.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
7ZIP_COMMON_OBJS = \
$O\FileStreams.obj \
!include "../../7zip.mak"
PROG = 7zcl.exe
MY_CONSOLE = 1
CURRENT_OBJS = \
$O\Client7z.obj \
COMMON_OBJS = \
$O\IntToString.obj \
$O\NewHandler.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
7ZIP_COMMON_OBJS = \
$O\FileStreams.obj \
!include "../../7zip.mak"

View File

@@ -99,9 +99,28 @@ UString CreateArchiveName(const UStringVector &paths, const NFind::CFileInfo *fi
name = Get_Correct_FsFile_Name(fs2us(CreateArchiveName2(us2fs(paths.Front()), fromPrev, keepName)));
}
UStringVector names;
{
FOR_VECTOR (i, paths)
{
NFind::CFileInfo fi2;
const NFind::CFileInfo *fp;
if (fi && paths.Size() == 1)
fp = fi;
else
{
if (!fi2.Find(us2fs(paths[i])))
continue;
fp = &fi2;
}
names.Add(fs2us(fp->Name));
}
}
UString postfix;
UInt32 index = 1;
for (;;)
{
// we don't want cases when we include archive to itself.
@@ -113,22 +132,10 @@ UString CreateArchiveName(const UStringVector &paths, const NFind::CFileInfo *fi
const UString name2_wim = name2 + L".wim";
unsigned i = 0;
for (i = 0; i < paths.Size(); i++)
{
const UString &fn = paths[i];
NFind::CFileInfo fi2;
const NFind::CFileInfo *fp;
if (fi && paths.Size() == 1)
fp = fi;
else
{
if (!fi2.Find(us2fs(fn)))
continue;
fp = &fi2;
}
const UString fname = fs2us(fp->Name);
for (i = 0; i < names.Size(); i++)
{
const UString &fname = names[i];
if ( 0 == CompareFileNames(fname, name2_zip)
|| 0 == CompareFileNames(fname, name2_7z)
|| 0 == CompareFileNames(fname, name2_tar)
@@ -136,7 +143,7 @@ UString CreateArchiveName(const UStringVector &paths, const NFind::CFileInfo *fi
break;
}
if (i == paths.Size())
if (i == names.Size())
break;
index++;
postfix = "_";

View File

@@ -102,7 +102,14 @@ STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStre
// if (!allowAbsVolPaths)
if (!IsSafePath(name2))
return S_FALSE;
// #ifdef _WIN32
// we don't want to support wildcards in names here here
if (name2.Find(L'?') >= 0 ||
name2.Find(L'*') >= 0)
return S_FALSE;
// #endif
#endif

View File

@@ -29,7 +29,6 @@
#endif
#include "../../../../C/7zCrc.h"
#include "../../../../C/Alloc.h"
#include "../../../../C/CpuArch.h"
#ifndef _7ZIP_ST
@@ -47,6 +46,7 @@
#include "../../../Common/IntToString.h"
#include "../../../Common/MyBuffer2.h"
#include "../../../Common/StringConvert.h"
#include "../../../Common/StringToInt.h"
@@ -94,80 +94,33 @@ static const UInt32 kAdditionalSize = (1 << 16);
static const UInt32 kCompressedAdditionalSize = (1 << 10);
static const UInt32 kMaxLzmaPropSize = 5;
#define ALLOC_WITH_HRESULT(_buffer_, _size_) \
(_buffer_)->Alloc(_size_); \
if (!(_buffer_)->IsAllocated()) return E_OUTOFMEMORY;
class CBaseRandomGenerator
{
UInt32 A1;
UInt32 A2;
UInt32 Salt;
public:
CBaseRandomGenerator() { Init(); }
CBaseRandomGenerator(UInt32 salt = 0): Salt(salt) { Init(); }
void Init() { A1 = 362436069; A2 = 521288629;}
UInt32 GetRnd()
{
return
return Salt ^
(
((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) )
);
}
};
static const unsigned kBufferAlignment = 1 << 4;
struct CBenchBuffer
{
size_t BufferSize;
#ifdef _WIN32
Byte *Buffer;
CBenchBuffer(): BufferSize(0), Buffer(NULL) {}
~CBenchBuffer() { ::MidFree(Buffer); }
void AllocAlignedMask(size_t size, size_t)
{
::MidFree(Buffer);
BufferSize = 0;
Buffer = (Byte *)::MidAlloc(size);
if (Buffer)
BufferSize = size;
}
#else
Byte *Buffer;
Byte *_bufBase;
CBenchBuffer(): BufferSize(0), Buffer(NULL), _bufBase(NULL){}
~CBenchBuffer() { ::MidFree(_bufBase); }
void AllocAlignedMask(size_t size, size_t alignMask)
{
::MidFree(_bufBase);
Buffer = NULL;
BufferSize = 0;
_bufBase = (Byte *)::MidAlloc(size + alignMask);
if (_bufBase)
{
// Buffer = (Byte *)(((uintptr_t)_bufBase + alignMask) & ~(uintptr_t)alignMask);
Buffer = (Byte *)(((ptrdiff_t)_bufBase + alignMask) & ~(ptrdiff_t)alignMask);
BufferSize = size;
}
}
#endif
bool Alloc(size_t size)
{
if (Buffer && BufferSize == size)
return true;
AllocAlignedMask(size, kBufferAlignment - 1);
return (Buffer != NULL || size == 0);
}
};
class CBenchRandomGenerator: public CBenchBuffer
class CBenchRandomGenerator: public CAlignedBuffer
{
static UInt32 GetVal(UInt32 &res, unsigned numBits)
{
@@ -184,23 +137,22 @@ class CBenchRandomGenerator: public CBenchBuffer
public:
void GenerateSimpleRandom(CBaseRandomGenerator *_RG_)
void GenerateSimpleRandom(UInt32 salt)
{
CBaseRandomGenerator rg = *_RG_;
const size_t bufSize = BufferSize;
Byte *buf = Buffer;
CBaseRandomGenerator rg(salt);
const size_t bufSize = Size();
Byte *buf = (Byte *)*this;
for (size_t i = 0; i < bufSize; i++)
buf[i] = (Byte)rg.GetRnd();
*_RG_ = rg;
}
void GenerateLz(unsigned dictBits, CBaseRandomGenerator *_RG_)
void GenerateLz(unsigned dictBits, UInt32 salt)
{
CBaseRandomGenerator rg = *_RG_;
CBaseRandomGenerator rg(salt);
UInt32 pos = 0;
UInt32 rep0 = 1;
const size_t bufSize = BufferSize;
Byte *buf = Buffer;
const size_t bufSize = Size();
Byte *buf = (Byte *)*this;
unsigned posBits = 1;
while (pos < bufSize)
@@ -255,8 +207,6 @@ public:
*dest++ = *src++;
}
}
*_RG_ = rg;
}
};
@@ -297,7 +247,7 @@ STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processed
class CBenchmarkOutStream:
public ISequentialOutStream,
public CBenchBuffer,
public CAlignedBuffer,
public CMyUnknownImp
{
// bool _overflow;
@@ -325,13 +275,13 @@ public:
STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
size_t curSize = BufferSize - Pos;
size_t curSize = Size() - Pos;
if (curSize > size)
curSize = size;
if (curSize != 0)
{
if (RealCopy)
memcpy(Buffer + Pos, data, curSize);
memcpy(((Byte *)*this) + Pos, data, curSize);
if (CalcCrc)
Crc = CrcUpdate(Crc, data, curSize);
Pos += curSize;
@@ -686,20 +636,39 @@ UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt
return props.GetDecompressRating(elapsedTime, freq, outSize, inSize, numIterations);
}
#ifndef _7ZIP_ST
struct CBenchSyncCommon
{
bool ExitMode;
NSynchronization::CManualResetEvent StartEvent;
CBenchSyncCommon(): ExitMode(false) {}
};
#endif
struct CEncoderInfo;
struct CEncoderInfo
{
#ifndef _7ZIP_ST
NWindows::CThread thread[2];
NSynchronization::CManualResetEvent ReadyEvent;
UInt32 NumDecoderSubThreads;
CBenchSyncCommon *Common;
#endif
CMyComPtr<ICompressCoder> _encoder;
CMyComPtr<ICompressFilter> _encoderFilter;
CBenchProgressInfo *progressInfoSpec[2];
CMyComPtr<ICompressProgressInfo> progressInfo[2];
UInt64 NumIterations;
UInt32 Salt;
#ifdef USE_ALLOCA
size_t AllocaSize;
#endif
@@ -738,22 +707,25 @@ struct CEncoderInfo
const Byte *fileData;
CBenchRandomGenerator rg;
CBenchBuffer rgCopy; // it must be 16-byte aligned !!!
CAlignedBuffer rgCopy; // it must be 16-byte aligned !!!
CBenchmarkOutStream *propStreamSpec;
CMyComPtr<ISequentialOutStream> propStream;
// for decode
unsigned generateDictBits;
COneMethodInfo _method;
// for decode
size_t _uncompressedDataSize;
HRESULT Init(
const COneMethodInfo &method,
unsigned generateDictBits,
CBaseRandomGenerator *rg);
HRESULT Generate();
HRESULT Encode();
HRESULT Decode(UInt32 decoderIndex);
CEncoderInfo():
#ifndef _7ZIP_ST
Common(NULL),
#endif
Salt(0),
fileData(NULL),
CheckCrc_Enc(true),
CheckCrc_Dec(true),
@@ -772,14 +744,15 @@ struct CEncoderInfo
#endif
res = encoder->Encode();
encoder->Results[0] = res;
}
catch(...)
{
res = E_FAIL;
}
encoder->Results[0] = res;
if (res != S_OK)
encoder->progressInfoSpec[0]->Status->SetResult(res);
encoder->ReadyEvent.Set();
return 0;
}
@@ -798,7 +771,12 @@ struct CEncoderInfo
HRESULT CreateEncoderThread()
{
return thread[0].Create(EncodeThreadFunction, this);
WRes res = 0;
if (!ReadyEvent.IsCreated())
res = ReadyEvent.Create();
if (res == 0)
res = thread[0].Create(EncodeThreadFunction, this);
return HRESULT_FROM_WIN32(res);
}
HRESULT CreateDecoderThread(unsigned index, bool callbackMode
@@ -823,11 +801,10 @@ struct CEncoderInfo
};
HRESULT CEncoderInfo::Init(
const COneMethodInfo &method,
unsigned generateDictBits,
CBaseRandomGenerator *rgLoc)
HRESULT CEncoderInfo::Generate()
{
const COneMethodInfo &method = _method;
// we need extra space, if input data is already compressed
const size_t kCompressedBufferSize =
kCompressedAdditionalSize +
@@ -841,40 +818,39 @@ HRESULT CEncoderInfo::Init(
if (!fileData)
{
if (!rg.Alloc(kBufferSize))
return E_OUTOFMEMORY;
ALLOC_WITH_HRESULT(&rg, kBufferSize);
// DWORD ttt = GetTickCount();
if (generateDictBits == 0)
rg.GenerateSimpleRandom(rgLoc);
rg.GenerateSimpleRandom(Salt);
else
rg.GenerateLz(generateDictBits, rgLoc);
rg.GenerateLz(generateDictBits, Salt);
// printf("\n%d\n ", GetTickCount() - ttt);
crc = CrcCalc(rg.Buffer, rg.BufferSize);
uncompressedDataPtr = rg.Buffer;
crc = CrcCalc((const Byte *)rg, rg.Size());
uncompressedDataPtr = (const Byte *)rg;
}
if (_encoderFilter)
{
if (!rgCopy.Alloc(kBufferSize))
return E_OUTOFMEMORY;
ALLOC_WITH_HRESULT(&rgCopy, kBufferSize);
}
outStreamSpec = new CBenchmarkOutStream;
outStream = outStreamSpec;
if (!outStreamSpec->Alloc(kCompressedBufferSize))
return E_OUTOFMEMORY;
if (!outStream)
{
outStreamSpec = new CBenchmarkOutStream;
outStream = outStreamSpec;
}
ALLOC_WITH_HRESULT(outStreamSpec, kCompressedBufferSize)
propStreamSpec = 0;
if (!propStream)
{
propStreamSpec = new CBenchmarkOutStream;
propStream = propStreamSpec;
}
if (!propStreamSpec->Alloc(kMaxLzmaPropSize))
return E_OUTOFMEMORY;
ALLOC_WITH_HRESULT(propStreamSpec, kMaxLzmaPropSize);
propStreamSpec->Init(true, false);
@@ -961,6 +937,28 @@ static void My_FilterBench(ICompressFilter *filter, Byte *data, size_t size)
HRESULT CEncoderInfo::Encode()
{
RINOK(Generate());
#ifndef _7ZIP_ST
if (Common)
{
Results[0] = S_OK;
WRes wres = ReadyEvent.Set();
if (wres == 0)
wres = Common->StartEvent.Lock();
if (wres != 0)
return HRESULT_FROM_WIN32(wres);
if (Common->ExitMode)
return S_OK;
}
else
#endif
{
CBenchProgressInfo *bpi = progressInfoSpec[0];
bpi->SetStartTime();
}
CBenchInfo &bi = progressInfoSpec[0]->BenchInfo;
bi.UnpackSize = 0;
bi.PackSize = 0;
@@ -997,10 +995,10 @@ HRESULT CEncoderInfo::Encode()
if (_encoderFilter)
{
memcpy(rgCopy.Buffer, uncompressedDataPtr, kBufferSize);
memcpy((Byte *)rgCopy, uncompressedDataPtr, kBufferSize);
_encoderFilter->Init();
My_FilterBench(_encoderFilter, rgCopy.Buffer, kBufferSize);
RINOK(WriteStream(outStream, rgCopy.Buffer, kBufferSize));
My_FilterBench(_encoderFilter, (Byte *)rgCopy, kBufferSize);
RINOK(WriteStream(outStream, (const Byte *)rgCopy, kBufferSize));
}
else
{
@@ -1078,7 +1076,7 @@ HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
if (setDecProps)
{
RINOK(setDecProps->SetDecoderProperties2(propStreamSpec->Buffer, (UInt32)propStreamSpec->Pos));
RINOK(setDecProps->SetDecoderProperties2((const Byte *)*propStreamSpec, (UInt32)propStreamSpec->Pos));
}
{
@@ -1106,7 +1104,7 @@ HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
prev = pi->BenchInfo.UnpackSize;
}
inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
inStreamSpec->Init((const Byte *)*outStreamSpec, compressedSize);
crcOutStreamSpec->Init();
UInt64 outSize = kBufferSize;
@@ -1114,12 +1112,12 @@ HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
if (_decoderFilter)
{
if (compressedSize > rgCopy.BufferSize)
if (compressedSize > rgCopy.Size())
return E_FAIL;
memcpy(rgCopy.Buffer, outStreamSpec->Buffer, compressedSize);
memcpy((Byte *)rgCopy, (const Byte *)*outStreamSpec, compressedSize);
_decoderFilter->Init();
My_FilterBench(_decoderFilter, rgCopy.Buffer, compressedSize);
RINOK(WriteStream(crcOutStream, rgCopy.Buffer, compressedSize));
My_FilterBench(_decoderFilter, (Byte *)rgCopy, compressedSize);
RINOK(WriteStream(crcOutStream, (const Byte *)rgCopy, compressedSize));
}
else
{
@@ -1157,6 +1155,57 @@ static UInt64 GetNumIterations(UInt64 numCommands, UInt64 complexInCommands)
}
#ifndef _7ZIP_ST
// ---------- CBenchThreadsFlusher ----------
struct CBenchThreadsFlusher
{
CBenchEncoders *EncodersSpec;
CBenchSyncCommon Common;
unsigned NumThreads;
bool NeedClose;
CBenchThreadsFlusher(): NumThreads(0), NeedClose(false) {}
~CBenchThreadsFlusher()
{
StartAndWait(true);
}
WRes StartAndWait(bool exitMode = false);
};
WRes CBenchThreadsFlusher::StartAndWait(bool exitMode)
{
if (!NeedClose)
return 0;
Common.ExitMode = exitMode;
WRes res = Common.StartEvent.Set();
for (unsigned i = 0; i < NumThreads; i++)
{
NWindows::CThread &t = EncodersSpec->encoders[i].thread[0];
if (t.IsCreated())
{
WRes res2 = t.Wait();
if (res2 == 0)
res2 = t.Close();
if (res == S_OK)
res = res2;
}
}
NeedClose = false;
return res;
}
#endif
static HRESULT MethodBench(
DECL_EXTERNAL_CODECS_LOC_VARS
UInt64 complexInCommands,
@@ -1208,6 +1257,8 @@ static HRESULT MethodBench(
numSubDecoderThreads = 2;
}
}
bool mtEncMode = (numEncoderThreads > 1);
#endif
CBenchEncoders encodersSpec(numEncoderThreads);
@@ -1247,9 +1298,6 @@ static HRESULT MethodBench(
}
}
CBaseRandomGenerator rg;
rg.Init();
UInt32 crc = 0;
if (fileData)
crc = CrcCalc(fileData, uncompressedDataSize);
@@ -1258,22 +1306,38 @@ static HRESULT MethodBench(
{
CEncoderInfo &encoder = encoders[i];
encoder._method = method;
encoder.generateDictBits = generateDictBits;
encoder._uncompressedDataSize = uncompressedDataSize;
encoder.kBufferSize = uncompressedDataSize;
encoder.fileData = fileData;
encoder.crc = crc;
RINOK(encoders[i].Init(method, generateDictBits, &rg));
}
CBenchProgressStatus status;
status.Res = S_OK;
status.EncodeMode = true;
#ifndef _7ZIP_ST
CBenchThreadsFlusher encoderFlusher;
if (mtEncMode)
{
WRes wres = encoderFlusher.Common.StartEvent.Create();
if (wres != 0)
return HRESULT_FROM_WIN32(wres);
encoderFlusher.NumThreads = numEncoderThreads;
encoderFlusher.EncodersSpec = &encodersSpec;
encoderFlusher.NeedClose = true;
}
#endif
for (i = 0; i < numEncoderThreads; i++)
{
CEncoderInfo &encoder = encoders[i];
encoder.NumIterations = GetNumIterations(benchProps->GeComprCommands(uncompressedDataSize), complexInCommands);
encoder.Salt = g_CrcTable[i & 0xFF];
encoder.Salt ^= (g_CrcTable[(i >> 8) & 0xFF] << 3);
// (g_CrcTable[0] == 0), and (encoder.Salt == 0) for first thread
// printf(" %8x", encoder.Salt);
for (int j = 0; j < 2; j++)
{
@@ -1288,30 +1352,50 @@ static HRESULT MethodBench(
CBenchProgressInfo *bpi = encoder.progressInfoSpec[0];
bpi->Callback = callback;
bpi->BenchInfo.NumIterations = numEncoderThreads;
bpi->SetStartTime();
}
#ifndef _7ZIP_ST
if (numEncoderThreads > 1)
if (mtEncMode)
{
#ifdef USE_ALLOCA
encoder.AllocaSize = (i * 16 * 21) & 0x7FF;
#endif
encoder.Common = &encoderFlusher.Common;
RINOK(encoder.CreateEncoderThread())
}
else
#endif
{
RINOK(encoder.Encode());
}
}
if (printCallback)
{
RINOK(printCallback->CheckBreak());
}
#ifndef _7ZIP_ST
if (numEncoderThreads > 1)
if (mtEncMode)
{
for (i = 0; i < numEncoderThreads; i++)
encoders[i].thread[0].Wait();
{
CEncoderInfo &encoder = encoders[i];
WRes wres = encoder.ReadyEvent.Lock();
if (wres != 0)
return HRESULT_FROM_WIN32(wres);
RINOK(encoder.Results[0]);
}
CBenchProgressInfo *bpi = encoders[0].progressInfoSpec[0];
bpi->SetStartTime();
WRes wres = encoderFlusher.StartAndWait();
if (status.Res == 0 && wres != 0)
return HRESULT_FROM_WIN32(wres);
}
else
#endif
{
RINOK(encoders[0].Encode());
}
RINOK(status.Res);
@@ -1327,11 +1411,16 @@ static HRESULT MethodBench(
CEncoderInfo &encoder = encoders[i];
info.UnpackSize += encoder.kBufferSize;
info.PackSize += encoder.compressedSize;
// printf("\n%7d\n", encoder.compressedSize);
}
RINOK(callback->SetEncodeResult(info, true));
// ---------- Decode ----------
status.Res = S_OK;
status.EncodeMode = false;
@@ -1618,21 +1707,21 @@ struct CCrcThreads
#endif
static UInt32 CrcCalc1(const Byte *buf, UInt32 size)
static UInt32 CrcCalc1(const Byte *buf, size_t size)
{
UInt32 crc = CRC_INIT_VAL;;
for (UInt32 i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
crc = CRC_UPDATE_BYTE(crc, buf[i]);
return CRC_GET_DIGEST(crc);
}
static void RandGen(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
static void RandGen(Byte *buf, size_t size, CBaseRandomGenerator &RG)
{
for (UInt32 i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
buf[i] = (Byte)RG.GetRnd();
}
static UInt32 RandGenCrc(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
static UInt32 RandGenCrc(Byte *buf, size_t size, CBaseRandomGenerator &RG)
{
RandGen(buf, size, RG);
return CrcCalc1(buf, size);
@@ -1640,14 +1729,15 @@ static UInt32 RandGenCrc(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
bool CrcInternalTest()
{
CBenchBuffer buffer;
const UInt32 kBufferSize0 = (1 << 8);
const UInt32 kBufferSize1 = (1 << 10);
const UInt32 kCheckSize = (1 << 5);
if (!buffer.Alloc(kBufferSize0 + kBufferSize1))
CAlignedBuffer buffer;
const size_t kBufferSize0 = (1 << 8);
const size_t kBufferSize1 = (1 << 10);
const unsigned kCheckSize = (1 << 5);
buffer.Alloc(kBufferSize0 + kBufferSize1);
if (!buffer.IsAllocated())
return false;
Byte *buf = buffer.Buffer;
UInt32 i;
Byte *buf = (Byte *)buffer;
size_t i;
for (i = 0; i < kBufferSize0; i++)
buf[i] = (Byte)i;
UInt32 crc1 = CrcCalc1(buf, kBufferSize0);
@@ -1656,7 +1746,7 @@ bool CrcInternalTest()
CBaseRandomGenerator RG;
RandGen(buf + kBufferSize0, kBufferSize1, RG);
for (i = 0; i < kBufferSize0 + kBufferSize1 - kCheckSize; i++)
for (UInt32 j = 0; j < kCheckSize; j++)
for (unsigned j = 0; j < kCheckSize; j++)
if (CrcCalc1(buf + i, j) != CrcCalc(buf + i, j))
return false;
return true;
@@ -1920,6 +2010,10 @@ void Add_LargePages_String(AString &s)
{
s += " (LP-";
PrintSize(s, g_LargePageSize);
#ifdef MY_CPU_X86_OR_AMD64
if (CPU_IsSupported_PageGB())
s += "-1G";
#endif
if (!g_LargePagesMode)
s += "-NA";
s += ")";
@@ -2238,14 +2332,13 @@ static HRESULT CrcBench(
methodName, hashID))
return E_NOTIMPL;
CBenchBuffer buffer;
CAlignedBuffer buffer;
size_t totalSize = (size_t)bufferSize * numThreads;
if (totalSize / numThreads != bufferSize)
return E_OUTOFMEMORY;
if (!buffer.Alloc(totalSize))
return E_OUTOFMEMORY;
ALLOC_WITH_HRESULT(&buffer, totalSize)
Byte *buf = buffer.Buffer;
Byte *buf = (Byte *)buffer;
CBaseRandomGenerator RG;
UInt32 bsize = (bufferSize == 0 ? 1 : bufferSize);
UInt64 numIterations = complexInCommands * 256 / complexity / bsize;
@@ -2793,7 +2886,7 @@ HRESULT Bench(
bool multiDict)
{
if (!CrcInternalTest())
return S_FALSE;
return E_FAIL;
UInt32 numCPUs = 1;
UInt64 ramSize = (UInt64)(sizeof(size_t)) << 29;
@@ -2822,7 +2915,7 @@ HRESULT Bench(
COneMethodInfo method;
CBenchBuffer fileDataBuffer;
CAlignedBuffer fileDataBuffer;
{
unsigned i;
@@ -2847,10 +2940,9 @@ HRESULT Bench(
return E_FAIL;
if (len >= ((UInt32)1 << 31) || len == 0)
return E_INVALIDARG;
if (!fileDataBuffer.Alloc((size_t)len))
return E_OUTOFMEMORY;
ALLOC_WITH_HRESULT(&fileDataBuffer, (size_t)len);
UInt32 processedSize;
file.Read(fileDataBuffer.Buffer, (UInt32)len, processedSize);
file.Read((Byte *)fileDataBuffer, (UInt32)len, processedSize);
if (processedSize != len)
return E_FAIL;
if (printCallback)
@@ -3066,7 +3158,7 @@ HRESULT Bench(
complexInCommands,
true, numThreadsSpecified,
method,
uncompressedDataSize, fileDataBuffer.Buffer,
uncompressedDataSize, (const Byte *)fileDataBuffer,
kOldLzmaDictBits, printCallback, benchCallback, &benchProps);
}
@@ -3378,9 +3470,9 @@ HRESULT Bench(
{
res = TotalBench(EXTERNAL_CODECS_LOC_VARS
complexInCommands, numThreads,
dictIsDefined || fileDataBuffer.Buffer, // forceUnpackSize
fileDataBuffer.Buffer ? fileDataBuffer.BufferSize : dict,
fileDataBuffer.Buffer,
dictIsDefined || fileDataBuffer.IsAllocated(), // forceUnpackSize
fileDataBuffer.IsAllocated() ? fileDataBuffer.Size() : dict,
(const Byte *)fileDataBuffer,
printCallback, &callback);
RINOK(res);
}
@@ -3470,9 +3562,9 @@ HRESULT Bench(
}
size_t uncompressedDataSize;
if (fileDataBuffer.Buffer)
if (fileDataBuffer.IsAllocated())
{
uncompressedDataSize = fileDataBuffer.BufferSize;
uncompressedDataSize = fileDataBuffer.Size();
}
else
{
@@ -3486,7 +3578,7 @@ HRESULT Bench(
complexInCommands,
true, numThreads,
method2,
uncompressedDataSize, fileDataBuffer.Buffer,
uncompressedDataSize, (const Byte *)fileDataBuffer,
kOldLzmaDictBits, printCallback, &callback, &callback.BenchProps);
f.NewLine();
RINOK(res);

View File

@@ -1,3 +1,9 @@
MY_CONSOLE = 1
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE
!ENDIF
CONSOLE_OBJS = \
$O\BenchCon.obj \
$O\ConsoleClose.obj \
@@ -33,4 +39,5 @@ UI_COMMON_OBJS = \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
#
C_OBJS = $(C_OBJS) \
$O\DllSecur.obj \

View File

@@ -87,7 +87,7 @@ static const char * const kHelpString =
"a"
#endif
#endif
" <command> [<switches>...] <archive_name> [<file_names>...]\n"
" <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]\n"
"\n"
"<Commands>\n"
" a : Add files to archive\n"
@@ -103,8 +103,7 @@ static const char * const kHelpString =
" x : eXtract files with full paths\n"
"\n"
"<Switches>\n"
" -- : Stop switches parsing\n"
" @listfile : set path to listfile that contains file names\n"
" -- : Stop switches and @listfile parsing\n"
" -ai[r[-|0]]{@listfile|!wildcard} : Include archives\n"
" -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives\n"
" -ao{a|s|t|u} : set Overwrite mode\n"

View File

@@ -2,6 +2,10 @@
#include "StdAfx.h"
#ifdef _WIN32
#include "../../../../C/DllSecur.h"
#endif
#include "../../../Common/MyException.h"
#include "../../../Common/StdOutStream.h"
@@ -63,6 +67,10 @@ int MY_CDECL main
try
{
#ifdef _WIN32
My_SetDefaultDllDirectories();
#endif
res = Main2(
#ifndef _WIN32
numArgs, args

View File

@@ -1,72 +1,64 @@
PROG = 7z.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS) \
-DEXTERNAL_CODECS \
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE
!ENDIF
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
$O\ResourceString.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\System.obj \
$O\TimeUtils.obj \
$O\LoadCodecs.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodProps.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
AR_COMMON_OBJS = \
$O\OutStreamWithCRC.obj \
COMPRESS_OBJS = \
$O\CopyCoder.obj \
C_OBJS = \
$O\Alloc.obj \
$O\CpuArch.obj \
$O\Sort.obj \
$O\Threads.obj \
!include "../../Crc.mak"
!include "Console.mak"
!include "../../7zip.mak"
PROG = 7z.exe
CFLAGS = $(CFLAGS) \
-DEXTERNAL_CODECS \
COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\FileSystem.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\System.obj \
$O\TimeUtils.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodProps.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
AR_COMMON_OBJS = \
$O\OutStreamWithCRC.obj \
COMPRESS_OBJS = \
$O\CopyCoder.obj \
C_OBJS = $(C_OBJS) \
$O\Alloc.obj \
$O\CpuArch.obj \
$O\Sort.obj \
$O\Threads.obj \
!include "../../Crc.mak"
!include "Console.mak"
!include "../../7zip.mak"

View File

@@ -120,7 +120,11 @@ HRESULT CZipContextMenu::InitContextMenu(const wchar_t * /* folder */, const wch
_isMenuForFM = true;
_fileNames.Clear();
for (UInt32 i = 0; i < numFiles; i++)
{
// MessageBoxW(0, names[i], NULL, 0);
// OutputDebugStringW(names[i]);
_fileNames.Add(names[i]);
}
_dropMode = false;
return S_OK;
}
@@ -423,6 +427,13 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
{
// OutputDebugStringA("QueryContextMenu");
/*
for (UInt32 i = 0; i < _fileNames.Size(); i++)
{
OutputDebugStringW(_fileNames[i]);
}
*/
LoadLangOneTime();
if (_fileNames.Size() == 0)
return E_FAIL;

View File

@@ -1,9 +1,9 @@
; 7-zip.def
LIBRARY "7-zip"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
; 7-zip.def
LIBRARY "7-zip"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE

View File

@@ -1,73 +1,74 @@
PROG = 7-zip.dll
DEF_FILE = Explorer.def
CFLAGS = $(CFLAGS) \
-DLANG \
!IFDEF UNDER_CE
LIBS = $(LIBS) Commctrl.lib
!ELSE
LIBS = $(LIBS) htmlhelp.lib comdlg32.lib Mpr.lib Gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH
!ENDIF
EXPLORER_OBJS = \
$O\DllExportsExplorer.obj \
$O\ContextMenu.obj \
$O\MyMessages.obj \
COMMON_OBJS = \
$O\IntToString.obj \
$O\Lang.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\Random.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\Window.obj \
!IFDEF UNDER_CE
WIN_OBJS = $(WIN_OBJS) \
$O\CommonDialog.obj \
!ENDIF
WIN_CTRL_OBJS = \
$O\Dialog.obj \
$O\ListView.obj \
UI_COMMON_OBJS = \
$O\ArchiveName.obj \
$O\CompressCall.obj \
$O\ExtractingFilePath.obj \
$O\ZipRegistry.obj \
FM_OBJS = \
$O\FormatUtils.obj \
$O\HelpUtils.obj \
$O\LangUtils.obj \
$O\ProgramLocation.obj \
$O\RegistryUtils.obj \
C_OBJS = \
$O\Threads.obj \
!include "../../7zip.mak"
PROG = 7-zip.dll
DEF_FILE = Explorer.def
CFLAGS = $(CFLAGS) \
-DLANG \
!IFDEF UNDER_CE
LIBS = $(LIBS) Commctrl.lib
!ELSE
LIBS = $(LIBS) htmlhelp.lib comdlg32.lib Mpr.lib Gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH
!ENDIF
EXPLORER_OBJS = \
$O\DllExportsExplorer.obj \
$O\ContextMenu.obj \
$O\MyMessages.obj \
COMMON_OBJS = \
$O\IntToString.obj \
$O\Lang.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\Random.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\Window.obj \
!IFDEF UNDER_CE
WIN_OBJS = $(WIN_OBJS) \
$O\CommonDialog.obj \
!ENDIF
WIN_CTRL_OBJS = \
$O\Dialog.obj \
$O\ListView.obj \
UI_COMMON_OBJS = \
$O\ArchiveName.obj \
$O\CompressCall.obj \
$O\ExtractingFilePath.obj \
$O\ZipRegistry.obj \
FM_OBJS = \
$O\FormatUtils.obj \
$O\HelpUtils.obj \
$O\LangUtils.obj \
$O\ProgramLocation.obj \
$O\RegistryUtils.obj \
C_OBJS = \
$O\CpuArch.obj \
$O\Threads.obj \
!include "../../7zip.mak"

View File

@@ -1,35 +1,35 @@
; 7-ZipFar.def : Declares the module parameters for the DLL.
LIBRARY "7-ZipFar"
EXPORTS
ExitFAR
SetStartupInfo
OpenPlugin
OpenFilePlugin
ClosePlugin
GetFindData
FreeFindData
SetDirectory
GetPluginInfo
Configure
GetOpenPluginInfo
GetFiles
PutFiles
DeleteFiles
ProcessKey
;SetStartupInfoW
;OpenPluginW
;OpenFilePluginW
;ClosePluginW
;GetFindDataW
;FreeFindDataW
;SetDirectoryW
;GetPluginInfoW
;ConfigureW
;GetOpenPluginInfoW
;GetFilesW
;PutFilesW
;DeleteFilesW
;ProcessKeyW
; 7-ZipFar.def : Declares the module parameters for the DLL.
LIBRARY "7-ZipFar"
EXPORTS
ExitFAR
SetStartupInfo
OpenPlugin
OpenFilePlugin
ClosePlugin
GetFindData
FreeFindData
SetDirectory
GetPluginInfo
Configure
GetOpenPluginInfo
GetFiles
PutFiles
DeleteFiles
ProcessKey
;SetStartupInfoW
;OpenPluginW
;OpenFilePluginW
;ClosePluginW
;GetFindDataW
;FreeFindDataW
;SetDirectoryW
;GetPluginInfoW
;ConfigureW
;GetOpenPluginInfoW
;GetFilesW
;PutFilesW
;DeleteFilesW
;ProcessKeyW

View File

@@ -7,6 +7,9 @@
#include <shlwapi.h>
#include "../../../../C/Alloc.h"
#ifdef _WIN32
#include "../../../../C/DllSecur.h"
#endif
#include "../../../Common/StringConvert.h"
#include "../../../Common/StringToInt.h"
@@ -660,6 +663,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
{
try
{
#ifdef _WIN32
My_SetDefaultDllDirectories();
#endif
return WinMain2(nCmdShow);
}
catch (...)

View File

@@ -1,3 +1,16 @@
CFLAGS = $(CFLAGS) \
-DLANG \
-DNEW_FOLDER_INTERFACE \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
!ELSE
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib Mpr.lib Gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE
LFLAGS = $(LFLAGS) /DELAYLOAD:mpr.dll
LIBS = $(LIBS) delayimp.lib
!ENDIF
FM_OBJS = \
$O\App.obj \
$O\BrowseDialog.obj \
@@ -73,6 +86,9 @@ WIN_OBJS = $(WIN_OBJS) \
!ENDIF
C_OBJS = $(C_OBJS) \
$O\DllSecur.obj \
AGENT_OBJS = \
$O\Agent.obj \
$O\AgentOut.obj \

View File

@@ -532,9 +532,8 @@ STDMETHODIMP CFSFolder::GetNumRawProps(UInt32 *numProps)
return S_OK;
}
STDMETHODIMP CFSFolder::GetRawPropInfo(UInt32 index, BSTR *name, PROPID *propID)
STDMETHODIMP CFSFolder::GetRawPropInfo(UInt32 /* index */, BSTR *name, PROPID *propID)
{
index = index;
*name = NULL;
*propID = kpidNtReparse;
return S_OK;

View File

@@ -161,8 +161,6 @@ static DWORD CALLBACK CopyProgressRoutine(
LPVOID lpData // from CopyFileEx
)
{
TotalFileSize = TotalFileSize;
// TotalBytesTransferred = TotalBytesTransferred;
// StreamSize = StreamSize;
// StreamBytesTransferred = StreamBytesTransferred;
// dwStreamNumber = dwStreamNumber;

View File

@@ -1,110 +1,102 @@
PROG = 7zFM.exe
CFLAGS = $(CFLAGS) \
-DLANG \
-DNEW_FOLDER_INTERFACE \
-DEXTERNAL_CODECS \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
!ELSE
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib Mpr.lib Gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE
!ENDIF
!include "FM.mak"
COMMON_OBJS = \
$O\IntToString.obj \
$O\Lang.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\Random.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj
WIN_OBJS = $(WIN_OBJS) \
$O\Clipboard.obj \
$O\CommonDialog.obj \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\MemoryGlobal.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\System.obj \
$O\TimeUtils.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
$O\ComboBox.obj \
$O\Dialog.obj \
$O\ListView.obj \
$O\PropertyPage.obj \
$O\Window2.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodProps.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveName.obj \
$O\ArchiveOpenCallback.obj \
$O\CompressCall.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\ExtractingFilePath.obj \
$O\HashCalc.obj \
$O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
$O\SortUtils.obj \
$O\UpdateAction.obj \
$O\UpdateCallback.obj \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
EXPLORER_OBJS = \
$O\ContextMenu.obj \
$O\RegistryContextMenu.obj \
GUI_OBJS = \
$O\HashGUI.obj \
$O\UpdateCallbackGUI2.obj \
COMPRESS_OBJS = \
$O\CopyCoder.obj \
C_OBJS = \
$O\Alloc.obj \
$O\Sort.obj \
$O\Threads.obj \
!include "../../7zip.mak"
PROG = 7zFM.exe
CFLAGS = $(CFLAGS) \
-DEXTERNAL_CODECS \
!include "FM.mak"
COMMON_OBJS = \
$O\IntToString.obj \
$O\Lang.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\Random.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\UTFConvert.obj \
$O\Wildcard.obj \
WIN_OBJS = $(WIN_OBJS) \
$O\Clipboard.obj \
$O\CommonDialog.obj \
$O\DLL.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileLink.obj \
$O\FileName.obj \
$O\MemoryGlobal.obj \
$O\MemoryLock.obj \
$O\Menu.obj \
$O\ProcessUtils.obj \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\System.obj \
$O\TimeUtils.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
$O\ComboBox.obj \
$O\Dialog.obj \
$O\ListView.obj \
$O\PropertyPage.obj \
$O\Window2.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodProps.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
$O\UniqBlocks.obj \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveName.obj \
$O\ArchiveOpenCallback.obj \
$O\CompressCall.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\ExtractingFilePath.obj \
$O\HashCalc.obj \
$O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
$O\SortUtils.obj \
$O\UpdateAction.obj \
$O\UpdateCallback.obj \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
EXPLORER_OBJS = \
$O\ContextMenu.obj \
$O\RegistryContextMenu.obj \
GUI_OBJS = \
$O\HashGUI.obj \
$O\UpdateCallbackGUI2.obj \
COMPRESS_OBJS = \
$O\CopyCoder.obj \
C_OBJS = $(C_OBJS) \
$O\Alloc.obj \
$O\CpuArch.obj \
$O\Sort.obj \
$O\Threads.obj \
!include "../../7zip.mak"

View File

@@ -2,6 +2,10 @@
#include "StdAfx.h"
#ifdef _WIN32
#include "../../../../C/DllSecur.h"
#endif
#include "../../../Common/MyWindows.h"
#include <shlwapi.h>
@@ -372,6 +376,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
// setlocale(LC_COLLATE, ".ACP");
try
{
#ifdef _WIN32
My_SetDefaultDllDirectories();
#endif
return Main2();
}
catch(const CNewException &)

View File

@@ -20,337 +20,334 @@
using namespace NWindows;
class CHashCallbackGUI: public CProgressThreadVirt, public IHashCallbackUI
class CHashCallbackGUI : public CProgressThreadVirt, public IHashCallbackUI
{
UInt64 NumFiles;
bool _curIsFolder;
UString FirstFileName;
// UString MainPath;
UInt64 NumFiles;
bool _curIsFolder;
UString FirstFileName;
// UString MainPath;
CPropNameValPairs PropNameValPairs;
CPropNameValPairs PropNameValPairs;
HRESULT ProcessVirt();
virtual void ProcessWasFinished_GuiVirt();
HRESULT ProcessVirt();
virtual void ProcessWasFinished_GuiVirt();
public:
const NWildcard::CCensor *censor;
const CHashOptions *options;
public:
const NWildcard::CCensor *censor;
const CHashOptions *options;
DECL_EXTERNAL_CODECS_LOC_VARS2;
DECL_EXTERNAL_CODECS_LOC_VARS2;
CHashCallbackGUI() {}
~CHashCallbackGUI() { }
CHashCallbackGUI() {}
~CHashCallbackGUI() {}
INTERFACE_IHashCallbackUI(;)
INTERFACE_IHashCallbackUI(;)
void AddErrorMessage(DWORD systemError, const wchar_t *name)
{
Sync.AddError_Code_Name(systemError, name);
}
void AddErrorMessage(DWORD systemError, const wchar_t *name)
{
Sync.AddError_Code_Name(systemError, name);
}
};
void AddValuePair(CPropNameValPairs &pairs, UINT resourceID, UInt64 value)
{
CProperty &pair = pairs.AddNew();
AddLangString(pair.Name, resourceID);
char sz[32];
ConvertUInt64ToString(value, sz);
pair.Value = sz;
CProperty &pair = pairs.AddNew();
AddLangString(pair.Name, resourceID);
char sz[32];
ConvertUInt64ToString(value, sz);
pair.Value = sz;
}
void AddSizeValue(UString &s, UInt64 value)
{
{
wchar_t sz[32];
ConvertUInt64ToString(value, sz);
s += MyFormatNew(IDS_FILE_SIZE, sz);
}
if (value >= (1 << 10))
{
char c;
if (value >= ((UInt64)10 << 30)) { value >>= 30; c = 'G'; }
else if (value >= (10 << 20)) { value >>= 20; c = 'M'; }
else { value >>= 10; c = 'K'; }
char sz[32];
ConvertUInt64ToString(value, sz);
s += " (";
s += sz;
s += " ";
s += (wchar_t)c;
s += "iB)";
}
{
wchar_t sz[32];
ConvertUInt64ToString(value, sz);
s += MyFormatNew(IDS_FILE_SIZE, sz);
}
if (value >= (1 << 10))
{
char c;
if (value >= ((UInt64)10 << 30))
{
value >>= 30;
c = 'G';
}
else if (value >= (10 << 20))
{
value >>= 20;
c = 'M';
}
else
{
value >>= 10;
c = 'K';
}
char sz[32];
ConvertUInt64ToString(value, sz);
s += " (";
s += sz;
s += " ";
s += (wchar_t)c;
s += "iB)";
}
}
void AddSizeValuePair(CPropNameValPairs &pairs, UINT resourceID, UInt64 value)
{
CProperty &pair = pairs.AddNew();
LangString(resourceID, pair.Name);
AddSizeValue(pair.Value, value);
CProperty &pair = pairs.AddNew();
LangString(resourceID, pair.Name);
AddSizeValue(pair.Value, value);
}
HRESULT CHashCallbackGUI::StartScanning()
{
CProgressSync &sync = Sync;
sync.Set_Status(LangString(IDS_SCANNING));
return CheckBreak();
CProgressSync &sync = Sync;
sync.Set_Status(LangString(IDS_SCANNING));
return CheckBreak();
}
HRESULT CHashCallbackGUI::ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir)
{
return Sync.ScanProgress(st.NumFiles, st.GetTotalBytes(), path, isDir);
return Sync.ScanProgress(st.NumFiles, st.GetTotalBytes(), path, isDir);
}
HRESULT CHashCallbackGUI::ScanError(const FString &path, DWORD systemError)
{
AddErrorMessage(systemError, fs2us(path));
return CheckBreak();
AddErrorMessage(systemError, fs2us(path));
return CheckBreak();
}
HRESULT CHashCallbackGUI::FinishScanning(const CDirItemsStat &st)
{
return ScanProgress(st, FString(), false);
return ScanProgress(st, FString(), false);
}
HRESULT CHashCallbackGUI::CheckBreak()
{
return Sync.CheckStop();
return Sync.CheckStop();
}
HRESULT CHashCallbackGUI::SetNumFiles(UInt64 numFiles)
{
CProgressSync &sync = Sync;
sync.Set_NumFilesTotal(numFiles);
return CheckBreak();
CProgressSync &sync = Sync;
sync.Set_NumFilesTotal(numFiles);
return CheckBreak();
}
HRESULT CHashCallbackGUI::SetTotal(UInt64 size)
{
CProgressSync &sync = Sync;
sync.Set_NumBytesTotal(size);
return CheckBreak();
CProgressSync &sync = Sync;
sync.Set_NumBytesTotal(size);
return CheckBreak();
}
HRESULT CHashCallbackGUI::SetCompleted(const UInt64 *completed)
{
return Sync.Set_NumBytesCur(completed);
return Sync.Set_NumBytesCur(completed);
}
HRESULT CHashCallbackGUI::BeforeFirstFile(const CHashBundle & /* hb */)
{
return S_OK;
return S_OK;
}
HRESULT CHashCallbackGUI::GetStream(const wchar_t *name, bool isFolder)
{
if (NumFiles == 0)
FirstFileName = name;
_curIsFolder = isFolder;
CProgressSync &sync = Sync;
sync.Set_FilePath(name, isFolder);
return CheckBreak();
if (NumFiles == 0)
FirstFileName = name;
_curIsFolder = isFolder;
CProgressSync &sync = Sync;
sync.Set_FilePath(name, isFolder);
return CheckBreak();
}
HRESULT CHashCallbackGUI::OpenFileError(const FString &path, DWORD systemError)
{
// if (systemError == ERROR_SHARING_VIOLATION)
{
AddErrorMessage(systemError, fs2us(path));
return S_FALSE;
}
// return systemError;
// if (systemError == ERROR_SHARING_VIOLATION)
{
AddErrorMessage(systemError, fs2us(path));
return S_FALSE;
}
// return systemError;
}
HRESULT CHashCallbackGUI::SetOperationResult(UInt64 /* fileSize */, const CHashBundle & /* hb */, bool /* showHash */)
{
CProgressSync &sync = Sync;
if (!_curIsFolder)
NumFiles++;
sync.Set_NumFilesCur(NumFiles);
return CheckBreak();
CProgressSync &sync = Sync;
if (!_curIsFolder)
NumFiles++;
sync.Set_NumFilesCur(NumFiles);
return CheckBreak();
}
static void AddHashString(CProperty &s, const CHasherState &h, unsigned digestIndex)
{
char temp[k_HashCalc_DigestSize_Max * 2 + 4];
AddHashHexToString(temp, h.Digests[digestIndex], h.DigestSize);
s.Value = temp;
char temp[k_HashCalc_DigestSize_Max * 2 + 4];
AddHashHexToString(temp, h.Digests[digestIndex], h.DigestSize);
s.Value = temp;
}
static void AddHashResString(CPropNameValPairs &s, const CHasherState &h, unsigned digestIndex, UInt32 resID)
{
CProperty &pair = s.AddNew();
UString &s2 = pair.Name;
LangString(resID, s2);
UString name (h.Name);
s2.Replace(L"CRC", name);
s2.Replace(L":", L"");
AddHashString(pair, h, digestIndex);
CProperty &pair = s.AddNew();
UString &s2 = pair.Name;
LangString(resID, s2);
UString name(h.Name);
s2.Replace(L"CRC", name);
s2.Replace(L":", L"");
AddHashString(pair, h, digestIndex);
}
void AddHashBundleRes(CPropNameValPairs &s, const CHashBundle &hb)
{
if (hb.NumErrors != 0)
AddValuePair(s, IDS_PROP_NUM_ERRORS, hb.NumErrors);
if (hb.NumErrors != 0)
AddValuePair(s, IDS_PROP_NUM_ERRORS, hb.NumErrors);
if (hb.NumFiles == 1 && hb.NumDirs == 0 && !hb.FirstFileName.IsEmpty())
{
CProperty &pair = s.AddNew();
LangString(IDS_PROP_NAME, pair.Name);
pair.Value = hb.FirstFileName;
}
else
{
if (!hb.MainName.IsEmpty())
if (hb.NumFiles == 1 && hb.NumDirs == 0 && !hb.FirstFileName.IsEmpty())
{
CProperty &pair = s.AddNew();
LangString(IDS_PROP_NAME, pair.Name);
pair.Value = hb.MainName;
}
if (hb.NumDirs != 0)
AddValuePair(s, IDS_PROP_FOLDERS, hb.NumDirs);
AddValuePair(s, IDS_PROP_FILES, hb.NumFiles);
}
AddSizeValuePair(s, IDS_PROP_SIZE, hb.FilesSize);
if (hb.NumAltStreams != 0)
{
AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, hb.NumAltStreams);
AddSizeValuePair(s, IDS_PROP_ALT_STREAMS_SIZE, hb.AltStreamsSize);
}
FOR_VECTOR (i, hb.Hashers)
{
const CHasherState &h = hb.Hashers[i];
if (hb.NumFiles == 1 && hb.NumDirs == 0)
{
CProperty &pair = s.AddNew();
pair.Name += h.Name;
AddHashString(pair, h, k_HashCalc_Index_DataSum);
CProperty &pair = s.AddNew();
LangString(IDS_PROP_NAME, pair.Name);
pair.Value = hb.FirstFileName;
}
else
{
AddHashResString(s, h, k_HashCalc_Index_DataSum, IDS_CHECKSUM_CRC_DATA);
AddHashResString(s, h, k_HashCalc_Index_NamesSum, IDS_CHECKSUM_CRC_DATA_NAMES);
if (!hb.MainName.IsEmpty())
{
CProperty &pair = s.AddNew();
LangString(IDS_PROP_NAME, pair.Name);
pair.Value = hb.MainName;
}
if (hb.NumDirs != 0)
AddValuePair(s, IDS_PROP_FOLDERS, hb.NumDirs);
AddValuePair(s, IDS_PROP_FILES, hb.NumFiles);
}
AddSizeValuePair(s, IDS_PROP_SIZE, hb.FilesSize);
if (hb.NumAltStreams != 0)
{
AddHashResString(s, h, k_HashCalc_Index_StreamsSum, IDS_CHECKSUM_CRC_STREAMS_NAMES);
AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, hb.NumAltStreams);
AddSizeValuePair(s, IDS_PROP_ALT_STREAMS_SIZE, hb.AltStreamsSize);
}
}
}
FOR_VECTOR(i, hb.Hashers)
{
const CHasherState &h = hb.Hashers[i];
if (hb.NumFiles == 1 && hb.NumDirs == 0)
{
CProperty &pair = s.AddNew();
pair.Name += h.Name;
AddHashString(pair, h, k_HashCalc_Index_DataSum);
}
else
{
AddHashResString(s, h, k_HashCalc_Index_DataSum, IDS_CHECKSUM_CRC_DATA);
AddHashResString(s, h, k_HashCalc_Index_NamesSum, IDS_CHECKSUM_CRC_DATA_NAMES);
}
if (hb.NumAltStreams != 0)
{
AddHashResString(s, h, k_HashCalc_Index_StreamsSum, IDS_CHECKSUM_CRC_STREAMS_NAMES);
}
}
}
void AddHashBundleRes(UString &s, const CHashBundle &hb)
{
CPropNameValPairs pairs;
AddHashBundleRes(pairs, hb);
FOR_VECTOR (i, pairs)
{
const CProperty &pair = pairs[i];
s += pair.Name;
s += ": ";
s += pair.Value;
s.Add_LF();
}
CPropNameValPairs pairs;
AddHashBundleRes(pairs, hb);
if (hb.NumErrors == 0 && hb.Hashers.IsEmpty())
{
s.Add_LF();
AddLangString(s, IDS_MESSAGE_NO_ERRORS);
s.Add_LF();
}
FOR_VECTOR(i, pairs)
{
const CProperty &pair = pairs[i];
s += pair.Name;
s += ": ";
s += pair.Value;
s.Add_LF();
}
if (hb.NumErrors == 0 && hb.Hashers.IsEmpty())
{
s.Add_LF();
AddLangString(s, IDS_MESSAGE_NO_ERRORS);
s.Add_LF();
}
}
HRESULT CHashCallbackGUI::AfterLastFile(CHashBundle &hb)
{
AddHashBundleRes(PropNameValPairs, hb, FirstFileName);
hb.FirstFileName = FirstFileName;
CProgressSync &sync = Sync;
sync.Set_NumFilesCur(hb.NumFiles);
AddHashBundleRes(PropNameValPairs, hb);
hb.FirstFileName = FirstFileName;
CProgressSync &sync = Sync;
sync.Set_NumFilesCur(hb.NumFiles);
// CProgressMessageBoxPair &pair = GetMessagePair(hb.NumErrors != 0);
// pair.Message = s;
// LangString(IDS_CHECKSUM_INFORMATION, pair.Title);
// CProgressMessageBoxPair &pair = GetMessagePair(hb.NumErrors != 0);
// pair.Message = s;
// LangString(IDS_CHECKSUM_INFORMATION, pair.Title);
return S_OK;
return S_OK;
}
HRESULT CHashCallbackGUI::ProcessVirt()
{
NumFiles = 0;
AString errorInfo;
HRESULT res = HashCalc(EXTERNAL_CODECS_LOC_VARS
*censor, *options, errorInfo, this);
return res;
NumFiles = 0;
AString errorInfo;
HRESULT res = HashCalc(EXTERNAL_CODECS_LOC_VARS * censor, *options, errorInfo, this);
return res;
}
HRESULT HashCalcGUI(
DECL_EXTERNAL_CODECS_LOC_VARS
const NWildcard::CCensor &censor,
DECL_EXTERNAL_CODECS_LOC_VARS const NWildcard::CCensor &censor,
const CHashOptions &options,
bool &messageWasDisplayed)
{
CHashCallbackGUI t;
#ifdef EXTERNAL_CODECS
t.__externalCodecs = __externalCodecs;
#endif
t.censor = &censor;
t.options = &options;
CHashCallbackGUI t;
#ifdef EXTERNAL_CODECS
t.__externalCodecs = __externalCodecs;
#endif
t.censor = &censor;
t.options = &options;
t.ShowCompressionInfo = false;
t.ShowCompressionInfo = false;
const UString title = LangString(IDS_CHECKSUM_CALCULATING);
const UString title = LangString(IDS_CHECKSUM_CALCULATING);
t.MainTitle = "7-Zip"; // LangString(IDS_APP_TITLE);
t.MainAddTitle = title;
t.MainAddTitle.Add_Space();
t.MainTitle = "7-Zip"; // LangString(IDS_APP_TITLE);
t.MainAddTitle = title;
t.MainAddTitle.Add_Space();
RINOK(t.Create(title));
messageWasDisplayed = t.ThreadFinishedOK && t.MessagesDisplayed;
return S_OK;
RINOK(t.Create(title));
messageWasDisplayed = t.ThreadFinishedOK && t.MessagesDisplayed;
return S_OK;
}
void ShowHashResults(const CPropNameValPairs &propPairs, HWND hwnd)
{
CListViewDialog lv;
FOR_VECTOR (i, propPairs)
{
const CProperty &pair = propPairs[i];
lv.Strings.Add(pair.Name);
lv.Values.Add(pair.Value);
}
lv.Title = LangString(IDS_CHECKSUM_INFORMATION);
lv.DeleteIsAllowed = true;
lv.SelectFirst = false;
lv.NumColumns = 2;
lv.Create(hwnd);
}
CListViewDialog lv;
FOR_VECTOR(i, propPairs)
{
const CProperty &pair = propPairs[i];
lv.Strings.Add(pair.Name);
lv.Values.Add(pair.Value);
}
lv.Title = LangString(IDS_CHECKSUM_INFORMATION);
lv.DeleteIsAllowed = true;
lv.SelectFirst = false;
lv.NumColumns = 2;
lv.Create(hwnd);
}
void ShowHashResults(const CHashBundle &hb, HWND hwnd)
{
CPropNameValPairs propPairs;
AddHashBundleRes(propPairs, hb);
ShowHashResults(propPairs, hwnd);
CPropNameValPairs propPairs;
AddHashBundleRes(propPairs, hb);
ShowHashResults(propPairs, hwnd);
}
void CHashCallbackGUI::ProcessWasFinished_GuiVirt()
{
ShowHashResults(PropNameValPairs, *this);
ShowHashResults(PropNameValPairs, *this);
}

View File

@@ -67,6 +67,10 @@ CFLAGS = $(CFLAGS) -MP2
CFLAGS = $(CFLAGS)
!ENDIF
!IFDEF MY_CONSOLE
CFLAGS = $(CFLAGS) -D_CONSOLE
!ENDIF
!IFNDEF UNDER_CE
!IF "$(PLATFORM)" == "arm"
CFLAGS = $(CFLAGS) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE

View File

@@ -107,7 +107,7 @@ bool ReadNamesFromListFile2(CFSTR fileName, UStringVector &strings, UINT codePag
}
const wchar_t kGoodBOM = 0xFEFF;
const wchar_t kBadBOM = 0xFFFE;
// const wchar_t kBadBOM = 0xFFFE;
UString s;
unsigned i = 0;
@@ -115,8 +115,10 @@ bool ReadNamesFromListFile2(CFSTR fileName, UStringVector &strings, UINT codePag
for (; i < u.Len(); i++)
{
wchar_t c = u[i];
/*
if (c == kGoodBOM || c == kBadBOM)
return false;
*/
if (c == '\n' || c == 0xD)
{
AddName(strings, s);

View File

@@ -5,7 +5,7 @@
#include "../../C/Alloc.h"
#include "Defs.h"
#include "MyTypes.h"
class CMidBuffer
{
@@ -15,7 +15,7 @@ class CMidBuffer
CLASS_NO_COPY(CMidBuffer)
public:
CMidBuffer(): _data(NULL), _size(0) {};
CMidBuffer(): _data(NULL), _size(0) {}
~CMidBuffer() { ::MidFree(_data); }
void Free() { ::MidFree(_data); _data = NULL; _size = 0; }
@@ -29,12 +29,12 @@ public:
{
if (!_data || size > _size)
{
::MidFree(_data);
const size_t kMinSize = (size_t)1 << 16;
if (size < kMinSize)
size = kMinSize;
::MidFree(_data);
_size = 0;
_data = 0;
_data = NULL;
_data = (Byte *)::MidAlloc(size);
if (_data)
_size = size;
@@ -42,4 +42,59 @@ public:
}
};
class CAlignedBuffer
{
Byte *_data;
size_t _size;
CLASS_NO_COPY(CAlignedBuffer)
public:
CAlignedBuffer(): _data(NULL), _size(0) {}
~CAlignedBuffer()
{
ISzAlloc_Free(&g_AlignedAlloc, _data);
}
void Free()
{
ISzAlloc_Free(&g_AlignedAlloc, _data);
_data = NULL;
_size = 0;
}
bool IsAllocated() const { return _data != NULL; }
operator Byte *() { return _data; }
operator const Byte *() const { return _data; }
size_t Size() const { return _size; }
void Alloc(size_t size)
{
if (!_data || size != _size)
{
ISzAlloc_Free(&g_AlignedAlloc, _data);
_size = 0;
_data = NULL;
_data = (Byte *)ISzAlloc_Alloc(&g_AlignedAlloc, size);
if (_data)
_size = size;
}
}
void AllocAtLeast(size_t size)
{
if (!_data || size > _size)
{
ISzAlloc_Free(&g_AlignedAlloc, _data);
_size = 0;
_data = NULL;
_data = (Byte *)ISzAlloc_Alloc(&g_AlignedAlloc, size);
if (_data)
_size = size;
}
}
};
#endif

View File

@@ -2,6 +2,8 @@
#include "StdAfx.h"
#include "../../C/CpuArch.h"
#include "MemoryLock.h"
namespace NWindows {
@@ -75,6 +77,9 @@ typedef void (WINAPI * Func_RtlGetVersion) (OSVERSIONINFOEXW *);
We suppose that Window 10 works incorrectly with "Large Pages" at:
- Windows 10 1703 (15063)
- Windows 10 1709 (16299)
- Windows 10 1809 (17763) on some CPUs that have no 1 GB page support.
We need more information about that new BUG in Windows.
*/
unsigned Get_LargePages_RiskLevel()
@@ -87,9 +92,19 @@ unsigned Get_LargePages_RiskLevel()
if (!func)
return 0;
func(&vi);
return (vi.dwPlatformId == VER_PLATFORM_WIN32_NT
&& vi.dwMajorVersion + vi.dwMinorVersion == 10
&& vi.dwBuildNumber <= 16299) ? 1 : 0;
if (vi.dwPlatformId != VER_PLATFORM_WIN32_NT)
return 0;
if (vi.dwMajorVersion + vi.dwMinorVersion != 10)
return 0;
if (vi.dwBuildNumber <= 16299)
return 1;
#ifdef MY_CPU_X86_OR_AMD64
if (!CPU_IsSupported_PageGB())
return 1;
#endif
return 0;
}
#endif

View File

@@ -2,6 +2,11 @@
#include "StdAfx.h"
/*
#include <stdio.h>
#include <string.h>
*/
#include "../Common/MyCom.h"
#ifndef _UNICODE
#include "../Common/StringConvert.h"
@@ -114,9 +119,22 @@ UString CDrop::QueryFileName(UINT fileIndex)
void CDrop::QueryFileNames(UStringVector &fileNames)
{
UINT numFiles = QueryCountOfFiles();
/*
char s[100];
sprintf(s, "QueryFileNames: %d files", numFiles);
OutputDebugStringA(s);
*/
fileNames.ClearAndReserve(numFiles);
for (UINT i = 0; i < numFiles; i++)
fileNames.AddInReserved(QueryFileName(i));
{
const UString s2 = QueryFileName(i);
if (!s2.IsEmpty())
fileNames.AddInReserved(s2);
/*
OutputDebugStringW(L"file ---");
OutputDebugStringW(s2);
*/
}
}

View File

@@ -10,8 +10,8 @@ AppName = "7-Zip"
InstallDir = %CE1%\%AppName%
[Strings]
AppVer = "18.06"
AppDate = "2018-12-30"
AppVer = "19.00"
AppDate = "2019-01-21"
[CEDevice]
; ProcessorType = 2577 ; ARM

View File

@@ -1,8 +1,8 @@
;--------------------------------
;Defines
!define VERSION_MAJOR 18
!define VERSION_MINOR 06
!define VERSION_MAJOR 19
!define VERSION_MINOR 00
!define VERSION_POSTFIX_FULL ""
!ifdef WIN64
!ifdef IA64

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?define VerMajor = "18" ?>
<?define VerMinor = "06" ?>
<?define VerMajor = "19" ?>
<?define VerMinor = "00" ?>
<?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "$(var.VerMajor)$(var.VerMinor)" ?>

View File

@@ -3,7 +3,7 @@
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-Zip Copyright (C) 1999-2018 Igor Pavlov.
7-Zip Copyright (C) 1999-2019 Igor Pavlov.
The licenses for files are:

View File

@@ -1,9 +1,9 @@
7-Zip 18.06 Sources
7-Zip 19.00 Sources
-------------------
7-Zip is a file archiver for Windows.
7-Zip Copyright (C) 1999-2018 Igor Pavlov.
7-Zip Copyright (C) 1999-2019 Igor Pavlov.
License Info

View File

@@ -1,6 +1,14 @@
HISTORY of the 7-Zip source code
--------------------------------
19.00 2019-02-21
-------------------------
- 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.
18.06 2018-12-30
-------------------------
- The speed for LZMA/LZMA2 compressing was increased by 3-10%,

View File

@@ -1,13 +1,5 @@
# Jame's Easy-Zip *almost* (continued)
# Git archive of 7-zip releases
I really like James Hoo's branch of the 7-zip utility. It has features that have repeatedly been begged for, but haven't been implemented by Igor Pavlov. The man is nothing but dedicated towards making things smaller, but he has no interest in UI.
This branch implements:
- Deleting archives after extraction.
- Recalling/Storing output history
- Icons in the context menu
- Opening the output folder after extraction.
There are some missing features from [Jame's 16.05 version](http://www.e7z.org/), namely the second about Easy-7zip dialog.
Because 7-zip [doesn't](https://github.com/7z) have a public repository, and their code is released only as archives on SourceForge, I maintain a git-ified copy here.
The [tagged releases](https://github.com/pornel/7z/releases) and the [original branch](https://github.com/pornel/7z/tree/original) contain pure 7-zip releases, without any modifications like this readme.