Compare commits

...

3 Commits

Author SHA1 Message Date
shunf4
eaa3e8b48c Origial James Hoo mod to 16.04 2024-04-20 18:55:58 +08:00
Igor Pavlov
603abd5528 16.04 2016-12-08 12:13:50 +00:00
Igor Pavlov
232ce79574 16.03 2016-12-08 12:12:54 +00:00
172 changed files with 56534 additions and 507 deletions

164
7zAll/7zAll.sln Normal file
View File

@@ -0,0 +1,164 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7z", "..\CPP\7zip\Bundles\Format7zF\Format7z.vcproj", "{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SFXCon", "..\CPP\7zip\Bundles\SFXCon\SFXCon.vcproj", "{0A87F1E0-6E9A-452C-A209-3968AD375DCA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SFXWin", "..\CPP\7zip\Bundles\SFXWin\SFXWin.vcproj", "{F0A92034-14AA-4347-92D5-CD4886865506}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "..\CPP\7zip\UI\Console\Console.vcproj", "{1A8E1EC5-A03F-4368-ABDF-57C21762F528}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Explorer", "..\CPP\7zip\UI\Explorer\Explorer.vcproj", "{FBA8DA13-7434-409C-83AB-FC6682A8869D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FM", "..\CPP\7zip\UI\FileManager\FM.vcproj", "{2628FF64-E1E1-4CB7-B588-08DE7145B630}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUI", "..\CPP\7zip\UI\GUI\GUI.vcproj", "{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugU|Win32 = DebugU|Win32
DebugU|x64 = DebugU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseD|Win32 = ReleaseD|Win32
ReleaseD|x64 = ReleaseD|x64
ReleaseU|Win32 = ReleaseU|Win32
ReleaseU|x64 = ReleaseU|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|Win32.ActiveCfg = Debug|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|Win32.Build.0 = Debug|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|x64.ActiveCfg = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|x64.Build.0 = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.DebugU|Win32.ActiveCfg = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.DebugU|x64.ActiveCfg = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.DebugU|x64.Build.0 = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|Win32.ActiveCfg = Release|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|Win32.Build.0 = Release|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|x64.ActiveCfg = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|x64.Build.0 = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.ReleaseD|Win32.ActiveCfg = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.ReleaseD|x64.ActiveCfg = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.ReleaseD|x64.Build.0 = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.ReleaseU|Win32.ActiveCfg = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.ReleaseU|x64.ActiveCfg = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.ReleaseU|x64.Build.0 = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|Win32.ActiveCfg = Debug|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|Win32.Build.0 = Debug|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|x64.ActiveCfg = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|x64.Build.0 = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.DebugU|Win32.ActiveCfg = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.DebugU|x64.ActiveCfg = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.DebugU|x64.Build.0 = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|Win32.ActiveCfg = Release|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|Win32.Build.0 = Release|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|x64.ActiveCfg = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|x64.Build.0 = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.ReleaseD|Win32.ActiveCfg = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.ReleaseD|x64.ActiveCfg = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.ReleaseD|x64.Build.0 = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.ReleaseU|Win32.ActiveCfg = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.ReleaseU|x64.ActiveCfg = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.ReleaseU|x64.Build.0 = Release|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|Win32.ActiveCfg = Debug|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|Win32.Build.0 = Debug|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|x64.ActiveCfg = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|x64.Build.0 = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.DebugU|Win32.ActiveCfg = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.DebugU|x64.ActiveCfg = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.DebugU|x64.Build.0 = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|Win32.ActiveCfg = Release|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|Win32.Build.0 = Release|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|x64.ActiveCfg = Release|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|x64.Build.0 = Release|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|Win32.ActiveCfg = ReleaseD|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|Win32.Build.0 = ReleaseD|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|x64.ActiveCfg = ReleaseD|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|x64.Build.0 = ReleaseD|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseU|Win32.ActiveCfg = ReleaseD|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseU|x64.ActiveCfg = ReleaseD|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseU|x64.Build.0 = ReleaseD|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|Win32.ActiveCfg = Debug|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|Win32.Build.0 = Debug|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|x64.ActiveCfg = Debug|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|x64.Build.0 = Debug|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|Win32.ActiveCfg = DebugU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|Win32.Build.0 = DebugU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|x64.ActiveCfg = DebugU|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|x64.Build.0 = DebugU|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|Win32.ActiveCfg = Release|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|Win32.Build.0 = Release|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|x64.ActiveCfg = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|x64.Build.0 = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseD|Win32.ActiveCfg = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseD|x64.ActiveCfg = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseD|x64.Build.0 = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|x64.Build.0 = ReleaseU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|Win32.ActiveCfg = Debug|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|Win32.Build.0 = Debug|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|x64.ActiveCfg = Debug|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|x64.Build.0 = Debug|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|Win32.ActiveCfg = DebugU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|Win32.Build.0 = DebugU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|x64.ActiveCfg = DebugU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|x64.Build.0 = DebugU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|Win32.ActiveCfg = Release|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|Win32.Build.0 = Release|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|x64.ActiveCfg = Release|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|x64.Build.0 = Release|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseD|Win32.ActiveCfg = ReleaseU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseD|x64.ActiveCfg = ReleaseU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseD|x64.Build.0 = ReleaseU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|x64.Build.0 = ReleaseU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|Win32.ActiveCfg = Debug|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|Win32.Build.0 = Debug|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|x64.ActiveCfg = Debug|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Debug|x64.Build.0 = Debug|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|Win32.ActiveCfg = DebugU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|Win32.Build.0 = DebugU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|x64.ActiveCfg = DebugU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.DebugU|x64.Build.0 = DebugU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|Win32.ActiveCfg = Release|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|Win32.Build.0 = Release|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|x64.ActiveCfg = Release|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.Release|x64.Build.0 = Release|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseD|Win32.ActiveCfg = ReleaseU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseD|x64.ActiveCfg = ReleaseU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseD|x64.Build.0 = ReleaseU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{2628FF64-E1E1-4CB7-B588-08DE7145B630}.ReleaseU|x64.Build.0 = ReleaseU|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Debug|Win32.ActiveCfg = Debug|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Debug|Win32.Build.0 = Debug|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Debug|x64.ActiveCfg = Debug|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Debug|x64.Build.0 = Debug|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.DebugU|Win32.ActiveCfg = DebugU|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.DebugU|Win32.Build.0 = DebugU|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.DebugU|x64.ActiveCfg = DebugU|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.DebugU|x64.Build.0 = DebugU|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Release|Win32.ActiveCfg = Release|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Release|Win32.Build.0 = Release|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Release|x64.ActiveCfg = Release|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.Release|x64.Build.0 = Release|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseD|Win32.ActiveCfg = Release|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseD|x64.ActiveCfg = Release|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseD|x64.Build.0 = Release|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{D4BC12CF-49F2-474D-BAF6-EAC069DB7D6C}.ReleaseU|x64.Build.0 = ReleaseU|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,9 +1,17 @@
#define MY_VER_MAJOR 16 #define MY_VER_MAJOR 16
#define MY_VER_MINOR 02 #define MY_VER_MINOR 04
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "16.02" #define MY_VERSION_NUMBERS "16.04"
#define MY_VERSION "16.02" #define MY_VERSION "16.04"
#define MY_DATE "2016-05-21"
#ifdef MY_X64
#define MY_7ZIP_NAME "7-Zip [64-bit]"
#else
#define MY_7ZIP_NAME "7-Zip [32-bit]"
#endif
#define MY_DATE "2016-10-04"
#undef MY_COPYRIGHT #undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE #undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov" #define MY_AUTHOR_NAME "Igor Pavlov"
@@ -17,3 +25,25 @@
#endif #endif
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " : " MY_COPYRIGHT " : " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " : " MY_COPYRIGHT " : " MY_DATE
#define MY_EASY7ZIP_VER_MAJOR 0
#define MY_EASY7ZIP_VER_MINOR 1
#ifdef MY_X64
#define MY_EASY7ZIP_7ZIP "Easy 7-Zip [64-bit]"
#else
#define MY_EASY7ZIP_7ZIP "Easy 7-Zip [32-bit]"
#endif
#define MY_EASY7ZIP_VERSION "0.1.6"
#ifdef MY_X64
#define MY_EASY7ZIP_7ZIP_VERSION "Easy 7-Zip v0.1.6 [64-bit]"
#else
#define MY_EASY7ZIP_7ZIP_VERSION "Easy 7-Zip v0.1.6 [32-bit]"
#endif
#define MY_EASY7ZIP_COPYRIGHT "Portions Copyright (C) 2013-2016 James Hoo"
#define MY_EASY7ZIP_AUTHOR "James Hoo"
#define MY_EASY7ZIP_HOMEPAGE "e7z.org"
#define MY_EASY7ZIP_SPECIAL_BUILD MY_EASY7ZIP_7ZIP_VERSION " (www." MY_EASY7ZIP_HOMEPAGE ") made by " MY_EASY7ZIP_AUTHOR

View File

@@ -40,8 +40,9 @@ BEGIN \
VALUE "InternalName", intName \ VALUE "InternalName", intName \
VALUE "LegalCopyright", MY_COPYRIGHT \ VALUE "LegalCopyright", MY_COPYRIGHT \
VALUE "OriginalFilename", origName \ VALUE "OriginalFilename", origName \
VALUE "ProductName", "7-Zip" \ VALUE "ProductName", MY_7ZIP_NAME \
VALUE "ProductVersion", MY_VERSION \ VALUE "ProductVersion", MY_VERSION \
VALUE "SpecialBuild", MY_EASY7ZIP_SPECIAL_BUILD \
END \ END \
END \ END \
BLOCK "VarFileInfo" \ BLOCK "VarFileInfo" \

View File

@@ -1,5 +1,5 @@
/* CpuArch.h -- CPU specific code /* CpuArch.h -- CPU specific code
2015-12-01: Igor Pavlov : Public domain */ 2016-06-09: Igor Pavlov : Public domain */
#ifndef __CPU_ARCH_H #ifndef __CPU_ARCH_H
#define __CPU_ARCH_H #define __CPU_ARCH_H
@@ -66,6 +66,7 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|| defined(__MIPSEL__) \ || defined(__MIPSEL__) \
|| defined(__MIPSEL) \ || defined(__MIPSEL) \
|| defined(_MIPSEL) \ || defined(_MIPSEL) \
|| defined(__BFIN__) \
|| (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
#define MY_CPU_LE #define MY_CPU_LE
#endif #endif

87
C/DllSecur.c Normal file
View File

@@ -0,0 +1,87 @@
/* DllSecur.c -- DLL loading security
2016-10-04 : Igor Pavlov : Public domain */
#include "Precomp.h"
#ifdef _WIN32
#include <windows.h>
#include "DllSecur.h"
#ifndef UNDER_CE
typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags);
#define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
#define MY_LOAD_LIBRARY_SEARCH_SYSTEM32 0x800
static const char * const g_Dlls =
#ifndef _CONSOLE
"UXTHEME\0"
#endif
"USERENV\0"
"SETUPAPI\0"
"APPHELP\0"
"PROPSYS\0"
"DWMAPI\0"
"CRYPTBASE\0"
"OLEACC\0"
"CLBCATQ\0"
;
#endif
void LoadSecurityDlls()
{
#ifndef UNDER_CE
wchar_t buf[MAX_PATH + 100];
{
// at Vista (ver 6.0) : CoCreateInstance(CLSID_ShellLink, ...) doesn't work after SetDefaultDllDirectories() : Check it ???
OSVERSIONINFO vi;
vi.dwOSVersionInfoSize = sizeof(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;
}
}
{
unsigned len = GetSystemDirectoryW(buf, MAX_PATH + 2);
if (len == 0 || len > MAX_PATH)
return;
}
{
const char *dll;
unsigned pos = (unsigned)lstrlenW(buf);
if (buf[pos - 1] != '\\')
buf[pos++] = '\\';
for (dll = g_Dlls; dll[0] != 0;)
{
unsigned k = 0;
for (;;)
{
char c = *dll++;
buf[pos + k] = c;
k++;
if (c == 0)
break;
}
lstrcatW(buf, L".dll");
LoadLibraryExW(buf, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}
}
#endif
}
#endif

19
C/DllSecur.h Normal file
View File

@@ -0,0 +1,19 @@
/* DllSecur.h -- DLL loading for security
2016-06-08 : Igor Pavlov : Public domain */
#ifndef __DLL_SECUR_H
#define __DLL_SECUR_H
#include "7zTypes.h"
EXTERN_C_BEGIN
#ifdef _WIN32
void LoadSecurityDlls();
#endif
EXTERN_C_END
#endif

View File

@@ -1,5 +1,5 @@
/* 7zipInstall.c - 7-Zip Installer /* 7zipInstall.c - 7-Zip Installer
2015-12-09 : Igor Pavlov : Public domain */ 2016-06-08 : Igor Pavlov : Public domain */
#include "Precomp.h" #include "Precomp.h"
@@ -21,6 +21,7 @@
#include "../../7zFile.h" #include "../../7zFile.h"
#include "../../7zVersion.h" #include "../../7zVersion.h"
#include "../../CpuArch.h" #include "../../CpuArch.h"
#include "../../DllSecur.h"
#include "resource.h" #include "resource.h"
@@ -876,6 +877,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
UNUSED_VAR(nCmdShow) UNUSED_VAR(nCmdShow)
#ifndef UNDER_CE #ifndef UNDER_CE
LoadSecurityDlls();
CoInitialize(NULL); CoInitialize(NULL);
#endif #endif

View File

@@ -191,6 +191,14 @@ SOURCE=..\..\Delta.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\DllSecur.c
# End Source File
# Begin Source File
SOURCE=..\..\DllSecur.h
# End Source File
# Begin Source File
SOURCE=..\..\Lzma2Dec.c SOURCE=..\..\Lzma2Dec.c
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -25,6 +25,7 @@ C_OBJS = \
$O\7zStream.obj \ $O\7zStream.obj \
$O\Bcj2.obj \ $O\Bcj2.obj \
$O\CpuArch.obj \ $O\CpuArch.obj \
$O\DllSecur.obj \
$O\LzmaDec.obj \ $O\LzmaDec.obj \
OBJS = \ OBJS = \

View File

@@ -20,6 +20,7 @@
#include "../../7zCrc.h" #include "../../7zCrc.h"
#include "../../7zFile.h" #include "../../7zFile.h"
#include "../../CpuArch.h" #include "../../CpuArch.h"
#include "../../DllSecur.h"
#define k_EXE_ExtIndex 2 #define k_EXE_ExtIndex 2
@@ -254,6 +255,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
Bool useShellExecute = True; Bool useShellExecute = True;
DWORD exitCode = 0; DWORD exitCode = 0;
LoadSecurityDlls();
#ifdef _CONSOLE #ifdef _CONSOLE
SetConsoleCtrlHandler(HandlerRoutine, TRUE); SetConsoleCtrlHandler(HandlerRoutine, TRUE);
#else #else

View File

@@ -187,6 +187,14 @@ SOURCE=..\..\Delta.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\DllSecur.c
# End Source File
# Begin Source File
SOURCE=..\..\DllSecur.h
# End Source File
# Begin Source File
SOURCE=..\..\Lzma2Dec.c SOURCE=..\..\Lzma2Dec.c
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -16,6 +16,7 @@ C_OBJS = \
$O\BraIA64.obj \ $O\BraIA64.obj \
$O\CpuArch.obj \ $O\CpuArch.obj \
$O\Delta.obj \ $O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \ $O\Lzma2Dec.obj \
$O\LzmaDec.obj \ $O\LzmaDec.obj \

View File

@@ -17,6 +17,7 @@ C_OBJS = \
$O\BraIA64.obj \ $O\BraIA64.obj \
$O\CpuArch.obj \ $O\CpuArch.obj \
$O\Delta.obj \ $O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \ $O\Lzma2Dec.obj \
$O\LzmaDec.obj \ $O\LzmaDec.obj \

View File

@@ -1097,7 +1097,10 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(
if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i]) if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
ThrowIncorrect(); ThrowIncorrect();
} }
HeadersSize += folders.PackPositions[folders.NumPackStreams];
if (folders.PackPositions)
HeadersSize += folders.PackPositions[folders.NumPackStreams];
return S_OK; return S_OK;
} }

View File

