Snap for 10453563 from d6152ba68f2d29c91efab3445c043c1dc0c1cb7a to mainline-permission-release

Change-Id: Iede2b9830848753e9868c900fef96256800306c0
diff --git a/C/7zArcIn.c b/C/7zArcIn.c
index 2202d08..68cc12f 100644
--- a/C/7zArcIn.c
+++ b/C/7zArcIn.c
@@ -1,5 +1,5 @@
 /* 7zArcIn.c -- 7z Input functions

-2018-07-04 : Igor Pavlov : Public domain */

+2018-12-31 : Igor Pavlov : Public domain */

 

 #include "Precomp.h"

 

@@ -19,7 +19,7 @@
   { MY_ALLOC(Byte, to, size, alloc); memcpy(to, from, size); }

 

 #define MY_ALLOC_ZE_AND_CPY(to, size, from, alloc) \

-  { if ((size) == 0) p = NULL; else { MY_ALLOC_AND_CPY(to, size, from, alloc) } }

+  { if ((size) == 0) to = NULL; else { MY_ALLOC_AND_CPY(to, size, from, alloc) } }

 

 #define k7zMajorVersion 0

 

@@ -666,7 +666,7 @@
   MY_ALLOC(size_t, p->FoCodersOffsets, (size_t)numFolders + 1, alloc);

   MY_ALLOC(UInt32, p->FoStartPackStreamIndex, (size_t)numFolders + 1, alloc);

   MY_ALLOC(UInt32, p->FoToCoderUnpackSizes, (size_t)numFolders + 1, alloc);

-  MY_ALLOC(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc);

+  MY_ALLOC_ZE(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc);

   

   startBufPtr = sd.Data;

   

diff --git a/C/7zDec.c b/C/7zDec.c
index 088f540..2a7b090 100644
--- a/C/7zDec.c
+++ b/C/7zDec.c
@@ -1,5 +1,5 @@
 /* 7zDec.c -- Decoding from 7z folder

-2018-07-04 : Igor Pavlov : Public domain */

+2019-02-02 : Igor Pavlov : Public domain */

 

 #include "Precomp.h"

 

@@ -156,7 +156,7 @@
     {

       SizeT inProcessed = (SizeT)lookahead, dicPos = state.dicPos;

       ELzmaStatus status;

-      res = LzmaDec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);

+      res = LzmaDec_DecodeToDic(&state, outSize, (const Byte *)inBuf, &inProcessed, LZMA_FINISH_END, &status);

       lookahead -= inProcessed;

       inSize -= inProcessed;

       if (res != SZ_OK)

