diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-08-16 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:55 +0300 |
commit | cba375916fb18db8b9101aedf4fa079e019311b3 (patch) | |
tree | 6275ae5fc2a8dd337ab0327180c871807e6ba5d4 /C | |
parent | 54490d51d5c6b0d794dcbad2d634d4c95fc25b6c (diff) |
15.0615.06
Diffstat (limited to 'C')
-rw-r--r-- | C/7zDec.c | 16 | ||||
-rw-r--r-- | C/7zVersion.h | 8 | ||||
-rw-r--r-- | C/Bcj2.c | 6 | ||||
-rw-r--r-- | C/Blake2.h | 48 | ||||
-rw-r--r-- | C/Blake2s.c | 244 | ||||
-rw-r--r-- | C/Compiler.h | 3 | ||||
-rw-r--r-- | C/CpuArch.h | 9 | ||||
-rw-r--r-- | C/LzmaDec.c | 11 | ||||
-rw-r--r-- | C/Util/7z/7zMain.c | 16 | ||||
-rw-r--r-- | C/Util/7z/makefile.gcc | 10 | ||||
-rw-r--r-- | C/Util/7zipInstall/7zipInstall.c | 47 | ||||
-rw-r--r-- | C/Util/7zipUninstall/7zipUninstall.c | 4 |
12 files changed, 384 insertions, 38 deletions
@@ -1,5 +1,5 @@ /* 7zDec.c -- Decoding from 7z folder -2015-06-13 : Igor Pavlov : Public domain */ +2015-08-01 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -144,11 +144,11 @@ static SRes SzDecodeLzma(const Byte *props, unsigned propsSize, UInt64 inSize, I for (;;) { - Byte *inBuf = NULL; + const void *inBuf = NULL; size_t lookahead = (1 << 18); if (lookahead > inSize) lookahead = (size_t)inSize; - res = inStream->Look((void *)inStream, (const void **)&inBuf, &lookahead); + res = inStream->Look(inStream, &inBuf, &lookahead); if (res != SZ_OK) break; @@ -197,11 +197,11 @@ static SRes SzDecodeLzma2(const Byte *props, unsigned propsSize, UInt64 inSize, for (;;) { - Byte *inBuf = NULL; + const void *inBuf = NULL; size_t lookahead = (1 << 18); if (lookahead > inSize) lookahead = (size_t)inSize; - res = inStream->Look((void *)inStream, (const void **)&inBuf, &lookahead); + res = inStream->Look(inStream, &inBuf, &lookahead); if (res != SZ_OK) break; @@ -237,11 +237,11 @@ static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer { while (inSize > 0) { - void *inBuf; + const void *inBuf; size_t curSize = (1 << 18); if (curSize > inSize) curSize = (size_t)inSize; - RINOK(inStream->Look((void *)inStream, (const void **)&inBuf, &curSize)); + RINOK(inStream->Look(inStream, &inBuf, &curSize)); if (curSize == 0) return SZ_ERROR_INPUT_EOF; memcpy(outBuffer, inBuf, curSize); @@ -429,7 +429,7 @@ static SRes SzFolder_Decode2(const CSzFolder *folder, RINOK(SzDecodePpmd(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain)); } #endif - else + else return SZ_ERROR_UNSUPPORTED; } else if (coder->MethodID == k_BCJ2) diff --git a/C/7zVersion.h b/C/7zVersion.h index a3c2c272..170f7aee 100644 --- a/C/7zVersion.h +++ b/C/7zVersion.h @@ -1,10 +1,12 @@ #define MY_VER_MAJOR 15 -#define MY_VER_MINOR 05 +#define MY_VER_MINOR 06 #define MY_VER_BUILD 00 -#define MY_VERSION "15.05 beta" -#define MY_DATE "2015-06-14" +#define MY_VERSION_NUMBERS "15.06" +#define MY_VERSION "15.06 beta" +#define MY_DATE "2015-08-09" #undef MY_COPYRIGHT #undef MY_VERSION_COPYRIGHT_DATE +#define MY_AUTHOR_NAME "Igor Pavlov" #define MY_COPYRIGHT_PD "Igor Pavlov : Public domain" #define MY_COPYRIGHT_CR "Copyright (c) 1999-2015 Igor Pavlov" @@ -1,5 +1,5 @@ /* Bcj2.c -- BCJ2 Decoder (Converter for x86 code) -2014-11-09 : Igor Pavlov : Public domain */ +2015-08-01 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -178,8 +178,8 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p) p->state = p->bufs[BCJ2_STREAM_MAIN] == p->lims[BCJ2_STREAM_MAIN] ? - BCJ2_STREAM_MAIN : - BCJ2_DEC_STATE_ORIG; + (unsigned)BCJ2_STREAM_MAIN : + (unsigned)BCJ2_DEC_STATE_ORIG; return SZ_OK; } diff --git a/C/Blake2.h b/C/Blake2.h new file mode 100644 index 00000000..14f3cb64 --- /dev/null +++ b/C/Blake2.h @@ -0,0 +1,48 @@ +/* Blake2.h -- BLAKE2 Hash +2015-06-30 : Igor Pavlov : Public domain +2015 : Samuel Neves : Public domain */ + +#ifndef __BLAKE2_H +#define __BLAKE2_H + +#include "7zTypes.h" + +EXTERN_C_BEGIN + +#define BLAKE2S_BLOCK_SIZE 64 +#define BLAKE2S_DIGEST_SIZE 32 +#define BLAKE2SP_PARALLEL_DEGREE 8 + +typedef struct +{ + UInt32 h[8]; + UInt32 t[2]; + UInt32 f[2]; + Byte buf[BLAKE2S_BLOCK_SIZE]; + UInt32 bufPos; + UInt32 lastNode_f1; + UInt32 dummy[2]; /* for sizeof(CBlake2s) alignment */ +} CBlake2s; + +/* You need to xor CBlake2s::h[i] with input parameter block after Blake2s_Init0() */ +/* +void Blake2s_Init0(CBlake2s *p); +void Blake2s_Update(CBlake2s *p, const Byte *data, size_t size); +void Blake2s_Final(CBlake2s *p, Byte *digest); +*/ + + +typedef struct +{ + CBlake2s S[BLAKE2SP_PARALLEL_DEGREE]; + unsigned bufPos; +} CBlake2sp; + + +void Blake2sp_Init(CBlake2sp *p); +void Blake2sp_Update(CBlake2sp *p, const Byte *data, size_t size); +void Blake2sp_Final(CBlake2sp *p, Byte *digest); + +EXTERN_C_END + +#endif diff --git a/C/Blake2s.c b/C/Blake2s.c new file mode 100644 index 00000000..6527415e --- /dev/null +++ b/C/Blake2s.c @@ -0,0 +1,244 @@ +/* Blake2s.c -- BLAKE2s and BLAKE2sp Hash +2015-06-30 : Igor Pavlov : Public domain +2015 : Samuel Neves : Public domain */ + +#include <string.h> + +#include "Blake2.h" +#include "CpuArch.h" +#include "RotateDefs.h" + +#define rotr32 rotrFixed + +#define BLAKE2S_NUM_ROUNDS 10 +#define BLAKE2S_FINAL_FLAG (~(UInt32)0) + +static const UInt32 k_Blake2s_IV[8] = +{ + 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, + 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL +}; + +static const Byte k_Blake2s_Sigma[BLAKE2S_NUM_ROUNDS][16] = +{ + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } , + { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } , + { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } , + { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } , + { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } , + { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } , + { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } , + { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } , + { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } , + { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } , +}; + + +void Blake2s_Init0(CBlake2s *p) +{ + unsigned i; + for (i = 0; i < 8; i++) + p->h[i] = k_Blake2s_IV[i]; + p->t[0] = 0; + p->t[1] = 0; + p->f[0] = 0; + p->f[1] = 0; + p->bufPos = 0; + p->lastNode_f1 = 0; +} + + +static void Blake2s_Compress(CBlake2s *p) +{ + UInt32 m[16]; + UInt32 v[16]; + + { + unsigned i; + + for (i = 0; i < 16; i++) + m[i] = GetUi32(p->buf + i * sizeof(m[i])); + + for (i = 0; i < 8; i++) + v[i] = p->h[i]; + } + + v[ 8] = k_Blake2s_IV[0]; + v[ 9] = k_Blake2s_IV[1]; + v[10] = k_Blake2s_IV[2]; + v[11] = k_Blake2s_IV[3]; + + v[12] = p->t[0] ^ k_Blake2s_IV[4]; + v[13] = p->t[1] ^ k_Blake2s_IV[5]; + v[14] = p->f[0] ^ k_Blake2s_IV[6]; + v[15] = p->f[1] ^ k_Blake2s_IV[7]; + + #define G(r,i,a,b,c,d) \ + a += b + m[sigma[2*i+0]]; d ^= a; d = rotr32(d, 16); c += d; b ^= c; b = rotr32(b, 12); \ + a += b + m[sigma[2*i+1]]; d ^= a; d = rotr32(d, 8); c += d; b ^= c; b = rotr32(b, 7); \ + + #define R(r) \ + G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \ + G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \ + G(r,2,v[ 2],v[ 6],v[10],v[14]); \ + G(r,3,v[ 3],v[ 7],v[11],v[15]); \ + G(r,4,v[ 0],v[ 5],v[10],v[15]); \ + G(r,5,v[ 1],v[ 6],v[11],v[12]); \ + G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \ + G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \ + + { + unsigned r; + for (r = 0; r < BLAKE2S_NUM_ROUNDS; r++) + { + const Byte *sigma = k_Blake2s_Sigma[r]; + R(r); + } + /* R(0); R(1); R(2); R(3); R(4); R(5); R(6); R(7); R(8); R(9); */ + } + + #undef G + #undef R + + { + unsigned i; + for (i = 0; i < 8; i++) + p->h[i] ^= v[i] ^ v[i + 8]; + } +} + + +#define Blake2s_Increment_Counter(S, inc) \ + { p->t[0] += (inc); p->t[1] += (p->t[0] < (inc)); } + +#define Blake2s_Set_LastBlock(p) \ + { p->f[0] = BLAKE2S_FINAL_FLAG; p->f[1] = p->lastNode_f1; } + + +static void Blake2s_Update(CBlake2s *p, const Byte *data, size_t size) +{ + while (size != 0) + { + unsigned pos = (unsigned)p->bufPos; + unsigned rem = BLAKE2S_BLOCK_SIZE - pos; + + if (size <= rem) + { + memcpy(p->buf + pos, data, size); + p->bufPos += (UInt32)size; + return; + } + + memcpy(p->buf + pos, data, rem); + Blake2s_Increment_Counter(S, BLAKE2S_BLOCK_SIZE); + Blake2s_Compress(p); + p->bufPos = 0; + data += rem; + size -= rem; + } +} + + +static void Blake2s_Final(CBlake2s *p, Byte *digest) +{ + unsigned i; + + Blake2s_Increment_Counter(S, (UInt32)p->bufPos); + Blake2s_Set_LastBlock(p); + memset(p->buf + p->bufPos, 0, BLAKE2S_BLOCK_SIZE - p->bufPos); + Blake2s_Compress(p); + + for (i = 0; i < 8; i++) + SetUi32(digest + sizeof(p->h[i]) * i, p->h[i]); +} + + +/* ---------- BLAKE2s ---------- */ + +/* we need to xor CBlake2s::h[i] with input parameter block after Blake2s_Init0() */ +/* +typedef struct +{ + Byte digest_length; + Byte key_length; + Byte fanout; + Byte depth; + UInt32 leaf_length; + Byte node_offset[6]; + Byte node_depth; + Byte inner_length; + Byte salt[BLAKE2S_SALTBYTES]; + Byte personal[BLAKE2S_PERSONALBYTES]; +} CBlake2sParam; +*/ + + +static void Blake2sp_Init_Spec(CBlake2s *p, unsigned node_offset, unsigned node_depth) +{ + Blake2s_Init0(p); + + p->h[0] ^= (BLAKE2S_DIGEST_SIZE | ((UInt32)BLAKE2SP_PARALLEL_DEGREE << 16) | ((UInt32)2 << 24)); + p->h[2] ^= ((UInt32)node_offset); + p->h[3] ^= ((UInt32)node_depth << 16) | ((UInt32)BLAKE2S_DIGEST_SIZE << 24); + /* + P->digest_length = BLAKE2S_DIGEST_SIZE; + P->key_length = 0; + P->fanout = BLAKE2SP_PARALLEL_DEGREE; + P->depth = 2; + P->leaf_length = 0; + store48(P->node_offset, node_offset); + P->node_depth = node_depth; + P->inner_length = BLAKE2S_DIGEST_SIZE; + */ +} + + +void Blake2sp_Init(CBlake2sp *p) +{ + unsigned i; + + p->bufPos = 0; + + for (i = 0; i < BLAKE2SP_PARALLEL_DEGREE; i++) + Blake2sp_Init_Spec(&p->S[i], i, 0); + + p->S[BLAKE2SP_PARALLEL_DEGREE - 1].lastNode_f1 = BLAKE2S_FINAL_FLAG; +} + + +void Blake2sp_Update(CBlake2sp *p, const Byte *data, size_t size) +{ + unsigned pos = p->bufPos; + while (size != 0) + { + unsigned index = pos / BLAKE2S_BLOCK_SIZE; + unsigned rem = BLAKE2S_BLOCK_SIZE - (pos & (BLAKE2S_BLOCK_SIZE - 1)); + if (rem > size) + rem = (unsigned)size; + Blake2s_Update(&p->S[index], data, rem); + size -= rem; + data += rem; + pos += rem; + pos &= (BLAKE2S_BLOCK_SIZE * BLAKE2SP_PARALLEL_DEGREE - 1); + } + p->bufPos = pos; +} + + +void Blake2sp_Final(CBlake2sp *p, Byte *digest) +{ + CBlake2s R; + unsigned i; + + Blake2sp_Init_Spec(&R, 0, 1); + R.lastNode_f1 = BLAKE2S_FINAL_FLAG; + + for (i = 0; i < BLAKE2SP_PARALLEL_DEGREE; i++) + { + Byte hash[BLAKE2S_DIGEST_SIZE]; + Blake2s_Final(&p->S[i], hash); + Blake2s_Update(&R, hash, BLAKE2S_DIGEST_SIZE); + } + + Blake2s_Final(&R, digest); +} diff --git a/C/Compiler.h b/C/Compiler.h index 5c53d5b6..5bba7ee5 100644 --- a/C/Compiler.h +++ b/C/Compiler.h @@ -1,5 +1,5 @@ /* Compiler.h -2015-03-25 : Igor Pavlov : Public domain */ +2015-08-02 : Igor Pavlov : Public domain */ #ifndef __7Z_COMPILER_H #define __7Z_COMPILER_H @@ -18,6 +18,7 @@ #else #pragma warning(disable : 4511) // copy constructor could not be generated #pragma warning(disable : 4512) // assignment operator could not be generated + #pragma warning(disable : 4514) // unreferenced inline function has been removed #pragma warning(disable : 4702) // unreachable code #pragma warning(disable : 4710) // not inlined #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information diff --git a/C/CpuArch.h b/C/CpuArch.h index 38835189..ddd27d26 100644 --- a/C/CpuArch.h +++ b/C/CpuArch.h @@ -1,5 +1,5 @@ /* CpuArch.h -- CPU specific code -2015-03-25: Igor Pavlov : Public domain */ +2015-08-02: Igor Pavlov : Public domain */ #ifndef __CPU_ARCH_H #define __CPU_ARCH_H @@ -90,9 +90,10 @@ Stop_Compiling_Bad_Endian #define GetUi16(p) (*(const UInt16 *)(const void *)(p)) #define GetUi32(p) (*(const UInt32 *)(const void *)(p)) #define GetUi64(p) (*(const UInt64 *)(const void *)(p)) -#define SetUi16(p, v) *(UInt16 *)(p) = (v); -#define SetUi32(p, v) *(UInt32 *)(p) = (v); -#define SetUi64(p, v) *(UInt64 *)(p) = (v); + +#define SetUi16(p, v) { *(UInt16 *)(p) = (v); } +#define SetUi32(p, v) { *(UInt32 *)(p) = (v); } +#define SetUi64(p, v) { *(UInt64 *)(p) = (v); } #else diff --git a/C/LzmaDec.c b/C/LzmaDec.c index c8326667..27efbaba 100644 --- a/C/LzmaDec.c +++ b/C/LzmaDec.c @@ -1,5 +1,5 @@ /* LzmaDec.c -- LZMA Decoder -2015-05-14 : Igor Pavlov : Public domain */ +2015-06-23 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -438,10 +438,16 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte if (checkDicSize == 0) { if (distance >= processedPos) + { + p->dicPos = dicPos; return SZ_ERROR_DATA; + } } else if (distance >= checkDicSize) + { + p->dicPos = dicPos; return SZ_ERROR_DATA; + } state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3; } @@ -453,7 +459,10 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte SizeT pos; if ((rem = limit - dicPos) == 0) + { + p->dicPos = dicPos; return SZ_ERROR_DATA; + } curLen = ((rem < len) ? (unsigned)rem : len); pos = dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0); diff --git a/C/Util/7z/7zMain.c b/C/Util/7z/7zMain.c index c1e49bf4..ed6bab2a 100644 --- a/C/Util/7z/7zMain.c +++ b/C/Util/7z/7zMain.c @@ -1,5 +1,5 @@ /* 7zMain.c - Test application for 7z Decoder -2015-05-11 : Igor Pavlov : Public domain */ +2015-08-02 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -328,22 +328,20 @@ void PrintError(char *sz) printf("\nERROR: %s\n", sz); } -#ifdef USE_WINDOWS_FILE static void GetAttribString(UInt32 wa, Bool isDir, char *s) { + #ifdef USE_WINDOWS_FILE s[0] = (char)(((wa & FILE_ATTRIBUTE_DIRECTORY) != 0 || isDir) ? 'D' : '.'); s[1] = (char)(((wa & FILE_ATTRIBUTE_READONLY ) != 0) ? 'R': '.'); s[2] = (char)(((wa & FILE_ATTRIBUTE_HIDDEN ) != 0) ? 'H': '.'); s[3] = (char)(((wa & FILE_ATTRIBUTE_SYSTEM ) != 0) ? 'S': '.'); s[4] = (char)(((wa & FILE_ATTRIBUTE_ARCHIVE ) != 0) ? 'A': '.'); - s[5] = '\0'; -} -#else -static void GetAttribString(UInt32, Bool, char *s) -{ - s[0] = '\0'; + s[5] = 0; + #else + s[0] = (char)(((wa & (1 << 4)) != 0 || isDir) ? 'D' : '.'); + s[1] = 0; + #endif } -#endif // #define NUM_PARENTS_MAX 128 diff --git a/C/Util/7z/makefile.gcc b/C/Util/7z/makefile.gcc index 46018201..beeb72fe 100644 --- a/C/Util/7z/makefile.gcc +++ b/C/Util/7z/makefile.gcc @@ -1,10 +1,10 @@ PROG = 7zDec -CXX = g++ +CXX = gcc LIB = RM = rm -f CFLAGS = -c -O2 -Wall -OBJS = 7zMain.o 7zAlloc.o 7zArcIn.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o +OBJS = 7zMain.o 7zAlloc.o 7zArcIn.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o CpuArch.o Delta.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o BraIA64.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o all: $(PROG) @@ -38,6 +38,9 @@ $(PROG): $(OBJS) CpuArch.o: ../../CpuArch.c $(CXX) $(CFLAGS) ../../CpuArch.c +Delta.o: ../../Delta.c + $(CXX) $(CFLAGS) ../../Delta.c + LzmaDec.o: ../../LzmaDec.c $(CXX) $(CFLAGS) ../../LzmaDec.c @@ -50,6 +53,9 @@ Bra.o: ../../Bra.c Bra86.o: ../../Bra86.c $(CXX) $(CFLAGS) ../../Bra86.c +BraIA64.o: ../../BraIA64.c + $(CXX) $(CFLAGS) ../../BraIA64.c + Bcj2.o: ../../Bcj2.c $(CXX) $(CFLAGS) ../../Bcj2.c diff --git a/C/Util/7zipInstall/7zipInstall.c b/C/Util/7zipInstall/7zipInstall.c index dc636d64..9a360579 100644 --- a/C/Util/7zipInstall/7zipInstall.c +++ b/C/Util/7zipInstall/7zipInstall.c @@ -1,5 +1,5 @@ -/* 7zipInnstall.c - 7-Zip Installer -2015-06-13 : Igor Pavlov : Public domain */ +/* 7zipInstall.c - 7-Zip Installer +2015-08-04 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -37,7 +37,7 @@ static const WCHAR *k_Reg_Software_7zip = L"Software\\7-Zip"; #define k_7zip_with_Ver_base L"7-Zip " LLL(MY_VERSION) #ifdef _64BIT_INSTALLER - #define k_7zip_with_Ver k_7zip_with_Ver_base L" x64" + #define k_7zip_with_Ver k_7zip_with_Ver_base L" (x64)" #else #define k_7zip_with_Ver k_7zip_with_Ver_base #endif @@ -84,6 +84,8 @@ static HWND g_Path_HWND; static HWND g_InfoLine_HWND; static HWND g_Progress_HWND; +static DWORD g_TotalSize; + static WCHAR path[MAX_PATH * 2 + 40]; @@ -143,7 +145,7 @@ static WRes CreateComplexDir() if (IS_DRIVE_PATH(s)) prefixSize = 3; - else if (IS_SEPAR(s[1]) && IS_SEPAR(s[1])) + else if (IS_SEPAR(s[0]) && IS_SEPAR(s[1])) prefixSize = 2; else return ERROR_INVALID_NAME; @@ -796,16 +798,30 @@ static void WriteShellEx() // wcscpy(destPath, path); // wcscat(destPath, L"7zFM.exe"); MyRegistry_SetString(destKey, L"DisplayName", k_7zip_with_Ver_str); + MyRegistry_SetString(destKey, L"DisplayVersion", LLL(MY_VERSION_NUMBERS)); MyRegistry_SetString(destKey, L"DisplayIcon", destPath); wcscpy(destPath, path); - // MyRegistry_SetString(destKey, L"InstallLocation", destPath); + MyRegistry_SetString(destKey, L"InstallLocation", destPath); wcscat(destPath, L"Uninstall.exe"); // wcscat(destPath, L"\""); MyRegistry_SetString(destKey, L"UninstallString", destPath); + MyRegistry_SetDWORD(destKey, L"NoModify", 1); MyRegistry_SetDWORD(destKey, L"NoRepair", 1); + + MyRegistry_SetDWORD(destKey, L"EstimatedSize", g_TotalSize >> 10); + + MyRegistry_SetDWORD(destKey, L"VersionMajor", MY_VER_MAJOR); + MyRegistry_SetDWORD(destKey, L"VersionMinor", MY_VER_MINOR); + + MyRegistry_SetString(destKey, L"Publisher", LLL(MY_AUTHOR_NAME)); + + // MyRegistry_SetString(destKey, L"HelpLink", L"http://www.7-zip.org/support.html"); + // MyRegistry_SetString(destKey, L"URLInfoAbout", L"http://www.7-zip.org/"); + // MyRegistry_SetString(destKey, L"URLUpdateInfo", L"http://www.7-zip.org/"); + RegCloseKey(destKey); } } @@ -1108,6 +1124,23 @@ if (res == SZ_OK) FileInStream_CreateVTable(&archiveStream); LookToRead_CreateVTable(&lookStream, False); + { + // Remove post spaces + unsigned endPos = 0; + unsigned i = 0; + + for (;;) + { + wchar_t c = path[i++]; + if (c == 0) + break; + if (c != ' ') + endPos = i; + } + + path[endPos] = 0; + } + NormalizePrefix(path); winRes = CreateComplexDir(); @@ -1131,6 +1164,8 @@ if (res == SZ_OK) UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call, if(!outBuf) */ Byte *outBuf = NULL; /* it must be NULL before first call for each new archive. */ size_t outBufSize = 0; /* it can have any value before first call, if(!outBuf) */ + + g_TotalSize = 0; if (!g_SilentMode) { @@ -1309,6 +1344,8 @@ if (res == SZ_OK) res = SZ_ERROR_FAIL; } + g_TotalSize += (DWORD)outSizeProcessed; + #ifdef USE_WINDOWS_FILE if (SzBitWithVals_Check(&db.MTime, i)) { diff --git a/C/Util/7zipUninstall/7zipUninstall.c b/C/Util/7zipUninstall/7zipUninstall.c index 68a8b029..60984347 100644 --- a/C/Util/7zipUninstall/7zipUninstall.c +++ b/C/Util/7zipUninstall/7zipUninstall.c @@ -1,5 +1,5 @@ /* 7zipUninstall.c - 7-Zip Uninstaller -2015-06-13 : Igor Pavlov : Public domain */ +2015-08-09 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -31,7 +31,7 @@ #define k_7zip_with_Ver_base L"7-Zip " LLL(MY_VERSION) #ifdef _64BIT_INSTALLER - #define k_7zip_with_Ver k_7zip_with_Ver_base L" x64" + #define k_7zip_with_Ver k_7zip_with_Ver_base L" (x64)" #else #define k_7zip_with_Ver k_7zip_with_Ver_base #endif |