@@ -38,7 +38,7 @@ struct CFilterMode
{ {
if (Id == k_IA64) if (Id == k_IA64)
Delta = 16; Delta = 16;
else if (Id == k_ARM || Id == k_PPC || Id == k_PPC) else if (Id == k_ARM || Id == k_PPC || Id == k_SPARC)
Delta = 4; Delta = 4;
else if (Id == k_ARMT) else if (Id == k_ARMT)
Delta = 2; Delta = 2;
@@ -779,7 +779,7 @@ struct CSolidGroup
CRecordVector<CFolderRepack> folderRefs; CRecordVector<CFolderRepack> folderRefs;
}; };
static const char *g_ExeExts[] = static const char * const g_ExeExts[] =
{ {
"dll" "dll"
, "exe" , "exe"

View File

@@ -168,7 +168,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
case kpidVolumeIndex: case kpidVolumeIndex:
{ {
if (m_Database.Volumes.Size() == 1) if (!m_Database.Volumes.IsEmpty())
{ {
const CDatabaseEx &db = m_Database.Volumes[0]; const CDatabaseEx &db = m_Database.Volumes[0];
const CInArcInfo &ai = db.ArcInfo; const CInArcInfo &ai = db.ArcInfo;

View File

@@ -156,7 +156,7 @@ bool CHeader::Parse(const Byte *p)
#define PT_PHDR 6 #define PT_PHDR 6
static const char *g_SegnmentTypes[] = static const char * const g_SegnmentTypes[] =
{ {
"Unused", "Unused",
"Loadable segment", "Loadable segment",
@@ -554,13 +554,31 @@ static const CUInt32PCharPair g_OS[] =
{ 255, "Standalone" } { 255, "Standalone" }
}; };
#define k_Machine_ARM 40
/*
#define EF_ARM_ABIMASK 0xFF000000
#define EF_ARM_BE8 0x00800000
#define EF_ARM_GCCMASK 0x00400FFF
#define EF_ARM_ABI_FLOAT_SOFT 0x00000200
#define EF_ARM_ABI_FLOAT_HARD 0x00000400
*/
static const CUInt32PCharPair g_ARM_Flags[] =
{
{ 9, "SF" },
{ 10, "HF" },
{ 23, "BE8" }
};
#define ET_NONE 0 #define ET_NONE 0
#define ET_REL 1 #define ET_REL 1
#define ET_EXEC 2 #define ET_EXEC 2
#define ET_DYN 3 #define ET_DYN 3
#define ET_CORE 4 #define ET_CORE 4
static const char *g_Types[] = static const char * const g_Types[] =
{ {
"None", "None",
"Relocatable file", "Relocatable file",
@@ -569,6 +587,9 @@ static const char *g_Types[] =
"Core file" "Core file"
}; };
class CHandler: class CHandler:
public IInArchive, public IInArchive,
public IArchiveAllowTail, public IArchiveAllowTail,
@@ -659,7 +680,29 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
case kpidBit64: if (_header.Mode64) prop = _header.Mode64; break; case kpidBit64: if (_header.Mode64) prop = _header.Mode64; break;
case kpidBigEndian: if (_header.Be) prop = _header.Be; break; case kpidBigEndian: if (_header.Be) prop = _header.Be; break;
case kpidShortComment: case kpidShortComment:
case kpidCpu: PAIR_TO_PROP(g_Machines, _header.Machine, prop); break;
case kpidCpu:
{
AString s = TypePairToString(g_Machines, ARRAY_SIZE(g_Machines), _header.Machine);
UInt32 flags = _header.Flags;
if (flags != 0)
{
char sz[16];
s.Add_Space();
if (_header.Machine == k_Machine_ARM)
{
s += FlagsToString(g_ARM_Flags, ARRAY_SIZE(g_ARM_Flags), flags & (((UInt32)1 << 24) - 1));
s += " ABI:";
ConvertUInt32ToString(flags >> 24, sz);
}
else
ConvertUInt32ToHex(flags, sz);
s += sz;
}
prop = s;
break;
}
case kpidHostOS: PAIR_TO_PROP(g_OS, _header.Os, prop); break; case kpidHostOS: PAIR_TO_PROP(g_OS, _header.Os, prop); break;
case kpidCharacts: TYPE_TO_PROP(g_Types, _header.Type, prop); break; case kpidCharacts: TYPE_TO_PROP(g_Types, _header.Type, prop); break;
case kpidExtension: case kpidExtension:

View File

@@ -93,7 +93,7 @@ static const Byte kProps[] =
IMP_IInArchive_Props IMP_IInArchive_Props
IMP_IInArchive_ArcProps_NO_Table IMP_IInArchive_ArcProps_NO_Table
static const char *g_AudioTypes[16] = static const char * const g_AudioTypes[16] =
{ {
"pcm" "pcm"
, "adpcm" , "adpcm"
@@ -113,7 +113,7 @@ static const char *g_AudioTypes[16] =
, "audio15" , "audio15"
}; };
static const char *g_VideoTypes[16] = static const char * const g_VideoTypes[16] =
{ {
"video0" "video0"
, "jpeg" , "jpeg"
@@ -133,7 +133,7 @@ static const char *g_VideoTypes[16] =
, "video15" , "video15"
}; };
static const char *g_Rates[4] = static const char * const g_Rates[4] =
{ {
"5.5 kHz" "5.5 kHz"
, "11 kHz" , "11 kHz"

View File

@@ -244,9 +244,31 @@ HRESULT CHandler::Open2(IInStream *stream)
_items.Add(item); _items.Add(item);
} }
UInt64 end = (backupLba + 1) * kSectorSize; {
if (_totalSize < end) const UInt64 end = (backupLba + 1) * kSectorSize;
_totalSize = end; if (_totalSize < end)
_totalSize = end;
}
{
UInt64 fileEnd;
RINOK(stream->Seek(0, STREAM_SEEK_END, &fileEnd));
if (_totalSize < fileEnd)
{
const UInt64 rem = fileEnd - _totalSize;
const UInt64 kRemMax = 1 << 22;
if (rem <= kRemMax)
{
RINOK(stream->Seek(_totalSize, STREAM_SEEK_SET, NULL));
bool areThereNonZeros = false;
UInt64 numZeros = 0;
if (ReadZeroTail(stream, areThereNonZeros, numZeros, kRemMax) == S_OK)
if (!areThereNonZeros)
_totalSize += numZeros;
}
}
}
return S_OK; return S_OK;
} }

View File

@@ -507,7 +507,7 @@ HRESULT CHeaderRec::Parse(const Byte *p)
// LeafRecords = Get32(p + 6); // LeafRecords = Get32(p + 6);
FirstLeafNode = Get32(p + 0xA); FirstLeafNode = Get32(p + 0xA);
// LastLeafNode = Get32(p + 0xE); // LastLeafNode = Get32(p + 0xE);
UInt32 nodeSize = Get16(p + 0x12); const UInt32 nodeSize = Get16(p + 0x12);
unsigned i; unsigned i;
for (i = 9; ((UInt32)1 << i) != nodeSize; i++) for (i = 9; ((UInt32)1 << i) != nodeSize; i++)
@@ -583,9 +583,9 @@ HRESULT CDatabase::LoadExtentFile(const CFork &fork, IInStream *inStream, CObjec
for (unsigned i = 0; i < desc.NumRecords; i++) for (unsigned i = 0; i < desc.NumRecords; i++)
{ {
UInt32 nodeSize = (UInt32)1 << hr.NodeSizeLog; const UInt32 nodeSize = (UInt32)1 << hr.NodeSizeLog;
UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2); const UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2); const UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
if (offs > nodeSize || offsNext > nodeSize) if (offs > nodeSize || offsNext > nodeSize)
return S_FALSE; return S_FALSE;
UInt32 recSize = offsNext - offs; UInt32 recSize = offsNext - offs;
@@ -727,12 +727,12 @@ HRESULT CDatabase::LoadAttrs(const CFork &fork, IInStream *inStream, IArchiveOpe
for (unsigned i = 0; i < desc.NumRecords; i++) for (unsigned i = 0; i < desc.NumRecords; i++)
{ {
UInt32 nodeSize = (1 << hr.NodeSizeLog); const UInt32 nodeSize = (1 << hr.NodeSizeLog);
UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2); const UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2); const UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
UInt32 recSize = offsNext - offs; UInt32 recSize = offsNext - offs;
if (offs >= nodeSize if (offs >= nodeSize
|| offsNext >= nodeSize || offsNext > nodeSize
|| offsNext < offs) || offsNext < offs)
return S_FALSE; return S_FALSE;
@@ -898,7 +898,7 @@ HRESULT CDatabase::LoadCatalog(const CFork &fork, const CObjectVector<CIdExtents
return S_FALSE; return S_FALSE;
usedBuf[node] = 1; usedBuf[node] = 1;
size_t nodeOffset = (size_t)node << hr.NodeSizeLog; const size_t nodeOffset = (size_t)node << hr.NodeSizeLog;
CNodeDescriptor desc; CNodeDescriptor desc;
desc.Parse(p + nodeOffset); desc.Parse(p + nodeOffset);
if (!desc.CheckNumRecords(hr.NodeSizeLog)) if (!desc.CheckNumRecords(hr.NodeSizeLog))
@@ -908,12 +908,12 @@ HRESULT CDatabase::LoadCatalog(const CFork &fork, const CObjectVector<CIdExtents
for (unsigned i = 0; i < desc.NumRecords; i++) for (unsigned i = 0; i < desc.NumRecords; i++)
{ {
UInt32 nodeSize = (1 << hr.NodeSizeLog); const UInt32 nodeSize = (1 << hr.NodeSizeLog);
UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2); const UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2); const UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
UInt32 recSize = offsNext - offs; UInt32 recSize = offsNext - offs;
if (offs >= nodeSize if (offs >= nodeSize
|| offs >= nodeSize || offsNext > nodeSize
|| offsNext < offs || offsNext < offs
|| recSize < 6) || recSize < 6)
return S_FALSE; return S_FALSE;

View File

@@ -30,7 +30,14 @@ static const Byte kProps[] =
kpidIsDir, kpidIsDir,
kpidSize, kpidSize,
kpidPackSize, kpidPackSize,
kpidMTime kpidMTime,
// kpidCTime,
// kpidATime,
kpidPosixAttrib,
// kpidUser,
// kpidGroup,
// kpidLinks,
kpidSymLink
}; };
static const Byte kArcProps[] = static const Byte kArcProps[] =
@@ -213,17 +220,87 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
prop = s; prop = s;
} }
break; break;
case kpidSymLink:
if (_archive.IsSusp)
{
UString s;
UInt32 mode;
if (item.GetPx(_archive.SuspSkipSize, k_Px_Mode, mode))
{
if (((mode >> 12) & 0xF) == 10)
{
AString s8;
if (item.GetSymLink(_archive.SuspSkipSize, s8))
{
s = MultiByteToUnicodeString(s8, CP_OEMCP);
prop = s;
}
}
}
}
break;
case kpidPosixAttrib:
/*
case kpidLinks:
case kpidUser:
case kpidGroup:
*/
{
if (_archive.IsSusp)
{
UInt32 t = 0;
switch (propID)
{
case kpidPosixAttrib: t = k_Px_Mode; break;
/*
case kpidLinks: t = k_Px_Links; break;
case kpidUser: t = k_Px_User; break;
case kpidGroup: t = k_Px_Group; break;
*/
}
UInt32 v;
if (item.GetPx(_archive.SuspSkipSize, t, v))
prop = v;
}
break;
}
case kpidIsDir: prop = item.IsDir(); break; case kpidIsDir: prop = item.IsDir(); break;
case kpidSize: case kpidSize:
case kpidPackSize: case kpidPackSize:
if (!item.IsDir()) if (!item.IsDir())
prop = (UInt64)ref.TotalSize; prop = (UInt64)ref.TotalSize;
break; break;
case kpidMTime: case kpidMTime:
// case kpidCTime:
// case kpidATime:
{ {
FILETIME utc; FILETIME utc;
if (item.DateTime.GetFileTime(utc)) if (/* propID == kpidMTime && */ item.DateTime.GetFileTime(utc))
prop = utc; prop = utc;
/*
else
{
UInt32 t = 0;
switch (propID)
{
case kpidMTime: t = k_Tf_MTime; break;
case kpidCTime: t = k_Tf_CTime; break;
case kpidATime: t = k_Tf_ATime; break;
}
CRecordingDateTime dt;
if (item.GetTf(_archive.SuspSkipSize, t, dt))
{
FILETIME utc;
if (dt.GetFileTime(utc))
prop = utc;
}
}
*/
break; break;
} }
} }
@@ -321,8 +398,10 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
UInt64 offset = 0; UInt64 offset = 0;
for (UInt32 e = 0; e < ref.NumExtents; e++) for (UInt32 e = 0; e < ref.NumExtents; e++)
{ {
lps->InSize = lps->OutSize = currentTotalSize + offset;
const CDir &item2 = ref.Dir->_subItems[ref.Index + e]; const CDir &item2 = ref.Dir->_subItems[ref.Index + e];
if (item2.Size == 0)
continue;
lps->InSize = lps->OutSize = currentTotalSize + offset;
RINOK(_stream->Seek((UInt64)item2.ExtentLocation * kBlockSize, STREAM_SEEK_SET, NULL)); RINOK(_stream->Seek((UInt64)item2.ExtentLocation * kBlockSize, STREAM_SEEK_SET, NULL));
streamSpec->Init(item2.Size); streamSpec->Init(item2.Size);
RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress)); RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress));

View File

@@ -608,7 +608,7 @@ HRESULT CInArchive::Open2()
for (UInt32 j = 0; j < ref.NumExtents; j++) for (UInt32 j = 0; j < ref.NumExtents; j++)
{ {
const CDir &item = ref.Dir->_subItems[ref.Index + j]; const CDir &item = ref.Dir->_subItems[ref.Index + j];
if (!item.IsDir()) if (!item.IsDir() && item.Size != 0)
UpdatePhySize(item.ExtentLocation, item.Size); UpdatePhySize(item.ExtentLocation, item.Size);
} }
} }

View File