@@ -218,7 +218,7 @@
     {

       SizeT inProcessed = (SizeT)lookahead, dicPos = state.decoder.dicPos;

       ELzmaStatus status;

-      res = Lzma2Dec_DecodeToDic(&state, outSize, inBuf, &inProcessed, LZMA_FINISH_END, &status);

+      res = Lzma2Dec_DecodeToDic(&state, outSize, (const Byte *)inBuf, &inProcessed, LZMA_FINISH_END, &status);

       lookahead -= inProcessed;

       inSize -= inProcessed;

       if (res != SZ_OK)

diff --git a/C/7zVersion.h b/C/7zVersion.h
index c26d9d2..0074c64 100644
--- a/C/7zVersion.h
+++ b/C/7zVersion.h
@@ -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"

diff --git a/C/Bcj2Enc.c b/C/Bcj2Enc.c
index a54ea08..7a02ecd 100644
--- a/C/Bcj2Enc.c
+++ b/C/Bcj2Enc.c
@@ -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 @@
     {

       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;

diff --git a/C/CpuArch.c b/C/CpuArch.c
index b37bdca..ff1890e 100644
--- a/C/CpuArch.c
+++ b/C/CpuArch.c
@@ -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 @@
   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

diff --git a/C/CpuArch.h b/C/CpuArch.h
index 51574f1..5f74c1c 100644
--- a/C/CpuArch.h
+++ b/C/CpuArch.h
@@ -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 @@
 

 BoolInt CPU_Is_InOrder();

 BoolInt CPU_Is_Aes_Supported();

+BoolInt CPU_IsSupported_PageGB();

 

 #endif

 

diff --git a/C/DllSecur.c b/C/DllSecur.c
index 8745421..19a22a9 100644
--- a/C/DllSecur.c
+++ b/C/DllSecur.c
@@ -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 @@
   "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 @@
       for (;;)

       {

         char c = *dll++;

-        buf[pos + k] = c;

+        buf[pos + k] = (Byte)c;

         k++;

         if (c == 0)

           break;

diff --git a/C/DllSecur.h b/C/DllSecur.h
index 023c509..4c11356 100644
--- a/C/DllSecur.h
+++ b/C/DllSecur.h
@@ -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 @@
 

 #ifdef _WIN32

 

+void My_SetDefaultDllDirectories();

 void LoadSecurityDlls();

 

 #endif

diff --git a/C/Lzma2Dec.c b/C/Lzma2Dec.c
index 69648ea..2e63105 100644
--- a/C/Lzma2Dec.c
+++ b/C/Lzma2Dec.c
@@ -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 @@
   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 @@
         // 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 @@
     }

 

     if (outSize == 0)

-      return LZMA_STATUS_NOT_FINISHED;

+      return (ELzma2ParseStatus)LZMA_STATUS_NOT_FINISHED;

 

     {

       SizeT inCur = inSize - *srcLen;

@@ -362,7 +362,7 @@
       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 @@
         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 @@
   }

   

   p->state = LZMA2_STATE_ERROR;

-  return LZMA_STATUS_NOT_SPECIFIED;

+  return (ELzma2ParseStatus)LZMA_STATUS_NOT_SPECIFIED;

 }

 

 

diff --git a/C/Lzma2DecMt.c b/C/Lzma2DecMt.c
index 2ca316f..87d5567 100644
--- a/C/Lzma2DecMt.c
+++ b/C/Lzma2DecMt.c
@@ -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 @@
     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;

diff --git a/C/LzmaEnc.c b/C/LzmaEnc.c
index 6954c2d..14086fc 100644
--- a/C/LzmaEnc.c
+++ b/C/LzmaEnc.c
@@ -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 @@
 

     // 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;

diff --git a/C/MtDec.c b/C/MtDec.c
index 374e4d3..25a8b04 100644
--- a/C/MtDec.c
+++ b/C/MtDec.c
@@ -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 @@
 }

 

 

-

-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)

diff --git a/C/Util/7z/7zMain.c b/C/Util/7z/7zMain.c
index 3e86076..1c02b48 100644
--- a/C/Util/7z/7zMain.c
+++ b/C/Util/7z/7zMain.c
@@ -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 @@
         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 @@
 {

   #ifdef USE_WINDOWS_FILE

   

-  return CreateDirectoryW(name, NULL) ? 0 : GetLastError();

+  return CreateDirectoryW((LPCWSTR)name, NULL) ? 0 : GetLastError();

   

   #else

 

@@ -227,7 +227,7 @@
 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 @@
   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 @@
                We remove posix bits, if we detect posix mode field */

             if ((attrib & 0xF0000000) != 0)

               attrib &= 0x7FFF;

-            SetFileAttributesW(destPath, attrib);

+            SetFileAttributesW((LPCWSTR)destPath, attrib);

           }

           #endif

         }

diff --git a/C/Util/SfxSetup/SfxSetup.c b/C/Util/SfxSetup/SfxSetup.c
index 7e00240..394369a 100644
--- a/C/Util/SfxSetup/SfxSetup.c
+++ b/C/Util/SfxSetup/SfxSetup.c
@@ -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 @@
 

   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 @@
       

       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 @@
       {

         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;

diff --git a/C/XzDec.c b/C/XzDec.c
index da6c2e7..4f53272 100644
--- a/C/XzDec.c
+++ b/C/XzDec.c
@@ -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 @@
   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 @@
     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;

 }

 