@@ -3,6 +3,8 @@
#ifndef __ARCHIVE_ISO_ITEM_H #ifndef __ARCHIVE_ISO_ITEM_H
#define __ARCHIVE_ISO_ITEM_H #define __ARCHIVE_ISO_ITEM_H
#include "../../../../C/CpuArch.h"
#include "../../../Common/MyString.h" #include "../../../Common/MyString.h"
#include "../../../Common/MyBuffer.h" #include "../../../Common/MyBuffer.h"
@@ -38,6 +40,32 @@ struct CRecordingDateTime
} }
}; };
enum EPx
{
k_Px_Mode,
k_Px_Links,
k_Px_User,
k_Px_Group,
k_Px_SerialNumber
// k_Px_Num
};
/*
enum ETf
{
k_Tf_CTime,
k_Tf_MTime,
k_Tf_ATime,
k_Tf_Attrib,
k_Tf_Backup,
k_Tf_Expiration,
k_Tf_Effective
// k_Tf_Num
};
*/
struct CDirRecord struct CDirRecord
{ {
UInt32 ExtentLocation; UInt32 ExtentLocation;
@@ -69,7 +97,8 @@ struct CDirRecord
return (b == 0 || b == 1); return (b == 0 || b == 1);
} }
const Byte* FindSuspName(unsigned skipSize, unsigned &lenRes) const
const Byte* FindSuspRecord(unsigned skipSize, Byte id0, Byte id1, unsigned &lenRes) const
{ {
lenRes = 0; lenRes = 0;
if (SystemUse.Size() < skipSize) if (SystemUse.Size() < skipSize)
@@ -81,12 +110,12 @@ struct CDirRecord
unsigned len = p[2]; unsigned len = p[2];
if (len < 3 || len > rem) if (len < 3 || len > rem)
return 0; return 0;
if (p[0] == 'N' && p[1] == 'M' && p[3] == 1) if (p[0] == id0 && p[1] == id1 && p[3] == 1)
{ {
if (len < 5) if (len < 4)
return 0; // Check it return 0; // Check it
lenRes = len - 5; lenRes = len - 4;
return p + 5; return p + 4;
} }
p += len; p += len;
rem -= len; rem -= len;
@@ -94,17 +123,23 @@ struct CDirRecord
return 0; return 0;
} }
const Byte* GetNameCur(bool checkSusp, int skipSize, unsigned &nameLenRes) const const Byte* GetNameCur(bool checkSusp, int skipSize, unsigned &nameLenRes) const
{ {
const Byte *res = NULL; const Byte *res = NULL;
unsigned len = 0; unsigned len = 0;
if (checkSusp) if (checkSusp)
res = FindSuspName(skipSize, len); res = FindSuspRecord(skipSize, 'N', 'M', len);
if (!res) if (!res || len < 1)
{ {
res = (const Byte *)FileId; res = (const Byte *)FileId;
len = (unsigned)FileId.Size(); len = (unsigned)FileId.Size();
} }
else
{
res++;
len--;
}
unsigned i; unsigned i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
if (res[i] == 0) if (res[i] == 0)
@@ -114,6 +149,141 @@ struct CDirRecord
} }
const bool GetSymLink(int skipSize, AString &link) const
{
link.Empty();
const Byte *p = NULL;
unsigned len = 0;
p = FindSuspRecord(skipSize, 'S', 'L', len);
if (!p || len < 1)
return false;
if (*p != 0)
return false;
p++;
len--;
while (len != 0)
{
if (len < 2)
return false;
unsigned flags = p[0];
unsigned cl = p[1];
p += 2;
len -= 2;
if (cl > len)
return false;
bool needSlash = false;
if (flags & (1 << 1)) link += "./";
else if (flags & (1 << 2)) link += "../";
else if (flags & (1 << 3)) link += '/';
else
needSlash = true;
for (unsigned i = 0; i < cl; i++)
{
char c = p[i];
if (c == 0)
{
break;
// return false;
}
link += c;
}
p += cl;
len -= cl;
if (len == 0)
break;
if (needSlash)
link += '/';
}
return true;
}
static const bool GetLe32Be32(const Byte *p, UInt32 &dest)
{
UInt32 v1 = GetUi32(p);
UInt32 v2 = GetBe32(p + 4);
if (v1 == v2)
{
dest = v1;
return true;
}
return false;
}
const bool GetPx(int skipSize, unsigned pxType, UInt32 &val) const
{
const Byte *p = NULL;
unsigned len = 0;
p = FindSuspRecord(skipSize, 'P', 'X', len);
if (!p)
return false;
// px.Clear();
if (len < ((unsigned)pxType + 1) * 8)
return false;
return GetLe32Be32(p + pxType * 8, val);
}
/*
const bool GetTf(int skipSize, unsigned pxType, CRecordingDateTime &t) const
{
const Byte *p = NULL;
unsigned len = 0;
p = FindSuspRecord(skipSize, 'T', 'F', len);
if (!p)
return false;
if (len < 1)
return false;
Byte flags = *p++;
len--;
unsigned step = 7;
if (flags & 0x80)
{
step = 17;
return false;
}
if ((flags & (1 << pxType)) == 0)
return false;
for (unsigned i = 0; i < pxType; i++)
{
if (len < step)
return false;
if (flags & (1 << i))
{
p += step;
len -= step;
}
}
if (len < step)
return false;
t.Year = p[0];
t.Month = p[1];
t.Day = p[2];
t.Hour = p[3];
t.Minute = p[4];
t.Second = p[5];
t.GmtOffset = (signed char)p[6];
return true;
}
*/
bool CheckSusp(const Byte *p, unsigned &startPos) const bool CheckSusp(const Byte *p, unsigned &startPos) const
{ {
if (p[0] == 'S' && if (p[0] == 'S' &&

View File

@@ -75,7 +75,7 @@ static const CUInt32PCharPair g_CpuPairs[] =
#define SECT_ATTR_ZEROFILL 1 #define SECT_ATTR_ZEROFILL 1
static const char *g_SectTypes[] = static const char * const g_SectTypes[] =
{ {
"REGULAR" "REGULAR"
, "ZEROFILL" , "ZEROFILL"
@@ -108,7 +108,7 @@ enum EFileType
kType_DSYM kType_DSYM
}; };
static const char *g_FileTypes[] = static const char * const g_FileTypes[] =
{ {
"0" "0"
, "OBJECT" , "OBJECT"
@@ -124,7 +124,7 @@ static const char *g_FileTypes[] =
}; };
static const char *g_ArcFlags[] = static const char * const g_ArcFlags[] =
{ {
"NOUNDEFS" "NOUNDEFS"
, "INCRLINK" , "INCRLINK"

View File

@@ -12,7 +12,6 @@
#include "../../Compress/BcjCoder.h" #include "../../Compress/BcjCoder.h"
#include "../../Compress/BZip2Decoder.h" #include "../../Compress/BZip2Decoder.h"
#include "../../Compress/DeflateDecoder.h"
#define Get32(p) GetUi32(p) #define Get32(p) GetUi32(p)
@@ -27,12 +26,16 @@ HRESULT CDecoder::Init(ISequentialInStream *inStream, bool &useFilter)
if (Method != _curMethod) if (Method != _curMethod)
Release(); Release();
_curMethod = Method; _curMethod = Method;
if (!_codecInStream) if (!_codecInStream)
{ {
switch (Method) switch (Method)
{ {
// case NMethodType::kCopy: return E_NOTIMPL; // case NMethodType::kCopy: return E_NOTIMPL;
case NMethodType::kDeflate: _codecInStream = new NCompress::NDeflate::NDecoder::CNsisCOMCoder(); break; case NMethodType::kDeflate:
_deflateDecoder = new NCompress::NDeflate::NDecoder::CCOMCoder();
_codecInStream = _deflateDecoder;
break;
case NMethodType::kBZip2: _codecInStream = new NCompress::NBZip2::CNsisDecoder(); break; case NMethodType::kBZip2: _codecInStream = new NCompress::NBZip2::CNsisDecoder(); break;
case NMethodType::kLZMA: case NMethodType::kLZMA:
_lzmaDecoder = new NCompress::NLzma::CDecoder(); _lzmaDecoder = new NCompress::NLzma::CDecoder();
@@ -42,6 +45,9 @@ HRESULT CDecoder::Init(ISequentialInStream *inStream, bool &useFilter)
} }
} }
if (Method == NMethodType::kDeflate)
_deflateDecoder->SetNsisMode(IsNsisDeflate);
if (FilterFlag) if (FilterFlag)
{ {
Byte flag; Byte flag;
@@ -199,9 +205,8 @@ HRESULT CDecoder::Decode(CByteBuffer *outBuf, bool unpackSizeDefined, UInt32 unp
if (outBuf) if (outBuf)
{ {
if (!unpackSizeDefined) if (unpackSizeDefined)
return S_FALSE; outBuf->Alloc(unpackSize);
outBuf->Alloc(unpackSize);
} }
UInt64 inSizeStart = 0; UInt64 inSizeStart = 0;
@@ -213,6 +218,8 @@ HRESULT CDecoder::Decode(CByteBuffer *outBuf, bool unpackSizeDefined, UInt32 unp
unpackSize = 0xFFFFFFFF; unpackSize = 0xFFFFFFFF;
UInt32 offset = 0; UInt32 offset = 0;
HRESULT res = S_OK;
for (;;) for (;;)
{ {
size_t rem = unpackSize - offset; size_t rem = unpackSize - offset;
@@ -225,11 +232,25 @@ HRESULT CDecoder::Decode(CByteBuffer *outBuf, bool unpackSizeDefined, UInt32 unp
if (size == 0) if (size == 0)
{ {
if (unpackSizeDefined) if (unpackSizeDefined)
return S_FALSE; res = S_FALSE;
break; break;
} }
if (outBuf) if (outBuf)
{
size_t nextSize = offset + size;
if (outBuf->Size() < nextSize)
{
{
const size_t nextSize2 = outBuf->Size() * 2;
if (nextSize < nextSize2)
nextSize = nextSize2;
}
outBuf->ChangeSize_KeepData(nextSize, offset);
}
memcpy((Byte *)*outBuf + (size_t)offset, Buffer, size); memcpy((Byte *)*outBuf + (size_t)offset, Buffer, size);
}
StreamPos += size; StreamPos += size;
offset += (UInt32)size; offset += (UInt32)size;
@@ -243,9 +264,17 @@ HRESULT CDecoder::Decode(CByteBuffer *outBuf, bool unpackSizeDefined, UInt32 unp
UInt64 outSize = offset; UInt64 outSize = offset;
RINOK(progress->SetRatioInfo(&inSize, &outSize)); RINOK(progress->SetRatioInfo(&inSize, &outSize));
if (realOutStream) if (realOutStream)
RINOK(WriteStream(realOutStream, Buffer, size)); {
res = WriteStream(realOutStream, Buffer, size);
if (res != S_OK)
break;
}
} }
return S_OK;
if (outBuf && offset != outBuf->Size())
outBuf->ChangeSize_KeepData(offset, offset);
return res;
} }
}} }}

View File

@@ -8,6 +8,7 @@
#include "../../Common/FilterCoder.h" #include "../../Common/FilterCoder.h"
#include "../../Common/StreamUtils.h" #include "../../Common/StreamUtils.h"
#include "../../Compress/DeflateDecoder.h"
#include "../../Compress/LzmaDecoder.h" #include "../../Compress/LzmaDecoder.h"
namespace NArchive { namespace NArchive {
@@ -37,6 +38,7 @@ class CDecoder
CMyComPtr<ISequentialInStream> _codecInStream; CMyComPtr<ISequentialInStream> _codecInStream;
CMyComPtr<ISequentialInStream> _decoderInStream; CMyComPtr<ISequentialInStream> _decoderInStream;
NCompress::NDeflate::NDecoder::CCOMCoder *_deflateDecoder;
NCompress::NLzma::CDecoder *_lzmaDecoder; NCompress::NLzma::CDecoder *_lzmaDecoder;
public: public:
@@ -46,9 +48,16 @@ public:
NMethodType::EEnum Method; NMethodType::EEnum Method;
bool FilterFlag; bool FilterFlag;
bool Solid; bool Solid;
bool IsNsisDeflate;
CByteBuffer Buffer; // temp buf. CByteBuffer Buffer; // temp buf.
CDecoder():
FilterFlag(false),
Solid(true),
IsNsisDeflate(true)
{}
void Release() void Release()
{ {
_filterInStream.Release(); _filterInStream.Release();

View File

@@ -175,7 +175,7 @@ static const CCommandInfo k_Commands[kNumCmds] =
{ 0 }, // "BringToFront" }, { 0 }, // "BringToFront" },
{ 2 }, // "SetDetailsView" }, { 2 }, // "SetDetailsView" },
{ 2 }, // "SetFileAttributes" }, { 2 }, // "SetFileAttributes" },
{ 2 }, // CreateDirectory, SetOutPath { 3 }, // CreateDirectory, SetOutPath
{ 3 }, // "IfFileExists" }, { 3 }, // "IfFileExists" },
{ 3 }, // SetRebootFlag, ... { 3 }, // SetRebootFlag, ...
{ 4 }, // "If" }, // IfAbort, IfSilent, IfErrors, IfRebootFlag { 4 }, // "If" }, // IfAbort, IfSilent, IfErrors, IfRebootFlag
@@ -1395,7 +1395,7 @@ void CInArchive::AddRegRoot(UInt32 val)
Script += s; Script += s;
} }
static const char *g_WinAttrib[] = static const char * const g_WinAttrib[] =
{ {
"READONLY" "READONLY"
, "HIDDEN" , "HIDDEN"
@@ -3362,6 +3362,11 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
#ifdef NSIS_SCRIPT #ifdef NSIS_SCRIPT
s += isSetOutPath ? "SetOutPath" : "CreateDirectory"; s += isSetOutPath ? "SetOutPath" : "CreateDirectory";
AddParam(params[0]); AddParam(params[0]);
if (params[2] != 0)
{
SmallSpaceComment();
s += "CreateRestrictedDirectory";
}
#endif #endif
break; break;
@@ -3378,11 +3383,8 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
params[2] == 0 && params[2] == 0 &&
params[3] == 0) params[3] == 0)
{ {
if (IsVarStr(params[1], kVar_OUTDIR)) spec_outdir_U = UPrefixes.Back(); // outdir_U;
{ spec_outdir_A = APrefixes.Back(); // outdir_A;
spec_outdir_U = UPrefixes.Back(); // outdir_U;
spec_outdir_A = APrefixes.Back();// outdir_A;
}
} }
} }
@@ -5045,6 +5047,9 @@ HRESULT CInArchive::Parse()
DetectNsisType(bhEntries, _data + bhEntries.Offset); DetectNsisType(bhEntries, _data + bhEntries.Offset);
Decoder.IsNsisDeflate = (NsisType != k_NsisType_Nsis3);
#ifdef NSIS_SCRIPT #ifdef NSIS_SCRIPT
{ {
@@ -5606,6 +5611,9 @@ HRESULT CInArchive::Open2(const Byte *sig, size_t size)
Decoder.Method = Method; Decoder.Method = Method;
Decoder.FilterFlag = FilterFlag; Decoder.FilterFlag = FilterFlag;
Decoder.Solid = IsSolid; Decoder.Solid = IsSolid;
Decoder.IsNsisDeflate = true; // we need some smart check that NSIS is not NSIS3 here.
Decoder.InputStream = _stream; Decoder.InputStream = _stream;
Decoder.Buffer.Alloc(kInputBufSize); Decoder.Buffer.Alloc(kInputBufSize);
Decoder.StreamPos = 0; Decoder.StreamPos = 0;

View File

@@ -2157,7 +2157,7 @@ STDMETHODIMP CHandler::GetRawProp(UInt32 index, PROPID propID, const void **data
return S_OK; return S_OK;
const CItem &item = Items[index]; const CItem &item = Items[index];
const CMftRec &rec = Recs[item.RecIndex]; const CMftRec &rec = Recs[item.RecIndex];
if (rec.SiAttr.SecurityId >= 0) if (rec.SiAttr.SecurityId > 0)
{ {
UInt64 offset; UInt64 offset;
UInt32 size; UInt32 size;
@@ -2169,6 +2169,7 @@ STDMETHODIMP CHandler::GetRawProp(UInt32 index, PROPID propID, const void **data
} }
} }
} }
return S_OK; return S_OK;
} }

View File

@@ -321,7 +321,7 @@ bool COptHeader::Parse(const Byte *p, UInt32 size)
if (NumDirItems > (1 << 16)) if (NumDirItems > (1 << 16))
return false; return false;
pos += 4; pos += 4;
if (pos + 8 * NumDirItems != size) if (pos + 8 * NumDirItems > size)
return false; return false;
for (UInt32 i = 0; i < NumDirItems && i < kNumDirItemsMax; i++) for (UInt32 i = 0; i < NumDirItems && i < kNumDirItemsMax; i++)
DirItems[i].Parse(p + pos + i * 8); DirItems[i].Parse(p + pos + i * 8);

View File

@@ -231,6 +231,18 @@ bool CItem::Is_CopyLink() const
return FindExtra_Link(link) && link.Type == NLinkType::kFileCopy; return FindExtra_Link(link) && link.Type == NLinkType::kFileCopy;
} }
bool CItem::Is_HardLink() const
{
CLinkInfo link;
return FindExtra_Link(link) && link.Type == NLinkType::kHardLink;
}
bool CItem::Is_CopyLink_or_HardLink() const
{
CLinkInfo link;
return FindExtra_Link(link) && (link.Type == NLinkType::kFileCopy || link.Type == NLinkType::kHardLink);
}
void CItem::Link_to_Prop(unsigned linkType, NWindows::NCOM::CPropVariant &prop) const void CItem::Link_to_Prop(unsigned linkType, NWindows::NCOM::CPropVariant &prop) const
{ {
CLinkInfo link; CLinkInfo link;
@@ -2587,7 +2599,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
{ {
if (testMode) if (testMode)
{ {
if (item->Is_CopyLink() && item->PackSize == 0) if (item->NeedUse_as_CopyLink_or_HardLink())
{ {
RINOK(extractCallback->PrepareOperation(askMode)); RINOK(extractCallback->PrepareOperation(askMode));
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK)); RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK));
@@ -2599,6 +2611,9 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
if (item->IsService()) if (item->IsService())
continue; continue;
if (item->NeedUse_as_HardLink())
continue;
bool needDecode = false; bool needDecode = false;
for (unsigned n = i + 1; n < _refs.Size(); n++) for (unsigned n = i + 1; n < _refs.Size(); n++)
@@ -2639,7 +2654,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
continue; continue;
} }
if (item->Is_CopyLink() && item->PackSize == 0) if (item->NeedUse_as_CopyLink())
{ {
RINOK(extractCallback->SetOperationResult( RINOK(extractCallback->SetOperationResult(
realOutStream ? realOutStream ?

View File

@@ -262,8 +262,12 @@ struct CItem
bool FindExtra_Link(CLinkInfo &link) const; bool FindExtra_Link(CLinkInfo &link) const;
void Link_to_Prop(unsigned linkType, NWindows::NCOM::CPropVariant &prop) const; void Link_to_Prop(unsigned linkType, NWindows::NCOM::CPropVariant &prop) const;
bool Is_CopyLink() const; bool Is_CopyLink() const;
bool Is_HardLink() const;
bool Is_CopyLink_or_HardLink() const;
bool NeedUse_as_CopyLink() const { return PackSize == 0 && Is_CopyLink(); } bool NeedUse_as_CopyLink() const { return PackSize == 0 && Is_CopyLink(); }
bool NeedUse_as_HardLink() const { return PackSize == 0 && Is_HardLink(); }
bool NeedUse_as_CopyLink_or_HardLink() const { return PackSize == 0 && Is_CopyLink_or_HardLink(); }
bool GetAltStreamName(AString &name) const; bool GetAltStreamName(AString &name) const;

View File

@@ -959,7 +959,7 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
*srcLen = 0; *srcLen = 0;
const Byte *destStart = dest; const Byte *destStart = dest;
const Byte *srcStart = src; const Byte *srcStart = src;
unsigned mode = 2; unsigned mode = 0;
{ {
if (srcRem == 0) if (srcRem == 0)
@@ -970,7 +970,7 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
src++; src++;
srcRem--; srcRem--;
b -= 17; b -= 17;
mode = (b < 4 ? 0 : 1); mode = (b < 4 ? 1 : 4);
if (b > srcRem || b > destRem) if (b > srcRem || b > destRem)
return S_FALSE; return S_FALSE;
srcRem -= b; srcRem -= b;
@@ -988,6 +988,7 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
UInt32 b = *src++; UInt32 b = *src++;
srcRem--; srcRem--;
UInt32 len, back; UInt32 len, back;
if (b >= 64) if (b >= 64)
{ {
srcRem--; srcRem--;
@@ -996,7 +997,7 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
} }
else if (b < 16) else if (b < 16)
{ {
if (mode == 2) if (mode == 0)
{ {
if (b == 0) if (b == 0)
{ {
@@ -1013,21 +1014,23 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
} }
} }
} }
b += 3; b += 3;
if (b > srcRem || b > destRem) if (b > srcRem || b > destRem)
return S_FALSE; return S_FALSE;
srcRem -= b; srcRem -= b;
destRem -= b; destRem -= b;
mode = 1; mode = 4;
do do
*dest++ = *src++; *dest++ = *src++;
while (--b); while (--b);
continue; continue;
} }
srcRem--; srcRem--;
back = (b >> 2) + (*src++ << 2); back = (b >> 2) + (*src++ << 2);
len = 2; len = 2;
if (mode == 1) if (mode == 4)
{ {
back += (1 << 11); back += (1 << 11);
len = 3; len = 3;
@@ -1038,6 +1041,7 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
UInt32 bOld = b; UInt32 bOld = b;
b = (b < 32 ? 7 : 31); b = (b < 32 ? 7 : 31);
len = bOld & b; len = bOld & b;
if (len == 0) if (len == 0)
{ {
for (len = b;; len += 255) for (len = b;; len += 255)
@@ -1053,6 +1057,7 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
} }
} }
} }
len += 2; len += 2;
if (srcRem < 2) if (srcRem < 2)
return S_FALSE; return S_FALSE;
@@ -1062,38 +1067,39 @@ static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *src
srcRem -= 2; srcRem -= 2;
if (bOld < 32) if (bOld < 32)
{ {
back += ((bOld & 8) << 11);
if (back == 0) if (back == 0)
{ {
*destLen = dest - destStart; *destLen = dest - destStart;
*srcLen = src - srcStart; *srcLen = src - srcStart;
return S_OK; return S_OK;
} }
back += ((bOld & 8) << 11) + (1 << 14) - 1; back += (1 << 14) - 1;
} }
} }
back++; back++;
if (len > destRem || (size_t)(dest - destStart) < back) if (len > destRem || (size_t)(dest - destStart) < back)
return S_FALSE; return S_FALSE;
destRem -= len; destRem -= len;
Byte *destTemp = dest - back; Byte *destTemp = dest - back;
dest += len; dest += len;
do do
{ {
*(destTemp + back) = *destTemp; *(destTemp + back) = *destTemp;
destTemp++; destTemp++;
} }
while (--len); while (--len);
b &= 3; b &= 3;
mode = b;
if (b == 0) if (b == 0)
{
mode = 2;
continue; continue;
}
if (b > srcRem || b > destRem) if (b > srcRem || b > destRem)
return S_FALSE; return S_FALSE;
srcRem -= b; srcRem -= b;
destRem -= b; destRem -= b;
mode = 0;
*dest++ = *src++; *dest++ = *src++;
if (b > 1) if (b > 1)
{ {

View File

@@ -646,7 +646,7 @@ STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
return S_OK; return S_OK;
} }
static const char *g_TagDesc[92] = static const char * const g_TagDesc[92] =
{ {
"End" "End"
, "ShowFrame" , "ShowFrame"

View File

@@ -72,6 +72,13 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
break; break;
} }
case kpidWarningFlags:
{
if (_warning)
prop = kpv_ErrorFlags_HeadersError;
break;
}
case kpidCodePage: case kpidCodePage:
{ {
const char *name = NULL; const char *name = NULL;
@@ -98,7 +105,13 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
HRESULT CHandler::ReadItem2(ISequentialInStream *stream, bool &filled, CItemEx &item) HRESULT CHandler::ReadItem2(ISequentialInStream *stream, bool &filled, CItemEx &item)
{ {
item.HeaderPos = _phySize; item.HeaderPos = _phySize;
RINOK(ReadItem(stream, filled, item, _error)); EErrorType error;
HRESULT res = ReadItem(stream, filled, item, error);
if (error == k_ErrorType_Warning)
_warning = true;
else if (error != k_ErrorType_OK)
_error = error;
RINOK(res);
if (filled) if (filled)
{ {
/* /*
@@ -233,6 +246,7 @@ STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
STDMETHODIMP CHandler::Close() STDMETHODIMP CHandler::Close()
{ {
_isArc = false; _isArc = false;
_warning = false;
_error = k_ErrorType_OK; _error = k_ErrorType_OK;
_phySizeDefined = false; _phySizeDefined = false;

View File

@@ -37,6 +37,7 @@ private:
UInt64 _headersSize; UInt64 _headersSize;
bool _phySizeDefined; bool _phySizeDefined;
EErrorType _error; EErrorType _error;
bool _warning;
bool _isArc; bool _isArc;
// bool _isSparse; // bool _isSparse;

View File

@@ -75,7 +75,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
{ {
COM_TRY_BEGIN COM_TRY_BEGIN
if ((_stream && (_error != k_ErrorType_OK /* || _isSparse */)) || _seqStream) if ((_stream && (_error != k_ErrorType_OK || _warning /* || _isSparse */)) || _seqStream)
return E_NOTIMPL; return E_NOTIMPL;
CObjectVector<CUpdateItem> updateItems; CObjectVector<CUpdateItem> updateItems;
UINT codePage = (_forceCodePage ? _specifiedCodePage : _openCodePage); UINT codePage = (_forceCodePage ? _specifiedCodePage : _openCodePage);

View File

@@ -328,13 +328,63 @@ static HRESULT GetNextItemReal(ISequentialInStream *stream, bool &filled, CItemE
return S_OK; return S_OK;
} }
static HRESULT ReadDataToString(ISequentialInStream *stream, CItemEx &item, AString &s, EErrorType &error)
{
const unsigned packSize = (unsigned)item.GetPackSizeAligned();
size_t processedSize = packSize;
HRESULT res = ReadStream(stream, s.GetBuf(packSize), &processedSize);
item.HeaderSize += (unsigned)processedSize;
s.ReleaseBuf_CalcLen((unsigned)item.PackSize);
RINOK(res);
if (processedSize != packSize)
error = k_ErrorType_UnexpectedEnd;
return S_OK;
}
static bool ParsePaxLongName(const AString &src, AString &dest)
{
dest.Empty();
for (unsigned pos = 0;;)
{
if (pos >= src.Len())
return false;
const char *start = src.Ptr(pos);
const char *end;
const UInt32 lineLen = ConvertStringToUInt32(start, &end);
if (end == start)
return false;
if (*end != ' ')
return false;
if (lineLen > src.Len() - pos)
return false;
unsigned offset = (unsigned)(end - start) + 1;
if (lineLen < offset)
return false;
if (IsString1PrefixedByString2(src.Ptr(pos + offset), "path="))
{
offset += 5; // "path="
dest = src.Mid(pos + offset, lineLen - offset);
if (dest.IsEmpty())
return false;
if (dest.Back() != '\n')
return false;
dest.DeleteBack();
return true;
}
pos += lineLen;
}
}
HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item, EErrorType &error) HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item, EErrorType &error)
{ {
item.HeaderSize = 0; item.HeaderSize = 0;
bool flagL = false; bool flagL = false;
bool flagK = false; bool flagK = false;
AString nameL; AString nameL;
AString nameK; AString nameK;
AString pax;
for (;;) for (;;)
{ {
@@ -363,18 +413,11 @@ HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item, EErro
return S_OK; return S_OK;
if (item.PackSize > (1 << 14)) if (item.PackSize > (1 << 14))
return S_OK; return S_OK;
unsigned packSize = (unsigned)item.GetPackSizeAligned();
char *buf = name->GetBuf(packSize); RINOK(ReadDataToString(stream, item, *name, error));
size_t processedSize = packSize; if (error != k_ErrorType_OK)
HRESULT res = ReadStream(stream, buf, &processedSize);
item.HeaderSize += (unsigned)processedSize;
name->ReleaseBuf_CalcLen((unsigned)item.PackSize);
RINOK(res);
if (processedSize != packSize)
{
error = k_ErrorType_UnexpectedEnd;
return S_OK; return S_OK;
}
continue; continue;
} }
@@ -385,6 +428,14 @@ HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item, EErro
case 'X': case 'X':
{ {
// pax Extended Header // pax Extended Header
if (item.Name.IsPrefixedBy("PaxHeader/"))
{
RINOK(ReadDataToString(stream, item, pax, error));
if (error != k_ErrorType_OK)
return S_OK;
continue;
}
break; break;
} }
case NFileHeader::NLinkFlag::kDumpDir: case NFileHeader::NLinkFlag::kDumpDir:
@@ -415,6 +466,16 @@ HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item, EErro
} }
error = k_ErrorType_OK; error = k_ErrorType_OK;
if (!pax.IsEmpty())
{
AString name;
if (ParsePaxLongName(pax, name))
item.Name = name;
else
error = k_ErrorType_Warning;
}
return S_OK; return S_OK;
} }
} }

View File

@@ -15,6 +15,7 @@ enum EErrorType
k_ErrorType_OK, k_ErrorType_OK,
k_ErrorType_Corrupted, k_ErrorType_Corrupted,
k_ErrorType_UnexpectedEnd, k_ErrorType_UnexpectedEnd,
k_ErrorType_Warning
}; };
HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &itemInfo, EErrorType &error); HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &itemInfo, EErrorType &error);