diff --git a/C/XzEnc.c b/C/XzEnc.c
index 1f512a5..309eca9 100644
--- a/C/XzEnc.c
+++ b/C/XzEnc.c
@@ -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 @@
       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);

diff --git a/CPP/7zip/Archive/7z/7zDecode.cpp b/CPP/7zip/Archive/7z/7zDecode.cpp
index 2705ecb..f61ad4a 100644
--- a/CPP/7zip/Archive/7z/7zDecode.cpp
+++ b/CPP/7zip/Archive/7z/7zDecode.cpp
@@ -355,7 +355,9 @@
 

   unsigned i;

 

+  #if !defined(_7ZIP_ST)

   bool mt_wasUsed = false;

+  #endif

 

   for (i = 0; i < folderInfo.Coders.Size(); i++)

   {

diff --git a/CPP/7zip/Bundles/Alone7z/Alone.dsp b/CPP/7zip/Bundles/Alone7z/Alone.dsp
index 6147e10..e12207d 100644
--- a/CPP/7zip/Bundles/Alone7z/Alone.dsp
+++ b/CPP/7zip/Bundles/Alone7z/Alone.dsp
@@ -1646,6 +1646,15 @@
 # End Source File

 # Begin Source File

 

+SOURCE=..\..\..\..\C\DllSecur.c

+# SUBTRACT CPP /YX /Yc /Yu

+# End Source File

+# Begin Source File

+

+SOURCE=..\..\..\..\C\DllSecur.h

+# End Source File

+# Begin Source File

+

 SOURCE=..\..\..\..\C\IStream.h

 # End Source File

 # Begin Source File

diff --git a/CPP/7zip/Bundles/Alone7z/makefile b/CPP/7zip/Bundles/Alone7z/makefile
index 91ee192..4f23c10 100644
--- a/CPP/7zip/Bundles/Alone7z/makefile
+++ b/CPP/7zip/Bundles/Alone7z/makefile
@@ -1,10 +1,6 @@
 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

+CFLAGS = $(CFLAGS) \

+  -DPROG_VARIANT_R \

 

 COMMON_OBJS = \

   $O\CommandLineParser.obj \

diff --git a/CPP/7zip/Bundles/LzmaCon/makefile b/CPP/7zip/Bundles/LzmaCon/makefile
index 7374df9..5a50808 100644
--- a/CPP/7zip/Bundles/LzmaCon/makefile
+++ b/CPP/7zip/Bundles/LzmaCon/makefile
@@ -1,6 +1,5 @@
 PROG = lzma.exe

 MY_CONSOLE = 1

-CFLAGS = $(CFLAGS)

 

 CURRENT_OBJS = \

   $O\LzmaAlone.obj \

diff --git a/CPP/7zip/Bundles/SFXCon/makefile b/CPP/7zip/Bundles/SFXCon/makefile
index 30e8a38..811975c 100644
--- a/CPP/7zip/Bundles/SFXCon/makefile
+++ b/CPP/7zip/Bundles/SFXCon/makefile
@@ -6,7 +6,6 @@
   -DEXTRACT_ONLY \

   -DNO_READ_FROM_CODER \

   -D_SFX \

-  -D_CONSOLE \

 

 CURRENT_OBJS = \

   $O\SfxCon.obj \

diff --git a/CPP/7zip/Common/FilterCoder.cpp b/CPP/7zip/Common/FilterCoder.cpp
index 275c60d..d5c7ff0 100644
--- a/CPP/7zip/Common/FilterCoder.cpp
+++ b/CPP/7zip/Common/FilterCoder.cpp
@@ -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 @@
     size = kMinSize;

   if (!_buf || _bufSize != size)

   {

-    AllocAlignedMask(size, 16 - 1);

+    AllocAligned(size);

     if (!_buf)

       return E_OUTOFMEMORY;

     _bufSize = size;

diff --git a/CPP/7zip/Common/FilterCoder.h b/CPP/7zip/Common/FilterCoder.h
index 0e2f84f..bde0e2b 100644
--- a/CPP/7zip/Common/FilterCoder.h
+++ b/CPP/7zip/Common/FilterCoder.h
@@ -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:

diff --git a/CPP/7zip/Crypto/7zAes.cpp b/CPP/7zip/Crypto/7zAes.cpp
index f412bf9..55e40f3 100644
--- a/CPP/7zip/Crypto/7zAes.cpp
+++ b/CPP/7zip/Crypto/7zAes.cpp
@@ -164,8 +164,8 @@
 {

   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;

 }

 

diff --git a/CPP/7zip/Crypto/RandGen.cpp b/CPP/7zip/Crypto/RandGen.cpp
index 542f39b..791275f 100644
--- a/CPP/7zip/Crypto/RandGen.cpp
+++ b/CPP/7zip/Crypto/RandGen.cpp
@@ -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 @@
   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 @@
       Sha256_Update(&hash, _buff, SHA256_DIGEST_SIZE);

     }

   }

+  while (--numIterations);

+

   Sha256_Final(&hash, _buff);

   _needInit = false;

 }

@@ -122,3 +229,5 @@
 }

 

 CRandomGenerator g_RandomGenerator;

+

+#endif

diff --git a/CPP/7zip/Crypto/RandGen.h b/CPP/7zip/Crypto/RandGen.h
index ff44450..dc5a338 100644
--- a/CPP/7zip/Crypto/RandGen.h
+++ b/CPP/7zip/Crypto/RandGen.h
@@ -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 @@
 

 extern CRandomGenerator g_RandomGenerator;

 

+#define MY_RAND_GEN(data, size) g_RandomGenerator.Generate(data, size)

+

+#endif

+

 #endif

diff --git a/CPP/7zip/UI/Common/ArchiveName.cpp b/CPP/7zip/UI/Common/ArchiveName.cpp
index b725024..b07d46c 100644
--- a/CPP/7zip/UI/Common/ArchiveName.cpp
+++ b/CPP/7zip/UI/Common/ArchiveName.cpp
@@ -99,9 +99,28 @@
     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 @@
     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 @@
         break;

     }

     

-    if (i == paths.Size())

+    if (i == names.Size())

       break;

     index++;

     postfix = "_";

diff --git a/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp b/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
index a9fda7b..fd8f9f8 100644
--- a/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
+++ b/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
@@ -102,7 +102,14 @@
   // 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

 

 

diff --git a/CPP/7zip/UI/Common/Bench.cpp b/CPP/7zip/UI/Common/Bench.cpp
index 20db0b1..3fb0758 100644
--- a/CPP/7zip/UI/Common/Bench.cpp
+++ b/CPP/7zip/UI/Common/Bench.cpp
@@ -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 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 @@
 

 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 @@
           *dest++ = *src++;

       }

     }

-

-    *_RG_ = rg;

   }

 };

 

@@ -297,7 +247,7 @@
   

 class CBenchmarkOutStream:

   public ISequentialOutStream,

-  public CBenchBuffer,

+  public CAlignedBuffer,

   public CMyUnknownImp

 {

   // bool _overflow;

@@ -325,13 +275,13 @@
 

 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 @@
   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 @@
   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 @@
       #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 @@
 

   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 @@
 };

 

 

-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 @@
   

   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;

+  }

 

-  propStreamSpec = 0;

+  ALLOC_WITH_HRESULT(outStreamSpec, kCompressedBufferSize)

+

   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 @@
 

 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 @@
     

     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 @@
   

   if (setDecProps)

   {

-    RINOK(setDecProps->SetDecoderProperties2(propStreamSpec->Buffer, (UInt32)propStreamSpec->Pos));

+    RINOK(setDecProps->SetDecoderProperties2((const Byte *)*propStreamSpec, (UInt32)propStreamSpec->Pos));

   }

 

   {

@@ -1106,7 +1104,7 @@
       prev = pi->BenchInfo.UnpackSize;

     }

 

-    inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);

+    inStreamSpec->Init((const Byte *)*outStreamSpec, compressedSize);

     crcOutStreamSpec->Init();

     

     UInt64 outSize = kBufferSize;

@@ -1114,12 +1112,12 @@
     

     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 @@
 }

 

 