View File

@@ -225,7 +225,7 @@ enum
FV_FILETYPE_FFS_PAD = 0xF0 FV_FILETYPE_FFS_PAD = 0xF0
}; };
static const char *g_FileTypes[] = static const char * const g_FileTypes[] =
{ {
"ALL" "ALL"
, "RAW" , "RAW"

View File

@@ -298,7 +298,8 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
AString res; AString res;
bool numMethods = 0; unsigned numMethods = 0;
for (unsigned i = 0; i < ARRAY_SIZE(k_Methods); i++) for (unsigned i = 0; i < ARRAY_SIZE(k_Methods); i++)
{ {
if (methodMask & ((UInt32)1 << i)) if (methodMask & ((UInt32)1 << i))

View File

@@ -255,13 +255,13 @@ static bool AddItem(const CXmlItem &item, CObjectVector<CFile> &files, int paren
if (encodingItem.IsTag) if (encodingItem.IsTag)
{ {
AString s = encodingItem.GetPropVal("style"); AString s = encodingItem.GetPropVal("style");
if (s.Len() >= 0) if (!s.IsEmpty())
{ {
AString appl = "application/"; const AString appl = "application/";
if (s.IsPrefixedBy(appl)) if (s.IsPrefixedBy(appl))
{ {
s.DeleteFrontal(appl.Len()); s.DeleteFrontal(appl.Len());
AString xx = "x-"; const AString xx = "x-";
if (s.IsPrefixedBy(xx)) if (s.IsPrefixedBy(xx))
{ {
s.DeleteFrontal(xx.Len()); s.DeleteFrontal(xx.Len());
@@ -365,12 +365,12 @@ HRESULT CHandler::Open2(IInStream *stream)
{ {
const CFile &file = _files[i]; const CFile &file = _files[i];
file.UpdateTotalPackSize(totalPackSize); file.UpdateTotalPackSize(totalPackSize);
if (file.Name == "Payload") if (file.Name == "Payload" || file.Name == "Content")
{ {
_mainSubfile = i; _mainSubfile = i;
numMainFiles++; numMainFiles++;
} }
if (file.Name == "PackageInfo") else if (file.Name == "PackageInfo")
_is_pkg = true; _is_pkg = true;
} }
@@ -723,7 +723,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
static const Byte k_Signature[] = { 'x', 'a', 'r', '!', 0, 0x1C }; static const Byte k_Signature[] = { 'x', 'a', 'r', '!', 0, 0x1C };
REGISTER_ARC_I( REGISTER_ARC_I(
"Xar", "xar pkg", 0, 0xE1, "Xar", "xar pkg xip", 0, 0xE1,
k_Signature, k_Signature,
0, 0,
0, 0,

View File

@@ -276,7 +276,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS
m_Items, updateItems, outStream, m_Items, updateItems, outStream,
m_Archive.IsOpen() ? &m_Archive : NULL, _removeSfxBlock, m_Archive.IsOpen() ? &m_Archive : NULL, _removeSfxBlock,
&options, callback); options, callback);
COM_TRY_END2 COM_TRY_END2
} }

View File

@@ -1454,7 +1454,10 @@ HRESULT CVols::ParseArcName(IArchiveOpenVolumeCallback *volCallback)
if (result == S_FALSE || !ZipStream) if (result == S_FALSE || !ZipStream)
{ {
if (MissingName.IsEmpty()) if (MissingName.IsEmpty())
{
MissingZip = true;
MissingName = volName; MissingName = volName;
}
return S_OK; return S_OK;
} }
@@ -1988,6 +1991,12 @@ HRESULT CInArchive::ReadHeaders2(CObjectVector<CItemEx> &items)
if (!IsMultiVol) if (!IsMultiVol)
{ {
if (EcdVolIndex == 0 && Vols.MissingZip && Vols.StartIsExe)
{
Vols.MissingName.Empty();
Vols.MissingZip = false;
}
UseDisk_in_SingleVol = true; UseDisk_in_SingleVol = true;
if (localsWereRead) if (localsWereRead)

View File

@@ -139,6 +139,7 @@ public:
bool StartIsZ; // is .zip or .zNN bool StartIsZ; // is .zip or .zNN
bool StartIsZip; // is .zip bool StartIsZip; // is .zip
bool IsUpperCase; bool IsUpperCase;
bool MissingZip;
Int32 StartVolIndex; // = (NN - 1), if StartStream is .zNN Int32 StartVolIndex; // = (NN - 1), if StartStream is .zNN
Int32 StartParsingVol; // if we need local parsing, we must use that stream Int32 StartParsingVol; // if we need local parsing, we must use that stream
@@ -173,6 +174,7 @@ public:
BaseName.Empty(); BaseName.Empty();
MissingName.Empty(); MissingName.Empty();
MissingZip = false;
ecd_wasRead = false; ecd_wasRead = false;
Streams.Clear(); Streams.Clear();

View File

@@ -584,7 +584,7 @@ static HRESULT Update2(
CInArchive *inArchive, CInArchive *inArchive,
const CObjectVector<CItemEx> &inputItems, const CObjectVector<CItemEx> &inputItems,
CObjectVector<CUpdateItem> &updateItems, CObjectVector<CUpdateItem> &updateItems,
const CCompressionMethodMode *options, const CCompressionMethodMode &options,
const CByteBuffer *comment, const CByteBuffer *comment,
IArchiveUpdateCallback *updateCallback) IArchiveUpdateCallback *updateCallback)
{ {
@@ -629,17 +629,15 @@ static HRESULT Update2(
UInt64 totalComplexity = complexity; UInt64 totalComplexity = complexity;
CAddCommon compressor(*options); CAddCommon compressor(options);
complexity = 0; complexity = 0;
CCompressionMethodMode options2; CCompressionMethodMode options2 = options;
if (options != 0)
options2 = *options;
#ifndef _7ZIP_ST #ifndef _7ZIP_ST
UInt32 numThreads = options->NumThreads; UInt32 numThreads = options.NumThreads;
const UInt32 kNumMaxThreads = 64; const UInt32 kNumMaxThreads = 64;
if (numThreads > kNumMaxThreads) if (numThreads > kNumMaxThreads)
numThreads = kNumMaxThreads; numThreads = kNumMaxThreads;
@@ -652,12 +650,12 @@ static HRESULT Update2(
const size_t kMemPerThread = (1 << 25); const size_t kMemPerThread = (1 << 25);
const size_t kBlockSize = 1 << 16; const size_t kBlockSize = 1 << 16;
bool mtMode = ((options != 0) && (numThreads > 1)); bool mtMode = (numThreads > 1);
if (numFilesToCompress <= 1) if (numFilesToCompress <= 1)
mtMode = false; mtMode = false;
Byte method = options->MethodSequence.Front(); Byte method = options.MethodSequence.Front();
if (!mtMode) if (!mtMode)
{ {
@@ -670,7 +668,7 @@ static HRESULT Update2(
} }
else else
{ {
if (method == NFileHeader::NCompressionMethod::kStored && !options->PasswordIsDefined) if (method == NFileHeader::NCompressionMethod::kStored && !options.PasswordIsDefined)
numThreads = 1; numThreads = 1;
if (method == NFileHeader::NCompressionMethod::kBZip2) if (method == NFileHeader::NCompressionMethod::kBZip2)
{ {
@@ -855,16 +853,16 @@ static HRESULT Update2(
if (isDir) if (isDir)
{ {
WriteDirHeader(archive, options, ui, item); WriteDirHeader(archive, &options, ui, item);
} }
else else
{ {
if (lastRealStreamItemIndex < (int)itemIndex) if (lastRealStreamItemIndex < (int)itemIndex)
{ {
lastRealStreamItemIndex = itemIndex; lastRealStreamItemIndex = itemIndex;
SetFileHeader(archive, *options, ui, item); SetFileHeader(archive, options, ui, item);
// file Size can be 64-bit !!! // file Size can be 64-bit !!!
archive.PrepareWriteCompressedData(item.Name.Len(), ui.Size, options->IsRealAesMode()); archive.PrepareWriteCompressedData(item.Name.Len(), ui.Size, options.IsRealAesMode());
} }
CMemBlocks2 &memRef = refs.Refs[itemIndex]; CMemBlocks2 &memRef = refs.Refs[itemIndex];
@@ -874,12 +872,12 @@ static HRESULT Update2(
CMyComPtr<IOutStream> outStream; CMyComPtr<IOutStream> outStream;
archive.CreateStreamForCompressing(&outStream); archive.CreateStreamForCompressing(&outStream);
memRef.WriteToStream(memManager.GetBlockSize(), outStream); memRef.WriteToStream(memManager.GetBlockSize(), outStream);
SetFileHeader(archive, *options, ui, item); SetFileHeader(archive, options, ui, item);
// the BUG was fixed in 9.26: // the BUG was fixed in 9.26:
// SetItemInfoFromCompressingResult must be after SetFileHeader // SetItemInfoFromCompressingResult must be after SetFileHeader
// to write correct Size. // to write correct Size.
SetItemInfoFromCompressingResult(memRef.CompressingResult, SetItemInfoFromCompressingResult(memRef.CompressingResult,
options->IsRealAesMode(), options->AesKeyMode, item); options.IsRealAesMode(), options.AesKeyMode, item);
archive.WriteLocalHeader_And_SeekToNextFile(item); archive.WriteLocalHeader_And_SeekToNextFile(item);
// RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); // RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
memRef.FreeOpt(&memManager); memRef.FreeOpt(&memManager);
@@ -920,9 +918,9 @@ static HRESULT Update2(
{ {
RINOK(threadInfo.OutStreamSpec->WriteToRealStream()); RINOK(threadInfo.OutStreamSpec->WriteToRealStream());
threadInfo.OutStreamSpec->ReleaseOutStream(); threadInfo.OutStreamSpec->ReleaseOutStream();
SetFileHeader(archive, *options, ui, item); SetFileHeader(archive, options, ui, item);
SetItemInfoFromCompressingResult(threadInfo.CompressingResult, SetItemInfoFromCompressingResult(threadInfo.CompressingResult,
options->IsRealAesMode(), options->AesKeyMode, item); options.IsRealAesMode(), options.AesKeyMode, item);
archive.WriteLocalHeader_And_SeekToNextFile(item); archive.WriteLocalHeader_And_SeekToNextFile(item);
} }
else else
@@ -1173,7 +1171,7 @@ HRESULT Update(
CObjectVector<CUpdateItem> &updateItems, CObjectVector<CUpdateItem> &updateItems,
ISequentialOutStream *seqOutStream, ISequentialOutStream *seqOutStream,
CInArchive *inArchive, bool removeSfx, CInArchive *inArchive, bool removeSfx,
CCompressionMethodMode *compressionMethodMode, const CCompressionMethodMode &compressionMethodMode,
IArchiveUpdateCallback *updateCallback) IArchiveUpdateCallback *updateCallback)
{ {
if (inArchive) if (inArchive)

View File

@@ -51,7 +51,7 @@ HRESULT Update(
CObjectVector<CUpdateItem> &updateItems, CObjectVector<CUpdateItem> &updateItems,
ISequentialOutStream *seqOutStream, ISequentialOutStream *seqOutStream,
CInArchive *inArchive, bool removeSfx, CInArchive *inArchive, bool removeSfx,
CCompressionMethodMode *compressionMethodMode, const CCompressionMethodMode &compressionMethodMode,
IArchiveUpdateCallback *updateCallback); IArchiveUpdateCallback *updateCallback);
}} }}

View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7z", "Format7z.vcproj", "{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|Win32.ActiveCfg = Debug|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|Win32.Build.0 = Debug|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|x64.ActiveCfg = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Debug|x64.Build.0 = Debug|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|Win32.ActiveCfg = Release|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|Win32.Build.0 = Release|Win32
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|x64.ActiveCfg = Release|x64
{F8F8C92B-2749-4444-A2C9-EBBCD87E0402}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

File diff suppressed because it is too large Load Diff

View File

@@ -749,11 +749,10 @@ static int main2(int numArgs, const char *args[])
} }
} }
if (!stdOutMode)
Print_Size("Output size: ", outStreamSpec->ProcessedSize);
if (outStreamSpec) if (outStreamSpec)
{ {
if (!stdOutMode)
Print_Size("Output size: ", outStreamSpec->ProcessedSize);
if (outStreamSpec->Close() != S_OK) if (outStreamSpec->Close() != S_OK)
throw "File closing error"; throw "File closing error";
} }

View File

@@ -804,6 +804,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File # End Source File
# Begin 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\Lzma2Dec.c SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
# End Source File # End Source File

View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SFXCon", "SFXCon.vcproj", "{0A87F1E0-6E9A-452C-A209-3968AD375DCA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|Win32.ActiveCfg = Debug|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|Win32.Build.0 = Debug|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|x64.ActiveCfg = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Debug|x64.Build.0 = Debug|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|Win32.ActiveCfg = Release|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|Win32.Build.0 = Release|Win32
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|x64.ActiveCfg = Release|x64
{0A87F1E0-6E9A-452C-A209-3968AD375DCA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,8 @@
#include "../../MyVersion.h" #include "../../MyVersion.h"
#include "../../../../C/DllSecur.h"
using namespace NWindows; using namespace NWindows;
using namespace NFile; using namespace NFile;
using namespace NDir; using namespace NDir;
@@ -103,7 +105,7 @@ static const wchar_t *kUniversalWildcard = L"*";
static const int kCommandIndex = 0; static const int kCommandIndex = 0;
static const char *kHelpString = static const char *kHelpString =
"\nUsage: 7zSFX [<command>] [<switches>...]\n" "\nUsage: 7zSFX [<command>] [<switches>...] [<file_name>...]\n"
"\n" "\n"
"<Commands>\n" "<Commands>\n"
// " l: List contents of archive\n" // " l: List contents of archive\n"
@@ -222,13 +224,6 @@ void AddCommandLineWildcardToCensor(NWildcard::CCensor &wildcardCensor,
ShowMessageAndThrowException(kIncorrectWildcardInCommandLine, NExitCode::kUserError); ShowMessageAndThrowException(kIncorrectWildcardInCommandLine, NExitCode::kUserError);
} }
void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor,
const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type,
bool /* thereAreSwitchIncludeWildcards */)
{
AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, type);
}
#ifndef _WIN32 #ifndef _WIN32
static void GetArguments(int numArgs, const char *args[], UStringVector &parts) static void GetArguments(int numArgs, const char *args[], UStringVector &parts)
@@ -248,6 +243,11 @@ int Main2(
#endif #endif
) )
{ {
#ifdef _WIN32
// do we need load Security DLLs for console program?
LoadSecurityDlls();
#endif
#if defined(_WIN32) && !defined(UNDER_CE) #if defined(_WIN32) && !defined(UNDER_CE)
SetFileApisToOEM(); SetFileApisToOEM();
#endif #endif
@@ -283,9 +283,16 @@ int Main2(
commandStrings.Delete(0); commandStrings.Delete(0);
NCommandLineParser::CParser parser(kNumSwitches); NCommandLineParser::CParser parser(kNumSwitches);
try try
{ {
parser.ParseStrings(kSwitchForms, commandStrings); if (!parser.ParseStrings(kSwitchForms, commandStrings))
{
g_StdOut << "Command line error:" << endl
<< parser.ErrorMessage << endl
<< parser.ErrorLine << endl;
return NExitCode::kUserError;
}
} }
catch(...) catch(...)
{ {
@@ -297,19 +304,23 @@ int Main2(
PrintHelp(); PrintHelp();
return 0; return 0;
} }
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings; const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
int numNonSwitchStrings = nonSwitchStrings.Size(); unsigned curCommandIndex = 0;
CArchiveCommand command; CArchiveCommand command;
if (numNonSwitchStrings == 0) if (nonSwitchStrings.IsEmpty())
command.CommandType = NCommandType::kFullExtract; command.CommandType = NCommandType::kFullExtract;
else else
{ {
if (numNonSwitchStrings > 1) const UString &cmd = nonSwitchStrings[curCommandIndex];
PrintHelpAndExit(); if (!ParseArchiveCommand(cmd, command))
if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], command)) {
PrintHelpAndExit(); g_StdOut << "ERROR: Unknown command:" << endl << cmd << endl;
return NExitCode::kUserError;
}
curCommandIndex = 1;
} }
@@ -318,11 +329,17 @@ int Main2(
NWildcard::CCensor wildcardCensor; NWildcard::CCensor wildcardCensor;
bool thereAreSwitchIncludeWildcards; {
thereAreSwitchIncludeWildcards = false; if (nonSwitchStrings.Size() == curCommandIndex)
AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, recursedType);
AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType, for (; curCommandIndex < nonSwitchStrings.Size(); curCommandIndex++)
thereAreSwitchIncludeWildcards); {
const UString &s = nonSwitchStrings[curCommandIndex];
if (s.IsEmpty())
throw "Empty file path";
AddCommandLineWildcardToCensor(wildcardCensor, s, true, recursedType);
}
}
bool yesToAll = parser[NKey::kYes].ThereIs; bool yesToAll = parser[NKey::kYes].ThereIs;

View File

@@ -4,6 +4,7 @@ CFLAGS = $(CFLAGS) \
-DEXTRACT_ONLY \ -DEXTRACT_ONLY \
-DNO_READ_FROM_CODER \ -DNO_READ_FROM_CODER \
-D_SFX \ -D_SFX \
-D_CONSOLE \
CURRENT_OBJS = \ CURRENT_OBJS = \
$O\SfxCon.obj \ $O\SfxCon.obj \
@@ -114,6 +115,7 @@ C_OBJS = \
$O\BraIA64.obj \ $O\BraIA64.obj \
$O\CpuArch.obj \ $O\CpuArch.obj \
$O\Delta.obj \ $O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \ $O\Lzma2Dec.obj \
$O\LzmaDec.obj \ $O\LzmaDec.obj \
$O\Ppmd7.obj \ $O\Ppmd7.obj \

View File

@@ -55,8 +55,7 @@ struct CThreadExtracting
Result = ArchiveLink.Open2(options, ExtractCallbackSpec); Result = ArchiveLink.Open2(options, ExtractCallbackSpec);
if (Result != S_OK) if (Result != S_OK)
{ {
if (Result != S_OK) ErrorMessage = kCantOpenArchive;
ErrorMessage = kCantOpenArchive;
return; return;
} }

View File

@@ -706,6 +706,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File # End Source File
# Begin 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\Lzma2Dec.c SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
# End Source File # End Source File

View File

@@ -23,6 +23,8 @@
#include "ExtractEngine.h" #include "ExtractEngine.h"
#include "../../../../C/DllSecur.h"
#include "resource.h" #include "resource.h"
using namespace NWindows; using namespace NWindows;
@@ -135,6 +137,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
NT_CHECK NT_CHECK
#ifdef _WIN32
LoadSecurityDlls();
#endif
// InitCommonControls(); // InitCommonControls();
UString archiveName, switches; UString archiveName, switches;

View File

@@ -100,6 +100,7 @@ C_OBJS = \
$O\BraIA64.obj \ $O\BraIA64.obj \
$O\CpuArch.obj \ $O\CpuArch.obj \
$O\Delta.obj \ $O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \ $O\Lzma2Dec.obj \
$O\LzmaDec.obj \ $O\LzmaDec.obj \
$O\Threads.obj \ $O\Threads.obj \

View File

@@ -888,6 +888,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File # End Source File
# Begin 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\Lzma2Dec.c SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
# End Source File # End Source File

View File

@@ -0,0 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SFXWin", "SFXWin.vcproj", "{F0A92034-14AA-4347-92D5-CD4886865506}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseD|Win32 = ReleaseD|Win32
ReleaseD|x64 = ReleaseD|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|Win32.ActiveCfg = Debug|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|Win32.Build.0 = Debug|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|x64.ActiveCfg = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Debug|x64.Build.0 = Debug|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|Win32.ActiveCfg = Release|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|Win32.Build.0 = Release|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|x64.ActiveCfg = Release|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.Release|x64.Build.0 = Release|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|Win32.ActiveCfg = ReleaseD|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|Win32.Build.0 = ReleaseD|Win32
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|x64.ActiveCfg = ReleaseD|x64
{F0A92034-14AA-4347-92D5-CD4886865506}.ReleaseD|x64.Build.0 = ReleaseD|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

File diff suppressed because it is too large Load Diff

View File

@@ -28,6 +28,8 @@
#include "../../UI/GUI/ExtractGUI.h" #include "../../UI/GUI/ExtractGUI.h"
#include "../../UI/GUI/ExtractRes.h" #include "../../UI/GUI/ExtractRes.h"
#include "../../../../C/DllSecur.h"
using namespace NWindows; using namespace NWindows;
using namespace NFile; using namespace NFile;
using namespace NDir; using namespace NDir;
@@ -220,6 +222,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
try try
{ {
#ifdef _WIN32
LoadSecurityDlls();
#endif
return WinMain2(); return WinMain2();
} }
catch(const CNewException &) catch(const CNewException &)

View File

@@ -131,8 +131,9 @@ C_OBJS = \
$O\Bra.obj \ $O\Bra.obj \
$O\Bra86.obj \ $O\Bra86.obj \
$O\BraIA64.obj \ $O\BraIA64.obj \
$O\Delta.obj \
$O\CpuArch.obj \ $O\CpuArch.obj \
$O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \ $O\Lzma2Dec.obj \
$O\LzmaDec.obj \ $O\LzmaDec.obj \
$O\Ppmd7.obj \ $O\Ppmd7.obj \

View File

@@ -7,8 +7,11 @@
MY_VERSION_INFO_APP("7z SFX", "7z.sfx") MY_VERSION_INFO_APP("7z SFX", "7z.sfx")
#define xc 240 #define xc 270
#define yc 64 #define yc 75
#define bxsOpen 30
#define xsSpace 4
IDI_ICON ICON "7z.ico" IDI_ICON ICON "7z.ico"
@@ -16,9 +19,13 @@ IDD_EXTRACT DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "7-Zip self-extracting archive" CAPTION "7-Zip self-extracting archive"
BEGIN BEGIN
LTEXT "E&xtract to:", IDT_EXTRACT_EXTRACT_TO, m, m, xc, 8 LTEXT "E&xtract to:", IDT_EXTRACT_EXTRACT_TO, m, m, xc, 8
EDITTEXT IDC_EXTRACT_PATH, m, 21, xc - bxsDots - 12, 14, ES_AUTOHSCROLL EDITTEXT IDC_EXTRACT_PATH, m, m + 12 - 1, xc - bxsDots - xsSpace - bxsOpen - xsSpace, 14, ES_AUTOHSCROLL
PUSHBUTTON "...", IDB_EXTRACT_SET_PATH, xs - m - bxsDots, 20, bxsDots, bys, WS_GROUP PUSHBUTTON "...", IDB_EXTRACT_SET_PATH, xs - m - bxsDots - xsSpace - bxsOpen, m + 12 - 1, bxsDots, bys-1, WS_GROUP
DEFPUSHBUTTON "Extract", IDOK, bx2, by, bxs, bys, WS_GROUP PUSHBUTTON "&Open", IDC_EXTRACT_BUTTON_OPEN_PATH, xs - m - bxsOpen, m + 12 - 1, bxsOpen, bys-1, WS_GROUP
LTEXT "", IDC_STATIC_EXTRACT_FREE_SPACE, m, m + 12 + 14 + 1, xc, 8
CONTROL "O&pen output folder after extracting", IDC_EXTRACT_CHECK_OPEN_OUTPUT_FOLDER, MY_CHECKBOX, m, m + 12 + 14 + 1 + 8 + 6, xc, 10
DEFPUSHBUTTON "&Extract", IDOK, bx2, by, bxs, bys, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
END END

View File

@@ -8,9 +8,9 @@ namespace NCompress {
namespace NDeflate { namespace NDeflate {
namespace NDecoder { namespace NDecoder {
CCoder::CCoder(bool deflate64Mode, bool deflateNSIS): CCoder::CCoder(bool deflate64Mode):
_deflate64Mode(deflate64Mode), _deflate64Mode(deflate64Mode),
_deflateNSIS(deflateNSIS), _deflateNSIS(false),
_keepHistory(false), _keepHistory(false),
_needFinishInput(false), _needFinishInput(false),
_needInitInStream(true), _needInitInStream(true),

View File

@@ -79,9 +79,11 @@ public:
bool ZlibMode; bool ZlibMode;
Byte ZlibFooter[4]; Byte ZlibFooter[4];
CCoder(bool deflate64Mode, bool deflateNSIS = false); CCoder(bool deflate64Mode);
virtual ~CCoder() {}; virtual ~CCoder() {};
void SetNsisMode(bool nsisMode) { _deflateNSIS = nsisMode; }
void Set_KeepHistory(bool keepHistory) { _keepHistory = keepHistory; } void Set_KeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
void Set_NeedFinishInput(bool needFinishInput) { _needFinishInput = needFinishInput; } void Set_NeedFinishInput(bool needFinishInput) { _needFinishInput = needFinishInput; }
@@ -147,7 +149,6 @@ public:
}; };
class CCOMCoder : public CCoder { public: CCOMCoder(): CCoder(false) {} }; class CCOMCoder : public CCoder { public: CCOMCoder(): CCoder(false) {} };
class CNsisCOMCoder : public CCoder { public: CNsisCOMCoder(): CCoder(false, true) {} };
class CCOMCoder64 : public CCoder { public: CCOMCoder64(): CCoder(true) {} }; class CCOMCoder64 : public CCoder { public: CCOMCoder64(): CCoder(true) {} };
}}} }}}

View File

@@ -80,7 +80,8 @@ static const UInt32 kHistorySize = 1 << 20;
static const UInt32 kWindowReservSize = (1 << 22) + 256; static const UInt32 kWindowReservSize = (1 << 22) + 256;
CDecoder::CDecoder(): CDecoder::CDecoder():
m_IsSolid(false) m_IsSolid(false),
m_TablesOK(false)
{ {
} }
@@ -100,6 +101,8 @@ UInt32 CDecoder::ReadBits(unsigned numBits) { return m_InBitStream.ReadBits(numB
bool CDecoder::ReadTables(void) bool CDecoder::ReadTables(void)
{ {
m_TablesOK = false;
Byte levelLevels[kLevelTableSize]; Byte levelLevels[kLevelTableSize];
Byte newLevels[kMaxTableSize]; Byte newLevels[kMaxTableSize];
m_AudioMode = (ReadBits(1) == 1); m_AudioMode = (ReadBits(1) == 1);
@@ -170,6 +173,9 @@ bool CDecoder::ReadTables(void)
} }
memcpy(m_LastLevels, newLevels, kMaxTableSize); memcpy(m_LastLevels, newLevels, kMaxTableSize);
m_TablesOK = true;
return true; return true;
} }
@@ -340,10 +346,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
return S_FALSE; return S_FALSE;
return S_OK; return S_OK;
} }
if (!ReadTables()) ReadTables();
return S_FALSE;
} }
if (!m_TablesOK)
return S_FALSE;
UInt64 startPos = m_OutWindowStream.GetProcessedSize(); UInt64 startPos = m_OutWindowStream.GetProcessedSize();
while (pos < unPackSize) while (pos < unPackSize)
{ {

View File

@@ -119,26 +119,29 @@ class CDecoder :
{ {
CLzOutWindow m_OutWindowStream; CLzOutWindow m_OutWindowStream;
CBitDecoder m_InBitStream; CBitDecoder m_InBitStream;
UInt32 m_RepDistPtr;
UInt32 m_RepDists[kNumRepDists];
UInt32 m_LastLength;
bool m_IsSolid;
bool m_TablesOK;
bool m_AudioMode;
NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder; NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder; NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder;
NHuffman::CDecoder<kNumHuffmanBits, kLenTableSize> m_LenDecoder; NHuffman::CDecoder<kNumHuffmanBits, kLenTableSize> m_LenDecoder;
NHuffman::CDecoder<kNumHuffmanBits, kMMTableSize> m_MMDecoders[NMultimedia::kNumChanelsMax]; NHuffman::CDecoder<kNumHuffmanBits, kMMTableSize> m_MMDecoders[NMultimedia::kNumChanelsMax];
NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder; NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
bool m_AudioMode; UInt64 m_PackSize;
NMultimedia::CFilter2 m_MmFilter;
unsigned m_NumChannels; unsigned m_NumChannels;
NMultimedia::CFilter2 m_MmFilter;
UInt32 m_RepDists[kNumRepDists];
UInt32 m_RepDistPtr;
UInt32 m_LastLength;
Byte m_LastLevels[kMaxTableSize]; Byte m_LastLevels[kMaxTableSize];
UInt64 m_PackSize;
bool m_IsSolid;
void InitStructures(); void InitStructures();
UInt32 ReadBits(unsigned numBits); UInt32 ReadBits(unsigned numBits);

View File

@@ -862,22 +862,26 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream
_numCorrectDistSymbols = newSizeLog * 2; _numCorrectDistSymbols = newSizeLog * 2;
} }
if (!_window || _winSize != newSize) // If dictionary was reduced, we use allocated dictionary block
// for compatibility with original unRAR decoder.
if (_window && newSize < _winSizeAllocated)
_winSize = _winSizeAllocated;
else if (!_window || _winSize != newSize)
{ {
if (!_isSolid && newSize > _winSizeAllocated) if (!_isSolid)
{ {
::MidFree(_window); ::MidFree(_window);
_window = NULL; _window = NULL;
_winSizeAllocated = 0; _winSizeAllocated = 0;
} }
Byte *win = _window; Byte *win;
if (!_window || newSize > _winSizeAllocated)
{ {
win = (Byte *)::MidAlloc(newSize); win = (Byte *)::MidAlloc(newSize);
if (!win) if (!win)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
_winSizeAllocated = newSize;
memset(win, 0, newSize); memset(win, 0, newSize);
} }
@@ -892,16 +896,18 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream
size_t newMask = newSize - 1; size_t newMask = newSize - 1;
size_t oldMask = _winSize - 1; size_t oldMask = _winSize - 1;
size_t winPos = _winPos; size_t winPos = _winPos;
for (size_t i = 1; i < oldSize; i++) // i < oldSize) ? for (size_t i = 1; i <= oldSize; i++)
win[(winPos - i) & newMask] = winOld[(winPos - i) & oldMask]; win[(winPos - i) & newMask] = winOld[(winPos - i) & oldMask];
::MidFree(_window); ::MidFree(_window);
} }
_window = win; _window = win;
_winSizeAllocated = newSize;
_winSize = newSize; _winSize = newSize;
} }
_winMask = _winSize - 1; _winMask = _winSize - 1;
_winPos &= _winMask;
if (!_inputBuf) if (!_inputBuf)
{ {

View File

@@ -59,7 +59,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#define MY_PAGE_STYLE STYLE WS_CHILD | WS_DISABLED | WS_CAPTION #define MY_PAGE_STYLE STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
#define MY_FONT FONT 8, "MS Shell Dlg" //#define MY_FONT FONT 8, "MS Shell Dlg"
#define MY_FONT FONT 8, "Tahoma"
#define SMALL_PAGE_SIZE_X 120 #define SMALL_PAGE_SIZE_X 120

View File

@@ -387,7 +387,7 @@ static void AddRenamePair(CObjectVector<CRenamePair> *renamePairs,
val.Add_LF(); val.Add_LF();
if (type == NRecursedType::kRecursed) if (type == NRecursedType::kRecursed)
val.AddAscii("-r"); val.AddAscii("-r");
else if (type == NRecursedType::kRecursed) else if (type == NRecursedType::kWildcardOnlyRecursed)
val.AddAscii("-r0"); val.AddAscii("-r0");
throw CArcCmdLineException("Unsupported rename command:", val); throw CArcCmdLineException("Unsupported rename command:", val);
} }

View File

@@ -359,14 +359,11 @@ HRESULT Extract(
op.stream = NULL; op.stream = NULL;
op.filePath = arcPath; op.filePath = arcPath;
HRESULT result = arcLink.Open3(op, openCallback); HRESULT result = arcLink.Open_Strict(op, openCallback);
if (result == E_ABORT) if (result == E_ABORT)
return result; return result;
if (result == S_OK && arcLink.NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
result = S_FALSE;
// arcLink.Set_ErrorsText(); // arcLink.Set_ErrorsText();
RINOK(extractCallback->OpenResult(codecs, arcLink, arcPath, result)); RINOK(extractCallback->OpenResult(codecs, arcLink, arcPath, result));

View File

@@ -401,6 +401,14 @@ struct CArchiveLink
HRESULT Open2(COpenOptions &options, IOpenCallbackUI *callbackUI); HRESULT Open2(COpenOptions &options, IOpenCallbackUI *callbackUI);
HRESULT Open3(COpenOptions &options, IOpenCallbackUI *callbackUI); HRESULT Open3(COpenOptions &options, IOpenCallbackUI *callbackUI);
HRESULT Open_Strict(COpenOptions &options, IOpenCallbackUI *callbackUI)
{
HRESULT result = Open3(options, callbackUI);
if (result == S_OK && NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
result = S_FALSE;
return result;
}
HRESULT ReOpen(COpenOptions &options); HRESULT ReOpen(COpenOptions &options);
}; };

View File

@@ -251,8 +251,6 @@ STDMETHODIMP COutMultiVolStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *n
STDMETHODIMP COutMultiVolStream::SetSize(UInt64 newSize) STDMETHODIMP COutMultiVolStream::SetSize(UInt64 newSize)
{ {
if (newSize < 0)
return E_INVALIDARG;
unsigned i = 0; unsigned i = 0;
while (i < Streams.Size()) while (i < Streams.Size())
{ {
@@ -1108,14 +1106,11 @@ HRESULT UpdateArchive(
RINOK(callback->StartOpenArchive(arcPath)); RINOK(callback->StartOpenArchive(arcPath));
HRESULT result = arcLink.Open3(op, openCallback); HRESULT result = arcLink.Open_Strict(op, openCallback);
if (result == E_ABORT) if (result == E_ABORT)
return result; return result;
if (result == S_OK && arcLink.NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
result = S_FALSE;
HRESULT res2 = callback->OpenResult(codecs, arcLink, arcPath, result); HRESULT res2 = callback->OpenResult(codecs, arcLink, arcPath, result);
/* /*
if (result == S_FALSE) if (result == S_FALSE)

View File

@@ -17,8 +17,10 @@ static NSynchronization::CCriticalSection g_CS;
#define CS_LOCK NSynchronization::CCriticalSectionLock lock(g_CS); #define CS_LOCK NSynchronization::CCriticalSectionLock lock(g_CS);
static const TCHAR *kCuPrefix = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR); static const TCHAR *kCuPrefix = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR);
static const TCHAR *kCuFMPrefix = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
static CSysString GetKeyPath(const CSysString &path) { return kCuPrefix + path; } static CSysString GetKeyPath(const CSysString &path) { return kCuPrefix + path; }
static CSysString GetFMKeyPath() { return kCuFMPrefix; }
static LONG OpenMainKey(CKey &key, LPCTSTR keyName) static LONG OpenMainKey(CKey &key, LPCTSTR keyName)
{ {
@@ -30,6 +32,16 @@ static LONG CreateMainKey(CKey &key, LPCTSTR keyName)
return key.Create(HKEY_CURRENT_USER, GetKeyPath(keyName)); return key.Create(HKEY_CURRENT_USER, GetKeyPath(keyName));
} }
static LONG OpenFMKey(CKey &key)
{
return key.Open(HKEY_CURRENT_USER, GetFMKeyPath(), KEY_READ);
}
static LONG CreateFMKey(CKey &key)
{
return key.Create(HKEY_CURRENT_USER, GetFMKeyPath());
}
static void Key_Set_BoolPair(CKey &key, LPCTSTR name, const CBoolPair &b) static void Key_Set_BoolPair(CKey &key, LPCTSTR name, const CBoolPair &b)
{ {
if (b.Def) if (b.Def)
@@ -62,6 +74,8 @@ static const TCHAR *kElimDup = TEXT("ElimDup");
// static const TCHAR *kAltStreams = TEXT("AltStreams"); // static const TCHAR *kAltStreams = TEXT("AltStreams");
static const TCHAR *kNtSecur = TEXT("Security"); static const TCHAR *kNtSecur = TEXT("Security");
static const TCHAR *kFMCopyHistoryValueName = TEXT("CopyHistory");
void CInfo::Save() const void CInfo::Save() const
{ {
CS_LOCK CS_LOCK
@@ -79,8 +93,15 @@ void CInfo::Save() const
Key_Set_BoolPair(key, kNtSecur, NtSecurity); Key_Set_BoolPair(key, kNtSecur, NtSecurity);
Key_Set_BoolPair(key, kShowPassword, ShowPassword); Key_Set_BoolPair(key, kShowPassword, ShowPassword);
key.RecurseDeleteKey(kPathHistory); // key.RecurseDeleteKey(kPathHistory);
key.SetValue_Strings(kPathHistory, Paths); // key.SetValue_Strings(kPathHistory, Paths);
key.Close();
if (CreateFMKey(key) == ERROR_SUCCESS)
{
key.SetValue_Strings(kFMCopyHistoryValueName, Paths);
key.Close();
}
} }
void Save_ShowPassword(bool showPassword) void Save_ShowPassword(bool showPassword)
@@ -104,28 +125,37 @@ void CInfo::Load()
CS_LOCK CS_LOCK
CKey key; CKey key;
if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS) // if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS)
return; // return;
key.GetValue_Strings(kPathHistory, Paths); if (OpenMainKey(key, kKeyName) == ERROR_SUCCESS)
UInt32 v;
if (key.QueryValue(kExtractMode, v) == ERROR_SUCCESS && v <= NPathMode::kAbsPaths)
{ {
PathMode = (NPathMode::EEnum)v; // key.GetValue_Strings(kPathHistory, Paths);
PathMode_Force = true; UInt32 v;
if (key.QueryValue(kExtractMode, v) == ERROR_SUCCESS && v <= NPathMode::kAbsPaths)
{
PathMode = (NPathMode::EEnum)v;
PathMode_Force = true;
}
if (key.QueryValue(kOverwriteMode, v) == ERROR_SUCCESS && v <= NOverwriteMode::kRenameExisting)
{
OverwriteMode = (NOverwriteMode::EEnum)v;
OverwriteMode_Force = true;
}
Key_Get_BoolPair_true(key, kSplitDest, SplitDest);
Key_Get_BoolPair(key, kElimDup, ElimDup);
// Key_Get_BoolPair(key, kAltStreams, AltStreams);
Key_Get_BoolPair(key, kNtSecur, NtSecurity);
Key_Get_BoolPair(key, kShowPassword, ShowPassword);
key.Close();
} }
if (key.QueryValue(kOverwriteMode, v) == ERROR_SUCCESS && v <= NOverwriteMode::kRenameExisting) if (OpenFMKey(key) == ERROR_SUCCESS)
{ {
OverwriteMode = (NOverwriteMode::EEnum)v; key.GetValue_Strings(kFMCopyHistoryValueName, Paths);
OverwriteMode_Force = true; key.Close();
} }
Key_Get_BoolPair_true(key, kSplitDest, SplitDest);
Key_Get_BoolPair(key, kElimDup, ElimDup);
// Key_Get_BoolPair(key, kAltStreams, AltStreams);
Key_Get_BoolPair(key, kNtSecur, NtSecurity);
Key_Get_BoolPair(key, kShowPassword, ShowPassword);
} }
bool Read_ShowPassword() bool Read_ShowPassword()
@@ -373,11 +403,11 @@ void CContextMenuInfo::Save() const
void CContextMenuInfo::Load() void CContextMenuInfo::Load()
{ {
Cascaded.Val = true; Cascaded.Val = false;
Cascaded.Def = false; Cascaded.Def = false;
MenuIcons.Val = false; MenuIcons.Val = true;
MenuIcons.Def = false; MenuIcons.Def = true;
ElimDup.Val = true; ElimDup.Val = true;
ElimDup.Def = false; ElimDup.Def = false;

View File

@@ -31,6 +31,9 @@ namespace NExtract
void Save_ShowPassword(bool showPassword); void Save_ShowPassword(bool showPassword);
bool Read_ShowPassword(); bool Read_ShowPassword();
void SaveOptShowPassword(bool bShow);
bool ReadOptShowPassword();
} }
namespace NCompression namespace NCompression

View File

@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "Console.vcproj", "{1A8E1EC5-A03F-4368-ABDF-57C21762F528}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugU|Win32 = DebugU|Win32
DebugU|x64 = DebugU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseU|Win32 = ReleaseU|Win32
ReleaseU|x64 = ReleaseU|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|Win32.ActiveCfg = Debug|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|Win32.Build.0 = Debug|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|x64.ActiveCfg = Debug|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Debug|x64.Build.0 = Debug|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|Win32.ActiveCfg = DebugU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|Win32.Build.0 = DebugU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|x64.ActiveCfg = DebugU|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.DebugU|x64.Build.0 = DebugU|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|Win32.ActiveCfg = Release|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|Win32.Build.0 = Release|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|x64.ActiveCfg = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.Release|x64.Build.0 = Release|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{1A8E1EC5-A03F-4368-ABDF-57C21762F528}.ReleaseU|x64.Build.0 = ReleaseU|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

File diff suppressed because it is too large Load Diff

View File

@@ -283,7 +283,7 @@ HRESULT CHashCallbackConsole::SetOperationResult(UInt64 fileSize, const CHashBun
return CheckBreak2(); return CheckBreak2();
} }
static const char *k_DigestTitles[] = static const char * const k_DigestTitles[] =
{ {
" : " " : "
, " for data: " , " for data: "

View File

@@ -1068,7 +1068,7 @@ HRESULT ListArchives(CCodecs *codecs,
g_StdOut << endl << kListing << arcPath << endl << endl; g_StdOut << endl << kListing << arcPath << endl << endl;
} }
HRESULT result = arcLink.Open3(options, &openCallback); HRESULT result = arcLink.Open_Strict(options, &openCallback);
if (result != S_OK) if (result != S_OK)
{ {
@@ -1095,9 +1095,6 @@ HRESULT ListArchives(CCodecs *codecs,
} }
{ {
if (arcLink.NonOpen_ErrorInfo.ErrorFormatIndex >= 0)
numErrors++;
FOR_VECTOR (r, arcLink.Arcs) FOR_VECTOR (r, arcLink.Arcs)
{ {
const CArcErrorInfo &arc = arcLink.Arcs[r].ErrorInfo; const CArcErrorInfo &arc = arcLink.Arcs[r].ErrorInfo;

View File

@@ -489,7 +489,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if (_fileNames.Size() > 0) if (_fileNames.Size() > 0)
{ {
const UString &fileName = _fileNames.Front(); const UString &fileName = _fileNames.Front();
#if defined(_WIN32) && !defined(UNDER_CE) #if defined(_WIN32) && !defined(UNDER_CE)
if (NName::IsDevicePath(us2fs(fileName))) if (NName::IsDevicePath(us2fs(fileName)))
{ {
@@ -577,7 +577,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if (!needExtract) if (!needExtract)
{ {
FOR_VECTOR (i, _fileNames) for (unsigned i = 1; i < _fileNames.Size(); i++)
{ {
NFind::CFileInfo fi; NFind::CFileInfo fi;
if (!fi.Find(us2fs(_fileNames[i]))) if (!fi.Find(us2fs(_fileNames[i])))
@@ -594,57 +594,52 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if (needExtract) if (needExtract)
{ {
// Extract
if ((contextMenuFlags & NContextMenuFlags::kExtract) != 0)
{ {
CCommandMapItem commandMapItem; UString baseFolder = fs2us(folderPrefix);
FillCommand(kExtract, mainString, commandMapItem);
if (_dropMode) if (_dropMode)
commandMapItem.Folder = _dropPath; baseFolder = _dropPath;
else
commandMapItem.Folder = fs2us(folderPrefix);
commandMapItem.Folder += GetSubFolderNameForExtract(fs2us(fi0.Name));
commandMapItem.Folder.Add_PathSepar();
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString, bitmap);
_commandMap.Add(commandMapItem);
}
// Extract Here
if ((contextMenuFlags & NContextMenuFlags::kExtractHere) != 0)
{
CCommandMapItem commandMapItem;
FillCommand(kExtractHere, mainString, commandMapItem);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString, bitmap);
if (_dropMode)
commandMapItem.Folder = _dropPath;
else
commandMapItem.Folder = fs2us(folderPrefix);
_commandMap.Add(commandMapItem);
}
// Extract To
if ((contextMenuFlags & NContextMenuFlags::kExtractTo) != 0)
{
CCommandMapItem commandMapItem;
UString s;
FillCommand(kExtractTo, s, commandMapItem);
UString folder = L'*';
if (_fileNames.Size() == 1)
folder = GetSubFolderNameForExtract(fs2us(fi0.Name));
if (_dropMode)
commandMapItem.Folder = _dropPath;
else
commandMapItem.Folder = fs2us(folderPrefix);
commandMapItem.Folder += folder;
folder.Add_PathSepar();
MyFormatNew_ReducedName(s, folder);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s, bitmap);
_commandMap.Add(commandMapItem);
}
// Test UString specFolder = L'*';
if (_fileNames.Size() == 1)
specFolder = GetSubFolderNameForExtract(fs2us(fi0.Name));
specFolder.Add_PathSepar();
if ((contextMenuFlags & NContextMenuFlags::kExtract) != 0)
{
// Extract
CCommandMapItem commandMapItem;
FillCommand(kExtract, mainString, commandMapItem);
commandMapItem.Folder = baseFolder + specFolder;
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString, bitmap);
_commandMap.Add(commandMapItem);
}
if ((contextMenuFlags & NContextMenuFlags::kExtractHere) != 0)
{
// Extract Here
CCommandMapItem commandMapItem;
FillCommand(kExtractHere, mainString, commandMapItem);
commandMapItem.Folder = baseFolder;
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString, bitmap);
_commandMap.Add(commandMapItem);
}
if ((contextMenuFlags & NContextMenuFlags::kExtractTo) != 0)
{
// Extract To
CCommandMapItem commandMapItem;
UString s;
FillCommand(kExtractTo, s, commandMapItem);
commandMapItem.Folder = baseFolder + specFolder;
MyFormatNew_ReducedName(s, specFolder);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s, bitmap);
_commandMap.Add(commandMapItem);
}
}
if ((contextMenuFlags & NContextMenuFlags::kTest) != 0) if ((contextMenuFlags & NContextMenuFlags::kTest) != 0)
{ {
// Test
CCommandMapItem commandMapItem; CCommandMapItem commandMapItem;
FillCommand(kTest, mainString, commandMapItem); FillCommand(kTest, mainString, commandMapItem);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString, bitmap); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString, bitmap);

View File

@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Explorer", "Explorer.vcproj", "{FBA8DA13-7434-409C-83AB-FC6682A8869D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugU|Win32 = DebugU|Win32
DebugU|x64 = DebugU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseU|Win32 = ReleaseU|Win32
ReleaseU|x64 = ReleaseU|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|Win32.ActiveCfg = Debug|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|Win32.Build.0 = Debug|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|x64.ActiveCfg = Debug|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Debug|x64.Build.0 = Debug|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|Win32.ActiveCfg = DebugU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|Win32.Build.0 = DebugU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|x64.ActiveCfg = DebugU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.DebugU|x64.Build.0 = DebugU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|Win32.ActiveCfg = Release|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|Win32.Build.0 = Release|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|x64.ActiveCfg = Release|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.Release|x64.Build.0 = Release|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|Win32.ActiveCfg = ReleaseU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|Win32.Build.0 = ReleaseU|Win32
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|x64.ActiveCfg = ReleaseU|x64
{FBA8DA13-7434-409C-83AB-FC6682A8869D}.ReleaseU|x64.Build.0 = ReleaseU|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

File diff suppressed because it is too large Load Diff

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 110 B

View File

@@ -3,9 +3,9 @@
#ifndef __STDAFX_H #ifndef __STDAFX_H
#define __STDAFX_H #define __STDAFX_H
// #define _WIN32_WINNT 0x0400 //// #define _WIN32_WINNT 0x0400
#define _WIN32_WINNT 0x0500 //#define _WIN32_WINNT 0x0500
#define WINVER _WIN32_WINNT //#define WINVER _WIN32_WINNT
#include "../../../Common/Common.h" #include "../../../Common/Common.h"

View File

@@ -3,6 +3,6 @@
MY_VERSION_INFO_DLL("7-Zip Shell Extension", "7-zip") MY_VERSION_INFO_DLL("7-Zip Shell Extension", "7-zip")
#ifndef UNDER_CE //#ifndef UNDER_CE
1 24 MOVEABLE PURE "7-zip.dll.manifest" //1 24 MOVEABLE PURE "7-zip.dll.manifest"
#endif //#endif

View File

@@ -396,8 +396,7 @@ static HANDLE MyOpenFilePluginW(const wchar_t *name)
agent, agent,
(const wchar_t *)archiveType (const wchar_t *)archiveType
); );
if (!plugin)
return INVALID_HANDLE_VALUE;
plugin->PasswordIsDefined = openArchiveCallbackSpec->PasswordIsDefined; plugin->PasswordIsDefined = openArchiveCallbackSpec->PasswordIsDefined;
plugin->Password = openArchiveCallbackSpec->Password; plugin->Password = openArchiveCallbackSpec->Password;

View File

@@ -0,0 +1,42 @@
// AboutEasy7ZipDialog.cpp
#include "StdAfx.h"
#include "AboutEasy7ZipDialog.h"
#include "HelpUtils.h"
static LPCWSTR kHelpTopic = L"start.htm";
bool CAboutEasy7ZipDialog::OnInit()
{
NormalizePosition();
return CModalDialog::OnInit();
}
void CAboutEasy7ZipDialog::OnHelp()
{
ShowHelpWindow(NULL, kHelpTopic);
}
bool CAboutEasy7ZipDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
LPCTSTR url;
switch(buttonID)
{
case IDC_ABOUT_BUTTON_EASY7ZIP_HOMEPAGE: url = TEXT("http://www.e7z.org/"); break;
default:
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
#ifdef UNDER_CE
SHELLEXECUTEINFO s;
memset(&s, 0, sizeof(s));
s.cbSize = sizeof(s);
s.lpFile = url;
::ShellExecuteEx(&s);
#else
::ShellExecute(NULL, NULL, url, NULL, NULL, SW_SHOWNORMAL);
#endif
return true;
}

View File

@@ -0,0 +1,18 @@
// AboutEasy7ZipDialog.h
#ifndef __ABOUT_EASY7ZIP_DIALOG_H
#define __ABOUT_EASY7ZIP_DIALOG_H
#include "AboutEasy7ZipDialogRes.h"
#include "../../../Windows/Control/Dialog.h"
class CAboutEasy7ZipDialog: public NWindows::NControl::CModalDialog
{
public:
virtual bool OnInit();
virtual void OnHelp();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_ABOUT_EASY_7ZIP, wndParent); }
};
#endif

View File

@@ -0,0 +1,16 @@
#include "AboutEasy7ZipDialogRes.h"
#include "../../GuiCommon.rc"
#include "../../MyVersion.h"
#define xc 165
#define yc 85
IDD_ABOUT_EASY_7ZIP DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "About Easy 7-Zip"
{
DEFPUSHBUTTON "OK", IDOK, bx1, by, bxs, bys
PUSHBUTTON MY_EASY7ZIP_HOMEPAGE, IDC_ABOUT_BUTTON_EASY7ZIP_HOMEPAGE, bx2, by, bxs, bys
LTEXT MY_EASY7ZIP_7ZIP_VERSION, -1, m, m, xc, 8
LTEXT MY_EASY7ZIP_COPYRIGHT, -1, m, m + 8 + 4, xc, 8
LTEXT "Easy 7-Zip is a free software made by James Hoo. The software was built based on 7-Zip 16.04.", -1, m, m + 8 + 4 + 8 + 12, xc, (yc - bys - 36)
}

View File

@@ -0,0 +1,2 @@
#define IDD_ABOUT_EASY_7ZIP 515
#define IDC_ABOUT_BUTTON_EASY7ZIP_HOMEPAGE 1001

View File

@@ -37,6 +37,8 @@ using namespace NName;
extern DWORD g_ComCtl32Version; extern DWORD g_ComCtl32Version;
extern HINSTANCE g_hInstance; extern HINSTANCE g_hInstance;
extern bool g_bProcessError;
static CFSTR kTempDirPrefix = FTEXT("7zE"); static CFSTR kTempDirPrefix = FTEXT("7zE");
void CPanelCallbackImp::OnTab() void CPanelCallbackImp::OnTab()
@@ -542,6 +544,12 @@ UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
bool IsCorrectFsName(const UString &name); bool IsCorrectFsName(const UString &name);
static bool IsDirectory(LPCWSTR lpszPathFile)
{
DWORD dwAttr;
dwAttr = GetFileAttributesW(lpszPathFile);
return (dwAttr != (DWORD)-1) && ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) != 0);
}
/* Returns true, if path is path that can be used as path for File System functions /* Returns true, if path is path that can be used as path for File System functions
@@ -578,6 +586,9 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
CRecordVector<UInt32> indices; CRecordVector<UInt32> indices;
UString destPath; UString destPath;
bool openOutputFolder;
bool deleteSourceFile;
bool close7Zip;
bool useDestPanel = false; bool useDestPanel = false;
{ {
@@ -614,10 +625,15 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title); LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title);
LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static); LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static);
copyDialog.Info = srcPanel.GetItemsInfoString(indices); copyDialog.Info = srcPanel.GetItemsInfoString(indices);
copyDialog.m_currentFolderPrefix = srcPanel._currentFolderPrefix;
if (copyDialog.Create(srcPanel.GetParent()) != IDOK) if (copyDialog.Create(srcPanel.GetParent()) != IDOK)
return; return;
openOutputFolder = copyDialog.m_bOpenOutputFolder;
deleteSourceFile = copyDialog.m_bDeleteSourceFile;
close7Zip = copyDialog.m_bClose7Zip;
destPath = copyDialog.Value; destPath = copyDialog.Value;
} }
@@ -742,11 +758,13 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
useDestPanel = true; useDestPanel = true;
AddUniqueStringToHeadOfList(copyFolders, destPath); AddUniqueStringToHeadOfList(copyFolders, destPath);
while (copyFolders.Size() > 20) while (copyFolders.Size() > 30)
copyFolders.DeleteBack(); copyFolders.DeleteBack();
SaveCopyHistory(copyFolders); SaveCopyHistory(copyFolders);
} }
g_bProcessError = false;
bool useSrcPanel = !useDestPanel || !srcPanel.Is_IO_FS_Folder(); bool useSrcPanel = !useDestPanel || !srcPanel.Is_IO_FS_Folder();
bool useTemp = useSrcPanel && useDestPanel; bool useTemp = useSrcPanel && useDestPanel;
@@ -830,6 +848,62 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
disableNotify1.Restore(); disableNotify1.Restore();
disableNotify2.Restore(); disableNotify2.Restore();
srcPanel.SetFocusToList(); srcPanel.SetFocusToList();
if (!g_bProcessError && result == S_OK)
{
if (openOutputFolder && IsDirectory(destPath))
{
StartApplicationDontWait(destPath, destPath, (HWND)_window);
}
if (deleteSourceFile)
{
DWORD dwAttr;
UString srcFilePath(srcPanel._currentFolderPrefix);
srcPanel.OpenParentFolder();
while (!srcFilePath.IsEmpty())
{
if (srcFilePath.Back() == '\\')
{
srcFilePath.DeleteBack();
}
dwAttr = GetFileAttributesW(srcFilePath);
if (dwAttr == INVALID_FILE_ATTRIBUTES)
{
int n = srcFilePath.ReverseFind(L'\\');
if (n != -1)
{
srcPanel.OpenParentFolder();
srcFilePath.ReleaseBuf_SetEnd(n);
}
else
{
break;
}
}
else if (dwAttr & FILE_ATTRIBUTE_ARCHIVE)
{
if (dwAttr & FILE_ATTRIBUTE_READONLY)
{
dwAttr &= (~FILE_ATTRIBUTE_READONLY);
SetFileAttributesW(srcFilePath, dwAttr);
}
::DeleteFileW(srcFilePath);
break;
}
else //if (dwAttr & FILE_ATTRIBUTE_DIRECTORY)
{
break;
}
} // while
}
if (close7Zip)
{
PostMessage (_window, WM_CLOSE, 0, 0);
}
}
} }
void CApp::OnSetSameFolder(int srcPanelIndex) void CApp::OnSetSameFolder(int srcPanelIndex)

View File

@@ -39,23 +39,23 @@ bool CComboDialog::OnInit()
return CModalDialog::OnInit(); return CModalDialog::OnInit();
} }
bool CComboDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize) //bool CComboDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{ //{
int mx, my; // int mx, my;
GetMargins(8, mx, my); // GetMargins(8, mx, my);
int bx1, bx2, by; // int bx1, bx2, by;
GetItemSizes(IDCANCEL, bx1, by); // GetItemSizes(IDCANCEL, bx1, by);
GetItemSizes(IDOK, bx2, by); // GetItemSizes(IDOK, bx2, by);
int y = ySize - my - by; // int y = ySize - my - by;
int x = xSize - mx - bx1; // int x = xSize - mx - bx1;
//
InvalidateRect(NULL); // InvalidateRect(NULL);
//
MoveItem(IDCANCEL, x, y, bx1, by); // MoveItem(IDCANCEL, x, y, bx1, by);
MoveItem(IDOK, x - mx - bx2, y, bx2, by); // MoveItem(IDOK, x - mx - bx2, y, bx2, by);
ChangeSubWindowSizeX(_comboBox, xSize - mx * 2); // ChangeSubWindowSizeX(_comboBox, xSize - mx * 2);
return false; // return false;
} //}
void CComboDialog::OnOK() void CComboDialog::OnOK()
{ {

View File

@@ -13,7 +13,7 @@ class CComboDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CComboBox _comboBox; NWindows::NControl::CComboBox _comboBox;
virtual void OnOK(); virtual void OnOK();
virtual bool OnInit(); virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize); // virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
public: public:
// bool Sorted; // bool Sorted;
UString Title; UString Title;

View File

@@ -1,14 +1,14 @@
#include "ComboDialogRes.h" #include "ComboDialogRes.h"
#include "../../GuiCommon.rc" #include "../../GuiCommon.rc"
#define xc 240 #define xc 260
#define yc 64 #define yc 64
IDD_COMBO DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT IDD_COMBO DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
CAPTION "Combo" CAPTION "Combo"
{ {
LTEXT "", IDT_COMBO, m, m, xc, 8 LTEXT "", IDT_COMBO, m, m, xc, 8
COMBOBOX IDC_COMBO, m, 20, xc, 65, MY_COMBO_WITH_EDIT COMBOBOX IDC_COMBO, m, 20, xc, 160, MY_COMBO_WITH_EDIT
OK_CANCEL OK_CANCEL
} }

View File

@@ -9,12 +9,31 @@
#include "BrowseDialog.h" #include "BrowseDialog.h"
#include "CopyDialog.h" #include "CopyDialog.h"
#include "Panel.h"
#include "ViewSettings.h"
#ifdef LANG #ifdef LANG
#include "LangUtils.h" #include "LangUtils.h"
#endif #endif
using namespace NWindows; using namespace NWindows;
static bool IsFileExistentAndNotDir(const wchar_t * lpszFile)
{
DWORD dwAttr;
dwAttr = GetFileAttributesW(lpszFile);
return (dwAttr != INVALID_FILE_ATTRIBUTES)
&& ((dwAttr & FILE_ATTRIBUTE_ARCHIVE) != 0)
&& ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) == 0);
}
static bool IsDirectory(LPCWSTR lpszPathFile)
{
DWORD dwAttr;
dwAttr = GetFileAttributesW(lpszPathFile);
return (dwAttr != (DWORD)-1) && ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) != 0);
}
bool CCopyDialog::OnInit() bool CCopyDialog::OnInit()
{ {
#ifdef LANG #ifdef LANG
@@ -23,6 +42,9 @@ bool CCopyDialog::OnInit()
_path.Attach(GetItem(IDC_COPY)); _path.Attach(GetItem(IDC_COPY));
SetText(Title); SetText(Title);
_freeSpace.Attach(GetItem(IDC_FREE_SPACE));
_freeSpace.SetText(L"");
NControl::CStatic staticContol; NControl::CStatic staticContol;
staticContol.Attach(GetItem(IDT_COPY)); staticContol.Attach(GetItem(IDT_COPY));
staticContol.SetText(Static); staticContol.SetText(Static);
@@ -33,8 +55,70 @@ bool CCopyDialog::OnInit()
FOR_VECTOR (i, Strings) FOR_VECTOR (i, Strings)
_path.AddString(Strings[i]); _path.AddString(Strings[i]);
_path.SetText(Value); _path.SetText(Value);
ShowPathFreeSpace(Value);
m_bOpenOutputFolder = ReadOptOpenOutputFolder();
m_bClose7Zip = ReadOptClose7Zip();
CheckButton(IDC_CHECK_OPEN_OUTPUT_FOLDER, m_bOpenOutputFolder);
CheckButton(IDC_CHECK_CLOSE_7ZIP, m_bClose7Zip);
SetItemText(IDT_COPY_INFO, Info); SetItemText(IDT_COPY_INFO, Info);
NormalizeSize(true); NormalizeSize(true);
RECT rc;
GetWindowRect(&rc);
m_sizeMinWindow.cx = (RECT_SIZE_X(rc))*4/5;
m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*4/5;
/////////////////////////////////////////////////////////
m_strRealFileName.Empty();
if (IsDirectory(m_currentFolderPrefix))
{
EnableItem(IDC_COPY_ADD_FILE_NAME, false);
EnableItem(IDC_CHECK_DELETE_SOURCE_FILE, false);
}
else
{
while (!m_currentFolderPrefix.IsEmpty())
{
if (m_currentFolderPrefix.Back() == '\\')
{
m_currentFolderPrefix.DeleteBack();
}
if (IsFileExistentAndNotDir(m_currentFolderPrefix))
{
int n = m_currentFolderPrefix.ReverseFind(L'\\');
int m = m_currentFolderPrefix.ReverseFind(L'.');
if (n != -1)
{
n++;
}
else
{
n = 0;
}
if (m == -1 || m <= n) m = m_currentFolderPrefix.Len();
m_strRealFileName = m_currentFolderPrefix.Mid(n, m - n);
break;
}
else
{
int n = m_currentFolderPrefix.ReverseFind(L'\\');
if (n != -1)
{
m_currentFolderPrefix.ReleaseBuf_SetEnd(n);
}
else
{
break;
}
}
}
}
return CModalDialog::OnInit(); return CModalDialog::OnInit();
} }
@@ -48,28 +132,49 @@ bool CCopyDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
int y = ySize - my - by; int y = ySize - my - by;
int x = xSize - mx - bx1; int x = xSize - mx - bx1;
InvalidateRect(NULL); // InvalidateRect(NULL);
{ {
RECT r; RECT r;
GetClientRectOfItem(IDB_COPY_SET_PATH, r);
int bx = RECT_SIZE_X(r); GetClientRectOfItem(IDC_COPY_ADD_FILE_NAME, r);
MoveItem(IDB_COPY_SET_PATH, xSize - mx - bx, r.top, bx, RECT_SIZE_Y(r)); int bxAddFileName = r.right - r.left;
ChangeSubWindowSizeX(_path, xSize - mx - mx - bx - mx); int byAddFileName = r.bottom - r.top;
MoveItem(IDC_COPY_ADD_FILE_NAME, xSize - mx - bxAddFileName, r.top, bxAddFileName, byAddFileName, false);
GetClientRectOfItem(IDC_COPY_OPEN_PATH, r);
int bxOpen = r.right - r.left;
int byOpen = r.bottom - r.top;
MoveItem(IDC_COPY_OPEN_PATH, xSize - mx - bxOpen - mx/2 - bxAddFileName, r.top, bxOpen, byOpen, false);
GetClientRectOfItem(IDB_COPY_SET_PATH, r);
// int bx = RECT_SIZE_X(r);
int bxSet = RECT_SIZE_X(r);
int bySet = RECT_SIZE_Y(r);
// MoveItem(IDB_COPY_SET_PATH, xSize - mx - bx, r.top, bx, RECT_SIZE_Y(r));
// ChangeSubWindowSizeX(_path, xSize - mx - mx - bx - mx);
MoveItem(IDB_COPY_SET_PATH, xSize - mx - bxSet - bxOpen - mx - bxAddFileName, r.top, bxSet, bySet, false);
ChangeSubWindowSizeX(_path, xSize - mx - mx - bxSet - bxOpen - mx - mx/2 - bxAddFileName, false);
} }
{ {
RECT r; RECT r;
GetClientRectOfItem(IDT_COPY_INFO, r); GetClientRectOfItem(IDT_COPY_INFO, r);
NControl::CStatic staticContol; // NControl::CStatic staticContol;
staticContol.Attach(GetItem(IDT_COPY_INFO)); // staticContol.Attach(GetItem(IDT_COPY_INFO));
int yPos = r.top; int yPos = r.top;
staticContol.Move(mx, yPos, xSize - mx * 2, y - 2 - yPos); int xc = xSize - mx * 2;
// staticContol.Move(mx, yPos, xSize - mx * 2, y - 2 - yPos);
MoveItem(IDT_COPY_INFO, mx, yPos, xc, y - 2 - yPos, false);
GetClientRectOfItem(IDC_AFTER_EXTRACT, r);
MoveItem(IDC_AFTER_EXTRACT, mx, r.top, xc, r.bottom-r.top, false);
} }
MoveItem(IDCANCEL, x, y, bx1, by); MoveItem(IDCANCEL, x, y, bx1, by, false);
MoveItem(IDOK, x - mx - bx2, y, bx2, by); MoveItem(IDOK, x - mx - bx2, y, bx2, by, false);
InvalidateRect(NULL);
return false; return false;
} }
@@ -80,6 +185,25 @@ bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
case IDB_COPY_SET_PATH: case IDB_COPY_SET_PATH:
OnButtonSetPath(); OnButtonSetPath();
return true; return true;
case IDC_COPY_OPEN_PATH:
OnButtonOpenPath();
return true;
case IDC_COPY_ADD_FILE_NAME:
OnButtonAddFileName();
return true;
case IDC_CHECK_OPEN_OUTPUT_FOLDER:
m_bOpenOutputFolder = IsButtonCheckedBool(IDC_CHECK_OPEN_OUTPUT_FOLDER);
return true;
case IDC_CHECK_DELETE_SOURCE_FILE:
m_bDeleteSourceFile = IsButtonCheckedBool(IDC_CHECK_DELETE_SOURCE_FILE);
return true;
case IDC_CHECK_CLOSE_7ZIP:
m_bClose7Zip = IsButtonCheckedBool(IDC_CHECK_CLOSE_7ZIP);
return true;
} }
return CModalDialog::OnButtonClicked(buttonID, buttonHWND); return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
} }
@@ -97,10 +221,191 @@ void CCopyDialog::OnButtonSetPath()
NFile::NName::NormalizeDirPathPrefix(resultPath); NFile::NName::NormalizeDirPathPrefix(resultPath);
_path.SetCurSel(-1); _path.SetCurSel(-1);
_path.SetText(resultPath); _path.SetText(resultPath);
ShowPathFreeSpace(resultPath);
} }
void CCopyDialog::OnOK() void CCopyDialog::OnOK()
{ {
SaveOptOpenOutputFolder(m_bOpenOutputFolder);
SaveOptClose7Zip(m_bClose7Zip);
_path.GetText(Value); _path.GetText(Value);
CModalDialog::OnOK(); CModalDialog::OnOK();
} }
void CCopyDialog::OnButtonOpenPath()
{
UString currentPath;
_path.GetText(currentPath);
if (IsDirectory(currentPath))
{
StartApplicationDontWait(currentPath, currentPath, (HWND)_window);
}
else
{
WCHAR szMsg[1024];
wsprintfW(szMsg, L"Folder \"%s\" is not available yet.\n\n"
L"Note: the program will create the folder automatically when extracting.", (LPCWSTR)currentPath);
MessageBoxW((HWND)_window, szMsg, L"7-Zip", MB_ICONEXCLAMATION);
}
}
void CCopyDialog::OnButtonAddFileName()
{
UString currentPath;
_path.GetText(currentPath);
currentPath.Trim();
if (currentPath.Back() == '\\')
{
currentPath.DeleteBack();
}
UString strLastDir;
int n = currentPath.ReverseFind(L'\\');
if (n != -1)
{
strLastDir = currentPath.Mid(n+1);
}
else
{
strLastDir = currentPath;
}
if (strLastDir != m_strRealFileName)
{
currentPath += L'\\';
currentPath += m_strRealFileName;
_path.SetText(currentPath);
}
_path.SetFocus();
}
bool CCopyDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_GETMINMAXINFO:
{
return OnGetMinMaxInfo((PMINMAXINFO)lParam);
}
}
return CModalDialog::OnMessage(message, wParam, lParam);
}
bool CCopyDialog::OnGetMinMaxInfo(PMINMAXINFO pMMI)
{
pMMI->ptMinTrackSize.x = m_sizeMinWindow.cx;
pMMI->ptMinTrackSize.y = m_sizeMinWindow.cy;
return false;
}
static int MakeByteSizeString64(wchar_t * lpszBuf, size_t ccBuf, unsigned __int64 n64Byte)
{
int nRet = 0;
if (n64Byte < 1000ui64)
{
// < 1K
nRet = swprintf(lpszBuf, ccBuf,
L"%I64d B", n64Byte);
}
else if (n64Byte < 1024000ui64) // 1024 * 1000
{
// 1K <= n64Byte < 1M
nRet = swprintf(lpszBuf, ccBuf,
L"%.1f KB", (double)n64Byte / 1024.0);
}
else if (n64Byte < 1048576000ui64) // 1024 * 1024 * 1000
{
// 1M <= n64Byte < 1G
nRet = swprintf(lpszBuf, ccBuf,
L"%.2f MB", (double)n64Byte / 1048576.0); // 1024 * 1024
}
else if (n64Byte < 1073741824000ui64) // 1024 * 1024 * 1024 * 1000
{
// 1 G <= n64Byte < 1T
nRet = swprintf(lpszBuf, ccBuf,
L"%.2f GB", (double)n64Byte / 1073741824.0); // 1024.0F * 1024.0F * 1024.0F
}
else
{
// n64Byte >= 1T
nRet = swprintf(lpszBuf, ccBuf,
L"%.2f TB", (double)n64Byte / 1099511627776.0);
// 1024.0F * 1024.0F * 1024.0F * 1024.0F
}
return nRet;
}
void CCopyDialog::ShowPathFreeSpace(UString & strPath)
{
bool bBadPath;
UString strText;
strText.Empty();
bBadPath = false;
strPath.Trim();
for (; !IsDirectory(strPath); )
{
int n = strPath.ReverseFind(L'\\');
if (n == -1)
{
bBadPath = true;
break;
}
else
{
strPath.ReleaseBuf_SetEnd(n);
}
}
if (!bBadPath)
{
unsigned __int64 n64FreeBytesAvailable;
unsigned __int64 n64TotalNumberOfBytes;
unsigned __int64 n64TotalNumberOfFreeBytes;
if (GetDiskFreeSpaceExW(strPath, (PULARGE_INTEGER)&n64FreeBytesAvailable,
(PULARGE_INTEGER)&n64TotalNumberOfBytes, (PULARGE_INTEGER)&n64TotalNumberOfFreeBytes))
{
wchar_t szFreeBytes[1024];
wchar_t szTotalBytes[1024];
MakeByteSizeString64(szFreeBytes, 1024-4, n64TotalNumberOfFreeBytes);
MakeByteSizeString64(szTotalBytes, 1024-4, n64TotalNumberOfBytes);
int nLen = swprintf(strText.GetBuf(1024), 1024-4, L"%s Free (Total: %s)", szFreeBytes, szTotalBytes);
strText.ReleaseBuf_SetEnd(nLen);
}
}
_freeSpace.SetText(strText);
}
bool CCopyDialog::OnCommand(int code, int itemID, LPARAM lParam)
{
if (itemID == IDC_COPY)
{
if (code == CBN_EDITCHANGE)
{
UString strPath;
_path.GetText(strPath);
ShowPathFreeSpace(strPath);
return true;
}
else if (code == CBN_SELCHANGE)
{
int nSel = _path.GetCurSel();
if (nSel != CB_ERR)
{
UString strPath;
_path.GetLBText(nSel, strPath);
ShowPathFreeSpace(strPath);
}
return true;
}
}
return CModalDialog::OnCommand(code, itemID, lParam);
}

View File

@@ -8,24 +8,46 @@
#include "CopyDialogRes.h" #include "CopyDialogRes.h"
const int kCopyDialog_NumInfoLines = 11; const int kCopyDialog_NumInfoLines = 14;
class CCopyDialog: public NWindows::NControl::CModalDialog class CCopyDialog: public NWindows::NControl::CModalDialog
{ {
NWindows::NControl::CComboBox _path; NWindows::NControl::CComboBox _path;
NWindows::NControl::CStatic _freeSpace;
virtual void OnOK(); virtual void OnOK();
virtual bool OnInit(); virtual bool OnInit();
virtual bool OnSize(WPARAM wParam, int xSize, int ySize); virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
void OnButtonSetPath(); void OnButtonSetPath();
void OnButtonOpenPath();
void OnButtonAddFileName();
bool OnButtonClicked(int buttonID, HWND buttonHWND); bool OnButtonClicked(int buttonID, HWND buttonHWND);
bool OnCommand(int code, int itemID, LPARAM lParam);
bool OnGetMinMaxInfo(PMINMAXINFO pMMI);
void ShowPathFreeSpace(UString & strPath);
protected:
SIZE m_sizeMinWindow;
public: public:
CCopyDialog(): m_bOpenOutputFolder(false), m_bDeleteSourceFile(false), m_bClose7Zip (false) { m_sizeMinWindow.cx = 0; m_sizeMinWindow.cy = 0; }
UString Title; UString Title;
UString Static; UString Static;
UString Value; UString Value;
UString Info; UString Info;
UStringVector Strings; UStringVector Strings;
bool m_bOpenOutputFolder;
bool m_bDeleteSourceFile;
bool m_bClose7Zip;
UString m_currentFolderPrefix;
UString m_strRealFileName;
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_COPY, parentWindow); } INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_COPY, parentWindow); }
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
}; };
#endif #endif

View File

@@ -1,20 +1,75 @@
#include "CopyDialogRes.h" #include "CopyDialogRes.h"
#include "../../GuiCommon.rc" #include "../../GuiCommon.rc"
#define xc 320 //#define xc 320
#define yc 144 //#define yc 144
//
//#define y 40
//
//IDD_COPY DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
//CAPTION "Copy"
//{
// LTEXT "", IDT_COPY, m, m, xc, 8
// COMBOBOX IDC_COPY, m, 20, xc - bxsDots - m, 65, MY_COMBO_WITH_EDIT
// PUSHBUTTON "...", IDB_COPY_SET_PATH, xs - m - bxsDots, 18, bxsDots, bys, WS_GROUP
// LTEXT "", IDT_COPY_INFO, m, y, xc, by - y - 1, SS_NOPREFIX | SS_LEFTNOWORDWRAP
// OK_CANCEL
//}
#define y 40
#define xc 340
#define yc 190
#define y 78
#define OPEN_XS 28
#define FILENAME_XS 40
#define SPACE_XS 4
#define FILENAME_X (xs - m - FILENAME_XS)
#define OPEN_X (FILENAME_X - OPEN_XS - SPACE_XS)
#define DOTS_X (OPEN_X - bxsDots - SPACE_XS)
#define PATH_Y (m + 12)
#define PATH_XS (DOTS_X - m - SPACE_XS)
#define FREE_SPACE_Y (PATH_Y + 15)
#define AFTER_EXTRACTION_Y (FREE_SPACE_Y + 12)
#define OPTION_SPACE 10
#define OPEN_OUTPUT_FOLDER_X (m + 6)
#define OPEN_OUTPUT_FOLDER_XS 80
#define OPEN_OUTPUT_FOLDER_Y (AFTER_EXTRACTION_Y + 12)
#define DELETE_SOURCE_X (OPEN_OUTPUT_FOLDER_X + OPEN_OUTPUT_FOLDER_XS + OPTION_SPACE)
#define DELETE_SOURCE_XS 88
#define CLOSE_7ZIP_X (DELETE_SOURCE_X + DELETE_SOURCE_XS + OPTION_SPACE)
#define CLOSE_7ZIP_XS 54
#define INFO_Y (AFTER_EXTRACTION_Y + 27 + 4)
#define INFO_YS (by - m - 12 - 15 - 12 - 27 - 4 - 1)
IDD_COPY DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT IDD_COPY DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
CAPTION "Copy" CAPTION "Copy"
{ {
LTEXT "", IDT_COPY, m, m, xc, 8 LTEXT "", IDT_COPY, m, m, xc, 9
COMBOBOX IDC_COPY, m, 20, xc - bxsDots - m, 65, MY_COMBO_WITH_EDIT COMBOBOX IDC_COPY, m, PATH_Y, PATH_XS, 160, MY_COMBO_WITH_EDIT
PUSHBUTTON "...", IDB_COPY_SET_PATH, xs - m - bxsDots, 18, bxsDots, bys, WS_GROUP PUSHBUTTON "...", IDB_COPY_SET_PATH, DOTS_X, PATH_Y - 1, bxsDots, bys - 1, WS_GROUP
LTEXT "", IDT_COPY_INFO, m, y, xc, by - y - 1, SS_NOPREFIX | SS_LEFTNOWORDWRAP PUSHBUTTON "&Open", IDC_COPY_OPEN_PATH, OPEN_X, PATH_Y - 1, OPEN_XS, bys - 1, WS_GROUP
PUSHBUTTON "&Filename", IDC_COPY_ADD_FILE_NAME, FILENAME_X, PATH_Y - 1, FILENAME_XS, bys - 1, WS_GROUP
LTEXT "", IDC_FREE_SPACE, m, FREE_SPACE_Y, xc, 9
GROUPBOX "After extraction completes successfully", IDC_AFTER_EXTRACT, m, AFTER_EXTRACTION_Y, xc, 27
CONTROL "O&pen output folder", IDC_CHECK_OPEN_OUTPUT_FOLDER, MY_CHECKBOX, OPEN_OUTPUT_FOLDER_X, OPEN_OUTPUT_FOLDER_Y, OPEN_OUTPUT_FOLDER_XS, 10
CONTROL "&Delete source archive", IDC_CHECK_DELETE_SOURCE_FILE, MY_CHECKBOX, DELETE_SOURCE_X, OPEN_OUTPUT_FOLDER_Y, DELETE_SOURCE_XS, 10
CONTROL "&Close 7-Zip", IDC_CHECK_CLOSE_7ZIP, MY_CHECKBOX, CLOSE_7ZIP_X, OPEN_OUTPUT_FOLDER_Y, CLOSE_7ZIP_XS, 10
LTEXT "", IDT_COPY_INFO, m, INFO_Y, xc, INFO_YS, SS_NOPREFIX | SS_LEFTNOWORDWRAP
OK_CANCEL OK_CANCEL
} }
#undef xc #undef xc
#undef yc #undef yc

View File

@@ -5,4 +5,12 @@
#define IDB_COPY_SET_PATH 102 #define IDB_COPY_SET_PATH 102
#define IDT_COPY_INFO 103 #define IDT_COPY_INFO 103
#define IDC_CHECK_OPEN_OUTPUT_FOLDER 104
#define IDC_COPY_OPEN_PATH 105
#define IDC_FREE_SPACE 106
#define IDC_COPY_ADD_FILE_NAME 107
#define IDC_CHECK_DELETE_SOURCE_FILE 108
#define IDC_CHECK_CLOSE_7ZIP 109
#define IDC_AFTER_EXTRACT 110
#define IDS_SET_FOLDER 6007 #define IDS_SET_FOLDER 6007

View File

@@ -43,7 +43,7 @@ CEnumFormatEtc::CEnumFormatEtc(const FORMATETC *pFormatEtc, ULONG numFormats)
m_Index = 0; m_Index = 0;
m_NumFormats = 0; m_NumFormats = 0;
m_Formats = new FORMATETC[numFormats]; m_Formats = new FORMATETC[numFormats];
if (m_Formats) // if (m_Formats)
{ {
m_NumFormats = numFormats; m_NumFormats = numFormats;
for (ULONG i = 0; i < numFormats; i++) for (ULONG i = 0; i < numFormats; i++)

Some files were not shown because too many files have changed in this diff Show More