+

+#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 @@
         numSubDecoderThreads = 2;

       }

     }

+

+  bool mtEncMode = (numEncoderThreads > 1);

   #endif

 

   CBenchEncoders encodersSpec(numEncoderThreads);

@@ -1247,9 +1298,6 @@
     }

   }

 

-  CBaseRandomGenerator rg;

-  rg.Init();

-

   UInt32 crc = 0;

   if (fileData)

     crc = CrcCalc(fileData, uncompressedDataSize);

@@ -1258,22 +1306,38 @@
   {

     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 @@
       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 @@
     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 @@
 

 #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 @@
 

 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 @@
   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 @@
   {

     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 @@
       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 @@
     bool multiDict)

 {

   if (!CrcInternalTest())

-    return S_FALSE;

+    return E_FAIL;

 

   UInt32 numCPUs = 1;

   UInt64 ramSize = (UInt64)(sizeof(size_t)) << 29;

@@ -2822,7 +2915,7 @@
 

   COneMethodInfo method;

 

-  CBenchBuffer fileDataBuffer;

+  CAlignedBuffer fileDataBuffer;

 

   {

   unsigned i;

@@ -2847,10 +2940,9 @@
         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 @@
         complexInCommands,

         true, numThreadsSpecified,

         method,

-        uncompressedDataSize, fileDataBuffer.Buffer,

+        uncompressedDataSize, (const Byte *)fileDataBuffer,

         kOldLzmaDictBits, printCallback, benchCallback, &benchProps);

   }

 

@@ -3378,9 +3470,9 @@
       {

         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 @@
       }

 

       size_t uncompressedDataSize;

-      if (fileDataBuffer.Buffer)

+      if (fileDataBuffer.IsAllocated())

       {

-        uncompressedDataSize = fileDataBuffer.BufferSize;

+        uncompressedDataSize = fileDataBuffer.Size();

       }

       else

       {

@@ -3486,7 +3578,7 @@
           complexInCommands,

           true, numThreads,

           method2,

-          uncompressedDataSize, fileDataBuffer.Buffer,

+          uncompressedDataSize, (const Byte *)fileDataBuffer,

           kOldLzmaDictBits, printCallback, &callback, &callback.BenchProps);

       f.NewLine();

       RINOK(res);

diff --git a/CPP/7zip/UI/Console/Console.mak b/CPP/7zip/UI/Console/Console.mak
index 6757e6b..d4268c5 100644
--- a/CPP/7zip/UI/Console/Console.mak
+++ b/CPP/7zip/UI/Console/Console.mak
@@ -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 @@
   $O\UpdatePair.obj \

   $O\UpdateProduce.obj \

 

-#

+C_OBJS = $(C_OBJS) \

+  $O\DllSecur.obj \

diff --git a/CPP/7zip/UI/Console/Main.cpp b/CPP/7zip/UI/Console/Main.cpp
index 906fa91..4d7aac9 100644
--- a/CPP/7zip/UI/Console/Main.cpp
+++ b/CPP/7zip/UI/Console/Main.cpp
@@ -87,7 +87,7 @@
     "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 @@
     "  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"

diff --git a/CPP/7zip/UI/Console/MainAr.cpp b/CPP/7zip/UI/Console/MainAr.cpp
index fdac643..1d6c5a4 100644
--- a/CPP/7zip/UI/Console/MainAr.cpp
+++ b/CPP/7zip/UI/Console/MainAr.cpp
@@ -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 @@
   

   try

   {

+    #ifdef _WIN32

+    My_SetDefaultDllDirectories();

+    #endif

+

     res = Main2(

     #ifndef _WIN32

     numArgs, args

diff --git a/CPP/7zip/UI/Console/makefile b/CPP/7zip/UI/Console/makefile
index 31bc5c2..2210e0b 100644
--- a/CPP/7zip/UI/Console/makefile
+++ b/CPP/7zip/UI/Console/makefile
@@ -1,12 +1,7 @@
 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 \

@@ -57,7 +52,7 @@
 COMPRESS_OBJS = \

   $O\CopyCoder.obj \

 

-C_OBJS = \

+C_OBJS = $(C_OBJS) \

   $O\Alloc.obj \

   $O\CpuArch.obj \

   $O\Sort.obj \

diff --git a/CPP/Build.mak b/CPP/Build.mak
index b3ea8e2..5752491 100644
--- a/CPP/Build.mak
+++ b/CPP/Build.mak
@@ -67,6 +67,10 @@
 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

diff --git a/CPP/Common/ListFileUtils.cpp b/CPP/Common/ListFileUtils.cpp
index e40b2d0..2fdde6d 100644
--- a/CPP/Common/ListFileUtils.cpp
+++ b/CPP/Common/ListFileUtils.cpp
@@ -107,7 +107,7 @@
   }

 

   const wchar_t kGoodBOM = 0xFEFF;

-  const wchar_t kBadBOM  = 0xFFFE;

+  // const wchar_t kBadBOM  = 0xFFFE;

   

   UString s;

   unsigned i = 0;

@@ -115,8 +115,10 @@
   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);

diff --git a/CPP/Common/MyBuffer2.h b/CPP/Common/MyBuffer2.h
index 5cabd73..10edcb1 100644
--- a/CPP/Common/MyBuffer2.h
+++ b/CPP/Common/MyBuffer2.h
@@ -5,7 +5,7 @@
 

 #include "../../C/Alloc.h"

 

-#include "Defs.h"

+#include "MyTypes.h"

 

 class CMidBuffer

 {

@@ -15,7 +15,7 @@
   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 @@
   {

     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 @@
   }

 };

 

+

+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

diff --git a/CPP/Windows/MemoryLock.cpp b/CPP/Windows/MemoryLock.cpp
index 3cd82e5..d1b3bcc 100644
--- a/CPP/Windows/MemoryLock.cpp
+++ b/CPP/Windows/MemoryLock.cpp
@@ -2,6 +2,8 @@
 

 #include "StdAfx.h"

 

+#include "../../C/CpuArch.h"

+

 #include "MemoryLock.h"

 

 namespace NWindows {

@@ -75,6 +77,9 @@
   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 @@
   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

diff --git a/CPP/Windows/Shell.cpp b/CPP/Windows/Shell.cpp
index fde29ac..7ba82d4 100644
--- a/CPP/Windows/Shell.cpp
+++ b/CPP/Windows/Shell.cpp
@@ -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 @@
 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);

+    */

+  }

 }

 

 

diff --git a/DOC/lzma-history.txt b/DOC/lzma-history.txt
index c4ea98d..3a6f0f3 100644
--- a/DOC/lzma-history.txt
+++ b/DOC/lzma-history.txt
@@ -1,6 +1,14 @@
 HISTORY of the LZMA SDK

 -----------------------

 

+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.

+- The bug in 7zIn.c code was fixed.

+

+

 18.06          2018-12-30

 -------------------------

 - The speed for LZMA/LZMA2 compressing was increased by 3-10%,

diff --git a/DOC/lzma-sdk.txt b/DOC/lzma-sdk.txt
index 97fc26d..1bde6db 100644
--- a/DOC/lzma-sdk.txt
+++ b/DOC/lzma-sdk.txt
@@ -1,4 +1,4 @@
-LZMA SDK 18.06

+LZMA SDK 19.00

 --------------

 

 LZMA SDK provides the documentation, samples, header files,

diff --git a/METADATA b/METADATA
index 313792c..102ab5b 100644
--- a/METADATA
+++ b/METADATA
@@ -1,3 +1,19 @@
+name: "lzma"
+description: "LZMA is default and general compression method of 7z format."
 third_party {
+  url {
+    type: HOMEPAGE
+    value: "https://7-zip.org/"
+  }
+  url {
+    type: ARCHIVE
+    value: "https://7-zip.org/a/lzma1900.7z"
+  }
+  version: "19.00"
   license_type: UNENCUMBERED
+  last_upgrade_date {
+    year: 2023
+    month: 2
+    day: 14
+  }
 }