Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/CPP/7zip/UI
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2008-08-13 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:56 +0300
commit173c07e166fdf6fcd20f18ea73008f1b628945df (patch)
tree13ebea85cdc4c16ae93714ff0627ee9f91ad7e08 /CPP/7zip/UI
parent3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff)
4.59 beta
Diffstat (limited to 'CPP/7zip/UI')
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.cpp103
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.h36
-rwxr-xr-xCPP/7zip/UI/Agent/AgentOut.cpp232
-rwxr-xr-xCPP/7zip/UI/Agent/AgentProxy.cpp16
-rwxr-xr-xCPP/7zip/UI/Agent/AgentProxy.h2
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolder.cpp20
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOpen.cpp4
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOut.cpp25
-rwxr-xr-xCPP/7zip/UI/Agent/UpdateCallbackAgent.cpp6
-rwxr-xr-xCPP/7zip/UI/Client7z/Client7z.cpp230
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveCommandLine.cpp186
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveCommandLine.h6
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveExtractCallback.cpp53
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveExtractCallback.h52
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveName.cpp2
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveOpenCallback.cpp66
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveOpenCallback.h50
-rwxr-xr-xCPP/7zip/UI/Common/CompressCall.cpp32
-rwxr-xr-xCPP/7zip/UI/Common/CompressCall.h4
-rwxr-xr-xCPP/7zip/UI/Common/DefaultName.cpp9
-rwxr-xr-xCPP/7zip/UI/Common/DefaultName.h2
-rwxr-xr-xCPP/7zip/UI/Common/DirItem.h61
-rwxr-xr-xCPP/7zip/UI/Common/EnumDirItems.cpp265
-rwxr-xr-xCPP/7zip/UI/Common/EnumDirItems.h28
-rwxr-xr-xCPP/7zip/UI/Common/ExitCode.h2
-rwxr-xr-xCPP/7zip/UI/Common/Extract.cpp97
-rwxr-xr-xCPP/7zip/UI/Common/Extract.h12
-rwxr-xr-xCPP/7zip/UI/Common/ExtractMode.h2
-rwxr-xr-xCPP/7zip/UI/Common/ExtractingFilePath.cpp1
-rwxr-xr-xCPP/7zip/UI/Common/HandlerLoader.h8
-rwxr-xr-xCPP/7zip/UI/Common/IFileExtractCallback.h3
-rwxr-xr-xCPP/7zip/UI/Common/LoadCodecs.cpp116
-rwxr-xr-xCPP/7zip/UI/Common/LoadCodecs.h23
-rwxr-xr-xCPP/7zip/UI/Common/OpenArchive.cpp224
-rwxr-xr-xCPP/7zip/UI/Common/OpenArchive.h53
-rwxr-xr-xCPP/7zip/UI/Common/PropIDUtils.cpp12
-rwxr-xr-xCPP/7zip/UI/Common/SetProperties.cpp2
-rwxr-xr-xCPP/7zip/UI/Common/StdAfx.h2
-rwxr-xr-xCPP/7zip/UI/Common/Update.cpp149
-rwxr-xr-xCPP/7zip/UI/Common/Update.h9
-rwxr-xr-xCPP/7zip/UI/Common/UpdateAction.cpp10
-rwxr-xr-xCPP/7zip/UI/Common/UpdateAction.h2
-rwxr-xr-xCPP/7zip/UI/Common/UpdateCallback.cpp137
-rwxr-xr-xCPP/7zip/UI/Common/UpdateCallback.h26
-rwxr-xr-xCPP/7zip/UI/Common/UpdatePair.cpp125
-rwxr-xr-xCPP/7zip/UI/Common/UpdatePair.h11
-rwxr-xr-xCPP/7zip/UI/Common/UpdateProduce.cpp59
-rwxr-xr-xCPP/7zip/UI/Common/UpdateProduce.h22
-rwxr-xr-xCPP/7zip/UI/Common/WorkDir.cpp4
-rwxr-xr-xCPP/7zip/UI/Common/ZipRegistry.cpp24
-rwxr-xr-xCPP/7zip/UI/Common/ZipRegistry.h6
-rwxr-xr-xCPP/7zip/UI/Console/Console.dsp4
-rwxr-xr-xCPP/7zip/UI/Console/ConsoleClose.h2
-rwxr-xr-xCPP/7zip/UI/Console/ExtractCallbackConsole.cpp83
-rwxr-xr-xCPP/7zip/UI/Console/ExtractCallbackConsole.h20
-rwxr-xr-xCPP/7zip/UI/Console/List.cpp182
-rwxr-xr-xCPP/7zip/UI/Console/List.h9
-rwxr-xr-xCPP/7zip/UI/Console/Main.cpp79
-rwxr-xr-xCPP/7zip/UI/Console/MainAr.cpp10
-rwxr-xr-xCPP/7zip/UI/Console/OpenCallbackConsole.cpp26
-rwxr-xr-xCPP/7zip/UI/Console/OpenCallbackConsole.h13
-rwxr-xr-xCPP/7zip/UI/Console/PercentPrinter.cpp8
-rwxr-xr-xCPP/7zip/UI/Console/PercentPrinter.h2
-rwxr-xr-xCPP/7zip/UI/Console/StdAfx.h2
-rwxr-xr-xCPP/7zip/UI/Console/UpdateCallbackConsole.cpp24
-rwxr-xr-xCPP/7zip/UI/Console/UpdateCallbackConsole.h7
-rwxr-xr-xCPP/7zip/UI/Console/UserInputUtils.cpp4
-rwxr-xr-xCPP/7zip/UI/Console/afxres.h1
-rwxr-xr-xCPP/7zip/UI/Console/makefile1
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenu.cpp235
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenu.h10
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenuFlags.h12
-rwxr-xr-xCPP/7zip/UI/Explorer/DllExports.cpp18
-rwxr-xr-xCPP/7zip/UI/Explorer/Explorer.dsp8
-rwxr-xr-xCPP/7zip/UI/Explorer/FoldersPage.cpp14
-rwxr-xr-xCPP/7zip/UI/Explorer/FoldersPage.rc10
-rwxr-xr-xCPP/7zip/UI/Explorer/MyMessages.cpp38
-rwxr-xr-xCPP/7zip/UI/Explorer/MyMessages.h24
-rwxr-xr-xCPP/7zip/UI/Explorer/OptionsDialog.cpp4
-rwxr-xr-xCPP/7zip/UI/Explorer/OptionsDialog.h4
-rwxr-xr-xCPP/7zip/UI/Explorer/RegistryContextMenu.cpp12
-rwxr-xr-xCPP/7zip/UI/Explorer/StdAfx.h4
-rwxr-xr-xCPP/7zip/UI/Explorer/SystemPage.cpp37
-rwxr-xr-xCPP/7zip/UI/Explorer/SystemPage.rc14
-rwxr-xr-xCPP/7zip/UI/Explorer/makefile1
-rwxr-xr-xCPP/7zip/UI/Explorer/resource.h44
-rwxr-xr-xCPP/7zip/UI/Far/ExtractEngine.cpp42
-rwxr-xr-xCPP/7zip/UI/Far/ExtractEngine.h31
-rwxr-xr-xCPP/7zip/UI/Far/Far.dsp4
-rwxr-xr-xCPP/7zip/UI/Far/FarUtils.cpp86
-rwxr-xr-xCPP/7zip/UI/Far/FarUtils.h34
-rwxr-xr-xCPP/7zip/UI/Far/Main.cpp248
-rwxr-xr-xCPP/7zip/UI/Far/Messages.h35
-rwxr-xr-xCPP/7zip/UI/Far/OverwriteDialog.cpp8
-rwxr-xr-xCPP/7zip/UI/Far/Plugin.cpp384
-rwxr-xr-xCPP/7zip/UI/Far/Plugin.h16
-rwxr-xr-xCPP/7zip/UI/Far/PluginCommon.cpp6
-rwxr-xr-xCPP/7zip/UI/Far/PluginDelete.cpp13
-rwxr-xr-xCPP/7zip/UI/Far/PluginRead.cpp65
-rwxr-xr-xCPP/7zip/UI/Far/PluginWrite.cpp98
-rwxr-xr-xCPP/7zip/UI/Far/ProgressBox.cpp142
-rwxr-xr-xCPP/7zip/UI/Far/ProgressBox.h27
-rwxr-xr-xCPP/7zip/UI/Far/UpdateCallback100.cpp21
-rwxr-xr-xCPP/7zip/UI/Far/UpdateCallback100.h31
-rwxr-xr-xCPP/7zip/UI/Far/makefile1
-rwxr-xr-xCPP/7zip/UI/FileManager/AboutDialog.cpp4
-rwxr-xr-xCPP/7zip/UI/FileManager/App.cpp249
-rwxr-xr-xCPP/7zip/UI/FileManager/App.h68
-rwxr-xr-xCPP/7zip/UI/FileManager/AppState.h2
-rwxr-xr-xCPP/7zip/UI/FileManager/ClassDefs.cpp2
-rwxr-xr-xCPP/7zip/UI/FileManager/ComboDialog.cpp10
-rwxr-xr-xCPP/7zip/UI/FileManager/CopyDialog.cpp17
-rwxr-xr-xCPP/7zip/UI/FileManager/CopyDialog.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/CopyDialog.rc10
-rwxr-xr-xCPP/7zip/UI/FileManager/CopyDialogRes.h1
-rwxr-xr-xCPP/7zip/UI/FileManager/EditPage.cpp2
-rwxr-xr-xCPP/7zip/UI/FileManager/EnumFormatEtc.cpp6
-rwxr-xr-xCPP/7zip/UI/FileManager/ExtractCallback.cpp152
-rwxr-xr-xCPP/7zip/UI/FileManager/ExtractCallback.h27
-rwxr-xr-xCPP/7zip/UI/FileManager/FM.cpp148
-rwxr-xr-xCPP/7zip/UI/FileManager/FM.dsp4
-rwxr-xr-xCPP/7zip/UI/FileManager/FSDrives.cpp95
-rwxr-xr-xCPP/7zip/UI/FileManager/FSDrives.h2
-rwxr-xr-xCPP/7zip/UI/FileManager/FSFolder.cpp98
-rwxr-xr-xCPP/7zip/UI/FileManager/FSFolder.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/FSFolderCopy.cpp38
-rwxr-xr-xCPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp96
-rwxr-xr-xCPP/7zip/UI/FileManager/FileFolderPluginOpen.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/FilePlugins.cpp2
-rwxr-xr-xCPP/7zip/UI/FileManager/FormatUtils.cpp8
-rwxr-xr-xCPP/7zip/UI/FileManager/FormatUtils.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/IFolder.h12
-rwxr-xr-xCPP/7zip/UI/FileManager/LangPage.cpp4
-rwxr-xr-xCPP/7zip/UI/FileManager/LangPage.h2
-rwxr-xr-xCPP/7zip/UI/FileManager/LangUtils.cpp10
-rwxr-xr-xCPP/7zip/UI/FileManager/ListViewDialog.cpp20
-rwxr-xr-xCPP/7zip/UI/FileManager/ListViewDialog.rc2
-rwxr-xr-xCPP/7zip/UI/FileManager/MessagesDialog.cpp54
-rwxr-xr-xCPP/7zip/UI/FileManager/MessagesDialog.rc2
-rwxr-xr-xCPP/7zip/UI/FileManager/MyLoadMenu.cpp27
-rwxr-xr-xCPP/7zip/UI/FileManager/MyLoadMenu.h3
-rwxr-xr-xCPP/7zip/UI/FileManager/NetFolder.cpp39
-rwxr-xr-xCPP/7zip/UI/FileManager/NetFolder.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/OpenCallback.cpp83
-rwxr-xr-xCPP/7zip/UI/FileManager/OpenCallback.h45
-rwxr-xr-xCPP/7zip/UI/FileManager/OverwriteDialog.cpp38
-rwxr-xr-xCPP/7zip/UI/FileManager/OverwriteDialog.h2
-rwxr-xr-xCPP/7zip/UI/FileManager/Panel.cpp300
-rwxr-xr-xCPP/7zip/UI/FileManager/Panel.h97
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelCopy.cpp26
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelCrc.cpp12
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelDrag.cpp48
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelFolderChange.cpp259
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelItemOpen.cpp146
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelItems.cpp70
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelKey.cpp8
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelListNotify.cpp36
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelMenu.cpp79
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelOperations.cpp188
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelSelect.cpp6
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelSort.cpp45
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelSplitFile.cpp278
-rwxr-xr-xCPP/7zip/UI/FileManager/PasswordDialog.cpp10
-rwxr-xr-xCPP/7zip/UI/FileManager/PhysDriveFolder.cpp38
-rwxr-xr-xCPP/7zip/UI/FileManager/PhysDriveFolder.h6
-rwxr-xr-xCPP/7zip/UI/FileManager/PluginInterface.h16
-rwxr-xr-xCPP/7zip/UI/FileManager/PluginLoader.h6
-rwxr-xr-xCPP/7zip/UI/FileManager/PluginsPage.cpp25
-rwxr-xr-xCPP/7zip/UI/FileManager/PluginsPage.rc4
-rwxr-xr-xCPP/7zip/UI/FileManager/ProgressDialog.cpp35
-rwxr-xr-xCPP/7zip/UI/FileManager/ProgressDialog.h7
-rwxr-xr-xCPP/7zip/UI/FileManager/ProgressDialog2.cpp66
-rwxr-xr-xCPP/7zip/UI/FileManager/ProgressDialog2.h17
-rwxr-xr-xCPP/7zip/UI/FileManager/ProgressDialog2.rc8
-rwxr-xr-xCPP/7zip/UI/FileManager/PropertyName.cpp50
-rwxr-xr-xCPP/7zip/UI/FileManager/PropertyName.h2
-rwxr-xr-xCPP/7zip/UI/FileManager/PropertyName.rc14
-rwxr-xr-xCPP/7zip/UI/FileManager/PropertyNameRes.h15
-rwxr-xr-xCPP/7zip/UI/FileManager/RegistryAssociations.cpp20
-rwxr-xr-xCPP/7zip/UI/FileManager/RegistryAssociations.h6
-rwxr-xr-xCPP/7zip/UI/FileManager/RegistryPlugins.cpp4
-rwxr-xr-xCPP/7zip/UI/FileManager/RegistryPlugins.h2
-rwxr-xr-xCPP/7zip/UI/FileManager/RootFolder.cpp113
-rwxr-xr-xCPP/7zip/UI/FileManager/RootFolder.h8
-rwxr-xr-xCPP/7zip/UI/FileManager/SettingsPage.cpp4
-rwxr-xr-xCPP/7zip/UI/FileManager/SettingsPage.rc16
-rwxr-xr-xCPP/7zip/UI/FileManager/SplitDialog.cpp14
-rwxr-xr-xCPP/7zip/UI/FileManager/StringUtils.cpp2
-rwxr-xr-xCPP/7zip/UI/FileManager/SysIconUtils.cpp34
-rwxr-xr-xCPP/7zip/UI/FileManager/SysIconUtils.h8
-rwxr-xr-xCPP/7zip/UI/FileManager/SystemPage.cpp68
-rwxr-xr-xCPP/7zip/UI/FileManager/SystemPage.rc2
-rwxr-xr-xCPP/7zip/UI/FileManager/TextPairs.cpp8
-rwxr-xr-xCPP/7zip/UI/FileManager/UpdateCallback100.cpp29
-rwxr-xr-xCPP/7zip/UI/FileManager/UpdateCallback100.h28
-rwxr-xr-xCPP/7zip/UI/FileManager/ViewSettings.cpp2
-rwxr-xr-xCPP/7zip/UI/FileManager/ViewSettings.h16
-rwxr-xr-xCPP/7zip/UI/FileManager/makefile1
-rwxr-xr-xCPP/7zip/UI/FileManager/resource.h11
-rwxr-xr-xCPP/7zip/UI/FileManager/resource.rc23
-rwxr-xr-xCPP/7zip/UI/GUI/BenchmarkDialog.cpp52
-rwxr-xr-xCPP/7zip/UI/GUI/BenchmarkDialog.h6
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.cpp94
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.h6
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.rc4
-rwxr-xr-xCPP/7zip/UI/GUI/Extract.rc6
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractDialog.cpp22
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractGUI.cpp38
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractGUI.h5
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractRes.h4
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.cpp161
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.dsp12
-rwxr-xr-xCPP/7zip/UI/GUI/OpenCallbackGUI.cpp61
-rwxr-xr-xCPP/7zip/UI/GUI/OpenCallbackGUI.h35
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateCallbackGUI.cpp91
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateCallbackGUI.h10
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateGUI.cpp38
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateGUI.h4
-rwxr-xr-xCPP/7zip/UI/GUI/makefile2
-rwxr-xr-xCPP/7zip/UI/GUI/resource.h26
220 files changed, 5152 insertions, 4154 deletions
diff --git a/CPP/7zip/UI/Agent/Agent.cpp b/CPP/7zip/UI/Agent/Agent.cpp
index 82ae33bc..b0cb559f 100755
--- a/CPP/7zip/UI/Agent/Agent.cpp
+++ b/CPP/7zip/UI/Agent/Agent.cpp
@@ -22,9 +22,9 @@ extern "C"
using namespace NWindows;
STDMETHODIMP CAgentFolder::GetAgentFolder(CAgentFolder **agentFolder)
-{
- *agentFolder = this;
- return S_OK;
+{
+ *agentFolder = this;
+ return S_OK;
}
void CAgentFolder::LoadFolder(CProxyFolder *folder)
@@ -137,13 +137,13 @@ STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARI
const CProxyFolder &item = folder->Folders[realIndex];
if (!_flatMode && propID == kpidSize)
prop = item.Size;
- else if (!_flatMode && propID == kpidPackedSize)
+ else if (!_flatMode && propID == kpidPackSize)
prop = item.PackSize;
else
switch(propID)
{
- case kpidIsFolder: prop = true; break;
- case kpidNumSubFolders: prop = item.NumSubFolders; break;
+ case kpidIsDir: prop = true; break;
+ case kpidNumSubDirs: prop = item.NumSubFolders; break;
case kpidNumSubFiles: prop = item.NumSubFiles; break;
case kpidName: prop = item.Name; break;
case kpidCRC:
@@ -153,7 +153,7 @@ STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARI
RINOK(_agentSpec->GetArchive()->GetProperty(item.Index, propID, value));
}
if (item.CrcIsDefined && value->vt == VT_EMPTY)
- prop = item.Crc;
+ prop = item.Crc;
break;
}
case kpidPrefix: GetPrefixIfAny(itemIndex, prop); break;
@@ -169,10 +169,10 @@ STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARI
const CProxyFile &item = folder->Files[realIndex];
switch(propID)
{
- case kpidIsFolder: prop = false; break;
+ case kpidIsDir: prop = false; break;
case kpidName: prop = item.Name; break;
case kpidPrefix: GetPrefixIfAny(itemIndex, prop); break;
- default:
+ default:
return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
}
}
@@ -238,9 +238,9 @@ STDMETHODIMP CAgentFolder::BindToParentFolder(IFolderFolder **resultFolder)
COM_TRY_END
}
-STATPROPSTG kProperties[] =
+STATPROPSTG kProperties[] =
{
- { NULL, kpidNumSubFolders, VT_UI4},
+ { NULL, kpidNumSubDirs, VT_UI4},
{ NULL, kpidNumSubFiles, VT_UI4},
{ NULL, kpidPrefix, VT_BSTR}
};
@@ -287,11 +287,11 @@ STDMETHODIMP CAgentFolder::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *pro
COM_TRY_END
}
-STATPROPSTG kFolderProps[] =
+STATPROPSTG kFolderProps[] =
{
{ NULL, kpidSize, VT_UI8},
- { NULL, kpidPackedSize, VT_UI8},
- { NULL, kpidNumSubFolders, VT_UI4},
+ { NULL, kpidPackSize, VT_UI8},
+ { NULL, kpidNumSubDirs, VT_UI4},
{ NULL, kpidNumSubFiles, VT_UI4},
{ NULL, kpidCRC, VT_UI4}
};
@@ -304,12 +304,12 @@ STDMETHODIMP CAgentFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
NWindows::NCOM::CPropVariant prop;
switch(propID)
{
- case kpidSize: prop = _proxyFolderItem->Size; break;
- case kpidPackedSize: prop = _proxyFolderItem->PackSize; break;
- case kpidNumSubFolders: prop = _proxyFolderItem->NumSubFolders; break;
- case kpidNumSubFiles: prop = _proxyFolderItem->NumSubFiles; break;
- case kpidName: prop = _proxyFolderItem->Name; break;
- case kpidPath: prop = _proxyFolderItem->GetFullPathPrefix(); break;
+ case kpidSize: prop = _proxyFolderItem->Size; break;
+ case kpidPackSize: prop = _proxyFolderItem->PackSize; break;
+ case kpidNumSubDirs: prop = _proxyFolderItem->NumSubFolders; break;
+ case kpidNumSubFiles: prop = _proxyFolderItem->NumSubFiles; break;
+ case kpidName: prop = _proxyFolderItem->Name; break;
+ case kpidPath: prop = _proxyFolderItem->GetFullPathPrefix(); break;
case kpidType: prop = UString(L"7-Zip.") + _agentSpec->ArchiveType; break;
case kpidCRC: if (_proxyFolderItem->CrcIsDefined) prop = _proxyFolderItem->Crc; break;
}
@@ -373,10 +373,10 @@ void CAgentFolder::GetRealIndices(const UInt32 *indices, UInt32 numItems, CUIntV
HeapSort(&realIndices.Front(), realIndices.Size());
}
-STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
- UInt32 numItems,
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode,
+STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
+ UInt32 numItems,
+ NExtract::NPathMode::EEnum pathMode,
+ NExtract::NOverwriteMode::EEnum overwriteMode,
const wchar_t *path,
INT32 testMode,
IFolderArchiveExtractCallback *extractCallback2)
@@ -399,20 +399,20 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
extractCallbackSpec->InitForMulti(false, pathMode, overwriteMode);
- extractCallbackSpec->Init(_agentSpec->GetArchive(),
- extractCallback2,
+ extractCallbackSpec->Init(_agentSpec->GetArchive(),
+ extractCallback2,
false,
(path ? path : L""),
- pathParts,
+ pathParts,
_agentSpec->DefaultName,
- _agentSpec->DefaultTime,
- _agentSpec->DefaultAttributes,
+ _agentSpec->DefaultTime,
+ _agentSpec->DefaultAttrib,
(UInt64)(Int64)-1
// ,_agentSpec->_srcDirectoryPrefix
);
CUIntVector realIndices;
GetRealIndices(indices, numItems, realIndices);
- return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
+ return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
realIndices.Size(), testMode, extractCallback);
COM_TRY_END
}
@@ -433,7 +433,7 @@ CAgent::~CAgent()
}
STDMETHODIMP CAgent::Open(
- const wchar_t *filePath,
+ const wchar_t *filePath,
BSTR *archiveType,
// CLSID *clsIDResult,
IArchiveOpenCallback *openArchiveCallback)
@@ -443,7 +443,7 @@ STDMETHODIMP CAgent::Open(
NFile::NFind::CFileInfoW fileInfo;
if (!NFile::NFind::FindFile(_archiveFilePath, fileInfo))
return ::GetLastError();
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
return E_FAIL;
CArcInfoEx archiverInfo0, archiverInfo1;
@@ -452,14 +452,13 @@ STDMETHODIMP CAgent::Open(
_compressCodecsInfo = _codecs;
RINOK(_codecs->Load());
- HRESULT res = OpenArchive(_codecs, _archiveFilePath, _archiveLink, openArchiveCallback);
+ RINOK(OpenArchive(_codecs, CIntVector(), _archiveFilePath, _archiveLink, openArchiveCallback));
// _archive = _archiveLink.GetArchive();
DefaultName = _archiveLink.GetDefaultItemName();
const CArcInfoEx &ai = _codecs->Formats[_archiveLink.GetArchiverIndex()];
- RINOK(res);
- DefaultTime = fileInfo.LastWriteTime;
- DefaultAttributes = fileInfo.Attributes;
+ DefaultTime = fileInfo.MTime;
+ DefaultAttrib = fileInfo.Attrib;
ArchiveType = ai.Name;
if (archiveType != 0)
{
@@ -470,7 +469,7 @@ STDMETHODIMP CAgent::Open(
COM_TRY_END
}
-STDMETHODIMP CAgent::ReOpen(IArchiveOpenCallback * /* openArchiveCallback */)
+STDMETHODIMP CAgent::ReOpen(IArchiveOpenCallback *openArchiveCallback)
{
COM_TRY_BEGIN
if (_proxyArchive != NULL)
@@ -478,7 +477,7 @@ STDMETHODIMP CAgent::ReOpen(IArchiveOpenCallback * /* openArchiveCallback */)
delete _proxyArchive;
_proxyArchive = NULL;
}
- RINOK(ReOpenArchive(_codecs, _archiveLink, _archiveFilePath));
+ RINOK(ReOpenArchive(_codecs, _archiveLink, _archiveFilePath, openArchiveCallback));
return ReadItems();
COM_TRY_END
}
@@ -508,10 +507,10 @@ HRESULT CAgent::ReadItems()
if (_proxyArchive != NULL)
return S_OK;
_proxyArchive = new CProxyArchive();
- return _proxyArchive->Load(GetArchive(),
- DefaultName,
- // _defaultTime,
- // _defaultAttributes,
+ return _proxyArchive->Load(GetArchive(),
+ DefaultName,
+ // _defaultTime,
+ // _defaultAttrib,
NULL);
}
@@ -529,8 +528,8 @@ STDMETHODIMP CAgent::BindToRootFolder(IFolderFolder **resultFolder)
STDMETHODIMP CAgent::Extract(
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode,
+ NExtract::NPathMode::EEnum pathMode,
+ NExtract::NOverwriteMode::EEnum overwriteMode,
const wchar_t *path,
INT32 testMode,
IFolderArchiveExtractCallback *extractCallback2)
@@ -539,14 +538,14 @@ STDMETHODIMP CAgent::Extract(
CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
extractCallbackSpec->InitForMulti(false, pathMode, overwriteMode);
- extractCallbackSpec->Init(GetArchive(),
- extractCallback2,
+ extractCallbackSpec->Init(GetArchive(),
+ extractCallback2,
false,
path,
- UStringVector(),
+ UStringVector(),
DefaultName,
- DefaultTime,
- DefaultAttributes,
+ DefaultTime,
+ DefaultAttrib,
(UInt64)(Int64)-1
// ,_srcDirectoryPrefix
);
@@ -561,7 +560,7 @@ STDMETHODIMP CAgent::GetNumberOfProperties(UInt32 *numProperties)
COM_TRY_END
}
-STDMETHODIMP CAgent::GetPropertyInfo(UInt32 index,
+STDMETHODIMP CAgent::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
COM_TRY_BEGIN
@@ -586,11 +585,11 @@ STDMETHODIMP CAgent::GetNumberOfArchiveProperties(UInt32 *numProperties)
COM_TRY_END
}
-STDMETHODIMP CAgent::GetArchivePropertyInfo(UInt32 index,
+STDMETHODIMP CAgent::GetArchivePropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
COM_TRY_BEGIN
- return GetArchive()->GetArchivePropertyInfo(index,
+ return GetArchive()->GetArchivePropertyInfo(index,
name, propID, varType);
COM_TRY_END
}
diff --git a/CPP/7zip/UI/Agent/Agent.h b/CPP/7zip/UI/Agent/Agent.h
index 0f2d7573..64fb31f6 100755
--- a/CPP/7zip/UI/Agent/Agent.h
+++ b/CPP/7zip/UI/Agent/Agent.h
@@ -21,7 +21,7 @@ class CAgentFolder;
DECL_INTERFACE(IArchiveFolderInternal, 0x01, 0xC)
{
- STDMETHOD(GetAgentFolder)(CAgentFolder **agentFolder) PURE;
+ STDMETHOD(GetAgentFolder)(CAgentFolder **agentFolder) PURE;
};
struct CProxyItem
@@ -32,7 +32,7 @@ struct CProxyItem
class CAgent;
-class CAgentFolder:
+class CAgentFolder:
public IFolderFolder,
public IFolderProperties,
public IGetFolderArchiveProperties,
@@ -46,7 +46,7 @@ class CAgentFolder:
{
public:
- MY_QUERYINTERFACE_BEGIN
+ MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(IFolderFolder)
MY_QUERYINTERFACE_ENTRY(IFolderProperties)
MY_QUERYINTERFACE_ENTRY(IGetFolderArchiveProperties)
@@ -69,9 +69,9 @@ public:
STDMETHOD(GetFolderArchiveProperties)(IFolderArchiveProperties **object);
// IArchiveFolder
- STDMETHOD(Extract)(const UINT32 *indices, UINT32 numItems,
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode,
+ STDMETHOD(Extract)(const UINT32 *indices, UINT32 numItems,
+ NExtract::NPathMode::EEnum pathMode,
+ NExtract::NOverwriteMode::EEnum overwriteMode,
const wchar_t *path,
INT32 testMode,
IFolderArchiveExtractCallback *extractCallback);
@@ -103,7 +103,7 @@ public:
bool deleteOperation,
bool createFolderOperation,
bool renameOperation,
- const wchar_t *newItemName,
+ const wchar_t *newItemName,
const NUpdateArchive::CActionSet *actionSet,
const UINT32 *indices, UINT32 numItems,
IFolderArchiveUpdateCallback *updateCallback100);
@@ -126,7 +126,7 @@ public:
private:
};
-class CAgent:
+class CAgent:
public IInFolderArchive,
public IFolderArchiveProperties,
#ifndef EXTRACT_ONLY
@@ -137,7 +137,7 @@ class CAgent:
{
public:
- MY_QUERYINTERFACE_BEGIN
+ MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(IInFolderArchive)
MY_QUERYINTERFACE_ENTRY(IFolderArchiveProperties)
#ifndef EXTRACT_ONLY
@@ -154,19 +154,19 @@ public:
INTERFACE_IOutFolderArchive(;)
HRESULT CommonUpdate(
- const wchar_t *newArchiveName,
+ const wchar_t *newArchiveName,
int numUpdateItems,
IArchiveUpdateCallback *updateCallback);
HRESULT CreateFolder(
- const wchar_t *newArchiveName,
- const wchar_t *folderName,
+ const wchar_t *newArchiveName,
+ const wchar_t *folderName,
IFolderArchiveUpdateCallback *updateCallback100);
HRESULT RenameItem(
- const wchar_t *newArchiveName,
- const UINT32 *indices, UINT32 numItems,
- const wchar_t *newItemName,
+ const wchar_t *newArchiveName,
+ const UINT32 *indices, UINT32 numItems,
+ const wchar_t *newItemName,
IFolderArchiveUpdateCallback *updateCallback100);
// ISetProperties
@@ -189,7 +189,7 @@ public:
UString DefaultName;
FILETIME DefaultTime;
- UINT32 DefaultAttributes;
+ DWORD DefaultAttrib;
UString ArchiveType;
@@ -211,7 +211,7 @@ public:
};
#ifdef NEW_FOLDER_INTERFACE
-class CArchiveFolderManager:
+class CArchiveFolderManager:
public IFolderManager,
public CMyUnknownImp
{
@@ -223,7 +223,7 @@ public:
CArchiveFolderManager(): _codecs(0) {}
private:
void LoadFormats();
- int FindFormat(const UString &type);
+ int FindFormat(const UString &type);
CCodecs *_codecs;
CMyComPtr<ICompressCodecsInfo> _compressCodecsInfo;
};
diff --git a/CPP/7zip/UI/Agent/AgentOut.cpp b/CPP/7zip/UI/Agent/AgentOut.cpp
index 7976e1a2..2e953aed 100755
--- a/CPP/7zip/UI/Agent/AgentOut.cpp
+++ b/CPP/7zip/UI/Agent/AgentOut.cpp
@@ -2,13 +2,14 @@
#include "StdAfx.h"
-#include "Common/StringConvert.h"
#include "Common/IntToString.h"
+#include "Common/StringConvert.h"
#include "Windows/Defs.h"
+#include "Windows/FileDir.h"
#include "Windows/PropVariant.h"
#include "Windows/PropVariantConversions.h"
-#include "Windows/FileDir.h"
+#include "Windows/Time.h"
#include "../../Compress/Copy/CopyCoder.h"
#include "../../Common/FileStreams.h"
@@ -54,7 +55,7 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
for (;;)
{
CMyComPtr<IFolderFolder> newFolder;
- folderItem->BindToParentFolder(&newFolder);
+ folderItem->BindToParentFolder(&newFolder);
if (newFolder == NULL)
break;
@@ -73,22 +74,22 @@ STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
return S_OK;
}
-STDMETHODIMP CAgent::SetFiles(const wchar_t *folderPrefix,
- const wchar_t **names, UINT32 numNames)
+STDMETHODIMP CAgent::SetFiles(const wchar_t *folderPrefix,
+ const wchar_t **names, UInt32 numNames)
{
_folderPrefix = folderPrefix;
_names.Clear();
_names.Reserve(numNames);
- for (UINT32 i = 0; i < numNames; i++)
+ for (UInt32 i = 0; i < numNames; i++)
_names.Add(names[i]);
return S_OK;
}
-static HRESULT GetFileTime(CAgent *agent, UINT32 itemIndex, FILETIME &fileTime)
+static HRESULT GetFileTime(CAgent *agent, UInt32 itemIndex, FILETIME &fileTime)
{
CPropVariant property;
- RINOK(agent->GetArchive()->GetProperty(itemIndex, kpidLastWriteTime, &property));
+ RINOK(agent->GetArchive()->GetProperty(itemIndex, kpidMTime, &property));
if (property.vt == VT_FILETIME)
fileTime = property.filetime;
else if (property.vt == VT_EMPTY)
@@ -99,54 +100,54 @@ static HRESULT GetFileTime(CAgent *agent, UINT32 itemIndex, FILETIME &fileTime)
}
static HRESULT EnumerateArchiveItems(CAgent *agent,
- const CProxyFolder &item,
+ const CProxyFolder &item,
const UString &prefix,
- CObjectVector<CArchiveItem> &archiveItems)
+ CObjectVector<CArcItem> &arcItems)
{
int i;
- for(i = 0; i < item.Files.Size(); i++)
+ for (i = 0; i < item.Files.Size(); i++)
{
const CProxyFile &fileItem = item.Files[i];
- CArchiveItem archiveItem;
+ CArcItem ai;
- RINOK(::GetFileTime(agent, fileItem.Index, archiveItem.LastWriteTime));
+ RINOK(::GetFileTime(agent, fileItem.Index, ai.MTime));
CPropVariant property;
agent->GetArchive()->GetProperty(fileItem.Index, kpidSize, &property);
- archiveItem.SizeIsDefined = (property.vt != VT_EMPTY);
- if (archiveItem.SizeIsDefined)
- archiveItem.Size = ConvertPropVariantToUInt64(property);
- archiveItem.IsDirectory = false;
- archiveItem.Name = prefix + fileItem.Name;
- archiveItem.Censored = true; // test it
- archiveItem.IndexInServer = fileItem.Index;
- archiveItems.Add(archiveItem);
+ ai.SizeDefined = (property.vt != VT_EMPTY);
+ if (ai.SizeDefined)
+ ai.Size = ConvertPropVariantToUInt64(property);
+ ai.IsDir = false;
+ ai.Name = prefix + fileItem.Name;
+ ai.Censored = true; // test it
+ ai.IndexInServer = fileItem.Index;
+ arcItems.Add(ai);
}
- for(i = 0; i < item.Folders.Size(); i++)
+ for (i = 0; i < item.Folders.Size(); i++)
{
const CProxyFolder &dirItem = item.Folders[i];
UString fullName = prefix + dirItem.Name;
if(dirItem.IsLeaf)
{
- CArchiveItem archiveItem;
- RINOK(::GetFileTime(agent, dirItem.Index, archiveItem.LastWriteTime));
- archiveItem.IsDirectory = true;
- archiveItem.SizeIsDefined = false;
- archiveItem.Name = fullName;
- archiveItem.Censored = true; // test it
- archiveItem.IndexInServer = dirItem.Index;
- archiveItems.Add(archiveItem);
+ CArcItem ai;
+ RINOK(::GetFileTime(agent, dirItem.Index, ai.MTime));
+ ai.IsDir = true;
+ ai.SizeDefined = false;
+ ai.Name = fullName;
+ ai.Censored = true; // test it
+ ai.IndexInServer = dirItem.Index;
+ arcItems.Add(ai);
}
- RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(L'\\'), archiveItems));
+ RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(L'\\'), arcItems));
}
return S_OK;
}
STDMETHODIMP CAgent::DoOperation(
- CCodecs *codecs,
+ CCodecs *codecs,
int formatIndex,
- const wchar_t *newArchiveName,
- const Byte *stateActions,
+ const wchar_t *newArchiveName,
+ const Byte *stateActions,
const wchar_t *sfxModule,
IFolderArchiveUpdateCallback *updateCallback100)
{
@@ -157,16 +158,16 @@ STDMETHODIMP CAgent::DoOperation(
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
actionSet.StateActions[i] = (NUpdateArchive::NPairAction::EEnum)stateActions[i];
- CObjectVector<CDirItem> dirItems;
+ CDirItems dirItems;
- UString folderPrefix = _folderPrefix;
- NFile::NName::NormalizeDirPathPrefix(folderPrefix);
- UStringVector errorPaths;
- CRecordVector<DWORD> errorCodes;
- ::EnumerateDirItems(folderPrefix, _names, _archiveNamePrefix, dirItems, errorPaths, errorCodes);
- if (errorCodes.Size() > 0)
{
- return errorCodes.Front();
+ UString folderPrefix = _folderPrefix;
+ NFile::NName::NormalizeDirPathPrefix(folderPrefix);
+ UStringVector errorPaths;
+ CRecordVector<DWORD> errorCodes;
+ dirItems.EnumerateDirItems2(folderPrefix, _archiveNamePrefix, _names, errorPaths, errorCodes);
+ if (errorCodes.Size() > 0)
+ return errorCodes.Front();
}
CMyComPtr<IOutArchive> outArchive;
@@ -193,7 +194,7 @@ STDMETHODIMP CAgent::DoOperation(
}
NFileTimeType::EEnum fileTimeType;
- UINT32 value;
+ UInt32 value;
RINOK(outArchive->GetFileTimeType(&value));
switch(value)
@@ -207,19 +208,21 @@ STDMETHODIMP CAgent::DoOperation(
return E_FAIL;
}
- CObjectVector<CUpdatePair> updatePairs;
- CObjectVector<CArchiveItem> archiveItems;
+ CObjectVector<CArcItem> arcItems;
if (GetArchive())
{
RINOK(ReadItems());
- EnumerateArchiveItems(this, _proxyArchive->RootFolder, L"", archiveItems);
+ EnumerateArchiveItems(this, _proxyArchive->RootFolder, L"", arcItems);
}
- GetUpdatePairInfoList(dirItems, archiveItems, fileTimeType, updatePairs);
-
- CObjectVector<CUpdatePair2> updatePairs2;
- UpdateProduce(updatePairs, actionSet, updatePairs2);
+ CRecordVector<CUpdatePair2> updatePairs2;
+
+ {
+ CRecordVector<CUpdatePair> updatePairs;
+ GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs);
+ UpdateProduce(updatePairs, actionSet, updatePairs2);
+ }
UInt32 numFiles = 0;
for (i = 0; i < updatePairs2.Size(); i++)
@@ -236,9 +239,8 @@ STDMETHODIMP CAgent::DoOperation(
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec );
- updateCallbackSpec->DirPrefix = folderPrefix;
updateCallbackSpec->DirItems = &dirItems;
- updateCallbackSpec->ArchiveItems = &archiveItems;
+ updateCallbackSpec->ArcItems = &arcItems;
updateCallbackSpec->UpdatePairs = &updatePairs2;
updateCallbackSpec->Archive = GetArchive();
updateCallbackSpec->Callback = &updateCallbackAgent;
@@ -305,12 +307,12 @@ STDMETHODIMP CAgent::DoOperation(
}
STDMETHODIMP CAgent::DoOperation2(
- const wchar_t *newArchiveName,
- const Byte *stateActions,
+ const wchar_t *newArchiveName,
+ const Byte *stateActions,
const wchar_t *sfxModule,
IFolderArchiveUpdateCallback *updateCallback100)
{
- return DoOperation(_codecs, -1, newArchiveName,
+ return DoOperation(_codecs, -1, newArchiveName,
stateActions, sfxModule, updateCallback100);
}
@@ -370,8 +372,8 @@ HRESULT CAgent::CommonUpdate(
STDMETHODIMP CAgent::DeleteItems(
- const wchar_t *newArchiveName,
- const UINT32 *indices, UINT32 numItems,
+ const wchar_t *newArchiveName,
+ const UInt32 *indices, UInt32 numItems,
IFolderArchiveUpdateCallback *updateCallback100)
{
if (!CanUpdate())
@@ -383,7 +385,7 @@ STDMETHODIMP CAgent::DeleteItems(
CUIntVector realIndices;
_agentFolder->GetRealIndices(indices, numItems, realIndices);
- CObjectVector<CUpdatePair2> updatePairs;
+ CRecordVector<CUpdatePair2> updatePairs;
int curIndex = 0;
UInt32 numItemsInArchive;
RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
@@ -395,13 +397,11 @@ STDMETHODIMP CAgent::DeleteItems(
curIndex++;
continue;
}
- CUpdatePair2 updatePair;
- updatePair.NewData = updatePair.NewProperties = false;
- updatePair.ExistInArchive = true;
- updatePair.ExistOnDisk = false;
- updatePair.IsAnti = false; // check it. Maybe it can be undefined
- updatePair.ArchiveItemIndex = i;
- updatePairs.Add(updatePair);
+ CUpdatePair2 up2;
+ up2.NewData = up2.NewProps = false;
+ up2.IsAnti = false; // check it. Maybe it can be undefined
+ up2.ArcIndex = i;
+ updatePairs.Add(up2);
}
updateCallbackSpec->UpdatePairs = &updatePairs;
updateCallbackSpec->Archive = GetArchive();
@@ -410,8 +410,8 @@ STDMETHODIMP CAgent::DeleteItems(
}
HRESULT CAgent::CreateFolder(
- const wchar_t *newArchiveName,
- const wchar_t *folderName,
+ const wchar_t *newArchiveName,
+ const wchar_t *folderName,
IFolderArchiveUpdateCallback *updateCallback100)
{
if (!CanUpdate())
@@ -421,44 +421,38 @@ HRESULT CAgent::CreateFolder(
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
- CObjectVector<CUpdatePair2> updatePairs;
- UINT32 numItemsInArchive;
+ CRecordVector<CUpdatePair2> updatePairs;
+ UInt32 numItemsInArchive;
RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
for (UInt32 i = 0; i < numItemsInArchive; i++)
{
- CUpdatePair2 updatePair;
- updatePair.NewData = updatePair.NewProperties = false;
- updatePair.ExistInArchive = true;
- updatePair.ExistOnDisk = false;
- updatePair.IsAnti = false; // check it.
- updatePair.ArchiveItemIndex = i;
- updatePairs.Add(updatePair);
+ CUpdatePair2 up2;
+ up2.NewData = up2.NewProps = false;
+ up2.IsAnti = false; // check it.
+ up2.ArcIndex = i;
+ updatePairs.Add(up2);
}
- CUpdatePair2 updatePair;
- updatePair.NewData = updatePair.NewProperties = true;
- updatePair.ExistInArchive = false;
- updatePair.ExistOnDisk = true;
- updatePair.IsAnti = false;
- updatePair.ArchiveItemIndex = -1;
- updatePair.DirItemIndex = 0;
+ CUpdatePair2 up2;
+ up2.NewData = up2.NewProps = true;
+ up2.IsAnti = false;
+ up2.DirIndex = 0;
+
+ updatePairs.Add(up2);
- updatePairs.Add(updatePair);
+ updatePairs.ReserveDown();
- CObjectVector<CDirItem> dirItems;
- CDirItem dirItem;
+ CDirItems dirItems;
+ CDirItem di;
- dirItem.Attributes = FILE_ATTRIBUTE_DIRECTORY;
- dirItem.Size = 0;
- dirItem.Name = _agentFolder->_proxyFolderItem->GetFullPathPrefix() + folderName;
+ di.Attrib = FILE_ATTRIBUTE_DIRECTORY;
+ di.Size = 0;
+ di.Name = _agentFolder->_proxyFolderItem->GetFullPathPrefix() + folderName;
- SYSTEMTIME systemTime;
- FILETIME fileTime;
- ::GetSystemTime(&systemTime);
- ::SystemTimeToFileTime(&systemTime, &fileTime);
- dirItem.LastAccessTime = dirItem.LastWriteTime =
- dirItem.CreationTime = fileTime;
+ FILETIME ft;
+ NTime::GetCurUtcFileTime(ft);
+ di.CTime = di.ATime = di.MTime = ft;
- dirItems.Add(dirItem);
+ dirItems.Items.Add(di);
updateCallbackSpec->Callback = &updateCallbackAgent;
updateCallbackSpec->DirItems = &dirItems;
@@ -469,9 +463,9 @@ HRESULT CAgent::CreateFolder(
HRESULT CAgent::RenameItem(
- const wchar_t *newArchiveName,
- const UINT32 *indices, UINT32 numItems,
- const wchar_t *newItemName,
+ const wchar_t *newArchiveName,
+ const UInt32 *indices, UInt32 numItems,
+ const wchar_t *newItemName,
IFolderArchiveUpdateCallback *updateCallback100)
{
if (!CanUpdate())
@@ -490,25 +484,22 @@ HRESULT CAgent::RenameItem(
UString oldItemPath = fullPrefix + _agentFolder->GetName(indices[0]);
UString newItemPath = fullPrefix + newItemName;
- CObjectVector<CUpdatePair2> updatePairs;
+ CRecordVector<CUpdatePair2> updatePairs;
+ UStringVector newNames;
+
int curIndex = 0;
- UINT32 numItemsInArchive;
+ UInt32 numItemsInArchive;
RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
for (UInt32 i = 0; i < numItemsInArchive; i++)
{
if (curIndex < realIndices.Size())
if (realIndices[curIndex] == i)
{
- CUpdatePair2 updatePair;
- updatePair.NewData = false;
- updatePair.NewProperties = true;
- updatePair.ExistInArchive = true;
- updatePair.ExistOnDisk = false;
- RINOK(IsArchiveItemAnti(GetArchive(), i, updatePair.IsAnti));
- updatePair.ArchiveItemIndex = i;
- updatePair.NewNameIsDefined = true;
-
- updatePair.NewName = newItemName;
+ CUpdatePair2 up2;
+ up2.NewData = false;
+ up2.NewProps = true;
+ RINOK(IsArchiveItemAnti(GetArchive(), i, up2.IsAnti));
+ up2.ArcIndex = i;
UString oldFullPath;
RINOK(GetArchiveItemPath(GetArchive(), i, DefaultName, oldFullPath));
@@ -516,26 +507,25 @@ HRESULT CAgent::RenameItem(
if (oldItemPath.CompareNoCase(oldFullPath.Left(oldItemPath.Length())) != 0)
return E_INVALIDARG;
- updatePair.NewName = newItemPath + oldFullPath.Mid(oldItemPath.Length());
- updatePairs.Add(updatePair);
+ up2.NewNameIndex = newNames.Add(newItemPath + oldFullPath.Mid(oldItemPath.Length()));
+ updatePairs.Add(up2);
curIndex++;
continue;
}
- CUpdatePair2 updatePair;
- updatePair.NewData = updatePair.NewProperties = false;
- updatePair.ExistInArchive = true;
- updatePair.ExistOnDisk = false;
- updatePair.IsAnti = false;
- updatePair.ArchiveItemIndex = i;
- updatePairs.Add(updatePair);
+ CUpdatePair2 up2;
+ up2.NewData = up2.NewProps = false;
+ up2.IsAnti = false;
+ up2.ArcIndex = i;
+ updatePairs.Add(up2);
}
updateCallbackSpec->Callback = &updateCallbackAgent;
updateCallbackSpec->UpdatePairs = &updatePairs;
+ updateCallbackSpec->NewNames = &newNames;
updateCallbackSpec->Archive = GetArchive();
return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
}
-STDMETHODIMP CAgent::SetProperties(const wchar_t **names,
+STDMETHODIMP CAgent::SetProperties(const wchar_t **names,
const PROPVARIANT *values, INT32 numProperties)
{
m_PropNames.Clear();
diff --git a/CPP/7zip/UI/Agent/AgentProxy.cpp b/CPP/7zip/UI/Agent/AgentProxy.cpp
index a50a26c7..704b5d33 100755
--- a/CPP/7zip/UI/Agent/AgentProxy.cpp
+++ b/CPP/7zip/UI/Agent/AgentProxy.cpp
@@ -80,7 +80,7 @@ void CProxyFolder::Clear()
Files.Clear();
}
-void CProxyFolder::GetPathParts(UStringVector &pathParts) const
+void CProxyFolder::GetPathParts(UStringVector &pathParts) const
{
pathParts.Clear();
UString result;
@@ -92,7 +92,7 @@ void CProxyFolder::GetPathParts(UStringVector &pathParts) const
}
}
-UString CProxyFolder::GetFullPathPrefix() const
+UString CProxyFolder::GetFullPathPrefix() const
{
UString result;
const CProxyFolder *current = this;
@@ -104,7 +104,7 @@ UString CProxyFolder::GetFullPathPrefix() const
return result;
}
-UString CProxyFolder::GetItemName(UInt32 index) const
+UString CProxyFolder::GetItemName(UInt32 index) const
{
if (index < (UInt32)Folders.Size())
return Folders[index].Name;
@@ -146,8 +146,8 @@ HRESULT CProxyArchive::Reload(IInArchive *archive, IProgress *progress)
return ReadObjects(archive, progress);
}
-HRESULT CProxyArchive::Load(IInArchive *archive,
- const UString &defaultName,
+HRESULT CProxyArchive::Load(IInArchive *archive,
+ const UString &defaultName,
// const FILETIME &defaultTime,
// UInt32 defaultAttributes,
IProgress *progress)
@@ -179,7 +179,7 @@ void CProxyFolder::CalculateSizes(IInArchive *archive)
{
UInt32 index = Files[i].Index;
Size += GetSize(archive, index, kpidSize);
- PackSize += GetSize(archive, index, kpidPackedSize);
+ PackSize += GetSize(archive, index, kpidPackSize);
{
NCOM::CPropVariant prop;
if (archive->GetProperty(index, kpidCRC, &prop) == S_OK)
@@ -213,14 +213,14 @@ HRESULT CProxyArchive::ReadObjects(IInArchive *archive, IProgress *progress)
RINOK(archive->GetNumberOfItems(&numItems));
if (progress != NULL)
{
- UINT64 totalItems = numItems;
+ UINT64 totalItems = numItems;
RINOK(progress->SetTotal(totalItems));
}
for(UInt32 i = 0; i < numItems; i++)
{
if (progress != NULL)
{
- UINT64 currentItemIndex = i;
+ UINT64 currentItemIndex = i;
RINOK(progress->SetCompleted(&currentItemIndex));
}
NCOM::CPropVariant propVariantPath;
diff --git a/CPP/7zip/UI/Agent/AgentProxy.h b/CPP/7zip/UI/Agent/AgentProxy.h
index 5cf7a05b..a0111088 100755
--- a/CPP/7zip/UI/Agent/AgentProxy.h
+++ b/CPP/7zip/UI/Agent/AgentProxy.h
@@ -53,7 +53,7 @@ public:
// UInt32 DefaultAttributes;
CProxyFolder RootFolder;
HRESULT Reload(IInArchive *archive, IProgress *progress);
- HRESULT Load(IInArchive *archive,
+ HRESULT Load(IInArchive *archive,
const UString &defaultName,
// const FILETIME &defaultTime,
// UInt32 defaultAttributes,
diff --git a/CPP/7zip/UI/Agent/ArchiveFolder.cpp b/CPP/7zip/UI/Agent/ArchiveFolder.cpp
index 3baa6202..780d26b8 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolder.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolder.cpp
@@ -19,11 +19,11 @@
using namespace NWindows;
using namespace NCOM;
-STDMETHODIMP CAgentFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
+STDMETHODIMP CAgentFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
COM_TRY_BEGIN
- CArchiveExtractCallback *extractCallbackSpec = new
+ CArchiveExtractCallback *extractCallbackSpec = new
CArchiveExtractCallback;
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
UStringVector pathParts;
@@ -41,31 +41,31 @@ STDMETHODIMP CAgentFolder::CopyTo(const UINT32 *indices, UINT32 numItems,
IID_IFolderArchiveExtractCallback, &extractCallback2));
}
- NExtract::NPathMode::EEnum pathMode = _flatMode ?
+ NExtract::NPathMode::EEnum pathMode = _flatMode ?
NExtract::NPathMode::kNoPathnames :
NExtract::NPathMode::kCurrentPathnames;
extractCallbackSpec->InitForMulti(false, pathMode, NExtract::NOverwriteMode::kAskBefore);
- extractCallbackSpec->Init(_agentSpec->GetArchive(),
- extractCallback2,
+ extractCallbackSpec->Init(_agentSpec->GetArchive(),
+ extractCallback2,
false,
path,
- pathParts,
+ pathParts,
_agentSpec->DefaultName,
- _agentSpec->DefaultTime,
- _agentSpec->DefaultAttributes,
+ _agentSpec->DefaultTime,
+ _agentSpec->DefaultAttrib,
(UInt64)(Int64)-1
// ,_agentSpec->_srcDirectoryPrefix
);
CUIntVector realIndices;
GetRealIndices(indices, numItems, realIndices);
- return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
+ return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
realIndices.Size(), BoolToInt(false), extractCallback);
COM_TRY_END
}
-STDMETHODIMP CAgentFolder::MoveTo(const UINT32 * /* indices */, UINT32 /* numItems */,
+STDMETHODIMP CAgentFolder::MoveTo(const UINT32 * /* indices */, UINT32 /* numItems */,
const wchar_t * /* path */, IFolderOperationsExtractCallback * /* callback */)
{
return E_NOTIMPL;
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
index 5f62dc9c..d983c13a 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
@@ -28,7 +28,7 @@ int CArchiveFolderManager::FindFormat(const UString &type)
return -1;
}
-STDMETHODIMP CArchiveFolderManager::OpenFolderFile(const wchar_t *filePath,
+STDMETHODIMP CArchiveFolderManager::OpenFolderFile(const wchar_t *filePath,
IFolderFolder **resultFolder, IProgress *progress)
{
CMyComPtr<IArchiveOpenCallback> openArchiveCallback;
@@ -122,7 +122,7 @@ STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
*types = valueTemp.Detach();
return S_OK;
}
-STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
+STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
const wchar_t * filePath, IProgress progress)
{
return E_NOTIMPL;
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
index 6bf41d61..304dce83 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
@@ -27,7 +27,7 @@ HRESULT CAgentFolder::CommonUpdateOperation(
bool deleteOperation,
bool createFolderOperation,
bool renameOperation,
- const wchar_t *newItemName,
+ const wchar_t *newItemName,
const NUpdateArchive::CActionSet *actionSet,
const UINT32 *indices, UINT32 numItems,
IFolderArchiveUpdateCallback *updateCallback100)
@@ -67,8 +67,8 @@ HRESULT CAgentFolder::CommonUpdateOperation(
{
result = _agentSpec->RenameItem(
tempFileName,
- indices, numItems,
- newItemName,
+ indices, numItems,
+ newItemName,
updateCallback100);
}
else
@@ -92,8 +92,15 @@ HRESULT CAgentFolder::CommonUpdateOperation(
tempFile.DisableDeleting();
if (!MyMoveFile(tempFileName, archiveFilePath ))
return GetLastError();
-
- RINOK(_agentSpec->ReOpen(NULL));
+
+ {
+ CMyComPtr<IArchiveOpenCallback> openCallback;
+ if (updateCallback100)
+ {
+ RINOK(updateCallback100->QueryInterface(IID_IArchiveOpenCallback, (void **)&openCallback));
+ }
+ RINOK(_agentSpec->ReOpen(openCallback));
+ }
////////////////////////////
// Restore FolderItem;
@@ -136,7 +143,7 @@ STDMETHODIMP CAgentFolder::CopyFrom(
RINOK(progressWrapper.QueryInterface(
IID_IFolderArchiveUpdateCallback, &updateCallback100));
}
- return CommonUpdateOperation(false, false, false, NULL,
+ return CommonUpdateOperation(false, false, false, NULL,
&NUpdateArchive::kAddActionSet, 0, 0, updateCallback100);
COM_TRY_END
}
@@ -152,7 +159,7 @@ STDMETHODIMP CAgentFolder::Delete(const UINT32 *indices, UINT32 numItems, IProgr
RINOK(progressWrapper.QueryInterface(
IID_IFolderArchiveUpdateCallback, &updateCallback100));
}
- return CommonUpdateOperation(true, false, false, NULL,
+ return CommonUpdateOperation(true, false, false, NULL,
&NUpdateArchive::kDeleteActionSet, indices, numItems, updateCallback100);
COM_TRY_END
}
@@ -185,7 +192,7 @@ STDMETHODIMP CAgentFolder::Rename(UINT32 index, const wchar_t *newName, IProgres
CMyComPtr<IProgress> progressWrapper = progress;
RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
}
- return CommonUpdateOperation(false, false, true, newName, NULL, &indices.Front(),
+ return CommonUpdateOperation(false, false, true, newName, NULL, &indices.Front(),
indices.Size(), updateCallback100);
COM_TRY_END
}
@@ -195,7 +202,7 @@ STDMETHODIMP CAgentFolder::CreateFile(const wchar_t * /* name */, IProgress * /*
return E_NOTIMPL;
}
-STDMETHODIMP CAgentFolder::SetProperty(UINT32 /* index */, PROPID /* propID */,
+STDMETHODIMP CAgentFolder::SetProperty(UINT32 /* index */, PROPID /* propID */,
const PROPVARIANT * /* value */, IProgress * /* progress */)
{
return E_NOTIMPL;
diff --git a/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp b/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
index e00d837a..6f435b35 100755
--- a/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
+++ b/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
@@ -63,9 +63,9 @@ HRESULT CUpdateCallbackAgent::OpenFileError(const wchar_t *name, DWORD systemErr
if (Callback)
{
RINOK(Callback->UpdateErrorMessage(
- UString(L"WARNING: ") +
- NError::MyFormatMessageW(systemError) +
- UString(L": ") +
+ UString(L"WARNING: ") +
+ NError::MyFormatMessageW(systemError) +
+ UString(L": ") +
UString(name)));
return S_FALSE;
}
diff --git a/CPP/7zip/UI/Client7z/Client7z.cpp b/CPP/7zip/UI/Client7z/Client7z.cpp
index e059d3ac..82db4f08 100755
--- a/CPP/7zip/UI/Client7z/Client7z.cpp
+++ b/CPP/7zip/UI/Client7z/Client7z.cpp
@@ -20,7 +20,7 @@
// {23170F69-40C1-278A-1000-000110070000}
-DEFINE_GUID(CLSID_CFormat7z,
+DEFINE_GUID(CLSID_CFormat7z,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
using namespace NWindows;
@@ -28,10 +28,10 @@ using namespace NWindows;
#define kDllName "7z.dll"
static const char *kCopyrightString = MY_7ZIP_VERSION
-" (" kDllName " client) "
+" (" kDllName " client) "
MY_COPYRIGHT " " MY_DATE;
-static const char *kHelpString =
+static const char *kHelpString =
"Usage: Client7z.exe [a | l | x ] archive.7z [fileName ...]\n"
"Examples:\n"
" Client7z.exe a archive.7z f1.txt f2.txt : compress two files to archive.7z\n"
@@ -40,8 +40,8 @@ static const char *kHelpString =
typedef UINT32 (WINAPI * CreateObjectFunc)(
- const GUID *clsID,
- const GUID *interfaceID,
+ const GUID *clsID,
+ const GUID *interfaceID,
void **outObject);
#ifdef _WIN32
@@ -51,7 +51,7 @@ static inline bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -90,7 +90,7 @@ static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propI
{
NCOM::CPropVariant prop;
RINOK(archive->GetProperty(index, propID, &prop));
- if(prop.vt == VT_BOOL)
+ if (prop.vt == VT_BOOL)
result = VARIANT_BOOLToBool(prop.boolVal);
else if (prop.vt == VT_EMPTY)
result = false;
@@ -101,7 +101,7 @@ static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propI
static HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
{
- return IsArchiveItemProp(archive, index, kpidIsFolder, result);
+ return IsArchiveItemProp(archive, index, kpidIsDir, result);
}
@@ -112,7 +112,7 @@ static const wchar_t *kEmptyFileAlias = L"[Content]";
// Archive Open callback class
-class CArchiveOpenCallback:
+class CArchiveOpenCallback:
public IArchiveOpenCallback,
public ICryptoGetTextPassword,
public CMyUnknownImp
@@ -146,7 +146,7 @@ STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
if (!PasswordIsDefined)
{
// You can ask real password here from user
- // Password = GetPassword(OutStream);
+ // Password = GetPassword(OutStream);
// PasswordIsDefined = true;
PrintError("Password is not defined");
return E_ABORT;
@@ -171,7 +171,7 @@ static const char *kCRCFailed = "CRC Failed";
static const char *kDataError = "Data Error";
static const char *kUnknownError = "Unknown Error";
-class CArchiveExtractCallback:
+class CArchiveExtractCallback:
public IArchiveExtractCallback,
public ICryptoGetTextPassword,
public CMyUnknownImp
@@ -199,11 +199,11 @@ private:
bool _extractMode;
struct CProcessedFileInfo
{
- FILETIME UTCLastWriteTime;
- UInt32 Attributes;
- bool IsDirectory;
- bool AttributesAreDefined;
- bool UTCLastWriteTimeIsDefined;
+ FILETIME MTime;
+ UInt32 Attrib;
+ bool isDir;
+ bool AttribDefined;
+ bool MTimeDefined;
} _processedFileInfo;
COutFileStream *_outFileStreamSpec;
@@ -237,7 +237,7 @@ STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 * /* completeVal
return S_OK;
}
-STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
+STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
ISequentialOutStream **outStream, Int32 askExtractMode)
{
*outStream = 0;
@@ -245,17 +245,17 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
{
// Get Name
- NCOM::CPropVariant propVariant;
- RINOK(_archiveHandler->GetProperty(index, kpidPath, &propVariant));
+ NCOM::CPropVariant prop;
+ RINOK(_archiveHandler->GetProperty(index, kpidPath, &prop));
UString fullPath;
- if(propVariant.vt == VT_EMPTY)
+ if (prop.vt == VT_EMPTY)
fullPath = kEmptyFileAlias;
- else
+ else
{
- if(propVariant.vt != VT_BSTR)
+ if (prop.vt != VT_BSTR)
return E_FAIL;
- fullPath = propVariant.bstrVal;
+ fullPath = prop.bstrVal;
}
_filePath = fullPath;
}
@@ -264,38 +264,38 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
return S_OK;
{
- // Get Attributes
- NCOM::CPropVariant propVariant;
- RINOK(_archiveHandler->GetProperty(index, kpidAttributes, &propVariant));
- if (propVariant.vt == VT_EMPTY)
+ // Get Attrib
+ NCOM::CPropVariant prop;
+ RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
+ if (prop.vt == VT_EMPTY)
{
- _processedFileInfo.Attributes = 0;
- _processedFileInfo.AttributesAreDefined = false;
+ _processedFileInfo.Attrib = 0;
+ _processedFileInfo.AttribDefined = false;
}
else
{
- if (propVariant.vt != VT_UI4)
+ if (prop.vt != VT_UI4)
return E_FAIL;
- _processedFileInfo.Attributes = propVariant.ulVal;
- _processedFileInfo.AttributesAreDefined = true;
+ _processedFileInfo.Attrib = prop.ulVal;
+ _processedFileInfo.AttribDefined = true;
}
}
- RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.IsDirectory));
+ RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.isDir));
{
// Get Modified Time
- NCOM::CPropVariant propVariant;
- RINOK(_archiveHandler->GetProperty(index, kpidLastWriteTime, &propVariant));
- _processedFileInfo.UTCLastWriteTimeIsDefined = false;
- switch(propVariant.vt)
+ NCOM::CPropVariant prop;
+ RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
+ _processedFileInfo.MTimeDefined = false;
+ switch(prop.vt)
{
case VT_EMPTY:
- // _processedFileInfo.UTCLastWriteTime = _utcLastWriteTimeDefault;
+ // _processedFileInfo.MTime = _utcMTimeDefault;
break;
case VT_FILETIME:
- _processedFileInfo.UTCLastWriteTime = propVariant.filetime;
- _processedFileInfo.UTCLastWriteTimeIsDefined = true;
+ _processedFileInfo.MTime = prop.filetime;
+ _processedFileInfo.MTimeDefined = true;
break;
default:
return E_FAIL;
@@ -304,12 +304,12 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
}
{
// Get Size
- NCOM::CPropVariant propVariant;
- RINOK(_archiveHandler->GetProperty(index, kpidSize, &propVariant));
- bool newFileSizeDefined = (propVariant.vt != VT_EMPTY);
+ NCOM::CPropVariant prop;
+ RINOK(_archiveHandler->GetProperty(index, kpidSize, &prop));
+ bool newFileSizeDefined = (prop.vt != VT_EMPTY);
UInt64 newFileSize;
if (newFileSizeDefined)
- newFileSize = ConvertPropVariantToUInt64(propVariant);
+ newFileSize = ConvertPropVariantToUInt64(prop);
}
@@ -323,14 +323,14 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
UString fullProcessedPath = _directoryPath + _filePath;
_diskFilePath = fullProcessedPath;
- if (_processedFileInfo.IsDirectory)
+ if (_processedFileInfo.isDir)
{
NFile::NDirectory::CreateComplexDirectory(fullProcessedPath);
}
else
{
- NFile::NFind::CFileInfoW fileInfo;
- if(NFile::NFind::FindFile(fullProcessedPath, fileInfo))
+ NFile::NFind::CFileInfoW fi;
+ if (NFile::NFind::FindFile(fullProcessedPath, fi))
{
if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
{
@@ -357,20 +357,13 @@ STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
_extractMode = false;
switch (askExtractMode)
{
- case NArchive::NExtract::NAskMode::kExtract:
- _extractMode = true;
+ case NArchive::NExtract::NAskMode::kExtract: _extractMode = true; break;
};
switch (askExtractMode)
{
- case NArchive::NExtract::NAskMode::kExtract:
- PrintString(kExtractingString);
- break;
- case NArchive::NExtract::NAskMode::kTest:
- PrintString(kTestingString);
- break;
- case NArchive::NExtract::NAskMode::kSkip:
- PrintString(kSkippingString);
- break;
+ case NArchive::NExtract::NAskMode::kExtract: PrintString(kExtractingString); break;
+ case NArchive::NExtract::NAskMode::kTest: PrintString(kTestingString); break;
+ case NArchive::NExtract::NAskMode::kSkip: PrintString(kSkippingString); break;
};
PrintString(_filePath);
return S_OK;
@@ -405,13 +398,13 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
if (_outFileStream != NULL)
{
- if (_processedFileInfo.UTCLastWriteTimeIsDefined)
- _outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
+ if (_processedFileInfo.MTimeDefined)
+ _outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
RINOK(_outFileStreamSpec->Close());
}
_outFileStream.Release();
- if (_extractMode && _processedFileInfo.AttributesAreDefined)
- NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
+ if (_extractMode && _processedFileInfo.AttribDefined)
+ NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib);
PrintNewLine();
return S_OK;
}
@@ -422,7 +415,7 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
if (!PasswordIsDefined)
{
// You can ask real password here from user
- // Password = GetPassword(OutStream);
+ // Password = GetPassword(OutStream);
// PasswordIsDefined = true;
PrintError("Password is not defined");
return E_ABORT;
@@ -438,18 +431,19 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
// Archive Creating callback class
struct CDirItem
-{
- UInt32 Attributes;
- FILETIME CreationTime;
- FILETIME LastAccessTime;
- FILETIME LastWriteTime;
+{
UInt64 Size;
+ FILETIME CTime;
+ FILETIME ATime;
+ FILETIME MTime;
UString Name;
UString FullPath;
- bool IsDirectory() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
+ UInt32 Attrib;
+
+ bool isDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
};
-class CArchiveUpdateCallback:
+class CArchiveUpdateCallback:
public IArchiveUpdateCallback2,
public ICryptoGetTextPassword2,
public CMyUnknownImp
@@ -462,8 +456,8 @@ public:
STDMETHOD(SetCompleted)(const UInt64 *completeValue);
// IUpdateCallback2
- STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator);
- STDMETHOD(GetUpdateItemInfo)(UInt32 index,
+ STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator);
+ STDMETHOD(GetUpdateItemInfo)(UInt32 index,
Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive);
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream);
@@ -520,26 +514,26 @@ STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG ** /* enume
return E_NOTIMPL;
}
-STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 /* index */,
+STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 /* index */,
Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive)
{
- if(newData != NULL)
+ if (newData != NULL)
*newData = BoolToInt(true);
- if(newProperties != NULL)
+ if (newProperties != NULL)
*newProperties = BoolToInt(true);
- if(indexInArchive != NULL)
- *indexInArchive = UInt32(-1);
+ if (indexInArchive != NULL)
+ *indexInArchive = (UInt32)-1;
return S_OK;
}
STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
- NWindows::NCOM::CPropVariant propVariant;
+ NWindows::NCOM::CPropVariant prop;
if (propID == kpidIsAnti)
{
- propVariant = false;
- propVariant.Detach(value);
+ prop = false;
+ prop.Detach(value);
return S_OK;
}
@@ -547,30 +541,16 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
const CDirItem &dirItem = (*DirItems)[index];
switch(propID)
{
- case kpidPath:
- propVariant = dirItem.Name;
- break;
- case kpidIsFolder:
- propVariant = dirItem.IsDirectory();
- break;
- case kpidSize:
- propVariant = dirItem.Size;
- break;
- case kpidAttributes:
- propVariant = dirItem.Attributes;
- break;
- case kpidLastAccessTime:
- propVariant = dirItem.LastAccessTime;
- break;
- case kpidCreationTime:
- propVariant = dirItem.CreationTime;
- break;
- case kpidLastWriteTime:
- propVariant = dirItem.LastWriteTime;
- break;
+ case kpidPath: prop = dirItem.Name; break;
+ case kpidIsDir: prop = dirItem.isDir(); break;
+ case kpidSize: prop = dirItem.Size; break;
+ case kpidAttrib: prop = dirItem.Attrib; break;
+ case kpidCTime: prop = dirItem.CTime; break;
+ case kpidATime: prop = dirItem.ATime; break;
+ case kpidMTime: prop = dirItem.MTime; break;
}
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
@@ -599,14 +579,14 @@ STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream
const CDirItem &dirItem = (*DirItems)[index];
GetStream2(dirItem.Name);
- if(dirItem.IsDirectory())
+ if (dirItem.isDir())
return S_OK;
{
CInFileStream *inStreamSpec = new CInFileStream;
CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
UString path = DirPrefix + dirItem.FullPath;
- if(!inStreamSpec->Open(path))
+ if (!inStreamSpec->Open(path))
{
DWORD sysError = ::GetLastError();
FailedCodes.Add(sysError);
@@ -654,7 +634,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOu
fileName += VolExt;
COutFileStream *streamSpec = new COutFileStream;
CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
- if(!streamSpec->Create(fileName, false))
+ if (!streamSpec->Create(fileName, false))
return ::GetLastError();
*volumeStream = streamLoc.Detach();
return S_OK;
@@ -662,12 +642,12 @@ STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOu
STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
- if (!PasswordIsDefined)
+ if (!PasswordIsDefined)
{
if (AskPassword)
{
// You can ask real password here from user
- // Password = GetPassword(OutStream);
+ // Password = GetPassword(OutStream);
// PasswordIsDefined = true;
PrintError("Password is not defined");
return E_ABORT;
@@ -726,24 +706,24 @@ int MY_CDECL main(int argc, char* argv[])
int i;
for (i = 3; i < argc; i++)
{
- CDirItem item;
+ CDirItem di;
UString name = GetUnicodeString(argv[i], CP_OEMCP);
- NFile::NFind::CFileInfoW fileInfo;
- if (!NFile::NFind::FindFile(name, fileInfo))
+ NFile::NFind::CFileInfoW fi;
+ if (!NFile::NFind::FindFile(name, fi))
{
PrintString(UString(L"Can't find file") + name);
return 1;
}
- item.Attributes = fileInfo.Attributes;
- item.Size = fileInfo.Size;
- item.CreationTime = fileInfo.CreationTime;
- item.LastAccessTime = fileInfo.LastAccessTime;
- item.LastWriteTime = fileInfo.LastWriteTime;
- item.Name = name;
- item.FullPath = name;
- dirItems.Add(item);
+ di.Attrib = fi.Attrib;
+ di.Size = fi.Size;
+ di.CTime = fi.CTime;
+ di.ATime = fi.ATime;
+ di.MTime = fi.MTime;
+ di.Name = name;
+ di.FullPath = name;
+ dirItems.Add(di);
}
COutFileStream *outFileStreamSpec = new COutFileStream;
CMyComPtr<IOutStream> outFileStream = outFileStreamSpec;
@@ -834,22 +814,22 @@ int MY_CDECL main(int argc, char* argv[])
{
// List command
UInt32 numItems = 0;
- archive->GetNumberOfItems(&numItems);
+ archive->GetNumberOfItems(&numItems);
for (UInt32 i = 0; i < numItems; i++)
{
{
// Get uncompressed size of file
- NWindows::NCOM::CPropVariant propVariant;
- archive->GetProperty(i, kpidSize, &propVariant);
- UString s = ConvertPropVariantToString(propVariant);
+ NWindows::NCOM::CPropVariant prop;
+ archive->GetProperty(i, kpidSize, &prop);
+ UString s = ConvertPropVariantToString(prop);
PrintString(s);
PrintString(" ");
}
{
// Get name of file
- NWindows::NCOM::CPropVariant propVariant;
- archive->GetProperty(i, kpidPath, &propVariant);
- UString s = ConvertPropVariantToString(propVariant);
+ NWindows::NCOM::CPropVariant prop;
+ archive->GetProperty(i, kpidPath, &prop);
+ UString s = ConvertPropVariantToString(prop);
PrintString(s);
}
PrintString("\n");
diff --git a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
index 6cf95f27..46e8a2a1 100755
--- a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
+++ b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
@@ -32,7 +32,7 @@ extern bool g_CaseSensitive;
#define MY_isatty_fileno(x) isatty(fileno(x))
#endif
-#define MY_IS_TERMINAL(x) (MY_isatty_fileno(x) != 0);
+#define MY_IS_TERMINAL(x) (MY_isatty_fileno(x) != 0);
using namespace NCommandLineParser;
using namespace NWindows;
@@ -48,7 +48,9 @@ enum Enum
kDisablePercents,
kArchiveType,
kYes,
+ #ifndef _NO_CRYPTO
kPassword,
+ #endif
kProperty,
kOutputDir,
kWorkingDir,
@@ -80,9 +82,9 @@ static const wchar_t kRecursedIDChar = 'R';
static const wchar_t *kRecursedPostCharSet = L"0-";
namespace NRecursedPostCharIndex {
- enum EEnum
+ enum EEnum
{
- kWildCardRecursionOnly = 0,
+ kWildCardRecursionOnly = 0,
kNoRecursion = 1
};
}
@@ -104,7 +106,7 @@ NExtract::NOverwriteMode::EEnum k_OverwriteModes[] =
NExtract::NOverwriteMode::kAutoRenameExisting
};
-static const CSwitchForm kSwitchForms[] =
+static const CSwitchForm kSwitchForms[] =
{
{ L"?", NSwitchType::kSimple, false },
{ L"H", NSwitchType::kSimple, false },
@@ -113,7 +115,9 @@ static const CSwitchForm kSwitchForms[] =
{ L"BD", NSwitchType::kSimple, false },
{ L"T", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"Y", NSwitchType::kSimple, false },
+ #ifndef _NO_CRYPTO
{ L"P", NSwitchType::kUnLimitedPostString, false, 0 },
+ #endif
{ L"M", NSwitchType::kUnLimitedPostString, true, 1 },
{ L"O", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"W", NSwitchType::kUnLimitedPostString, false, 0 },
@@ -138,7 +142,7 @@ static const CSwitchForm kSwitchForms[] =
{ L"SSC", NSwitchType::kPostChar, false, 0, 0, L"-" }
};
-static const CCommandForm g_CommandForms[] =
+static const CCommandForm g_CommandForms[] =
{
{ L"A", false },
{ L"U", false },
@@ -206,7 +210,7 @@ NExtract::NPathMode::EEnum CArchiveCommand::GetPathMode() const
bool CArchiveCommand::IsFromUpdateGroup() const
{
- return (CommandType == NCommandType::kAdd ||
+ return (CommandType == NCommandType::kAdd ||
CommandType == NCommandType::kUpdate ||
CommandType == NCommandType::kDelete);
}
@@ -215,9 +219,9 @@ static NRecursedType::EEnum GetRecursedTypeFromIndex(int index)
{
switch (index)
{
- case NRecursedPostCharIndex::kWildCardRecursionOnly:
+ case NRecursedPostCharIndex::kWildCardRecursionOnly:
return NRecursedType::kWildCardOnlyRecursed;
- case NRecursedPostCharIndex::kNoRecursion:
+ case NRecursedPostCharIndex::kNoRecursion:
return NRecursedType::kNonRecursed;
default:
return NRecursedType::kRecursed;
@@ -229,7 +233,7 @@ static bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &c
UString commandStringUpper = commandString;
commandStringUpper.MakeUpper();
UString postString;
- int commandIndex = ParseCommand(kNumCommandForms, g_CommandForms, commandStringUpper,
+ int commandIndex = ParseCommand(kNumCommandForms, g_CommandForms, commandStringUpper,
postString) ;
if (commandIndex < 0)
return false;
@@ -240,7 +244,7 @@ static bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &c
// ------------------------------------------------------------------
// filenames functions
-static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
+static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
const UString &name, bool include, NRecursedType::EEnum type)
{
bool isWildCard = DoesNameContainWildCard(name);
@@ -262,7 +266,7 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
return true;
}
-static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
+static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
{
UStringVector names;
@@ -273,7 +277,7 @@ static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
throw kIncorrectWildCardInListFile;
}
-static void AddCommandLineWildCardToCensr(NWildcard::CCensor &wildcardCensor,
+static void AddCommandLineWildCardToCensr(NWildcard::CCensor &wildcardCensor,
const UString &name, bool include, NRecursedType::EEnum recursedType)
{
if (!AddNameToCensor(wildcardCensor, name, include, recursedType))
@@ -282,13 +286,13 @@ static void AddCommandLineWildCardToCensr(NWildcard::CCensor &wildcardCensor,
static void AddToCensorFromNonSwitchesStrings(
int startIndex,
- NWildcard::CCensor &wildcardCensor,
- const UStringVector &nonSwitchStrings, NRecursedType::EEnum type,
+ NWildcard::CCensor &wildcardCensor,
+ const UStringVector &nonSwitchStrings, NRecursedType::EEnum type,
bool thereAreSwitchIncludes, UINT codePage)
{
- if(nonSwitchStrings.Size() == startIndex && (!thereAreSwitchIncludes))
+ if (nonSwitchStrings.Size() == startIndex && (!thereAreSwitchIncludes))
AddCommandLineWildCardToCensr(wildcardCensor, kUniversalWildcard, true, type);
- for(int i = startIndex; i < nonSwitchStrings.Size(); i++)
+ for (int i = startIndex; i < nonSwitchStrings.Size(); i++)
{
const UString &s = nonSwitchStrings[i];
if (s[0] == kFileListID)
@@ -299,8 +303,8 @@ static void AddToCensorFromNonSwitchesStrings(
}
#ifdef _WIN32
-static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
- const UString &switchParam, bool include,
+static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
+ const UString &switchParam, bool include,
NRecursedType::EEnum commonRecursedType)
{
int splitPos = switchParam.Find(L':');
@@ -337,7 +341,7 @@ static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
wchar_t c = curData[i];
if (c == L'\0')
{
- AddCommandLineWildCardToCensr(wildcardCensor,
+ AddCommandLineWildCardToCensr(wildcardCensor,
name, include, commonRecursedType);
name.Empty();
}
@@ -363,11 +367,11 @@ static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
}
#endif
-static void AddSwitchWildCardsToCensor(NWildcard::CCensor &wildcardCensor,
- const UStringVector &strings, bool include,
+static void AddSwitchWildCardsToCensor(NWildcard::CCensor &wildcardCensor,
+ const UStringVector &strings, bool include,
NRecursedType::EEnum commonRecursedType, UINT codePage)
{
- for(int i = 0; i < strings.Size(); i++)
+ for (int i = 0; i < strings.Size(); i++)
{
const UString &name = strings[i];
NRecursedType::EEnum recursedType;
@@ -451,7 +455,7 @@ static void ConvertToLongNames(const UString &prefix, NWildcard::CCensorNode &no
for (i = 0; i < node.SubNodes.Size(); i++)
{
NWildcard::CCensorNode &nextNode = node.SubNodes[i];
- ConvertToLongNames(prefix + nextNode.Name + wchar_t(NFile::NName::kDirDelimiter), nextNode);
+ ConvertToLongNames(prefix + nextNode.Name + wchar_t(NFile::NName::kDirDelimiter), nextNode);
}
}
@@ -483,14 +487,14 @@ const int kUpdatePairStateNotSupportedActions[] = {2, 2, 1, -1, -1, -1, -1};
const UString kUpdatePairActionIDSet = L"0123"; //Ignore, Copy, Compress, Create Anti
-const wchar_t *kUpdateIgnoreItselfPostStringID = L"-";
-const wchar_t kUpdateNewArchivePostCharID = '!';
+const wchar_t *kUpdateIgnoreItselfPostStringID = L"-";
+const wchar_t kUpdateNewArchivePostCharID = '!';
-static bool ParseUpdateCommandString2(const UString &command,
+static bool ParseUpdateCommandString2(const UString &command,
NUpdateArchive::CActionSet &actionSet, UString &postString)
{
- for(int i = 0; i < command.Length();)
+ for (int i = 0; i < command.Length();)
{
wchar_t c = MyCharUpper(command[i]);
int statePos = kUpdatePairStateIDSet.Find(c);
@@ -514,16 +518,16 @@ static bool ParseUpdateCommandString2(const UString &command,
return true;
}
-static void ParseUpdateCommandString(CUpdateOptions &options,
- const UStringVector &updatePostStrings,
+static void ParseUpdateCommandString(CUpdateOptions &options,
+ const UStringVector &updatePostStrings,
const NUpdateArchive::CActionSet &defaultActionSet)
{
- for(int i = 0; i < updatePostStrings.Size(); i++)
+ for (int i = 0; i < updatePostStrings.Size(); i++)
{
const UString &updateString = updatePostStrings[i];
- if(updateString.CompareNoCase(kUpdateIgnoreItselfPostStringID) == 0)
+ if (updateString.CompareNoCase(kUpdateIgnoreItselfPostStringID) == 0)
{
- if(options.UpdateArchiveItself)
+ if (options.UpdateArchiveItself)
{
options.UpdateArchiveItself = false;
options.Commands.Delete(0);
@@ -536,14 +540,14 @@ static void ParseUpdateCommandString(CUpdateOptions &options,
UString postString;
if (!ParseUpdateCommandString2(updateString, actionSet, postString))
ThrowUserErrorException();
- if(postString.IsEmpty())
+ if (postString.IsEmpty())
{
- if(options.UpdateArchiveItself)
+ if (options.UpdateArchiveItself)
options.Commands[0].ActionSet = actionSet;
}
else
{
- if(MyCharUpper(postString[0]) != kUpdateNewArchivePostCharID)
+ if (MyCharUpper(postString[0]) != kUpdateNewArchivePostCharID)
ThrowUserErrorException();
CUpdateArchiveCommand uc;
UString archivePath = postString.Mid(1);
@@ -603,20 +607,20 @@ static bool ParseComplexSize(const UString &src, UInt64 &result)
}
static void SetAddCommandOptions(
- NCommandType::EEnum commandType,
- const CParser &parser,
+ NCommandType::EEnum commandType,
+ const CParser &parser,
CUpdateOptions &options)
{
NUpdateArchive::CActionSet defaultActionSet;
switch(commandType)
{
- case NCommandType::kAdd:
+ case NCommandType::kAdd:
defaultActionSet = NUpdateArchive::kAddActionSet;
break;
- case NCommandType::kDelete:
+ case NCommandType::kDelete:
defaultActionSet = NUpdateArchive::kDeleteActionSet;
break;
- default:
+ default:
defaultActionSet = NUpdateArchive::kUpdateActionSet;
}
@@ -626,10 +630,10 @@ static void SetAddCommandOptions(
CUpdateArchiveCommand updateMainCommand;
updateMainCommand.ActionSet = defaultActionSet;
options.Commands.Add(updateMainCommand);
- if(parser[NKey::kUpdate].ThereIs)
- ParseUpdateCommandString(options, parser[NKey::kUpdate].PostStrings,
+ if (parser[NKey::kUpdate].ThereIs)
+ ParseUpdateCommandString(options, parser[NKey::kUpdate].PostStrings,
defaultActionSet);
- if(parser[NKey::kWorkingDir].ThereIs)
+ if (parser[NKey::kWorkingDir].ThereIs)
{
const UString &postString = parser[NKey::kWorkingDir].PostStrings[0];
if (postString.IsEmpty())
@@ -659,7 +663,7 @@ static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &pr
if (parser[NKey::kProperty].ThereIs)
{
// options.MethodMode.Properties.Clear();
- for(int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
+ for (int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
{
CProperty property;
const UString &postString = parser[NKey::kProperty].PostStrings[i];
@@ -676,7 +680,7 @@ static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &pr
}
}
-CArchiveCommandLineParser::CArchiveCommandLineParser():
+CArchiveCommandLineParser::CArchiveCommandLineParser():
parser(sizeof(kSwitchForms) / sizeof(kSwitchForms[0])) {}
void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
@@ -686,7 +690,7 @@ void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
{
parser.ParseStrings(kSwitchForms, commandStrings);
}
- catch(...)
+ catch(...)
{
ThrowUserErrorException();
}
@@ -715,7 +719,7 @@ struct CCodePagePair
UINT CodePage;
};
-static CCodePagePair g_CodePagePairs[] =
+static CCodePagePair g_CodePagePairs[] =
{
{ L"UTF-8", CP_UTF8 },
{ L"WIN", CP_ACP },
@@ -740,7 +744,7 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
{
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
int numNonSwitchStrings = nonSwitchStrings.Size();
- if(numNonSwitchStrings < kMinNonSwitchWords)
+ if (numNonSwitchStrings < kMinNonSwitchWords)
ThrowUserErrorException();
if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command))
@@ -780,41 +784,45 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
if (parser[NKey::kInclude].ThereIs)
{
thereAreSwitchIncludes = true;
- AddSwitchWildCardsToCensor(options.WildcardCensor,
+ AddSwitchWildCardsToCensor(options.WildcardCensor,
parser[NKey::kInclude].PostStrings, true, recursedType, codePage);
}
if (parser[NKey::kExclude].ThereIs)
- AddSwitchWildCardsToCensor(options.WildcardCensor,
+ AddSwitchWildCardsToCensor(options.WildcardCensor,
parser[NKey::kExclude].PostStrings, false, recursedType, codePage);
int curCommandIndex = kCommandIndex + 1;
- bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs &&
- options.Command.CommandType != NCommandType::kBenchmark &&
+ bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs &&
+ options.Command.CommandType != NCommandType::kBenchmark &&
options.Command.CommandType != NCommandType::kInfo;
if (thereIsArchiveName)
{
- if(curCommandIndex >= numNonSwitchStrings)
+ if (curCommandIndex >= numNonSwitchStrings)
ThrowUserErrorException();
options.ArchiveName = nonSwitchStrings[curCommandIndex++];
}
AddToCensorFromNonSwitchesStrings(
- curCommandIndex, options.WildcardCensor,
+ curCommandIndex, options.WildcardCensor,
nonSwitchStrings, recursedType, thereAreSwitchIncludes, codePage);
options.YesToAll = parser[NKey::kYes].ThereIs;
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
+ #ifndef _NO_CRYPTO
options.PasswordEnabled = parser[NKey::kPassword].ThereIs;
-
- if(options.PasswordEnabled)
+ if (options.PasswordEnabled)
options.Password = parser[NKey::kPassword].PostStrings[0];
+ #endif
options.StdInMode = parser[NKey::kStdIn].ThereIs;
options.ShowDialog = parser[NKey::kShowDialog].ThereIs;
- if(isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
+ if (parser[NKey::kArchiveType].ThereIs)
+ options.ArcType = parser[NKey::kArchiveType].PostStrings[0];
+
+ if (isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
{
if (options.StdInMode)
ThrowException("Reading archives from stdin is not implemented");
@@ -825,11 +833,11 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
if (parser[NKey::kArInclude].ThereIs)
{
- AddSwitchWildCardsToCensor(archiveWildcardCensor,
+ AddSwitchWildCardsToCensor(archiveWildcardCensor,
parser[NKey::kArInclude].PostStrings, true, NRecursedType::kNonRecursed, codePage);
}
if (parser[NKey::kArExclude].ThereIs)
- AddSwitchWildCardsToCensor(archiveWildcardCensor,
+ AddSwitchWildCardsToCensor(archiveWildcardCensor,
parser[NKey::kArExclude].PostStrings, false, NRecursedType::kNonRecursed, codePage);
if (thereIsArchiveName)
@@ -841,21 +849,23 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
archiveWildcardCensor.ExtendExclude();
- CObjectVector<CDirItem> dirItems;
- {
- UStringVector errorPaths;
- CRecordVector<DWORD> errorCodes;
- HRESULT res = EnumerateItems(archiveWildcardCensor, dirItems, NULL, errorPaths, errorCodes);
- if (res != S_OK || errorPaths.Size() > 0)
- throw "cannot find archive";
- }
UStringVector archivePaths;
- int i;
- for (i = 0; i < dirItems.Size(); i++)
+
{
- const CDirItem &dirItem = dirItems[i];
- if (!dirItem.IsDirectory())
- archivePaths.Add(dirItem.FullPath);
+ CDirItems dirItems;
+ {
+ UStringVector errorPaths;
+ CRecordVector<DWORD> errorCodes;
+ HRESULT res = EnumerateItems(archiveWildcardCensor, dirItems, NULL, errorPaths, errorCodes);
+ if (res != S_OK || errorPaths.Size() > 0)
+ throw "cannot find archive";
+ }
+ for (int i = 0; i < dirItems.Items.Size(); i++)
+ {
+ const CDirItem &dirItem = dirItems.Items[i];
+ if (!dirItem.IsDir())
+ archivePaths.Add(dirItems.GetPhyPath(i));
+ }
}
if (archivePaths.Size() == 0)
@@ -863,6 +873,7 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
UStringVector archivePathsFull;
+ int i;
for (i = 0; i < archivePaths.Size(); i++)
{
UString fullPath;
@@ -881,33 +892,30 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
if (isExtractGroupCommand)
{
- SetMethodOptions(parser, options.ExtractProperties);
+ SetMethodOptions(parser, options.ExtractProperties);
if (options.StdOutMode && options.IsStdOutTerminal && options.IsStdErrTerminal)
throw kSameTerminalError;
- if(parser[NKey::kOutputDir].ThereIs)
+ if (parser[NKey::kOutputDir].ThereIs)
{
options.OutputDir = parser[NKey::kOutputDir].PostStrings[0];
NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
}
options.OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- if(parser[NKey::kOverwrite].ThereIs)
- options.OverwriteMode =
+ if (parser[NKey::kOverwrite].ThereIs)
+ options.OverwriteMode =
k_OverwriteModes[parser[NKey::kOverwrite].PostCharIndex];
else if (options.YesToAll)
options.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
}
}
- else if(options.Command.IsFromUpdateGroup())
+ else if (options.Command.IsFromUpdateGroup())
{
CUpdateOptions &updateOptions = options.UpdateOptions;
- if(parser[NKey::kArchiveType].ThereIs)
- options.ArcType = parser[NKey::kArchiveType].PostStrings[0];
-
- SetAddCommandOptions(options.Command.CommandType, parser, updateOptions);
+ SetAddCommandOptions(options.Command.CommandType, parser, updateOptions);
- SetMethodOptions(parser, updateOptions.MethodMode.Properties);
+ SetMethodOptions(parser, updateOptions.MethodMode.Properties);
if (parser[NKey::kShareForWrite].ThereIs)
updateOptions.OpenShareForWrite = true;
@@ -916,8 +924,8 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
if (options.EnablePercents)
{
- if ((options.StdOutMode && !options.IsStdErrTerminal) ||
- (!options.StdOutMode && !options.IsStdOutTerminal))
+ if ((options.StdOutMode && !options.IsStdErrTerminal) ||
+ (!options.StdOutMode && !options.IsStdOutTerminal))
options.EnablePercents = false;
}
@@ -940,19 +948,19 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
throw "stdout mode and email mode cannot be combined";
if (updateOptions.StdOutMode && options.IsStdOutTerminal)
throw kTerminalOutError;
- if(updateOptions.StdInMode)
+ if (updateOptions.StdInMode)
updateOptions.StdInFileName = parser[NKey::kStdIn].PostStrings.Front();
#ifdef _WIN32
ConvertToLongNames(options.WildcardCensor);
#endif
}
- else if(options.Command.CommandType == NCommandType::kBenchmark)
+ else if (options.Command.CommandType == NCommandType::kBenchmark)
{
options.NumThreads = (UInt32)-1;
options.DictionarySize = (UInt32)-1;
options.NumIterations = 1;
- if (curCommandIndex < numNonSwitchStrings)
+ if (curCommandIndex < numNonSwitchStrings)
{
if (!ConvertStringToUInt32(nonSwitchStrings[curCommandIndex++], options.NumIterations))
ThrowUserErrorException();
@@ -994,10 +1002,10 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
ThrowUserErrorException();
}
}
- else if(options.Command.CommandType == NCommandType::kInfo)
+ else if (options.Command.CommandType == NCommandType::kInfo)
{
}
- else
+ else
ThrowUserErrorException();
options.WildcardCensor.ExtendExclude();
}
diff --git a/CPP/7zip/UI/Common/ArchiveCommandLine.h b/CPP/7zip/UI/Common/ArchiveCommandLine.h
index 5f54b064..9c37f336 100755
--- a/CPP/7zip/UI/Common/ArchiveCommandLine.h
+++ b/CPP/7zip/UI/Common/ArchiveCommandLine.h
@@ -63,11 +63,13 @@ struct CArchiveCommandLineOptions
// NWildcard::CCensor ArchiveWildcardCensor;
NWildcard::CCensor WildcardCensor;
- CArchiveCommand Command;
+ CArchiveCommand Command;
UString ArchiveName;
+ #ifndef _NO_CRYPTO
bool PasswordEnabled;
UString Password;
+ #endif
bool TechMode;
// Extract
@@ -82,7 +84,7 @@ struct CArchiveCommandLineOptions
UString ArcType;
bool EnablePercents;
- // Benchmark
+ // Benchmark
UInt32 NumIterations;
UInt32 NumThreads;
UInt32 DictionarySize;
diff --git a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
index c3913e1c..5af5286b 100755
--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
@@ -32,10 +32,10 @@ void CArchiveExtractCallback::Init(
IInArchive *archiveHandler,
IFolderArchiveExtractCallback *extractCallback2,
bool stdOutMode,
- const UString &directoryPath,
+ const UString &directoryPath,
const UStringVector &removePathParts,
const UString &itemDefaultName,
- const FILETIME &utcLastWriteTimeDefault,
+ const FILETIME &utcMTimeDefault,
UInt32 attributesDefault,
UInt64 packSize)
{
@@ -52,7 +52,7 @@ void CArchiveExtractCallback::Init(
LocalProgressSpec->SendProgress = false;
_itemDefaultName = itemDefaultName;
- _utcLastWriteTimeDefault = utcLastWriteTimeDefault;
+ _utcMTimeDefault = utcMTimeDefault;
_attributesDefault = attributesDefault;
_removePathParts = removePathParts;
_archiveHandler = archiveHandler;
@@ -167,7 +167,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
UString fullPath;
RINOK(GetArchiveItemPath(_archiveHandler, index, _itemDefaultName, fullPath));
- RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.IsDirectory));
+ RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.IsDir));
_filePath = fullPath;
@@ -209,7 +209,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
{
NCOM::CPropVariant prop;
- RINOK(_archiveHandler->GetProperty(index, kpidAttributes, &prop));
+ RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
if (prop.vt == VT_EMPTY)
{
_processedFileInfo.Attributes = _attributesDefault;
@@ -224,17 +224,14 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
}
}
- RINOK(GetTime(index, kpidCreationTime, _processedFileInfo.CreationTime,
- _processedFileInfo.IsCreationTimeDefined));
- RINOK(GetTime(index, kpidLastWriteTime, _processedFileInfo.LastWriteTime,
- _processedFileInfo.IsLastWriteTimeDefined));
- RINOK(GetTime(index, kpidLastAccessTime, _processedFileInfo.LastAccessTime,
- _processedFileInfo.IsLastAccessTimeDefined));
+ RINOK(GetTime(index, kpidCTime, _processedFileInfo.CTime, _processedFileInfo.CTimeDefined));
+ RINOK(GetTime(index, kpidATime, _processedFileInfo.ATime, _processedFileInfo.ATimeDefined));
+ RINOK(GetTime(index, kpidMTime, _processedFileInfo.MTime, _processedFileInfo.MTimeDefined));
bool isAnti = false;
RINOK(IsArchiveItemProp(_archiveHandler, index, kpidIsAnti, isAnti));
- UStringVector pathParts;
+ UStringVector pathParts;
SplitPathToParts(fullPath, pathParts);
if(pathParts.IsEmpty())
@@ -265,7 +262,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
UString processedPath = MakePathNameFromParts(pathParts);
if (!isAnti)
{
- if (!_processedFileInfo.IsDirectory)
+ if (!_processedFileInfo.IsDir)
{
if (!pathParts.IsEmpty())
pathParts.DeleteBack();
@@ -275,18 +272,18 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
{
UString fullPathNew;
CreateComplexDirectory(pathParts, fullPathNew);
- if (_processedFileInfo.IsDirectory)
- NFile::NDirectory::SetDirTime(fullPathNew,
- (WriteCreated && _processedFileInfo.IsCreationTimeDefined) ? &_processedFileInfo.CreationTime : NULL,
- (WriteAccessed && _processedFileInfo.IsLastAccessTimeDefined) ? &_processedFileInfo.LastAccessTime : NULL,
- (WriteModified && _processedFileInfo.IsLastWriteTimeDefined) ? &_processedFileInfo.LastWriteTime : &_utcLastWriteTimeDefault);
+ if (_processedFileInfo.IsDir)
+ NFile::NDirectory::SetDirTime(fullPathNew,
+ (WriteCTime && _processedFileInfo.CTimeDefined) ? &_processedFileInfo.CTime : NULL,
+ (WriteATime && _processedFileInfo.ATimeDefined) ? &_processedFileInfo.ATime : NULL,
+ (WriteMTime && _processedFileInfo.MTimeDefined) ? &_processedFileInfo.MTime : &_utcMTimeDefault);
}
}
UString fullProcessedPath = _directoryPath + processedPath;
- if(_processedFileInfo.IsDirectory)
+ if(_processedFileInfo.IsDir)
{
_diskFilePath = fullProcessedPath;
if (isAnti)
@@ -307,9 +304,9 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
{
Int32 overwiteResult;
RINOK(_extractCallback2->AskOverwrite(
- fullProcessedPath, &fileInfo.LastWriteTime, &fileInfo.Size, fullPath,
- _processedFileInfo.IsLastWriteTimeDefined ? &_processedFileInfo.LastWriteTime : NULL,
- newFileSizeDefined ? &newFileSize : NULL,
+ fullProcessedPath, &fileInfo.MTime, &fileInfo.Size, fullPath,
+ _processedFileInfo.MTimeDefined ? &_processedFileInfo.MTime : NULL,
+ newFileSizeDefined ? &newFileSize : NULL,
&overwiteResult))
switch(overwiteResult)
@@ -408,7 +405,7 @@ STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
case NArchive::NExtract::NAskMode::kExtract:
_extractMode = true;
};
- return _extractCallback2->PrepareOperation(_filePath, _processedFileInfo.IsDirectory,
+ return _extractCallback2->PrepareOperation(_filePath, _processedFileInfo.IsDir,
askExtractMode, _isSplit ? &_position: 0);
COM_TRY_END
}
@@ -430,15 +427,15 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
if (_outFileStream != NULL)
{
_outFileStreamSpec->SetTime(
- (WriteCreated && _processedFileInfo.IsCreationTimeDefined) ? &_processedFileInfo.CreationTime : NULL,
- (WriteAccessed && _processedFileInfo.IsLastAccessTimeDefined) ? &_processedFileInfo.LastAccessTime : NULL,
- (WriteModified && _processedFileInfo.IsLastWriteTimeDefined) ? &_processedFileInfo.LastWriteTime : &_utcLastWriteTimeDefault);
+ (WriteCTime && _processedFileInfo.CTimeDefined) ? &_processedFileInfo.CTime : NULL,
+ (WriteATime && _processedFileInfo.ATimeDefined) ? &_processedFileInfo.ATime : NULL,
+ (WriteMTime && _processedFileInfo.MTimeDefined) ? &_processedFileInfo.MTime : &_utcMTimeDefault);
_curSize = _outFileStreamSpec->ProcessedSize;
RINOK(_outFileStreamSpec->Close());
_outFileStream.Release();
}
UnpackSize += _curSize;
- if (_processedFileInfo.IsDirectory)
+ if (_processedFileInfo.IsDir)
NumFolders++;
else
NumFiles++;
@@ -470,7 +467,7 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
COM_TRY_BEGIN
if (!_cryptoGetTextPassword)
{
- RINOK(_extractCallback2.QueryInterface(IID_ICryptoGetTextPassword,
+ RINOK(_extractCallback2.QueryInterface(IID_ICryptoGetTextPassword,
&_cryptoGetTextPassword));
}
return _cryptoGetTextPassword->CryptoGetTextPassword(password);
diff --git a/CPP/7zip/UI/Common/ArchiveExtractCallback.h b/CPP/7zip/UI/Common/ArchiveExtractCallback.h
index 756dfb08..e895c54b 100755
--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.h
@@ -15,7 +15,7 @@
#include "ExtractMode.h"
-class CArchiveExtractCallback:
+class CArchiveExtractCallback:
public IArchiveExtractCallback,
// public IArchiveVolumeExtractCallback,
public ICryptoGetTextPassword,
@@ -26,15 +26,9 @@ public:
MY_UNKNOWN_IMP2(ICryptoGetTextPassword, ICompressProgressInfo)
// COM_INTERFACE_ENTRY(IArchiveVolumeExtractCallback)
- // IProgress
- STDMETHOD(SetTotal)(UInt64 size);
- STDMETHOD(SetCompleted)(const UInt64 *completeValue);
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
+ INTERFACE_IArchiveExtractCallback(;)
- // IExtractCallBack
- STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode);
- STDMETHOD(PrepareOperation)(Int32 askExtractMode);
- STDMETHOD(SetOperationResult)(Int32 resultEOperationResult);
+ STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
// IArchiveVolumeExtractCallback
// STDMETHOD(GetInStream)(const wchar_t *name, ISequentialInStream **inStream);
@@ -59,24 +53,24 @@ private:
bool _extractMode;
- bool WriteModified;
- bool WriteCreated;
- bool WriteAccessed;
+ bool WriteCTime;
+ bool WriteATime;
+ bool WriteMTime;
bool _encrypted;
struct CProcessedFileInfo
{
- FILETIME CreationTime;
- FILETIME LastWriteTime;
- FILETIME LastAccessTime;
+ FILETIME CTime;
+ FILETIME ATime;
+ FILETIME MTime;
UInt32 Attributes;
- bool IsCreationTimeDefined;
- bool IsLastWriteTimeDefined;
- bool IsLastAccessTimeDefined;
+ bool CTimeDefined;
+ bool ATimeDefined;
+ bool MTimeDefined;
- bool IsDirectory;
+ bool IsDir;
bool AttributesAreDefined;
} _processedFileInfo;
@@ -86,7 +80,7 @@ private:
UStringVector _removePathParts;
UString _itemDefaultName;
- FILETIME _utcLastWriteTimeDefault;
+ FILETIME _utcMTimeDefault;
UInt32 _attributesDefault;
bool _stdOutMode;
@@ -94,9 +88,9 @@ private:
HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined);
public:
CArchiveExtractCallback():
- WriteModified(true),
- WriteCreated(true),
- WriteAccessed(false),
+ WriteCTime(true),
+ WriteATime(true),
+ WriteMTime(true),
_multiArchives(false)
{
LocalProgressSpec = new CLocalProgress();
@@ -113,23 +107,23 @@ public:
UInt64 NumFiles;
UInt64 UnpackSize;
- void InitForMulti(bool multiArchives,
+ void InitForMulti(bool multiArchives,
NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode)
- {
- _multiArchives = multiArchives; NumFolders = NumFiles = UnpackSize = 0;
+ NExtract::NOverwriteMode::EEnum overwriteMode)
+ {
+ _multiArchives = multiArchives; NumFolders = NumFiles = UnpackSize = 0;
_pathMode = pathMode;
_overwriteMode = overwriteMode;
}
void Init(
- IInArchive *archiveHandler,
+ IInArchive *archiveHandler,
IFolderArchiveExtractCallback *extractCallback2,
bool stdOutMode,
const UString &directoryPath,
const UStringVector &removePathParts,
const UString &itemDefaultName,
- const FILETIME &utcLastWriteTimeDefault,
+ const FILETIME &utcMTimeDefault,
UInt32 attributesDefault,
UInt64 packSize);
diff --git a/CPP/7zip/UI/Common/ArchiveName.cpp b/CPP/7zip/UI/Common/ArchiveName.cpp
index 2d50ede1..a2fc6a0f 100755
--- a/CPP/7zip/UI/Common/ArchiveName.cpp
+++ b/CPP/7zip/UI/Common/ArchiveName.cpp
@@ -31,7 +31,7 @@ UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
if (!NFile::NFind::FindFile(srcName, fileInfo))
return resultName;
resultName = fileInfo.Name;
- if (!fileInfo.IsDirectory() && !keepName)
+ if (!fileInfo.IsDir() && !keepName)
{
int dotPos = resultName.ReverseFind('.');
if (dotPos > 0)
diff --git a/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp b/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
index 2f0c41a4..8f289d1b 100755
--- a/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
+++ b/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
@@ -15,61 +15,46 @@ using namespace NWindows;
STDMETHODIMP COpenCallbackImp::SetTotal(const UInt64 *files, const UInt64 *bytes)
{
COM_TRY_BEGIN
+ if (ReOpenCallback)
+ return ReOpenCallback->SetTotal(files, bytes);
if (!Callback)
return S_OK;
- return Callback->SetTotal(files, bytes);
+ return Callback->Open_SetTotal(files, bytes);
COM_TRY_END
}
STDMETHODIMP COpenCallbackImp::SetCompleted(const UInt64 *files, const UInt64 *bytes)
{
COM_TRY_BEGIN
+ if (ReOpenCallback)
+ return ReOpenCallback->SetCompleted(files, bytes);
if (!Callback)
return S_OK;
- return Callback->SetTotal(files, bytes);
+ return Callback->Open_SetCompleted(files, bytes);
COM_TRY_END
}
STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (_subArchiveMode)
- {
switch(propID)
{
- case kpidName:
- propVariant = _subArchiveName;
- break;
+ case kpidName: prop = _subArchiveName; break;
}
- propVariant.Detach(value);
- return S_OK;
- }
- switch(propID)
- {
- case kpidName:
- propVariant = _fileInfo.Name;
- break;
- case kpidIsFolder:
- propVariant = _fileInfo.IsDirectory();
- break;
- case kpidSize:
- propVariant = _fileInfo.Size;
- break;
- case kpidAttributes:
- propVariant = (UInt32)_fileInfo.Attributes;
- break;
- case kpidLastAccessTime:
- propVariant = _fileInfo.LastAccessTime;
- break;
- case kpidCreationTime:
- propVariant = _fileInfo.CreationTime;
- break;
- case kpidLastWriteTime:
- propVariant = _fileInfo.LastWriteTime;
- break;
+ else
+ switch(propID)
+ {
+ case kpidName: prop = _fileInfo.Name; break;
+ case kpidIsDir: prop = _fileInfo.IsDir(); break;
+ case kpidSize: prop = _fileInfo.Size; break;
+ case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
+ case kpidCTime: prop = _fileInfo.CTime; break;
+ case kpidATime: prop = _fileInfo.ATime; break;
+ case kpidMTime: prop = _fileInfo.MTime; break;
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
COM_TRY_END
}
@@ -102,13 +87,13 @@ STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStre
return S_FALSE;
if (Callback)
{
- RINOK(Callback->CheckBreak());
+ RINOK(Callback->Open_CheckBreak());
}
*inStream = NULL;
UString fullPath = _folderPrefix + name;
if (!NFile::NFind::FindFile(fullPath, _fileInfo))
return S_FALSE;
- if (_fileInfo.IsDirectory())
+ if (_fileInfo.IsDir())
return S_FALSE;
CInFileStreamVol *inFile = new CInFileStreamVol;
CMyComPtr<IInStream> inStreamTemp = inFile;
@@ -128,9 +113,16 @@ STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStre
STDMETHODIMP COpenCallbackImp::CryptoGetTextPassword(BSTR *password)
{
COM_TRY_BEGIN
+ if (ReOpenCallback)
+ {
+ CMyComPtr<ICryptoGetTextPassword> getTextPassword;
+ ReOpenCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
+ if (getTextPassword)
+ return getTextPassword->CryptoGetTextPassword(password);
+ }
if (!Callback)
return E_NOTIMPL;
- return Callback->CryptoGetTextPassword(password);
+ return Callback->Open_CryptoGetTextPassword(password);
COM_TRY_END
}
#endif
diff --git a/CPP/7zip/UI/Common/ArchiveOpenCallback.h b/CPP/7zip/UI/Common/ArchiveOpenCallback.h
index 12b2b325..ca445974 100755
--- a/CPP/7zip/UI/Common/ArchiveOpenCallback.h
+++ b/CPP/7zip/UI/Common/ArchiveOpenCallback.h
@@ -9,54 +9,61 @@
#ifndef _NO_CRYPTO
#include "../../IPassword.h"
-#endif
+#endif
#include "../../Archive/IArchive.h"
+#ifdef _NO_CRYPTO
+
+#define INTERFACE_IOpenCallbackUI_Crypto(x)
+
+#else
+
+#define INTERFACE_IOpenCallbackUI_Crypto(x) \
+ virtual HRESULT Open_CryptoGetTextPassword(BSTR *password) x; \
+ virtual HRESULT Open_GetPasswordIfAny(UString &password) x; \
+ virtual bool Open_WasPasswordAsked() x; \
+ virtual void Open_ClearPasswordWasAskedFlag() x; \
+
+#endif
+
+#define INTERFACE_IOpenCallbackUI(x) \
+ virtual HRESULT Open_CheckBreak() x; \
+ virtual HRESULT Open_SetTotal(const UInt64 *files, const UInt64 *bytes) x; \
+ virtual HRESULT Open_SetCompleted(const UInt64 *files, const UInt64 *bytes) x; \
+ INTERFACE_IOpenCallbackUI_Crypto(x)
+
struct IOpenCallbackUI
{
- virtual HRESULT CheckBreak() = 0;
- virtual HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes) = 0;
- virtual HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes) = 0;
- #ifndef _NO_CRYPTO
- virtual HRESULT CryptoGetTextPassword(BSTR *password) = 0;
- virtual HRESULT GetPasswordIfAny(UString &password) = 0;
- virtual bool WasPasswordAsked() = 0;
- virtual void ClearPasswordWasAskedFlag() = 0;
- #endif
+ INTERFACE_IOpenCallbackUI(=0)
};
-class COpenCallbackImp:
+class COpenCallbackImp:
public IArchiveOpenCallback,
public IArchiveOpenVolumeCallback,
public IArchiveOpenSetSubArchiveName,
#ifndef _NO_CRYPTO
public ICryptoGetTextPassword,
- #endif
+ #endif
public CMyUnknownImp
{
public:
#ifndef _NO_CRYPTO
MY_UNKNOWN_IMP3(
- IArchiveOpenVolumeCallback,
+ IArchiveOpenVolumeCallback,
ICryptoGetTextPassword,
IArchiveOpenSetSubArchiveName
)
#else
MY_UNKNOWN_IMP2(
- IArchiveOpenVolumeCallback,
+ IArchiveOpenVolumeCallback,
IArchiveOpenSetSubArchiveName
)
#endif
- STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes);
- STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes);
-
- // IArchiveOpenVolumeCallback
- STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value);
- STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream);
+ INTERFACE_IArchiveOpenCallback(;)
+ INTERFACE_IArchiveOpenVolumeCallback(;)
#ifndef _NO_CRYPTO
- // ICryptoGetTextPassword
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
#endif
@@ -75,6 +82,7 @@ private:
public:
UStringVector FileNames;
IOpenCallbackUI *Callback;
+ CMyComPtr<IArchiveOpenCallback> ReOpenCallback;
UInt64 TotalSize;
COpenCallbackImp(): Callback(NULL) {}
diff --git a/CPP/7zip/UI/Common/CompressCall.cpp b/CPP/7zip/UI/Common/CompressCall.cpp
index 5eba9194..3564c950 100755
--- a/CPP/7zip/UI/Common/CompressCall.cpp
+++ b/CPP/7zip/UI/Common/CompressCall.cpp
@@ -37,7 +37,7 @@ static void AddLagePagesSwitch(UString &params)
params += kLargePagesDisable;
}
-HRESULT MyCreateProcess(const UString &params,
+HRESULT MyCreateProcess(const UString &params,
LPCWSTR curDir, bool waitFinish,
NWindows::NSynchronization::CBaseEvent *event)
{
@@ -59,9 +59,9 @@ HRESULT MyCreateProcess(const UString &params,
CSysString curDirA;
if (curDir != 0)
curDirA = GetSystemString(curDir);
- result = ::CreateProcessA(NULL, (LPSTR)(LPCSTR)GetSystemString(params),
- NULL, NULL, FALSE, 0, NULL,
- ((curDir != 0) ? (LPCSTR)curDirA: 0),
+ result = ::CreateProcessA(NULL, (LPSTR)(LPCSTR)GetSystemString(params),
+ NULL, NULL, FALSE, 0, NULL,
+ ((curDir != 0) ? (LPCSTR)curDirA: 0),
&startupInfo, &processInformation);
}
else
@@ -76,9 +76,9 @@ HRESULT MyCreateProcess(const UString &params,
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
- result = ::CreateProcessW(NULL, (LPWSTR)(LPCWSTR)params,
- NULL, NULL, FALSE, 0, NULL,
- curDir,
+ result = ::CreateProcessW(NULL, (LPWSTR)(LPCWSTR)params,
+ NULL, NULL, FALSE, 0, NULL,
+ curDir,
&startupInfo, &processInformation);
}
if (result == 0)
@@ -114,7 +114,7 @@ static UString Get7zGuiPath()
return GetQuotedString(path);
}
-static HRESULT CreateTempEvent(const wchar_t *name,
+static HRESULT CreateTempEvent(const wchar_t *name,
NSynchronization::CManualResetEvent &event, UString &eventName)
{
CRandom random;
@@ -133,8 +133,8 @@ static HRESULT CreateTempEvent(const wchar_t *name,
}
}
-static HRESULT CreateMap(const UStringVector &names,
- const UString &id,
+static HRESULT CreateMap(const UStringVector &names,
+ const UString &id,
CFileMapping &fileMapping, NSynchronization::CManualResetEvent &event,
UString &params)
{
@@ -198,10 +198,10 @@ HRESULT CompressFiles(
const UString &curDir,
const UString &archiveName,
const UString &archiveType,
- const UStringVector &names,
- // const UString &outFolder,
+ const UStringVector &names,
+ // const UString &outFolder,
bool email,
- bool showDialog,
+ bool showDialog,
bool waitFinish)
{
/*
@@ -292,14 +292,14 @@ HRESULT CompressFiles(
for (int i = 0; i < names.Size(); i++)
{
const UString &unicodeString = names[i];
- memcpy(curData, (const wchar_t *)unicodeString ,
+ memcpy(curData, (const wchar_t *)unicodeString ,
unicodeString .Length() * sizeof(wchar_t));
curData += unicodeString.Length();
*curData++ = L'\0';
}
// MessageBox(0, params, 0, 0);
- RINOK(MyCreateProcess(params,
- (curDir.IsEmpty()? 0: (LPCWSTR)curDir),
+ RINOK(MyCreateProcess(params,
+ (curDir.IsEmpty()? 0: (LPCWSTR)curDir),
waitFinish, &event));
}
catch(...)
diff --git a/CPP/7zip/UI/Common/CompressCall.h b/CPP/7zip/UI/Common/CompressCall.h
index 2bb1c7be..feb45790 100755
--- a/CPP/7zip/UI/Common/CompressCall.h
+++ b/CPP/7zip/UI/Common/CompressCall.h
@@ -14,8 +14,8 @@ HRESULT CompressFiles(
const UString &curDir,
const UString &archiveName,
const UString &archiveType,
- const UStringVector &names,
- // const UString &outFolder,
+ const UStringVector &names,
+ // const UString &outFolder,
bool email, bool showDialog, bool waitFinish);
HRESULT ExtractArchives(
diff --git a/CPP/7zip/UI/Common/DefaultName.cpp b/CPP/7zip/UI/Common/DefaultName.cpp
index 8ee7c048..020cb50a 100755
--- a/CPP/7zip/UI/Common/DefaultName.cpp
+++ b/CPP/7zip/UI/Common/DefaultName.cpp
@@ -6,7 +6,7 @@
static const wchar_t *kEmptyFileAlias = L"[Content]";
-UString GetDefaultName2(const UString &fileName,
+static UString GetDefaultName3(const UString &fileName,
const UString &extension, const UString &addSubExtension)
{
int extLength = extension.Length();
@@ -24,3 +24,10 @@ UString GetDefaultName2(const UString &fileName,
return kEmptyFileAlias;
}
+UString GetDefaultName2(const UString &fileName,
+ const UString &extension, const UString &addSubExtension)
+{
+ UString name = GetDefaultName3(fileName, extension, addSubExtension);
+ name.TrimRight();
+ return name;
+}
diff --git a/CPP/7zip/UI/Common/DefaultName.h b/CPP/7zip/UI/Common/DefaultName.h
index a702cb0f..9764ff87 100755
--- a/CPP/7zip/UI/Common/DefaultName.h
+++ b/CPP/7zip/UI/Common/DefaultName.h
@@ -5,7 +5,7 @@
#include "Common/MyString.h"
-UString GetDefaultName2(const UString &fileName,
+UString GetDefaultName2(const UString &fileName,
const UString &extension, const UString &addSubExtension);
#endif
diff --git a/CPP/7zip/UI/Common/DirItem.h b/CPP/7zip/UI/Common/DirItem.h
index d2f2ab43..0f289483 100755
--- a/CPP/7zip/UI/Common/DirItem.h
+++ b/CPP/7zip/UI/Common/DirItem.h
@@ -8,28 +8,61 @@
#include "../../Archive/IArchive.h"
struct CDirItem
-{
- FILETIME CreationTime;
- FILETIME LastAccessTime;
- FILETIME LastWriteTime;
+{
UInt64 Size;
+ FILETIME CTime;
+ FILETIME ATime;
+ FILETIME MTime;
UString Name;
- UString FullPath;
- UInt32 Attributes;
- bool IsDirectory() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
+ UInt32 Attrib;
+ int PhyParent;
+ int LogParent;
+
+ CDirItem(): PhyParent(-1), LogParent(-1) {}
+ bool IsDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
};
-struct CArchiveItem
-{
- FILETIME LastWriteTime;
+class CDirItems
+{
+ UStringVector Prefixes;
+ CIntVector PhyParents;
+ CIntVector LogParents;
+
+ UString GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const;
+public:
+ CObjectVector<CDirItem> Items;
+
+ int GetNumFolders() const { return Prefixes.Size(); }
+ UString GetPhyPath(int index) const;
+ UString GetLogPath(int index) const;
+
+ int AddPrefix(int phyParent, int logParent, const UString &prefix);
+ void DeleteLastPrefix();
+
+ void EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix,
+ UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes);
+
+ void EnumerateDirItems2(
+ const UString &phyPrefix,
+ const UString &logPrefix,
+ const UStringVector &filePaths,
+ UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes);
+
+ void ReserveDown();
+};
+
+struct CArcItem
+{
UInt64 Size;
+ FILETIME MTime;
UString Name;
- bool IsDirectory;
- bool SizeIsDefined;
+ bool IsDir;
+ bool SizeDefined;
bool Censored;
UInt32 IndexInServer;
- int FileTimeType;
- CArchiveItem(): IsDirectory(false), SizeIsDefined(false), Censored(false), FileTimeType(-1) {}
+ int TimeType;
+
+ CArcItem(): IsDir(false), SizeDefined(false), Censored(false), TimeType(-1) {}
};
#endif
diff --git a/CPP/7zip/UI/Common/EnumDirItems.cpp b/CPP/7zip/UI/Common/EnumDirItems.cpp
index 454092ec..3b01b6e8 100755
--- a/CPP/7zip/UI/Common/EnumDirItems.cpp
+++ b/CPP/7zip/UI/Common/EnumDirItems.cpp
@@ -2,6 +2,8 @@
#include "StdAfx.h"
+#include <stdio.h>
+
#include "Common/StringConvert.h"
#include "Common/Wildcard.h"
#include "Common/MyCom.h"
@@ -12,87 +14,171 @@ using namespace NWindows;
using namespace NFile;
using namespace NName;
-void AddDirFileInfo(
- const UString &prefix, // prefix for logical path
- const UString &fullPathName, // path on disk: can be relative to some basePrefix
- const NFind::CFileInfoW &fileInfo,
- CObjectVector<CDirItem> &dirItems)
+void AddDirFileInfo(int phyParent, int logParent,
+ const NFind::CFileInfoW &fi, CObjectVector<CDirItem> &dirItems)
{
- CDirItem item;
- item.Attributes = fileInfo.Attributes;
- item.Size = fileInfo.Size;
- item.CreationTime = fileInfo.CreationTime;
- item.LastAccessTime = fileInfo.LastAccessTime;
- item.LastWriteTime = fileInfo.LastWriteTime;
- item.Name = prefix + fileInfo.Name;
- item.FullPath = fullPathName;
- dirItems.Add(item);
+ CDirItem di;
+ di.Size = fi.Size;
+ di.CTime = fi.CTime;
+ di.ATime = fi.ATime;
+ di.MTime = fi.MTime;
+ di.Attrib = fi.Attrib;
+ di.PhyParent = phyParent;
+ di.LogParent = logParent;
+ di.Name = fi.Name;
+ dirItems.Add(di);
}
-static void EnumerateDirectory(
- const UString &baseFolderPrefix, // base (disk) prefix for scanning
- const UString &directory, // additional disk prefix starting from baseFolderPrefix
- const UString &prefix, // logical prefix
- CObjectVector<CDirItem> &dirItems,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes)
+UString CDirItems::GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const
+{
+ UString path;
+ int len = name.Length();
+ int i;
+ for (i = index; i >= 0; i = parents[i])
+ len += Prefixes[i].Length();
+ int totalLen = len;
+ wchar_t *p = path.GetBuffer(len);
+ p[len] = 0;
+ len -= name.Length();
+ memcpy(p + len, (const wchar_t *)name, name.Length() * sizeof(wchar_t));
+ for (i = index; i >= 0; i = parents[i])
+ {
+ const UString &s = Prefixes[i];
+ len -= s.Length();
+ memcpy(p + len, (const wchar_t *)s, s.Length() * sizeof(wchar_t));
+ }
+ path.ReleaseBuffer(totalLen);
+ return path;
+}
+
+UString CDirItems::GetPhyPath(int index) const
+{
+ const CDirItem &di = Items[index];
+ return GetPrefixesPath(PhyParents, di.PhyParent, di.Name);
+}
+
+UString CDirItems::GetLogPath(int index) const
+{
+ const CDirItem &di = Items[index];
+ return GetPrefixesPath(LogParents, di.LogParent, di.Name);
+}
+
+void CDirItems::ReserveDown()
+{
+ Prefixes.ReserveDown();
+ PhyParents.ReserveDown();
+ LogParents.ReserveDown();
+ Items.ReserveDown();
+}
+
+int CDirItems::AddPrefix(int phyParent, int logParent, const UString &prefix)
+{
+ PhyParents.Add(phyParent);
+ LogParents.Add(logParent);
+ return Prefixes.Add(prefix);
+}
+
+void CDirItems::DeleteLastPrefix()
+{
+ PhyParents.DeleteBack();
+ LogParents.DeleteBack();
+ Prefixes.DeleteBack();
+}
+
+void CDirItems::EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix,
+ UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
{
- NFind::CEnumeratorW enumerator(baseFolderPrefix + directory + wchar_t(kAnyStringWildcard));
+ NFind::CEnumeratorW enumerator(phyPrefix + (wchar_t)kAnyStringWildcard);
for (;;)
- {
- NFind::CFileInfoW fileInfo;
+ {
+ NFind::CFileInfoW fi;
bool found;
- if (!enumerator.Next(fileInfo, found))
+ if (!enumerator.Next(fi, found))
{
errorCodes.Add(::GetLastError());
- errorPaths.Add(baseFolderPrefix + directory);
+ errorPaths.Add(phyPrefix);
return;
}
if (!found)
break;
- AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo, dirItems);
- if (fileInfo.IsDirectory())
+ AddDirFileInfo(phyParent, logParent, fi, Items);
+ if (fi.IsDir())
{
- EnumerateDirectory(baseFolderPrefix, directory + fileInfo.Name + wchar_t(kDirDelimiter),
- prefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems, errorPaths, errorCodes);
+ const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
+ int parent = AddPrefix(phyParent, logParent, name2);
+ EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes);
}
}
}
-void EnumerateDirItems(
- const UString &baseFolderPrefix, // base (disk) prefix for scanning
- const UStringVector &fileNames, // names relative to baseFolderPrefix
- const UString &archiveNamePrefix,
- CObjectVector<CDirItem> &dirItems,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes)
+void CDirItems::EnumerateDirItems2(const UString &phyPrefix, const UString &logPrefix,
+ const UStringVector &filePaths, UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
{
- for(int i = 0; i < fileNames.Size(); i++)
+ int phyParent = phyPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, phyPrefix);
+ int logParent = logPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, logPrefix);
+
+ for (int i = 0; i < filePaths.Size(); i++)
{
- const UString &fileName = fileNames[i];
- NFind::CFileInfoW fileInfo;
- if (!NFind::FindFile(baseFolderPrefix + fileName, fileInfo))
+ const UString &filePath = filePaths[i];
+ NFind::CFileInfoW fi;
+ const UString phyPath = phyPrefix + filePath;
+ if (!NFind::FindFile(phyPath, fi))
{
errorCodes.Add(::GetLastError());
- errorPaths.Add(baseFolderPrefix + fileName);
+ errorPaths.Add(phyPath);
continue;
}
- AddDirFileInfo(archiveNamePrefix, fileName, fileInfo, dirItems);
- if (fileInfo.IsDirectory())
+ int delimiter = filePath.ReverseFind((wchar_t)kDirDelimiter);
+
+ int phyParentCur = phyParent;
+ if (delimiter >= 0)
+ phyParentCur = AddPrefix(phyParentCur, logParent, filePath.Left(delimiter + 1));
+ AddDirFileInfo(phyParentCur, logParent, fi, Items);
+ if (fi.IsDir())
{
- EnumerateDirectory(baseFolderPrefix, fileName + wchar_t(kDirDelimiter),
- archiveNamePrefix + fileInfo.Name + wchar_t(kDirDelimiter),
- dirItems, errorPaths, errorCodes);
+ const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
+ int parent = AddPrefix(phyParentCur, logParent, name2);
+ EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes);
}
}
+ ReserveDown();
+}
+
+static HRESULT EnumerateDirItems(const NWildcard::CCensorNode &curNode,
+ int phyParent, int logParent, const UString &phyPrefix,
+ const UStringVector &addArchivePrefix,
+ CDirItems &dirItems,
+ bool enterToSubFolders,
+ IEnumDirItemCallback *callback,
+ UStringVector &errorPaths,
+ CRecordVector<DWORD> &errorCodes);
+
+static HRESULT EnumerateDirItems_Spec(const NWildcard::CCensorNode &curNode,
+ int phyParent, int logParent, const UString &curFolderName,
+ const UString &phyPrefix,
+ const UStringVector &addArchivePrefix,
+ CDirItems &dirItems,
+ bool enterToSubFolders,
+ IEnumDirItemCallback *callback,
+ UStringVector &errorPaths,
+ CRecordVector<DWORD> &errorCodes)
+
+{
+ const UString name2 = curFolderName + (wchar_t)kDirDelimiter;
+ int parent = dirItems.AddPrefix(phyParent, logParent, name2);
+ int numItems = dirItems.Items.Size();
+ HRESULT res = EnumerateDirItems(curNode, parent, parent, phyPrefix + name2,
+ addArchivePrefix, dirItems, enterToSubFolders, callback, errorPaths, errorCodes);
+ if (numItems == dirItems.Items.Size())
+ dirItems.DeleteLastPrefix();
+ return res;
}
-static HRESULT EnumerateDirItems(
- const NWildcard::CCensorNode &curNode,
- const UString &diskPrefix, // full disk path prefix
- const UString &archivePrefix, // prefix from root
+
+static HRESULT EnumerateDirItems(const NWildcard::CCensorNode &curNode,
+ int phyParent, int logParent, const UString &phyPrefix,
const UStringVector &addArchivePrefix, // prefix from curNode
- CObjectVector<CDirItem> &dirItems,
+ CDirItems &dirItems,
bool enterToSubFolders,
IEnumDirItemCallback *callback,
UStringVector &errorPaths,
@@ -102,7 +188,7 @@ static HRESULT EnumerateDirItems(
if (curNode.NeedCheckSubDirs())
enterToSubFolders = true;
if (callback)
- RINOK(callback->CheckBreak());
+ RINOK(callback->ScanProgress(dirItems.GetNumFolders(), dirItems.Items.Size(), phyPrefix));
// try direct_names case at first
if (addArchivePrefix.IsEmpty() && !enterToSubFolders)
@@ -127,30 +213,28 @@ static HRESULT EnumerateDirItems(
{
const NWildcard::CItem &item = curNode.IncludeItems[i];
const UString &name = item.PathParts.Front();
- const UString fullPath = diskPrefix + name;
- NFind::CFileInfoW fileInfo;
- if (!NFind::FindFile(fullPath, fileInfo))
+ const UString fullPath = phyPrefix + name;
+ NFind::CFileInfoW fi;
+ if (!NFind::FindFile(fullPath, fi))
{
errorCodes.Add(::GetLastError());
errorPaths.Add(fullPath);
continue;
}
- bool isDir = fileInfo.IsDirectory();
+ bool isDir = fi.IsDir();
if (isDir && !item.ForDir || !isDir && !item.ForFile)
{
errorCodes.Add((DWORD)E_FAIL);
errorPaths.Add(fullPath);
continue;
}
- const UString realName = fileInfo.Name;
- const UString realDiskPath = diskPrefix + realName;
{
UStringVector pathParts;
- pathParts.Add(fileInfo.Name);
+ pathParts.Add(fi.Name);
if (curNode.CheckPathToRoot(false, pathParts, !isDir))
continue;
}
- AddDirFileInfo(archivePrefix, realDiskPath, fileInfo, dirItems);
+ AddDirFileInfo(phyParent, logParent, fi, dirItems.Items);
if (!isDir)
continue;
@@ -167,11 +251,10 @@ static HRESULT EnumerateDirItems(
else
{
nextNode = &curNode;
- addArchivePrefixNew.Add(name); // don't change it to realName. It's for shortnames support
+ addArchivePrefixNew.Add(name); // don't change it to fi.Name. It's for shortnames support
}
- RINOK(EnumerateDirItems(*nextNode,
- realDiskPath + wchar_t(kDirDelimiter),
- archivePrefix + realName + wchar_t(kDirDelimiter),
+
+ RINOK(EnumerateDirItems_Spec(*nextNode, phyParent, logParent, fi.Name, phyPrefix,
addArchivePrefixNew, dirItems, true, callback, errorPaths, errorCodes));
}
for (i = 0; i < curNode.SubNodes.Size(); i++)
@@ -180,9 +263,9 @@ static HRESULT EnumerateDirItems(
if (!needEnterVector[i])
continue;
const NWildcard::CCensorNode &nextNode = curNode.SubNodes[i];
- const UString fullPath = diskPrefix + nextNode.Name;
- NFind::CFileInfoW fileInfo;
- if (!NFind::FindFile(fullPath, fileInfo))
+ const UString fullPath = phyPrefix + nextNode.Name;
+ NFind::CFileInfoW fi;
+ if (!NFind::FindFile(fullPath, fi))
{
if (!nextNode.AreThereIncludeItems())
continue;
@@ -190,15 +273,14 @@ static HRESULT EnumerateDirItems(
errorPaths.Add(fullPath);
continue;
}
- if (!fileInfo.IsDirectory())
+ if (!fi.IsDir())
{
errorCodes.Add((DWORD)E_FAIL);
errorPaths.Add(fullPath);
continue;
}
- RINOK(EnumerateDirItems(nextNode,
- diskPrefix + fileInfo.Name + wchar_t(kDirDelimiter),
- archivePrefix + fileInfo.Name + wchar_t(kDirDelimiter),
+
+ RINOK(EnumerateDirItems_Spec(nextNode, phyParent, logParent, fi.Name, phyPrefix,
UStringVector(), dirItems, false, callback, errorPaths, errorCodes));
}
return S_OK;
@@ -206,38 +288,38 @@ static HRESULT EnumerateDirItems(
}
- NFind::CEnumeratorW enumerator(diskPrefix + wchar_t(kAnyStringWildcard));
- for (;;)
+ NFind::CEnumeratorW enumerator(phyPrefix + wchar_t(kAnyStringWildcard));
+ for (int ttt = 0; ; ttt++)
{
- NFind::CFileInfoW fileInfo;
+ NFind::CFileInfoW fi;
bool found;
- if (!enumerator.Next(fileInfo, found))
+ if (!enumerator.Next(fi, found))
{
errorCodes.Add(::GetLastError());
- errorPaths.Add(diskPrefix);
+ errorPaths.Add(phyPrefix);
break;
}
if (!found)
break;
- if (callback)
- RINOK(callback->CheckBreak());
- const UString &name = fileInfo.Name;
+ if (callback && (ttt & 0xFF) == 0xFF)
+ RINOK(callback->ScanProgress(dirItems.GetNumFolders(), dirItems.Items.Size(), phyPrefix));
+ const UString &name = fi.Name;
bool enterToSubFolders2 = enterToSubFolders;
UStringVector addArchivePrefixNew = addArchivePrefix;
addArchivePrefixNew.Add(name);
{
UStringVector addArchivePrefixNewTemp(addArchivePrefixNew);
- if (curNode.CheckPathToRoot(false, addArchivePrefixNewTemp, !fileInfo.IsDirectory()))
+ if (curNode.CheckPathToRoot(false, addArchivePrefixNewTemp, !fi.IsDir()))
continue;
}
- if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fileInfo.IsDirectory()))
+ if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fi.IsDir()))
{
- AddDirFileInfo(archivePrefix, diskPrefix + name, fileInfo, dirItems);
- if (fileInfo.IsDirectory())
+ AddDirFileInfo(phyParent, logParent, fi, dirItems.Items);
+ if (fi.IsDir())
enterToSubFolders2 = true;
}
- if (!fileInfo.IsDirectory())
+ if (!fi.IsDir())
continue;
const NWildcard::CCensorNode *nextNode = 0;
@@ -256,17 +338,16 @@ static HRESULT EnumerateDirItems(
nextNode = &curNode;
addArchivePrefixNew.Add(name);
}
- RINOK(EnumerateDirItems(*nextNode,
- diskPrefix + name + wchar_t(kDirDelimiter),
- archivePrefix + name + wchar_t(kDirDelimiter),
+
+ RINOK(EnumerateDirItems_Spec(*nextNode, phyParent, logParent, name, phyPrefix,
addArchivePrefixNew, dirItems, enterToSubFolders2, callback, errorPaths, errorCodes));
}
return S_OK;
}
HRESULT EnumerateItems(
- const NWildcard::CCensor &censor,
- CObjectVector<CDirItem> &dirItems,
+ const NWildcard::CCensor &censor,
+ CDirItems &dirItems,
IEnumDirItemCallback *callback,
UStringVector &errorPaths,
CRecordVector<DWORD> &errorCodes)
@@ -274,8 +355,10 @@ HRESULT EnumerateItems(
for (int i = 0; i < censor.Pairs.Size(); i++)
{
const NWildcard::CPair &pair = censor.Pairs[i];
- RINOK(EnumerateDirItems(pair.Head, pair.Prefix, L"", UStringVector(), dirItems, false,
+ int phyParent = pair.Prefix.IsEmpty() ? -1 : dirItems.AddPrefix(-1, -1, pair.Prefix);
+ RINOK(EnumerateDirItems(pair.Head, phyParent, -1, pair.Prefix, UStringVector(), dirItems, false,
callback, errorPaths, errorCodes));
}
+ dirItems.ReserveDown();
return S_OK;
}
diff --git a/CPP/7zip/UI/Common/EnumDirItems.h b/CPP/7zip/UI/Common/EnumDirItems.h
index 8d5495a8..d0ce950e 100755
--- a/CPP/7zip/UI/Common/EnumDirItems.h
+++ b/CPP/7zip/UI/Common/EnumDirItems.h
@@ -4,35 +4,21 @@
#define __ENUM_DIR_ITEMS_H
#include "Common/Wildcard.h"
-#include "DirItem.h"
-
#include "Windows/FileFind.h"
+#include "DirItem.h"
-void AddDirFileInfo(
- const UString &prefix,
- const UString &fullPathName,
- const NWindows::NFile::NFind::CFileInfoW &fileInfo,
- CObjectVector<CDirItem> &dirItems);
-
-
-void EnumerateDirItems(
- const UString &baseFolderPrefix,
- const UStringVector &fileNames,
- const UString &archiveNamePrefix,
- CObjectVector<CDirItem> &dirItems,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes);
+void AddDirFileInfo(int phyParent, int logParent,
+ const NWindows::NFile::NFind::CFileInfoW &fi, CObjectVector<CDirItem> &dirItems);
struct IEnumDirItemCallback
{
- virtual HRESULT CheckBreak() { return S_OK; }
+ virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) = 0;
};
-
HRESULT EnumerateItems(
- const NWildcard::CCensor &censor,
- CObjectVector<CDirItem> &dirItems,
- IEnumDirItemCallback *callback,
+ const NWildcard::CCensor &censor,
+ CDirItems &dirItems,
+ IEnumDirItemCallback *callback,
UStringVector &errorPaths,
CRecordVector<DWORD> &errorCodes);
diff --git a/CPP/7zip/UI/Common/ExitCode.h b/CPP/7zip/UI/Common/ExitCode.h
index 0aac3695..b6d7d4df 100755
--- a/CPP/7zip/UI/Common/ExitCode.h
+++ b/CPP/7zip/UI/Common/ExitCode.h
@@ -10,7 +10,7 @@ enum EEnum {
kSuccess = 0, // Successful operation
kWarning = 1, // Non fatal error(s) occurred
kFatalError = 2, // A fatal error occurred
- // kCRCError = 3, // A CRC error occurred when unpacking
+ // kCRCError = 3, // A CRC error occurred when unpacking
// kLockedArchive = 4, // Attempt to modify an archive previously locked
// kWriteError = 5, // Write to disk error
// kOpenError = 6, // Open file error
diff --git a/CPP/7zip/UI/Common/Extract.cpp b/CPP/7zip/UI/Common/Extract.cpp
index 0e56a08a..3ac497f4 100755
--- a/CPP/7zip/UI/Common/Extract.cpp
+++ b/CPP/7zip/UI/Common/Extract.cpp
@@ -12,10 +12,9 @@
using namespace NWindows;
-HRESULT DecompressArchive(
+static HRESULT DecompressArchive(
IInArchive *archive,
UInt64 packSize,
- const UString &defaultName,
const NWildcard::CCensorNode &wildcardCensor,
const CExtractOptions &options,
IExtractCallbackUI *callback,
@@ -45,7 +44,11 @@ HRESULT DecompressArchive(
UStringVector removePathParts;
UString outDir = options.OutputDir;
- outDir.Replace(L"*", defaultName);
+ outDir.Replace(L"*", options.DefaultItemName);
+ #ifdef _WIN32
+ outDir.TrimRight();
+ #endif
+
if(!outDir.IsEmpty())
if(!NFile::NDirectory::CreateComplexDirectory(outDir))
{
@@ -57,34 +60,34 @@ HRESULT DecompressArchive(
}
extractCallbackSpec->Init(
- archive,
+ archive,
callback,
options.StdOutMode,
- outDir,
- removePathParts,
- options.DefaultItemName,
- options.ArchiveFileInfo.LastWriteTime,
- options.ArchiveFileInfo.Attributes,
+ outDir,
+ removePathParts,
+ options.DefaultItemName,
+ options.ArchiveFileInfo.MTime,
+ options.ArchiveFileInfo.Attrib,
packSize);
#ifdef COMPRESS_MT
RINOK(SetProperties(archive, options.Properties));
#endif
- HRESULT result = archive->Extract(&realIndices.Front(),
+ HRESULT result = archive->Extract(&realIndices.Front(),
realIndices.Size(), options.TestMode? 1: 0, extractCallbackSpec);
return callback->ExtractResult(result);
}
HRESULT DecompressArchives(
- CCodecs *codecs,
- UStringVector &archivePaths, UStringVector &archivePathsFull,
+ CCodecs *codecs, const CIntVector &formatIndices,
+ UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
const CExtractOptions &optionsSpec,
IOpenCallbackUI *openCallback,
- IExtractCallbackUI *extractCallback,
- UString &errorMessage,
+ IExtractCallbackUI *extractCallback,
+ UString &errorMessage,
CDecompressStat &stat)
{
stat.Clear();
@@ -95,13 +98,13 @@ HRESULT DecompressArchives(
for (i = 0; i < archivePaths.Size(); i++)
{
const UString &archivePath = archivePaths[i];
- NFile::NFind::CFileInfoW archiveFileInfo;
- if (!NFile::NFind::FindFile(archivePath, archiveFileInfo))
+ NFile::NFind::CFileInfoW fi;
+ if (!NFile::NFind::FindFile(archivePath, fi))
throw "there is no such archive";
- if (archiveFileInfo.IsDirectory())
+ if (fi.IsDir())
throw "can't decompress folder";
- archiveSizes.Add(archiveFileInfo.Size);
- totalPackSize += archiveFileInfo.Size;
+ archiveSizes.Add(fi.Size);
+ totalPackSize += fi.Size;
}
CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
CMyComPtr<IArchiveExtractCallback> ec(extractCallbackSpec);
@@ -109,31 +112,60 @@ HRESULT DecompressArchives(
extractCallbackSpec->InitForMulti(multi, options.PathMode, options.OverwriteMode);
if (multi)
{
- RINOK(extractCallback->SetTotal(totalPackSize));
+ RINOK(extractCallback->SetTotal(totalPackSize));
}
for (i = 0; i < archivePaths.Size(); i++)
{
const UString &archivePath = archivePaths[i];
- NFile::NFind::CFileInfoW archiveFileInfo;
- if (!NFile::NFind::FindFile(archivePath, archiveFileInfo))
+ NFile::NFind::CFileInfoW fi;
+ if (!NFile::NFind::FindFile(archivePath, fi))
throw "there is no such archive";
- if (archiveFileInfo.IsDirectory())
+ if (fi.IsDir())
throw "there is no such archive";
- options.ArchiveFileInfo = archiveFileInfo;
+ options.ArchiveFileInfo = fi;
#ifndef _NO_CRYPTO
- openCallback->ClearPasswordWasAskedFlag();
+ openCallback->Open_ClearPasswordWasAskedFlag();
#endif
RINOK(extractCallback->BeforeOpen(archivePath));
CArchiveLink archiveLink;
- HRESULT result = MyOpenArchive(codecs, archivePath, archiveLink, openCallback);
+
+ CIntVector formatIndices2 = formatIndices;
+ #ifndef _SFX
+ if (formatIndices.IsEmpty())
+ {
+ int pos = archivePath.ReverseFind(L'.');
+ if (pos >= 0)
+ {
+ UString s = archivePath.Mid(pos + 1);
+ int index = codecs->FindFormatForExtension(s);
+ if (index >= 0 && s == L"001")
+ {
+ s = archivePath.Left(pos);
+ pos = s.ReverseFind(L'.');
+ if (pos >= 0)
+ {
+ int index2 = codecs->FindFormatForExtension(s.Mid(pos + 1));
+ if (index2 >= 0 && s.CompareNoCase(L"rar") != 0)
+ {
+ formatIndices2.Add(index2);
+ formatIndices2.Add(index);
+ }
+ }
+ }
+ }
+ }
+ #endif
+ HRESULT result = MyOpenArchive(codecs, formatIndices2, archivePath, archiveLink, openCallback);
+ if (result == E_ABORT)
+ return result;
bool crypted = false;
#ifndef _NO_CRYPTO
- crypted = openCallback->WasPasswordAsked();
+ crypted = openCallback->Open_WasPasswordAsked();
#endif
RINOK(extractCallback->OpenResult(archivePath, result, crypted));
@@ -154,12 +186,12 @@ HRESULT DecompressArchives(
if (archiveLink.VolumePaths.Size() != 0)
{
totalPackSize += archiveLink.VolumesSize;
- RINOK(extractCallback->SetTotal(totalPackSize));
+ RINOK(extractCallback->SetTotal(totalPackSize));
}
#ifndef _NO_CRYPTO
UString password;
- RINOK(openCallback->GetPasswordIfAny(password));
+ RINOK(openCallback->Open_GetPasswordIfAny(password));
if (!password.IsEmpty())
{
RINOK(extractCallback->SetPassword(password));
@@ -168,11 +200,10 @@ HRESULT DecompressArchives(
options.DefaultItemName = archiveLink.GetDefaultItemName();
RINOK(DecompressArchive(
- archiveLink.GetArchive(),
- archiveFileInfo.Size + archiveLink.VolumesSize,
- archiveLink.GetDefaultItemName(),
+ archiveLink.GetArchive(),
+ fi.Size + archiveLink.VolumesSize,
wildcardCensor, options, extractCallback, extractCallbackSpec, errorMessage));
- extractCallbackSpec->LocalProgressSpec->InSize += archiveFileInfo.Size +
+ extractCallbackSpec->LocalProgressSpec->InSize += fi.Size +
archiveLink.VolumesSize;
extractCallbackSpec->LocalProgressSpec->OutSize = extractCallbackSpec->UnpackSize;
if (!errorMessage.IsEmpty())
diff --git a/CPP/7zip/UI/Common/Extract.h b/CPP/7zip/UI/Common/Extract.h
index e7add12e..37add18b 100755
--- a/CPP/7zip/UI/Common/Extract.h
+++ b/CPP/7zip/UI/Common/Extract.h
@@ -40,16 +40,16 @@ public:
CCodecs *Codecs;
#endif
- CExtractOptions():
- StdOutMode(false),
- YesToAll(false),
+ CExtractOptions():
+ StdOutMode(false),
+ YesToAll(false),
TestMode(false),
PathMode(NExtract::NPathMode::kFullPathnames),
OverwriteMode(NExtract::NOverwriteMode::kAskBefore)
{}
/*
- bool FullPathMode() const { return (ExtractMode == NExtractMode::kTest) ||
+ bool FullPathMode() const { return (ExtractMode == NExtractMode::kTest) ||
(ExtractMode == NExtractMode::kFullPath); }
*/
};
@@ -65,13 +65,13 @@ struct CDecompressStat
};
HRESULT DecompressArchives(
- CCodecs *codecs,
+ CCodecs *codecs, const CIntVector &formatIndices,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
const CExtractOptions &options,
IOpenCallbackUI *openCallback,
IExtractCallbackUI *extractCallback,
- UString &errorMessage,
+ UString &errorMessage,
CDecompressStat &stat);
#endif
diff --git a/CPP/7zip/UI/Common/ExtractMode.h b/CPP/7zip/UI/Common/ExtractMode.h
index 96b5a8cd..b448fb30 100755
--- a/CPP/7zip/UI/Common/ExtractMode.h
+++ b/CPP/7zip/UI/Common/ExtractMode.h
@@ -26,6 +26,6 @@ namespace NExtract {
kAutoRenameExisting
};
}
-}
+}
#endif
diff --git a/CPP/7zip/UI/Common/ExtractingFilePath.cpp b/CPP/7zip/UI/Common/ExtractingFilePath.cpp
index fa796ca6..5de388dd 100755
--- a/CPP/7zip/UI/Common/ExtractingFilePath.cpp
+++ b/CPP/7zip/UI/Common/ExtractingFilePath.cpp
@@ -14,6 +14,7 @@ static UString ReplaceIncorrectChars(const UString &s)
c = '_';
res += c;
}
+ res.TrimRight();
return res;
#else
return s;
diff --git a/CPP/7zip/UI/Common/HandlerLoader.h b/CPP/7zip/UI/Common/HandlerLoader.h
index 2a878019..4c7e1a8f 100755
--- a/CPP/7zip/UI/Common/HandlerLoader.h
+++ b/CPP/7zip/UI/Common/HandlerLoader.h
@@ -7,14 +7,14 @@
#include "Windows/DLL.h"
typedef UInt32 (WINAPI * CreateObjectFunc)(
- const GUID *clsID,
- const GUID *interfaceID,
+ const GUID *clsID,
+ const GUID *interfaceID,
void **outObject);
class CHandlerLoader: public NWindows::NDLL::CLibrary
{
public:
- HRESULT CreateHandler(LPCWSTR filepath, REFGUID clsID,
+ HRESULT CreateHandler(LPCWSTR filepath, REFGUID clsID,
void **archive, bool outHandler)
{
if (!Load(filepath))
@@ -27,7 +27,7 @@ public:
Free();
return res;
}
- HRESULT res = createObject(&clsID,
+ HRESULT res = createObject(&clsID,
outHandler ? &IID_IOutArchive : &IID_IInArchive, (void **)archive);
if (res != 0)
Free();
diff --git a/CPP/7zip/UI/Common/IFileExtractCallback.h b/CPP/7zip/UI/Common/IFileExtractCallback.h
index 284e9cb3..e8dcdce5 100755
--- a/CPP/7zip/UI/Common/IFileExtractCallback.h
+++ b/CPP/7zip/UI/Common/IFileExtractCallback.h
@@ -37,7 +37,10 @@ struct IExtractCallbackUI: IFolderArchiveExtractCallback
virtual HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted) = 0;
virtual HRESULT ThereAreNoFiles() = 0;
virtual HRESULT ExtractResult(HRESULT result) = 0;
+
+ #ifndef _NO_CRYPTO
virtual HRESULT SetPassword(const UString &password) = 0;
+ #endif
};
#endif
diff --git a/CPP/7zip/UI/Common/LoadCodecs.cpp b/CPP/7zip/UI/Common/LoadCodecs.cpp
index 52b2ebe8..79caf55e 100755
--- a/CPP/7zip/UI/Common/LoadCodecs.cpp
+++ b/CPP/7zip/UI/Common/LoadCodecs.cpp
@@ -47,7 +47,7 @@ static CSysString GetLibraryFolderPrefix()
#define kCodecsFolderName TEXT("Codecs")
#define kFormatsFolderName TEXT("Formats")
-static TCHAR *kMainDll = TEXT("7z.dll");
+static const TCHAR *kMainDll = TEXT("7z.dll");
#ifdef _WIN32
static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
@@ -69,15 +69,15 @@ static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
CSysString GetBaseFolderPrefixFromRegistry()
{
CSysString moduleFolderPrefix = GetLibraryFolderPrefix();
- NFind::CFileInfo fileInfo;
- if (NFind::FindFile(moduleFolderPrefix + kMainDll, fileInfo))
- if (!fileInfo.IsDirectory())
+ NFind::CFileInfo fi;
+ if (NFind::FindFile(moduleFolderPrefix + kMainDll, fi))
+ if (!fi.IsDir())
return moduleFolderPrefix;
- if (NFind::FindFile(moduleFolderPrefix + kCodecsFolderName, fileInfo))
- if (fileInfo.IsDirectory())
+ if (NFind::FindFile(moduleFolderPrefix + kCodecsFolderName, fi))
+ if (fi.IsDir())
return moduleFolderPrefix;
- if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fileInfo))
- if (fileInfo.IsDirectory())
+ if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fi))
+ if (fi.IsDir())
return moduleFolderPrefix;
#ifdef _WIN32
CSysString path;
@@ -97,7 +97,7 @@ typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, vo
typedef UInt32 (WINAPI *SetLargePageModeFunc)();
-static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
+static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
PROPID propId, CLSID &clsId, bool &isAssigned)
{
NWindows::NCOM::CPropVariant prop;
@@ -142,8 +142,8 @@ HRESULT CCodecs::LoadCodecs()
}
static HRESULT ReadProp(
- GetHandlerPropertyFunc getProp,
- GetHandlerPropertyFunc2 getProp2,
+ GetHandlerPropertyFunc getProp,
+ GetHandlerPropertyFunc2 getProp2,
UInt32 index, PROPID propID, NCOM::CPropVariant &prop)
{
if (getProp2)
@@ -152,8 +152,8 @@ static HRESULT ReadProp(
}
static HRESULT ReadBoolProp(
- GetHandlerPropertyFunc getProp,
- GetHandlerPropertyFunc2 getProp2,
+ GetHandlerPropertyFunc getProp,
+ GetHandlerPropertyFunc2 getProp2,
UInt32 index, PROPID propID, bool &res)
{
NCOM::CPropVariant prop;
@@ -166,8 +166,8 @@ static HRESULT ReadBoolProp(
}
static HRESULT ReadStringProp(
- GetHandlerPropertyFunc getProp,
- GetHandlerPropertyFunc2 getProp2,
+ GetHandlerPropertyFunc getProp,
+ GetHandlerPropertyFunc2 getProp2,
UInt32 index, PROPID propID, UString &res)
{
NCOM::CPropVariant prop;
@@ -183,11 +183,11 @@ static HRESULT ReadStringProp(
static const unsigned int kNumArcsMax = 32;
static unsigned int g_NumArcs = 0;
-static const CArcInfo *g_Arcs[kNumArcsMax];
-void RegisterArc(const CArcInfo *arcInfo)
-{
+static const CArcInfo *g_Arcs[kNumArcsMax];
+void RegisterArc(const CArcInfo *arcInfo)
+{
if (g_NumArcs < kNumArcsMax)
- g_Arcs[g_NumArcs++] = arcInfo;
+ g_Arcs[g_NumArcs++] = arcInfo;
}
static void SplitString(const UString &srcString, UStringVector &destStrings)
@@ -334,7 +334,7 @@ int CCodecLib::FindIconIndex(const UString &ext) const
#endif
#ifdef _7ZIP_LARGE_PAGES
-extern "C"
+extern "C"
{
extern SIZE_T g_LargePageSize;
}
@@ -391,12 +391,12 @@ HRESULT CCodecs::LoadDll(const CSysString &dllPath)
HRESULT CCodecs::LoadDllsFromFolder(const CSysString &folderPrefix)
{
NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*")));
- NFile::NFind::CFileInfo fileInfo;
- while (enumerator.Next(fileInfo))
+ NFile::NFind::CFileInfo fi;
+ while (enumerator.Next(fi))
{
- if (fileInfo.IsDirectory())
+ if (fi.IsDir())
continue;
- RINOK(LoadDll(folderPrefix + fileInfo.Name));
+ RINOK(LoadDll(folderPrefix + fi.Name));
}
return S_OK;
}
@@ -442,14 +442,16 @@ HRESULT CCodecs::Load()
return S_OK;
}
-int CCodecs::FindFormatForArchiveName(const UString &archivePath) const
+#ifndef _SFX
+
+int CCodecs::FindFormatForArchiveName(const UString &arcPath) const
{
- int slashPos1 = archivePath.ReverseFind(L'\\');
- int slashPos2 = archivePath.ReverseFind(L'.');
- int dotPos = archivePath.ReverseFind(L'.');
+ int slashPos1 = arcPath.ReverseFind(L'\\');
+ int slashPos2 = arcPath.ReverseFind(L'.');
+ int dotPos = arcPath.ReverseFind(L'.');
if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2)
return -1;
- UString ext = archivePath.Mid(dotPos + 1);
+ UString ext = arcPath.Mid(dotPos + 1);
for (int i = 0; i < Formats.Size(); i++)
{
const CArcInfoEx &arc = Formats[i];
@@ -463,19 +465,47 @@ int CCodecs::FindFormatForArchiveName(const UString &archivePath) const
return -1;
}
+int CCodecs::FindFormatForExtension(const UString &ext) const
+{
+ if (ext.IsEmpty())
+ return -1;
+ for (int i = 0; i < Formats.Size(); i++)
+ if (Formats[i].FindExtension(ext) >= 0)
+ return i;
+ return -1;
+}
+
int CCodecs::FindFormatForArchiveType(const UString &arcType) const
{
for (int i = 0; i < Formats.Size(); i++)
- {
- const CArcInfoEx &arc = Formats[i];
- if (!arc.UpdateEnabled)
- continue;
- if (arc.Name.CompareNoCase(arcType) == 0)
+ if (Formats[i].Name.CompareNoCase(arcType) == 0)
return i;
- }
return -1;
}
+bool CCodecs::FindFormatForArchiveType(const UString &arcType, CIntVector &formatIndices) const
+{
+ formatIndices.Clear();
+ for (int pos = 0; pos < arcType.Length();)
+ {
+ int pos2 = arcType.Find('.', pos);
+ if (pos2 < 0)
+ pos2 = arcType.Length();
+ const UString name = arcType.Mid(pos, pos2 - pos);
+ int index = FindFormatForArchiveType(name);
+ if (index < 0 && name != L"*")
+ {
+ formatIndices.Clear();
+ return false;
+ }
+ formatIndices.Add(index);
+ pos = pos2 + 1;
+ }
+ return true;
+}
+
+#endif
+
#ifdef EXTERNAL_CODECS
#ifdef EXPORT_CODECS
@@ -487,9 +517,9 @@ STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value);
STDMETHODIMP CCodecs::GetNumberOfMethods(UInt32 *numMethods)
{
- *numMethods =
+ *numMethods =
#ifdef EXPORT_CODECS
- g_NumCodecs +
+ g_NumCodecs +
#endif
Codecs.Size();
return S_OK;
@@ -502,7 +532,7 @@ STDMETHODIMP CCodecs::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *valu
return GetMethodProperty(index, propID, value);
#endif
- const CDllCodecInfo &ci = Codecs[index
+ const CDllCodecInfo &ci = Codecs[index
#ifdef EXPORT_CODECS
- g_NumCodecs
#endif
@@ -531,7 +561,7 @@ STDMETHODIMP CCodecs::CreateDecoder(UInt32 index, const GUID *iid, void **coder)
if (index < g_NumCodecs)
return CreateCoder2(false, index, iid, coder);
#endif
- const CDllCodecInfo &ci = Codecs[index
+ const CDllCodecInfo &ci = Codecs[index
#ifdef EXPORT_CODECS
- g_NumCodecs
#endif
@@ -547,7 +577,7 @@ STDMETHODIMP CCodecs::CreateEncoder(UInt32 index, const GUID *iid, void **coder)
if (index < g_NumCodecs)
return CreateCoder2(true, index, iid, coder);
#endif
- const CDllCodecInfo &ci = Codecs[index
+ const CDllCodecInfo &ci = Codecs[index
#ifdef EXPORT_CODECS
- g_NumCodecs
#endif
@@ -558,7 +588,7 @@ STDMETHODIMP CCodecs::CreateEncoder(UInt32 index, const GUID *iid, void **coder)
}
HRESULT CCodecs::CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const
-{
+{
for (int i = 0; i < Codecs.Size(); i++)
{
const CDllCodecInfo &codec = Codecs[i];
@@ -585,7 +615,7 @@ int CCodecs::GetCodecLibIndex(UInt32 index)
return -1;
#endif
#ifdef EXTERNAL_CODECS
- const CDllCodecInfo &ci = Codecs[index
+ const CDllCodecInfo &ci = Codecs[index
#ifdef EXPORT_CODECS
- g_NumCodecs
#endif
@@ -609,7 +639,7 @@ bool CCodecs::GetCodecEncoderIsAssigned(UInt32 index)
}
#endif
#ifdef EXTERNAL_CODECS
- const CDllCodecInfo &ci = Codecs[index
+ const CDllCodecInfo &ci = Codecs[index
#ifdef EXPORT_CODECS
- g_NumCodecs
#endif
diff --git a/CPP/7zip/UI/Common/LoadCodecs.h b/CPP/7zip/UI/Common/LoadCodecs.h
index dadcf7c2..71de2ff1 100755
--- a/CPP/7zip/UI/Common/LoadCodecs.h
+++ b/CPP/7zip/UI/Common/LoadCodecs.h
@@ -85,7 +85,7 @@ struct CArcInfoEx
void AddExts(const wchar_t* ext, const wchar_t* addExt);
- CArcInfoEx():
+ CArcInfoEx():
#ifdef EXTERNAL_CODECS
LibIndex(-1),
#endif
@@ -130,7 +130,7 @@ class CCodecs:
#endif
public CMyUnknownImp
{
-public:
+public:
#ifdef EXTERNAL_CODECS
CObjectVector<CCodecLib> Libs;
CObjectVector<CDllCodecInfo> Codecs;
@@ -148,8 +148,13 @@ public:
public:
CObjectVector<CArcInfoEx> Formats;
HRESULT Load();
- int FindFormatForArchiveName(const UString &archivePath) const;
+
+ #ifndef _SFX
+ int FindFormatForArchiveName(const UString &arcPath) const;
+ int FindFormatForExtension(const UString &ext) const;
int FindFormatForArchiveType(const UString &arcType) const;
+ bool FindFormatForArchiveType(const UString &arcType, CIntVector &formatIndices) const;
+ #endif
MY_UNKNOWN_IMP
@@ -166,8 +171,8 @@ public:
UString GetCodecName(UInt32 index);
HRESULT CreateInArchive(int formatIndex, CMyComPtr<IInArchive> &archive) const
- {
- const CArcInfoEx &ai = Formats[formatIndex];
+ {
+ const CArcInfoEx &ai = Formats[formatIndex];
#ifdef EXTERNAL_CODECS
if (ai.LibIndex < 0)
#endif
@@ -176,12 +181,12 @@ public:
return S_OK;
}
#ifdef EXTERNAL_CODECS
- return CreateArchiveHandler(ai, (void **)&archive, false);
+ return CreateArchiveHandler(ai, (void **)&archive, false);
#endif
}
HRESULT CreateOutArchive(int formatIndex, CMyComPtr<IOutArchive> &archive) const
- {
- const CArcInfoEx &ai = Formats[formatIndex];
+ {
+ const CArcInfoEx &ai = Formats[formatIndex];
#ifdef EXTERNAL_CODECS
if (ai.LibIndex < 0)
#endif
@@ -190,7 +195,7 @@ public:
return S_OK;
}
#ifdef EXTERNAL_CODECS
- return CreateArchiveHandler(ai, (void **)&archive, true);
+ return CreateArchiveHandler(ai, (void **)&archive, true);
#endif
}
int FindOutFormatFromName(const UString &name) const
diff --git a/CPP/7zip/UI/Common/OpenArchive.cpp b/CPP/7zip/UI/Common/OpenArchive.cpp
index 4bd93455..7037d876 100755
--- a/CPP/7zip/UI/Common/OpenArchive.cpp
+++ b/CPP/7zip/UI/Common/OpenArchive.cpp
@@ -52,11 +52,11 @@ HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &def
return S_OK;
}
-HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
+HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
const FILETIME &defaultFileTime, FILETIME &fileTime)
{
NCOM::CPropVariant prop;
- RINOK(archive->GetProperty(index, kpidLastWriteTime, &prop));
+ RINOK(archive->GetProperty(index, kpidMTime, &prop));
if (prop.vt == VT_FILETIME)
fileTime = prop.filetime;
else if (prop.vt == VT_EMPTY)
@@ -81,7 +81,7 @@ HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool
HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
{
- return IsArchiveItemProp(archive, index, kpidIsFolder, result);
+ return IsArchiveItemProp(archive, index, kpidIsDir, result);
}
HRESULT IsArchiveItemAnti(IInArchive *archive, UInt32 index, bool &result)
@@ -112,9 +112,10 @@ static inline bool TestSignature(const Byte *p1, const Byte *p2, size_t size)
HRESULT OpenArchive(
CCodecs *codecs,
+ int arcTypeIndex,
IInStream *inStream,
- const UString &fileName,
- IInArchive **archiveResult,
+ const UString &fileName,
+ IInArchive **archiveResult,
int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback)
@@ -127,6 +128,11 @@ HRESULT OpenArchive(
extension = fileName.Mid(dotPos + 1);
}
CIntVector orderIndices;
+ if (arcTypeIndex >= 0)
+ orderIndices.Add(arcTypeIndex);
+ else
+ {
+
int i;
int numFinded = 0;
for (i = 0; i < codecs->Formats.Size(); i++)
@@ -140,32 +146,84 @@ HRESULT OpenArchive(
{
CIntVector orderIndices2;
CByteBuffer byteBuffer;
- const size_t kBufferSize = (200 << 10);
+ const size_t kBufferSize = (1 << 21);
byteBuffer.SetCapacity(kBufferSize);
- Byte *buffer = byteBuffer;
RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
size_t processedSize = kBufferSize;
- RINOK(ReadStream(inStream, buffer, &processedSize));
+ RINOK(ReadStream(inStream, byteBuffer, &processedSize));
+ if (processedSize == 0)
+ return S_FALSE;
+
+ const Byte *buf = byteBuffer;
+ Byte hash[1 << 16];
+ memset(hash, 0xFF, 1 << 16);
+ Byte prevs[256];
+ if (orderIndices.Size() > 255)
+ return S_FALSE;
+ int i;
+ for (i = 0; i < orderIndices.Size(); i++)
+ {
+ const CArcInfoEx &ai = codecs->Formats[orderIndices[i]];
+ const CByteBuffer &sig = ai.StartSignature;
+ if (sig.GetCapacity() < 2)
+ continue;
+ UInt32 v = sig[0] | ((UInt32)sig[1] << 8);
+ prevs[i] = hash[v];
+ hash[v] = (Byte)i;
+ }
+
+ processedSize--;
for (UInt32 pos = 0; pos < processedSize; pos++)
{
- for (int i = 0; i < orderIndices.Size(); i++)
+ for (; hash[buf[pos] | ((UInt32)buf[pos + 1] << 8)] == 0xFF && pos < processedSize; pos++);
+ if (pos == processedSize)
+ break;
+ UInt32 v = buf[pos] | ((UInt32)buf[pos + 1] << 8);
+ Byte *ptr = &hash[v];
+ int i = *ptr;
+ do
{
int index = orderIndices[i];
const CArcInfoEx &ai = codecs->Formats[index];
const CByteBuffer &sig = ai.StartSignature;
- if (sig.GetCapacity() == 0)
- continue;
- if (pos + sig.GetCapacity() > processedSize)
- continue;
- if (TestSignature(buffer + pos, sig, sig.GetCapacity()))
- {
- orderIndices2.Add(index);
- orderIndices.Delete(i--);
- }
+ if (sig.GetCapacity() != 0 && pos + sig.GetCapacity() <= processedSize + 1)
+ if (TestSignature(buf + pos, sig, sig.GetCapacity()))
+ {
+ orderIndices2.Add(index);
+ orderIndices[i] = 0xFF;
+ *ptr = prevs[i];
+ }
+ ptr = &prevs[i];
+ i = *ptr;
}
+ while (i != 0xFF);
+ }
+
+ for (i = 0; i < orderIndices.Size(); i++)
+ {
+ int val = orderIndices[i];
+ if (val != 0xFF)
+ orderIndices2.Add(val);
}
- orderIndices2 += orderIndices;
orderIndices = orderIndices2;
+
+ if (orderIndices.Size() >= 2)
+ {
+ int isoIndex = codecs->FindFormatForArchiveType(L"iso");
+ int udfIndex = codecs->FindFormatForArchiveType(L"udf");
+ int iIso = -1;
+ int iUdf = -1;
+ for (int i = 0; i < orderIndices.Size(); i++)
+ {
+ if (orderIndices[i] == isoIndex) iIso = i;
+ if (orderIndices[i] == udfIndex) iUdf = i;
+ }
+ if (iUdf == iIso + 1)
+ {
+ orderIndices[iUdf] = isoIndex;
+ orderIndices[iIso] = udfIndex;
+ }
+ }
}
else if (extension == L"000" || extension == L"001")
{
@@ -195,9 +253,9 @@ HRESULT OpenArchive(
}
}
#endif
+ }
- HRESULT badResult = S_OK;
- for(i = 0; i < orderIndices.Size(); i++)
+ for(int i = 0; i < orderIndices.Size(); i++)
{
inStream->Seek(0, STREAM_SEEK_SET, NULL);
@@ -222,13 +280,7 @@ HRESULT OpenArchive(
HRESULT result = archive->Open(inStream, &kMaxCheckStartPosition, openArchiveCallback);
if (result == S_FALSE)
continue;
- if(result != S_OK)
- {
- badResult = result;
- if(result == E_ABORT)
- break;
- continue;
- }
+ RINOK(result);
*archiveResult = archive.Detach();
const CArcInfoEx &format = codecs->Formats[formatIndex];
if (format.Exts.Size() == 0)
@@ -240,21 +292,20 @@ HRESULT OpenArchive(
int subExtIndex = format.FindExtension(extension);
if (subExtIndex < 0)
subExtIndex = 0;
- defaultItemName = GetDefaultName2(fileName,
- format.Exts[subExtIndex].Ext,
+ defaultItemName = GetDefaultName2(fileName,
+ format.Exts[subExtIndex].Ext,
format.Exts[subExtIndex].AddExt);
}
return S_OK;
}
- if (badResult != S_OK)
- return badResult;
return S_FALSE;
}
HRESULT OpenArchive(
CCodecs *codecs,
- const UString &filePath,
- IInArchive **archiveResult,
+ int arcTypeIndex,
+ const UString &filePath,
+ IInArchive **archiveResult,
int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback)
@@ -263,7 +314,7 @@ HRESULT OpenArchive(
CMyComPtr<IInStream> inStream(inStreamSpec);
if (!inStreamSpec->Open(filePath))
return GetLastError();
- return OpenArchive(codecs, inStream, ExtractFileNameFromPath(filePath),
+ return OpenArchive(codecs, arcTypeIndex, inStream, ExtractFileNameFromPath(filePath),
archiveResult, formatIndex,
defaultItemName, openArchiveCallback);
}
@@ -284,38 +335,54 @@ static void MakeDefaultName(UString &name)
HRESULT OpenArchive(
CCodecs *codecs,
- const UString &fileName,
- IInArchive **archive0,
- IInArchive **archive1,
+ const CIntVector &formatIndices,
+ const UString &fileName,
+ IInArchive **archive0,
+ IInArchive **archive1,
int &formatIndex0,
int &formatIndex1,
UString &defaultItemName0,
UString &defaultItemName1,
IArchiveOpenCallback *openArchiveCallback)
{
- HRESULT result = OpenArchive(codecs, fileName,
- archive0, formatIndex0, defaultItemName0, openArchiveCallback);
+ if (formatIndices.Size() >= 3)
+ return E_NOTIMPL;
+
+ int arcTypeIndex = -1;
+ if (formatIndices.Size() >= 1)
+ arcTypeIndex = formatIndices[formatIndices.Size() - 1];
+
+ HRESULT result = OpenArchive(codecs, arcTypeIndex, fileName,
+ archive0, formatIndex0, defaultItemName0, openArchiveCallback);
RINOK(result);
+
+ if (formatIndices.Size() == 1)
+ return S_OK;
+ arcTypeIndex = -1;
+ if (formatIndices.Size() >= 2)
+ arcTypeIndex = formatIndices[formatIndices.Size() - 2];
+
+ HRESULT resSpec = (formatIndices.Size() == 0 ? S_OK : E_NOTIMPL);
+
CMyComPtr<IInArchiveGetStream> getStream;
result = (*archive0)->QueryInterface(IID_IInArchiveGetStream, (void **)&getStream);
- if (result != S_OK || getStream == 0)
- return S_OK;
+ if (result != S_OK || !getStream)
+ return resSpec;
CMyComPtr<ISequentialInStream> subSeqStream;
result = getStream->GetStream(0, &subSeqStream);
- if (result != S_OK)
- return S_OK;
+ if (result != S_OK || !subSeqStream)
+ return resSpec;
CMyComPtr<IInStream> subStream;
- if (subSeqStream.QueryInterface(IID_IInStream, &subStream) != S_OK)
- return S_OK;
- if (!subStream)
- return S_OK;
+ result = subSeqStream.QueryInterface(IID_IInStream, &subStream);
+ if (result != S_OK || !subStream)
+ return resSpec;
UInt32 numItems;
RINOK((*archive0)->GetNumberOfItems(&numItems));
if (numItems < 1)
- return S_OK;
+ return resSpec;
UString subPath;
RINOK(GetArchiveItemPath(*archive0, 0, subPath))
@@ -338,39 +405,47 @@ HRESULT OpenArchive(
if (setSubArchiveName)
setSubArchiveName->SetSubArchiveName(subPath);
- result = OpenArchive(codecs, subStream, subPath,
+ result = OpenArchive(codecs, arcTypeIndex, subStream, subPath,
archive1, formatIndex1, defaultItemName1, openArchiveCallback);
+ resSpec = (formatIndices.Size() == 0 ? S_OK : S_FALSE);
+ if (result != S_OK)
+ return resSpec;
return S_OK;
}
static void SetCallback(const UString &archiveName,
- IOpenCallbackUI *openCallbackUI, CMyComPtr<IArchiveOpenCallback> &openCallback)
+ IOpenCallbackUI *openCallbackUI,
+ IArchiveOpenCallback *reOpenCallback,
+ CMyComPtr<IArchiveOpenCallback> &openCallback)
{
COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
openCallback = openCallbackSpec;
openCallbackSpec->Callback = openCallbackUI;
+ openCallbackSpec->ReOpenCallback = reOpenCallback;
UString fullName;
int fileNamePartStartIndex;
NFile::NDirectory::MyGetFullPathName(archiveName, fullName, fileNamePartStartIndex);
openCallbackSpec->Init(
- fullName.Left(fileNamePartStartIndex),
+ fullName.Left(fileNamePartStartIndex),
fullName.Mid(fileNamePartStartIndex));
}
HRESULT MyOpenArchive(
- CCodecs *codecs,
+ CCodecs *codecs,
+ int arcTypeIndex,
const UString &archiveName,
IInArchive **archive, UString &defaultItemName, IOpenCallbackUI *openCallbackUI)
{
CMyComPtr<IArchiveOpenCallback> openCallback;
- SetCallback(archiveName, openCallbackUI, openCallback);
+ SetCallback(archiveName, openCallbackUI, NULL, openCallback);
int formatInfo;
- return OpenArchive(codecs, archiveName, archive, formatInfo, defaultItemName, openCallback);
+ return OpenArchive(codecs, arcTypeIndex, archiveName, archive, formatInfo, defaultItemName, openCallback);
}
HRESULT MyOpenArchive(
CCodecs *codecs,
+ const CIntVector &formatIndices,
const UString &archiveName,
IInArchive **archive0,
IInArchive **archive1,
@@ -393,11 +468,11 @@ HRESULT MyOpenArchive(
openCallbackSpec->Init(prefix, name);
int formatIndex0, formatIndex1;
- RINOK(OpenArchive(codecs, archiveName,
- archive0,
- archive1,
- formatIndex0,
- formatIndex1,
+ RINOK(OpenArchive(codecs, formatIndices, archiveName,
+ archive0,
+ archive1,
+ formatIndex0,
+ formatIndex1,
defaultItemName0,
defaultItemName1,
openCallback));
@@ -427,27 +502,29 @@ void CArchiveLink::Release()
HRESULT OpenArchive(
CCodecs *codecs,
+ const CIntVector &formatIndices,
const UString &archiveName,
CArchiveLink &archiveLink,
IArchiveOpenCallback *openCallback)
{
- HRESULT res = OpenArchive(codecs, archiveName,
- &archiveLink.Archive0, &archiveLink.Archive1,
- archiveLink.FormatIndex0, archiveLink.FormatIndex1,
- archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
+ HRESULT res = OpenArchive(codecs, formatIndices, archiveName,
+ &archiveLink.Archive0, &archiveLink.Archive1,
+ archiveLink.FormatIndex0, archiveLink.FormatIndex1,
+ archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
openCallback);
archiveLink.IsOpen = (res == S_OK);
return res;
}
HRESULT MyOpenArchive(CCodecs *codecs,
- const UString &archiveName,
+ const CIntVector &formatIndices,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IOpenCallbackUI *openCallbackUI)
{
- HRESULT res = MyOpenArchive(codecs, archiveName,
- &archiveLink.Archive0, &archiveLink.Archive1,
- archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
+ HRESULT res = MyOpenArchive(codecs, formatIndices, archiveName,
+ &archiveLink.Archive0, &archiveLink.Archive1,
+ archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
archiveLink.VolumePaths,
archiveLink.VolumesSize,
openCallbackUI);
@@ -455,18 +532,19 @@ HRESULT MyOpenArchive(CCodecs *codecs,
return res;
}
-HRESULT ReOpenArchive(CCodecs *codecs, CArchiveLink &archiveLink, const UString &fileName)
+HRESULT ReOpenArchive(CCodecs *codecs, CArchiveLink &archiveLink, const UString &fileName,
+ IArchiveOpenCallback *openCallback)
{
if (archiveLink.GetNumLevels() > 1)
return E_NOTIMPL;
if (archiveLink.GetNumLevels() == 0)
- return MyOpenArchive(codecs, fileName, archiveLink, 0);
+ return MyOpenArchive(codecs, CIntVector(), fileName, archiveLink, 0);
- CMyComPtr<IArchiveOpenCallback> openCallback;
- SetCallback(fileName, NULL, openCallback);
+ CMyComPtr<IArchiveOpenCallback> openCallbackNew;
+ SetCallback(fileName, NULL, openCallback, openCallbackNew);
- HRESULT res = ReOpenArchive(archiveLink.GetArchive(), fileName, openCallback);
+ HRESULT res = ReOpenArchive(archiveLink.GetArchive(), fileName, openCallbackNew);
archiveLink.IsOpen = (res == S_OK);
return res;
}
diff --git a/CPP/7zip/UI/Common/OpenArchive.h b/CPP/7zip/UI/Common/OpenArchive.h
index 7b424463..f1b4fda7 100755
--- a/CPP/7zip/UI/Common/OpenArchive.h
+++ b/CPP/7zip/UI/Common/OpenArchive.h
@@ -12,7 +12,7 @@
HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, UString &result);
HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &defaultName, UString &result);
-HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
+HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
const FILETIME &defaultFileTime, FILETIME &fileTime);
HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result);
HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result);
@@ -25,26 +25,29 @@ struct ISetSubArchiveName
HRESULT OpenArchive(
CCodecs *codecs,
+ int arcTypeIndex,
IInStream *inStream,
- const UString &fileName,
- IInArchive **archiveResult,
+ const UString &fileName,
+ IInArchive **archiveResult,
int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback);
HRESULT OpenArchive(
CCodecs *codecs,
- const UString &filePath,
- IInArchive **archive,
+ int arcTypeIndex,
+ const UString &filePath,
+ IInArchive **archive,
int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback);
HRESULT OpenArchive(
CCodecs *codecs,
- const UString &filePath,
- IInArchive **archive0,
- IInArchive **archive1,
+ const CIntVector &formatIndices,
+ const UString &filePath,
+ IInArchive **archive0,
+ IInArchive **archive1,
int &formatIndex0,
int &formatIndex1,
UString &defaultItemName0,
@@ -54,24 +57,6 @@ HRESULT OpenArchive(
HRESULT ReOpenArchive(IInArchive *archive, const UString &fileName, IArchiveOpenCallback *openArchiveCallback);
-HRESULT MyOpenArchive(
- CCodecs *codecs,
- const UString &archiveName,
- IInArchive **archive,
- UString &defaultItemName,
- IOpenCallbackUI *openCallbackUI);
-
-HRESULT MyOpenArchive(
- CCodecs *codecs,
- const UString &archiveName,
- IInArchive **archive0,
- IInArchive **archive1,
- UString &defaultItemName0,
- UString &defaultItemName1,
- UStringVector &volumePaths,
- UInt64 &volumesSize,
- IOpenCallbackUI *openCallbackUI);
-
struct CArchiveLink
{
CMyComPtr<IInArchive> Archive0;
@@ -84,10 +69,11 @@ struct CArchiveLink
UStringVector VolumePaths;
+ bool IsOpen;
UInt64 VolumesSize;
int GetNumLevels() const
- {
+ {
int result = 0;
if (Archive0)
{
@@ -98,8 +84,6 @@ struct CArchiveLink
return result;
}
- bool IsOpen;
-
CArchiveLink(): IsOpen(false), VolumesSize(0) {};
IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; }
@@ -111,20 +95,23 @@ struct CArchiveLink
HRESULT OpenArchive(
CCodecs *codecs,
- const UString &archiveName,
+ const CIntVector &formatIndices,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IArchiveOpenCallback *openCallback);
HRESULT MyOpenArchive(
CCodecs *codecs,
- const UString &archiveName,
+ const CIntVector &formatIndices,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IOpenCallbackUI *openCallbackUI);
HRESULT ReOpenArchive(
CCodecs *codecs,
- CArchiveLink &archiveLink,
- const UString &fileName);
+ CArchiveLink &archiveLink,
+ const UString &fileName,
+ IArchiveOpenCallback *openCallback);
#endif
diff --git a/CPP/7zip/UI/Common/PropIDUtils.cpp b/CPP/7zip/UI/Common/PropIDUtils.cpp
index 76596883..bf11ea15 100755
--- a/CPP/7zip/UI/Common/PropIDUtils.cpp
+++ b/CPP/7zip/UI/Common/PropIDUtils.cpp
@@ -36,14 +36,14 @@ UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, b
{
switch(propID)
{
- case kpidCreationTime:
- case kpidLastWriteTime:
- case kpidLastAccessTime:
+ case kpidCTime:
+ case kpidATime:
+ case kpidMTime:
{
if (propVariant.vt != VT_FILETIME)
return UString(); // It is error;
FILETIME localFileTime;
- if (propVariant.filetime.dwHighDateTime == 0 &&
+ if (propVariant.filetime.dwHighDateTime == 0 &&
propVariant.filetime.dwLowDateTime == 0)
return UString();
if (!::FileTimeToLocalFileTime(&propVariant.filetime, &localFileTime))
@@ -58,7 +58,7 @@ UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, b
ConvertUInt32ToHex(propVariant.ulVal, temp);
return temp;
}
- case kpidAttributes:
+ case kpidAttrib:
{
if(propVariant.vt != VT_UI4)
break;
@@ -67,7 +67,7 @@ UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, b
if (NFile::NFind::NAttributes::IsReadOnly(attributes)) result += L'R';
if (NFile::NFind::NAttributes::IsHidden(attributes)) result += L'H';
if (NFile::NFind::NAttributes::IsSystem(attributes)) result += L'S';
- if (NFile::NFind::NAttributes::IsDirectory(attributes)) result += L'D';
+ if (NFile::NFind::NAttributes::IsDir(attributes)) result += L'D';
if (NFile::NFind::NAttributes::IsArchived(attributes)) result += L'A';
if (NFile::NFind::NAttributes::IsCompressed(attributes)) result += L'C';
if (NFile::NFind::NAttributes::IsEncrypted(attributes)) result += L'E';
diff --git a/CPP/7zip/UI/Common/SetProperties.cpp b/CPP/7zip/UI/Common/SetProperties.cpp
index 201e95b5..4827f2a7 100755
--- a/CPP/7zip/UI/Common/SetProperties.cpp
+++ b/CPP/7zip/UI/Common/SetProperties.cpp
@@ -22,7 +22,7 @@ static void ParseNumberString(const UString &s, NCOM::CPropVariant &prop)
prop = s;
else if (result <= 0xFFFFFFFF)
prop = (UInt32)result;
- else
+ else
prop = result;
}
diff --git a/CPP/7zip/UI/Common/StdAfx.h b/CPP/7zip/UI/Common/StdAfx.h
index 100f4344..9a8e7d21 100755
--- a/CPP/7zip/UI/Common/StdAfx.h
+++ b/CPP/7zip/UI/Common/StdAfx.h
@@ -6,4 +6,4 @@
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
-#endif
+#endif
diff --git a/CPP/7zip/UI/Common/Update.cpp b/CPP/7zip/UI/Common/Update.cpp
index 8e879246..f2207557 100755
--- a/CPP/7zip/UI/Common/Update.cpp
+++ b/CPP/7zip/UI/Common/Update.cpp
@@ -6,37 +6,34 @@
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
-#include "Common/CommandLineParser.h"
#ifdef _WIN32
#include "Windows/DLL.h"
#endif
-#include "Windows/Defs.h"
#include "Windows/FileDir.h"
#include "Windows/FileFind.h"
#include "Windows/FileName.h"
#include "Windows/PropVariant.h"
#include "Windows/PropVariantConversions.h"
-// #include "Windows/Synchronization.h"
+#include "Windows/Time.h"
#include "../../Common/FileStreams.h"
#include "../../Compress/Copy/CopyCoder.h"
#include "../Common/DirItem.h"
#include "../Common/EnumDirItems.h"
-#include "../Common/UpdateProduce.h"
#include "../Common/OpenArchive.h"
+#include "../Common/UpdateProduce.h"
-#include "TempFiles.h"
-#include "UpdateCallback.h"
#include "EnumDirItems.h"
#include "SetProperties.h"
+#include "TempFiles.h"
+#include "UpdateCallback.h"
-static const char *kUpdateIsNotSupoorted =
+static const char *kUpdateIsNotSupoorted =
"update operations are not supported for this archive";
-using namespace NCommandLineParser;
using namespace NWindows;
using namespace NCOM;
using namespace NFile;
@@ -52,7 +49,7 @@ static HRESULT CopyBlock(ISequentialInStream *inStream, ISequentialOutStream *ou
return copyCoder->Code(inStream, outStream, NULL, NULL, NULL);
}
-class COutMultiVolStream:
+class COutMultiVolStream:
public IOutStream,
public CMyUnknownImp
{
@@ -84,7 +81,7 @@ public:
_length = 0;
}
- HRESULT Close();
+ HRESULT Close();
MY_UNKNOWN_IMP1(IOutStream)
@@ -251,10 +248,15 @@ static const wchar_t *kSFXExtension =
L"";
#endif
-bool CUpdateOptions::Init(const CCodecs *codecs, const UString &arcPath, const UString &arcType)
+bool CUpdateOptions::Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath)
{
- if (!arcType.IsEmpty())
- MethodMode.FormatIndex = codecs->FindFormatForArchiveType(arcType);
+ if (formatIndices.Size() > 1)
+ return false;
+ int arcTypeIndex = -1;
+ if (formatIndices.Size() != 0)
+ arcTypeIndex = formatIndices[0];
+ if (arcTypeIndex >= 0)
+ MethodMode.FormatIndex = arcTypeIndex;
else
{
MethodMode.FormatIndex = codecs->FindFormatForArchiveName(arcPath);
@@ -264,6 +266,8 @@ bool CUpdateOptions::Init(const CCodecs *codecs, const UString &arcPath, const U
if (MethodMode.FormatIndex < 0)
return false;
const CArcInfoEx &arcInfo = codecs->Formats[MethodMode.FormatIndex];
+ if (!arcInfo.UpdateEnabled)
+ return false;
UString typeExt = arcInfo.GetMainExt();
UString ext = typeExt;
if (SfxMode)
@@ -284,16 +288,16 @@ bool CUpdateOptions::Init(const CCodecs *codecs, const UString &arcPath, const U
static HRESULT Compress(
CCodecs *codecs,
- const CActionSet &actionSet,
+ const CActionSet &actionSet,
IInArchive *archive,
const CCompressionMethodMode &compressionMethod,
- CArchivePath &archivePath,
- const CObjectVector<CArchiveItem> &archiveItems,
+ CArchivePath &archivePath,
+ const CObjectVector<CArcItem> &arcItems,
bool shareForWrite,
bool stdInMode,
/* const UString & stdInFileName, */
bool stdOutMode,
- const CObjectVector<CDirItem> &dirItems,
+ const CDirItems &dirItems,
bool sfxMode,
const UString &sfxModule,
const CRecordVector<UInt64> &volumesSizes,
@@ -342,11 +346,13 @@ static HRESULT Compress(
return E_FAIL;
}
- CObjectVector<CUpdatePair> updatePairs;
- GetUpdatePairInfoList(dirItems, archiveItems, fileTimeType, updatePairs); // must be done only once!!!
-
- CObjectVector<CUpdatePair2> updatePairs2;
- UpdateProduce(updatePairs, actionSet, updatePairs2);
+ CRecordVector<CUpdatePair2> updatePairs2;
+
+ {
+ CRecordVector<CUpdatePair> updatePairs;
+ GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs); // must be done only once!!!
+ UpdateProduce(updatePairs, actionSet, updatePairs2);
+ }
UInt32 numFiles = 0;
for (int i = 0; i < updatePairs2.Size(); i++)
@@ -363,7 +369,7 @@ static HRESULT Compress(
updateCallbackSpec->StdInMode = stdInMode;
updateCallbackSpec->Callback = callback;
updateCallbackSpec->DirItems = &dirItems;
- updateCallbackSpec->ArchiveItems = &archiveItems;
+ updateCallbackSpec->ArcItems = &arcItems;
updateCallbackSpec->UpdatePairs = &updatePairs2;
CMyComPtr<ISequentialOutStream> outStream;
@@ -496,27 +502,26 @@ HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
IInArchive *archive,
const UString &defaultItemName,
const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo,
- CObjectVector<CArchiveItem> &archiveItems)
+ CObjectVector<CArcItem> &arcItems)
{
- archiveItems.Clear();
+ arcItems.Clear();
UInt32 numItems;
RINOK(archive->GetNumberOfItems(&numItems));
- archiveItems.Reserve(numItems);
- for(UInt32 i = 0; i < numItems; i++)
+ arcItems.Reserve(numItems);
+ for (UInt32 i = 0; i < numItems; i++)
{
- CArchiveItem ai;
+ CArcItem ai;
RINOK(GetArchiveItemPath(archive, i, ai.Name));
- RINOK(IsArchiveItemFolder(archive, i, ai.IsDirectory));
- ai.Censored = censor.CheckPath(ai.Name.IsEmpty() ? defaultItemName : ai.Name, !ai.IsDirectory);
- RINOK(GetArchiveItemFileTime(archive, i,
- archiveFileInfo.LastWriteTime, ai.LastWriteTime));
+ RINOK(IsArchiveItemFolder(archive, i, ai.IsDir));
+ ai.Censored = censor.CheckPath(ai.Name.IsEmpty() ? defaultItemName : ai.Name, !ai.IsDir);
+ RINOK(GetArchiveItemFileTime(archive, i, archiveFileInfo.MTime, ai.MTime));
{
CPropVariant prop;
RINOK(archive->GetProperty(i, kpidSize, &prop));
- ai.SizeIsDefined = (prop.vt != VT_EMPTY);
- if (ai.SizeIsDefined)
+ ai.SizeDefined = (prop.vt != VT_EMPTY);
+ if (ai.SizeDefined)
ai.Size = ConvertPropVariantToUInt64(prop);
}
@@ -525,8 +530,8 @@ HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
RINOK(archive->GetProperty(i, kpidTimeType, &prop));
if (prop.vt == VT_UI4)
{
- ai.FileTimeType = (int)(NFileTimeType::EEnum)prop.ulVal;
- switch(ai.FileTimeType)
+ ai.TimeType = (int)(NFileTimeType::EEnum)prop.ulVal;
+ switch(ai.TimeType)
{
case NFileTimeType::kWindows:
case NFileTimeType::kUnix:
@@ -539,7 +544,7 @@ HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
}
ai.IndexInServer = i;
- archiveItems.Add(ai);
+ arcItems.Add(ai);
}
return S_OK;
}
@@ -548,9 +553,9 @@ HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
static HRESULT UpdateWithItemLists(
CCodecs *codecs,
CUpdateOptions &options,
- IInArchive *archive,
- const CObjectVector<CArchiveItem> &archiveItems,
- const CObjectVector<CDirItem> &dirItems,
+ IInArchive *archive,
+ const CObjectVector<CArcItem> &arcItems,
+ CDirItems &dirItems,
CTempFiles &tempFiles,
CUpdateErrorInfo &errorInfo,
IUpdateCallbackUI2 *callback)
@@ -564,22 +569,22 @@ static HRESULT UpdateWithItemLists(
}
else
{
- RINOK(callback->StartArchive(command.ArchivePath.GetFinalPath(),
+ RINOK(callback->StartArchive(command.ArchivePath.GetFinalPath(),
i == 0 && options.UpdateArchiveItself && archive != 0));
}
RINOK(Compress(
codecs,
command.ActionSet, archive,
- options.MethodMode,
- command.ArchivePath,
- archiveItems,
+ options.MethodMode,
+ command.ArchivePath,
+ arcItems,
options.OpenShareForWrite,
- options.StdInMode,
+ options.StdInMode,
/* options.StdInFileName, */
options.StdOutMode,
- dirItems,
- options.SfxMode, options.SfxModule,
+ dirItems,
+ options.SfxMode, options.SfxModule,
options.VolumesSizes,
tempFiles,
errorInfo, callback));
@@ -606,7 +611,10 @@ public:
struct CEnumDirItemUpdateCallback: public IEnumDirItemCallback
{
IUpdateCallbackUI2 *Callback;
- HRESULT CheckBreak() { return Callback->CheckBreak(); }
+ HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path)
+ {
+ return Callback->ScanProgress(numFolders, numFiles, path);
+ }
};
#ifdef _WIN32
@@ -622,7 +630,7 @@ typedef MY_MAPISENDDOCUMENTS FAR *MY_LPMAPISENDDOCUMENTS;
HRESULT UpdateArchive(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options,
CUpdateErrorInfo &errorInfo,
IOpenCallbackUI *openCallback,
@@ -662,11 +670,16 @@ HRESULT UpdateArchive(
IInArchive *archive = 0;
if (NFind::FindFile(archiveName, archiveFileInfo))
{
- if (archiveFileInfo.IsDirectory())
+ if (archiveFileInfo.IsDir())
throw "there is no such archive";
if (options.VolumesSizes.Size() > 0)
return E_NOTIMPL;
- HRESULT result = MyOpenArchive(codecs, archiveName, archiveLink, openCallback);
+ CIntVector formatIndices;
+ if (options.MethodMode.FormatIndex >= 0)
+ formatIndices.Add(options.MethodMode.FormatIndex);
+ HRESULT result = MyOpenArchive(codecs, formatIndices, archiveName, archiveLink, openCallback);
+ if (result == E_ABORT)
+ return result;
RINOK(callback->OpenResult(archiveName, result));
RINOK(result);
if (archiveLink.VolumePaths.Size() > 1)
@@ -686,19 +699,16 @@ HRESULT UpdateArchive(
*/
}
- CObjectVector<CDirItem> dirItems;
+ CDirItems dirItems;
if (options.StdInMode)
{
- CDirItem item;
- item.FullPath = item.Name = options.StdInFileName;
- item.Size = (UInt64)(Int64)-1;
- item.Attributes = 0;
- SYSTEMTIME st;
- FILETIME ft;
- GetSystemTime(&st);
- SystemTimeToFileTime(&st, &ft);
- item.CreationTime = item.LastAccessTime = item.LastWriteTime = ft;
- dirItems.Add(item);
+ CDirItem di;
+ di.Name = options.StdInFileName;
+ di.Size = (UInt64)(Int64)-1;
+ di.Attrib = 0;
+ NTime::GetCurUtcFileTime(di.MTime);
+ di.CTime = di.ATime = di.MTime;
+ dirItems.Items.Add(di);
}
else
{
@@ -718,9 +728,10 @@ HRESULT UpdateArchive(
{
RINOK(callback->CanNotFindError(errorPaths[i], errorCodes[i]));
}
- if(res != S_OK)
+ if (res != S_OK)
{
- errorInfo.Message = L"Scanning error";
+ if (res != E_ABORT)
+ errorInfo.Message = L"Scanning error";
// errorInfo.FileName = errorPath;
return res;
}
@@ -785,14 +796,14 @@ HRESULT UpdateArchive(
}
}
- CObjectVector<CArchiveItem> archiveItems;
+ CObjectVector<CArcItem> arcItems;
if (archive != NULL)
{
- RINOK(EnumerateInArchiveItems(censor,
- archive, defaultItemName, archiveFileInfo, archiveItems));
+ RINOK(EnumerateInArchiveItems(censor,
+ archive, defaultItemName, archiveFileInfo, arcItems));
}
- RINOK(UpdateWithItemLists(codecs, options, archive, archiveItems, dirItems,
+ RINOK(UpdateWithItemLists(codecs, options, archive, arcItems, dirItems,
tempFiles, errorInfo, callback));
if (archive != NULL)
@@ -870,7 +881,7 @@ HRESULT UpdateArchive(
AString path = GetAnsiString(arcPath);
AString name = GetAnsiString(fileName);
// Warning!!! MAPISendDocuments function changes Current directory
- fnSend(0, ";", (LPSTR)(LPCSTR)path, (LPSTR)(LPCSTR)name, 0);
+ fnSend(0, ";", (LPSTR)(LPCSTR)path, (LPSTR)(LPCSTR)name, 0);
}
}
#endif
diff --git a/CPP/7zip/UI/Common/Update.h b/CPP/7zip/UI/Common/Update.h
index 49e4be81..46547bf9 100755
--- a/CPP/7zip/UI/Common/Update.h
+++ b/CPP/7zip/UI/Common/Update.h
@@ -17,7 +17,7 @@ struct CArchivePath
{
UString Prefix; // path(folder) prefix including slash
UString Name; // base name
- UString BaseExtension; // archive type extension or "exe" extension
+ UString BaseExtension; // archive type extension or "exe" extension
UString VolExtension; // archive type extension for volumes
bool Temp;
@@ -70,7 +70,7 @@ struct CArchivePath
path += UString(L'.') + BaseExtension;
path += L".tmp";
path += TempPostfix;
- return path;
+ return path;
}
};
@@ -111,7 +111,7 @@ struct CUpdateOptions
UString WorkingDir;
- bool Init(const CCodecs *codecs, const UString &arcPath, const UString &arcType);
+ bool Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath);
CUpdateOptions():
UpdateArchiveItself(true),
@@ -144,6 +144,7 @@ struct CUpdateErrorInfo: public CErrorInfo
INTERFACE_IUpdateCallbackUI(x) \
virtual HRESULT OpenResult(const wchar_t *name, HRESULT result) x; \
virtual HRESULT StartScanning() x; \
+ virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) x; \
virtual HRESULT CanNotFindError(const wchar_t *name, DWORD systemError) x; \
virtual HRESULT FinishScanning() x; \
virtual HRESULT StartArchive(const wchar_t *name, bool updating) x; \
@@ -156,7 +157,7 @@ struct IUpdateCallbackUI2: public IUpdateCallbackUI
HRESULT UpdateArchive(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options,
CUpdateErrorInfo &errorInfo,
IOpenCallbackUI *openCallback,
diff --git a/CPP/7zip/UI/Common/UpdateAction.cpp b/CPP/7zip/UI/Common/UpdateAction.cpp
index 5e3b5a10..845384fb 100755
--- a/CPP/7zip/UI/Common/UpdateAction.cpp
+++ b/CPP/7zip/UI/Common/UpdateAction.cpp
@@ -6,7 +6,7 @@
namespace NUpdateArchive {
-const CActionSet kAddActionSet =
+const CActionSet kAddActionSet =
{
NPairAction::kCopy,
NPairAction::kCopy,
@@ -17,7 +17,7 @@ const CActionSet kAddActionSet =
NPairAction::kCompress
};
-const CActionSet kUpdateActionSet =
+const CActionSet kUpdateActionSet =
{
NPairAction::kCopy,
NPairAction::kCopy,
@@ -28,7 +28,7 @@ const CActionSet kUpdateActionSet =
NPairAction::kCompress
};
-const CActionSet kFreshActionSet =
+const CActionSet kFreshActionSet =
{
NPairAction::kCopy,
NPairAction::kCopy,
@@ -39,7 +39,7 @@ const CActionSet kFreshActionSet =
NPairAction::kCompress
};
-const CActionSet kSynchronizeActionSet =
+const CActionSet kSynchronizeActionSet =
{
NPairAction::kCopy,
NPairAction::kIgnore,
@@ -50,7 +50,7 @@ const CActionSet kSynchronizeActionSet =
NPairAction::kCompress,
};
-const CActionSet kDeleteActionSet =
+const CActionSet kDeleteActionSet =
{
NPairAction::kCopy,
NPairAction::kIgnore,
diff --git a/CPP/7zip/UI/Common/UpdateAction.h b/CPP/7zip/UI/Common/UpdateAction.h
index aa050975..7da5ff2e 100755
--- a/CPP/7zip/UI/Common/UpdateAction.h
+++ b/CPP/7zip/UI/Common/UpdateAction.h
@@ -5,7 +5,7 @@
namespace NUpdateArchive {
- namespace NPairState
+ namespace NPairState
{
const int kNumValues = 7;
enum EEnum
diff --git a/CPP/7zip/UI/Common/UpdateCallback.cpp b/CPP/7zip/UI/Common/UpdateCallback.cpp
index a5f0a54f..dcca2a1a 100755
--- a/CPP/7zip/UI/Common/UpdateCallback.cpp
+++ b/CPP/7zip/UI/Common/UpdateCallback.cpp
@@ -20,8 +20,9 @@ CArchiveUpdateCallback::CArchiveUpdateCallback():
ShareForWrite(false),
StdInMode(false),
DirItems(0),
- ArchiveItems(0),
- UpdatePairs(0)
+ ArcItems(0),
+ UpdatePairs(0),
+ NewNames(0)
{}
@@ -48,49 +49,37 @@ STDMETHODIMP CArchiveUpdateCallback::SetRatioInfo(const UInt64 *inSize, const UI
/*
-STATPROPSTG kProperties[] =
+STATPROPSTG kProperties[] =
{
{ NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsFolder, VT_BOOL},
+ { NULL, kpidIsDir, VT_BOOL},
{ NULL, kpidSize, VT_UI8},
- { NULL, kpidLastAccessTime, VT_FILETIME},
- { NULL, kpidCreationTime, VT_FILETIME},
- { NULL, kpidLastWriteTime, VT_FILETIME},
- { NULL, kpidAttributes, VT_UI4},
+ { NULL, kpidCTime, VT_FILETIME},
+ { NULL, kpidATime, VT_FILETIME},
+ { NULL, kpidMTime, VT_FILETIME},
+ { NULL, kpidAttrib, VT_UI4},
{ NULL, kpidIsAnti, VT_BOOL}
};
-*/
STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG **)
{
- return E_NOTIMPL;
- /*
- return CStatPropEnumerator::CreateEnumerator(kProperties,
- sizeof(kProperties) / sizeof(kProperties[0]), enumerator);
- */
+ return CStatPropEnumerator::CreateEnumerator(kProperties, sizeof(kProperties) / sizeof(kProperties[0]), enumerator);
}
+*/
-STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 index,
- Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive)
+STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 index,
+ Int32 *newData, Int32 *newProps, UInt32 *indexInArchive)
{
COM_TRY_BEGIN
RINOK(Callback->CheckBreak());
- const CUpdatePair2 &updatePair = (*UpdatePairs)[index];
- if(newData != NULL)
- *newData = BoolToInt(updatePair.NewData);
- if(newProperties != NULL)
- *newProperties = BoolToInt(updatePair.NewProperties);
- if(indexInArchive != NULL)
+ const CUpdatePair2 &up = (*UpdatePairs)[index];
+ if (newData != NULL) *newData = BoolToInt(up.NewData);
+ if (newProps != NULL) *newProps = BoolToInt(up.NewProps);
+ if (indexInArchive != NULL)
{
- if (updatePair.ExistInArchive)
- {
- if (ArchiveItems == 0)
- *indexInArchive = updatePair.ArchiveItemIndex;
- else
- *indexInArchive = (*ArchiveItems)[updatePair.ArchiveItemIndex].IndexInServer;
- }
- else
- *indexInArchive = UInt32(-1);
+ *indexInArchive = (UInt32)-1;
+ if (up.ExistInArchive())
+ *indexInArchive = (ArcItems == 0) ? up.ArcIndex : (*ArcItems)[up.ArcIndex].IndexInServer;
}
return S_OK;
COM_TRY_END
@@ -99,83 +88,69 @@ STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 index,
STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
- const CUpdatePair2 &updatePair = (*UpdatePairs)[index];
- NWindows::NCOM::CPropVariant propVariant;
+ const CUpdatePair2 &up = (*UpdatePairs)[index];
+ NWindows::NCOM::CPropVariant prop;
if (propID == kpidIsAnti)
{
- propVariant = updatePair.IsAnti;
- propVariant.Detach(value);
+ prop = up.IsAnti;
+ prop.Detach(value);
return S_OK;
}
- if (updatePair.IsAnti)
+ if (up.IsAnti)
{
switch(propID)
{
- case kpidIsFolder:
+ case kpidIsDir:
case kpidPath:
break;
case kpidSize:
- propVariant = (UInt64)0;
- propVariant.Detach(value);
+ prop = (UInt64)0;
+ prop.Detach(value);
return S_OK;
default:
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
}
- if(updatePair.ExistOnDisk)
+ if (up.ExistOnDisk())
{
- const CDirItem &dirItem = (*DirItems)[updatePair.DirItemIndex];
+ const CDirItem &di = DirItems->Items[up.DirIndex];
switch(propID)
{
- case kpidPath:
- propVariant = dirItem.Name;
- break;
- case kpidIsFolder:
- propVariant = dirItem.IsDirectory();
- break;
- case kpidSize:
- propVariant = dirItem.Size;
- break;
- case kpidAttributes:
- propVariant = dirItem.Attributes;
- break;
- case kpidLastAccessTime:
- propVariant = dirItem.LastAccessTime;
- break;
- case kpidCreationTime:
- propVariant = dirItem.CreationTime;
- break;
- case kpidLastWriteTime:
- propVariant = dirItem.LastWriteTime;
- break;
+ case kpidPath: prop = DirItems->GetLogPath(up.DirIndex); break;
+ case kpidIsDir: prop = di.IsDir(); break;
+ case kpidSize: prop = di.Size; break;
+ case kpidAttrib: prop = di.Attrib; break;
+ case kpidCTime: prop = di.CTime; break;
+ case kpidATime: prop = di.ATime; break;
+ case kpidMTime: prop = di.MTime; break;
}
}
else
{
if (propID == kpidPath)
{
- if (updatePair.NewNameIsDefined)
+ if (up.NewNameIndex >= 0)
{
- propVariant = updatePair.NewName;
- propVariant.Detach(value);
+ prop = (*NewNames)[up.NewNameIndex];
+ prop.Detach(value);
return S_OK;
}
}
- if (updatePair.ExistInArchive && Archive)
+ if (up.ExistInArchive() && Archive)
{
UInt32 indexInArchive;
- if (ArchiveItems == 0)
- indexInArchive = updatePair.ArchiveItemIndex;
+ if (ArcItems == 0)
+ indexInArchive = up.ArcIndex;
else
- indexInArchive = (*ArchiveItems)[updatePair.ArchiveItemIndex].IndexInServer;
+ indexInArchive = (*ArcItems)[up.ArcIndex].IndexInServer;
return Archive->GetProperty(indexInArchive, propID, value);
}
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
COM_TRY_END
}
@@ -183,21 +158,21 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream **inStream)
{
COM_TRY_BEGIN
- const CUpdatePair2 &updatePair = (*UpdatePairs)[index];
- if(!updatePair.NewData)
+ const CUpdatePair2 &up = (*UpdatePairs)[index];
+ if (!up.NewData)
return E_FAIL;
RINOK(Callback->CheckBreak());
RINOK(Callback->Finilize());
- if(updatePair.IsAnti)
+ if (up.IsAnti)
{
- return Callback->GetStream((*ArchiveItems)[updatePair.ArchiveItemIndex].Name, true);
+ return Callback->GetStream((*ArcItems)[up.ArcIndex].Name, true);
}
- const CDirItem &dirItem = (*DirItems)[updatePair.DirItemIndex];
- RINOK(Callback->GetStream(dirItem.Name, false));
+ const CDirItem &di = DirItems->Items[up.DirIndex];
+ RINOK(Callback->GetStream(DirItems->GetLogPath(up.DirIndex), false));
- if(dirItem.IsDirectory())
+ if (di.IsDir())
return S_OK;
if (StdInMode)
@@ -210,8 +185,8 @@ STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream
{
CInFileStream *inStreamSpec = new CInFileStream;
CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
- UString path = DirPrefix + dirItem.FullPath;
- if(!inStreamSpec->OpenShared(path, ShareForWrite))
+ const UString path = DirItems->GetPhyPath(up.DirIndex);
+ if (!inStreamSpec->OpenShared(path, ShareForWrite))
{
return Callback->OpenFileError(path, ::GetLastError());
}
@@ -252,7 +227,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOu
fileName += VolExt;
COutFileStream *streamSpec = new COutFileStream;
CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
- if(!streamSpec->Create(fileName, false))
+ if (!streamSpec->Create(fileName, false))
return ::GetLastError();
*volumeStream = streamLoc.Detach();
return S_OK;
diff --git a/CPP/7zip/UI/Common/UpdateCallback.h b/CPP/7zip/UI/Common/UpdateCallback.h
index bf90ff9e..411ee011 100755
--- a/CPP/7zip/UI/Common/UpdateCallback.h
+++ b/CPP/7zip/UI/Common/UpdateCallback.h
@@ -31,7 +31,7 @@ struct IUpdateCallbackUI
INTERFACE_IUpdateCallbackUI(=0)
};
-class CArchiveUpdateCallback:
+class CArchiveUpdateCallback:
public IArchiveUpdateCallback2,
public ICryptoGetTextPassword2,
public ICompressProgressInfo,
@@ -39,25 +39,13 @@ class CArchiveUpdateCallback:
{
public:
MY_UNKNOWN_IMP3(
- IArchiveUpdateCallback2,
+ IArchiveUpdateCallback2,
ICryptoGetTextPassword2,
ICompressProgressInfo)
- // IProgress
- STDMETHOD(SetTotal)(UInt64 size);
- STDMETHOD(SetCompleted)(const UInt64 *completeValue);
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
- // IUpdateCallback
- STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator);
- STDMETHOD(GetUpdateItemInfo)(UInt32 index,
- Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive);
- STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream);
- STDMETHOD(SetOperationResult)(Int32 operationResult);
-
- STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size);
- STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream);
+ INTERFACE_IArchiveUpdateCallback2(;)
STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
@@ -68,12 +56,12 @@ public:
IUpdateCallbackUI *Callback;
- UString DirPrefix;
bool ShareForWrite;
bool StdInMode;
- const CObjectVector<CDirItem> *DirItems;
- const CObjectVector<CArchiveItem> *ArchiveItems;
- const CObjectVector<CUpdatePair2> *UpdatePairs;
+ const CDirItems *DirItems;
+ const CObjectVector<CArcItem> *ArcItems;
+ const CRecordVector<CUpdatePair2> *UpdatePairs;
+ const UStringVector *NewNames;
CMyComPtr<IInArchive> Archive;
CArchiveUpdateCallback();
diff --git a/CPP/7zip/UI/Common/UpdatePair.cpp b/CPP/7zip/UI/Common/UpdatePair.cpp
index 2ee0f167..26a1a8de 100755
--- a/CPP/7zip/UI/Common/UpdatePair.cpp
+++ b/CPP/7zip/UI/Common/UpdatePair.cpp
@@ -42,7 +42,7 @@ static const wchar_t *kDuplicateFileNameMessage = L"Duplicate filename:";
/*
static const char *kNotCensoredCollisionMessaged = "Internal file name collision:\n";
-static const char *kSameTimeChangedSizeCollisionMessaged =
+static const char *kSameTimeChangedSizeCollisionMessaged =
"Collision between files with same date/time and different sizes:\n";
*/
@@ -61,92 +61,103 @@ static void TestDuplicateString(const UStringVector &strings, const CIntVector &
}
void GetUpdatePairInfoList(
- const CObjectVector<CDirItem> &dirItems,
- const CObjectVector<CArchiveItem> &archiveItems,
+ const CDirItems &dirItems,
+ const CObjectVector<CArcItem> &arcItems,
NFileTimeType::EEnum fileTimeType,
- CObjectVector<CUpdatePair> &updatePairs)
+ CRecordVector<CUpdatePair> &updatePairs)
{
- CIntVector dirIndices, archiveIndices;
- UStringVector dirNames, archiveNames;
+ CIntVector dirIndices, arcIndices;
- int numDirItems = dirItems.Size();
- int i;
- for(i = 0; i < numDirItems; i++)
- dirNames.Add(dirItems[i].Name);
- SortFileNames(dirNames, dirIndices);
- TestDuplicateString(dirNames, dirIndices);
+ int numDirItems = dirItems.Items.Size();
+ int numArcItems = arcItems.Size();
+
+
+ {
+ UStringVector arcNames;
+ arcNames.Reserve(numArcItems);
+ for (int i = 0; i < numArcItems; i++)
+ arcNames.Add(arcItems[i].Name);
+ SortFileNames(arcNames, arcIndices);
+ TestDuplicateString(arcNames, arcIndices);
+ }
- int numArchiveItems = archiveItems.Size();
- for(i = 0; i < numArchiveItems; i++)
- archiveNames.Add(archiveItems[i].Name);
- SortFileNames(archiveNames, archiveIndices);
- TestDuplicateString(archiveNames, archiveIndices);
+ UStringVector dirNames;
+ {
+ dirNames.Reserve(numDirItems);
+ for (int i = 0; i < numDirItems; i++)
+ dirNames.Add(dirItems.GetLogPath(i));
+ SortFileNames(dirNames, dirIndices);
+ TestDuplicateString(dirNames, dirIndices);
+ }
- int dirItemIndex = 0, archiveItemIndex = 0;
- CUpdatePair pair;
- while(dirItemIndex < numDirItems && archiveItemIndex < numArchiveItems)
+ int dirIndex = 0, arcIndex = 0;
+ while (dirIndex < numDirItems && arcIndex < numArcItems)
{
- int dirItemIndex2 = dirIndices[dirItemIndex],
- archiveItemIndex2 = archiveIndices[archiveItemIndex];
- const CDirItem &dirItem = dirItems[dirItemIndex2];
- const CArchiveItem &archiveItem = archiveItems[archiveItemIndex2];
- int compareResult = CompareFileNames(dirItem.Name, archiveItem.Name);
+ CUpdatePair pair;
+ int dirIndex2 = dirIndices[dirIndex];
+ int arcIndex2 = arcIndices[arcIndex];
+ const CDirItem &di = dirItems.Items[dirIndex2];
+ const CArcItem &ai = arcItems[arcIndex2];
+ int compareResult = CompareFileNames(dirNames[dirIndex2], ai.Name);
if (compareResult < 0)
{
- pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
- pair.DirItemIndex = dirItemIndex2;
- dirItemIndex++;
+ pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
+ pair.DirIndex = dirIndex2;
+ dirIndex++;
}
else if (compareResult > 0)
{
- pair.State = archiveItem.Censored ?
- NUpdateArchive::NPairState::kOnlyInArchive: NUpdateArchive::NPairState::kNotMasked;
- pair.ArchiveItemIndex = archiveItemIndex2;
- archiveItemIndex++;
+ pair.State = ai.Censored ?
+ NUpdateArchive::NPairState::kOnlyInArchive:
+ NUpdateArchive::NPairState::kNotMasked;
+ pair.ArcIndex = arcIndex2;
+ arcIndex++;
}
else
{
- if (!archiveItem.Censored)
- throw 1082022;; // TTString(kNotCensoredCollisionMessaged + dirItem.Name);
- pair.DirItemIndex = dirItemIndex2;
- pair.ArchiveItemIndex = archiveItemIndex2;
- switch (MyCompareTime(archiveItem.FileTimeType != - 1 ?
- (NFileTimeType::EEnum)archiveItem.FileTimeType : fileTimeType, dirItem.LastWriteTime, archiveItem.LastWriteTime))
+ if (!ai.Censored)
+ throw 1082022;
+ pair.DirIndex = dirIndex2;
+ pair.ArcIndex = arcIndex2;
+ switch (MyCompareTime(
+ ai.TimeType != - 1 ? (NFileTimeType::EEnum)ai.TimeType : fileTimeType,
+ di.MTime, ai.MTime))
{
- case -1:
- pair.State = NUpdateArchive::NPairState::kNewInArchive;
- break;
- case 1:
- pair.State = NUpdateArchive::NPairState::kOldInArchive;
- break;
+ case -1: pair.State = NUpdateArchive::NPairState::kNewInArchive; break;
+ case 1: pair.State = NUpdateArchive::NPairState::kOldInArchive; break;
default:
- if (archiveItem.SizeIsDefined)
- if (dirItem.Size != archiveItem.Size)
- // throw 1082034; // kSameTimeChangedSizeCollisionMessaged;
+ if (ai.SizeDefined)
+ if (di.Size != ai.Size)
pair.State = NUpdateArchive::NPairState::kUnknowNewerFiles;
else
pair.State = NUpdateArchive::NPairState::kSameFiles;
else
pair.State = NUpdateArchive::NPairState::kUnknowNewerFiles;
}
- dirItemIndex++;
- archiveItemIndex++;
+ dirIndex++;
+ arcIndex++;
}
updatePairs.Add(pair);
}
- for(;dirItemIndex < numDirItems; dirItemIndex++)
+
+ for (; dirIndex < numDirItems; dirIndex++)
{
+ CUpdatePair pair;
pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
- pair.DirItemIndex = dirIndices[dirItemIndex];
+ pair.DirIndex = dirIndices[dirIndex];
updatePairs.Add(pair);
}
- for(;archiveItemIndex < numArchiveItems; archiveItemIndex++)
+
+ for (; arcIndex < numArcItems; arcIndex++)
{
- int archiveItemIndex2 = archiveIndices[archiveItemIndex];
- const CArchiveItem &archiveItem = archiveItems[archiveItemIndex2];
- pair.State = archiveItem.Censored ?
- NUpdateArchive::NPairState::kOnlyInArchive: NUpdateArchive::NPairState::kNotMasked;
- pair.ArchiveItemIndex = archiveItemIndex2;
+ CUpdatePair pair;
+ int arcIndex2 = arcIndices[arcIndex];
+ pair.State = arcItems[arcIndex2].Censored ?
+ NUpdateArchive::NPairState::kOnlyInArchive:
+ NUpdateArchive::NPairState::kNotMasked;
+ pair.ArcIndex = arcIndex2;
updatePairs.Add(pair);
}
+
+ updatePairs.ReserveDown();
}
diff --git a/CPP/7zip/UI/Common/UpdatePair.h b/CPP/7zip/UI/Common/UpdatePair.h
index f50a23f8..3a332649 100755
--- a/CPP/7zip/UI/Common/UpdatePair.h
+++ b/CPP/7zip/UI/Common/UpdatePair.h
@@ -11,14 +11,15 @@
struct CUpdatePair
{
NUpdateArchive::NPairState::EEnum State;
- int ArchiveItemIndex;
- int DirItemIndex;
+ int ArcIndex;
+ int DirIndex;
+ CUpdatePair(): ArcIndex(-1), DirIndex(-1) {}
};
void GetUpdatePairInfoList(
- const CObjectVector<CDirItem> &dirItems,
- const CObjectVector<CArchiveItem> &archiveItems,
+ const CDirItems &dirItems,
+ const CObjectVector<CArcItem> &arcItems,
NFileTimeType::EEnum fileTimeType,
- CObjectVector<CUpdatePair> &updatePairs);
+ CRecordVector<CUpdatePair> &updatePairs);
#endif
diff --git a/CPP/7zip/UI/Common/UpdateProduce.cpp b/CPP/7zip/UI/Common/UpdateProduce.cpp
index 5552161a..b2bc59a5 100755
--- a/CPP/7zip/UI/Common/UpdateProduce.cpp
+++ b/CPP/7zip/UI/Common/UpdateProduce.cpp
@@ -6,58 +6,49 @@
using namespace NUpdateArchive;
-static const char *kUpdateActionSetCollision =
- "Internal collision in update action set";
+static const char *kUpdateActionSetCollision = "Internal collision in update action set";
void UpdateProduce(
- const CObjectVector<CUpdatePair> &updatePairs,
+ const CRecordVector<CUpdatePair> &updatePairs,
const NUpdateArchive::CActionSet &actionSet,
- CObjectVector<CUpdatePair2> &operationChain)
+ CRecordVector<CUpdatePair2> &operationChain)
{
- for(int i = 0; i < updatePairs.Size(); i++)
+ for (int i = 0; i < updatePairs.Size(); i++)
{
- // CUpdateArchiveRange aRange;
const CUpdatePair &pair = updatePairs[i];
- CUpdatePair2 pair2;
- pair2.IsAnti = false;
- pair2.ArchiveItemIndex = pair.ArchiveItemIndex;
- pair2.DirItemIndex = pair.DirItemIndex;
- pair2.ExistInArchive = (pair.State != NPairState::kOnlyOnDisk);
- pair2.ExistOnDisk = (pair.State != NPairState::kOnlyInArchive && pair.State != NPairState::kNotMasked);
+ CUpdatePair2 up2;
+ up2.IsAnti = false;
+ up2.DirIndex = pair.DirIndex;
+ up2.ArcIndex = pair.ArcIndex;
+ up2.NewData = up2.NewProps = true;
switch(actionSet.StateActions[pair.State])
{
case NPairAction::kIgnore:
/*
if (pair.State != NPairState::kOnlyOnDisk)
- IgnoreArchiveItem(m_ArchiveItems[pair.ArchiveItemIndex]);
+ IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]);
// cout << "deleting";
*/
- break;
+ continue;
+
case NPairAction::kCopy:
- {
- if (pair.State == NPairState::kOnlyOnDisk)
- throw kUpdateActionSetCollision;
- pair2.NewData = pair2.NewProperties = false;
- operationChain.Add(pair2);
- break;
- }
+ if (pair.State == NPairState::kOnlyOnDisk)
+ throw kUpdateActionSetCollision;
+ up2.NewData = up2.NewProps = false;
+ break;
+
case NPairAction::kCompress:
- {
- if (pair.State == NPairState::kOnlyInArchive ||
+ if (pair.State == NPairState::kOnlyInArchive ||
pair.State == NPairState::kNotMasked)
- throw kUpdateActionSetCollision;
- pair2.NewData = pair2.NewProperties = true;
- operationChain.Add(pair2);
- break;
- }
+ throw kUpdateActionSetCollision;
+ break;
+
case NPairAction::kCompressAsAnti:
- {
- pair2.IsAnti = true;
- pair2.NewData = pair2.NewProperties = true;
- operationChain.Add(pair2);
- break;
- }
+ up2.IsAnti = true;
+ break;
}
+ operationChain.Add(up2);
}
+ operationChain.ReserveDown();
}
diff --git a/CPP/7zip/UI/Common/UpdateProduce.h b/CPP/7zip/UI/Common/UpdateProduce.h
index 8f58dab9..7e1a4a3f 100755
--- a/CPP/7zip/UI/Common/UpdateProduce.h
+++ b/CPP/7zip/UI/Common/UpdateProduce.h
@@ -7,25 +7,23 @@
struct CUpdatePair2
{
- // bool OperationIsCompress;
bool NewData;
- bool NewProperties;
-
- bool ExistInArchive;
- bool ExistOnDisk;
+ bool NewProps;
bool IsAnti;
- int ArchiveItemIndex;
- int DirItemIndex;
+
+ int DirIndex;
+ int ArcIndex;
+ int NewNameIndex;
- bool NewNameIsDefined;
- UString NewName;
+ bool ExistOnDisk() const { return DirIndex != -1; }
+ bool ExistInArchive() const { return ArcIndex != -1; }
- CUpdatePair2(): NewNameIsDefined(false) {}
+ CUpdatePair2(): IsAnti(false), DirIndex(-1), ArcIndex(-1), NewNameIndex(-1) {}
};
void UpdateProduce(
- const CObjectVector<CUpdatePair> &updatePairs,
+ const CRecordVector<CUpdatePair> &updatePairs,
const NUpdateArchive::CActionSet &actionSet,
- CObjectVector<CUpdatePair2> &operationChain);
+ CRecordVector<CUpdatePair2> &operationChain);
#endif
diff --git a/CPP/7zip/UI/Common/WorkDir.cpp b/CPP/7zip/UI/Common/WorkDir.cpp
index 8db6f4f1..e97275b1 100755
--- a/CPP/7zip/UI/Common/WorkDir.cpp
+++ b/CPP/7zip/UI/Common/WorkDir.cpp
@@ -10,8 +10,8 @@
#include "Windows/FileName.h"
#include "Windows/FileDir.h"
-static inline UINT GetCurrentCodePage()
- { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
+static inline UINT GetCurrentCodePage()
+ { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
using namespace NWindows;
using namespace NFile;
diff --git a/CPP/7zip/UI/Common/ZipRegistry.cpp b/CPP/7zip/UI/Common/ZipRegistry.cpp
index 1f076caf..4bba19f8 100755
--- a/CPP/7zip/UI/Common/ZipRegistry.cpp
+++ b/CPP/7zip/UI/Common/ZipRegistry.cpp
@@ -15,7 +15,7 @@
using namespace NWindows;
using namespace NRegistry;
-static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP");
+static const TCHAR *kCUBasePath = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP");
static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
@@ -31,7 +31,7 @@ static const TCHAR *kExtractionShowPasswordValueName = TEXT("ShowPassword");
static CSysString GetKeyPath(const CSysString &path)
{
- return CSysString(kCUBasePath) + CSysString('\\') + CSysString(path);
+ return CSysString(kCUBasePath) + CSysString(CHAR_PATH_SEPARATOR) + path;
}
void SaveExtractionInfo(const NExtract::CInfo &info)
@@ -69,9 +69,9 @@ void ReadExtractionInfo(NExtract::CInfo &info)
{
CKey pathHistoryKey;
- if(pathHistoryKey.Open(extractionKey, kExtractionPathHistoryKeyName, KEY_READ) ==
+ if(pathHistoryKey.Open(extractionKey, kExtractionPathHistoryKeyName, KEY_READ) ==
ERROR_SUCCESS)
- {
+ {
for (;;)
{
wchar_t numberString[16];
@@ -109,7 +109,7 @@ void ReadExtractionInfo(NExtract::CInfo &info)
break;
}
}
- if (extractionKey.QueryValue(kExtractionShowPasswordValueName,
+ if (extractionKey.QueryValue(kExtractionShowPasswordValueName,
info.ShowPassword) != ERROR_SUCCESS)
info.ShowPassword = false;
}
@@ -234,15 +234,15 @@ void ReadCompressionInfo(NCompression::CInfo &info)
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CKey compressionKey;
- if(compressionKey.Open(HKEY_CURRENT_USER,
+ if(compressionKey.Open(HKEY_CURRENT_USER,
GetKeyPath(kCompressionKeyName), KEY_READ) != ERROR_SUCCESS)
return;
{
CKey historyArchivesKey;
- if(historyArchivesKey.Open(compressionKey, kCompressionHistoryArchivesKeyName, KEY_READ) ==
+ if(historyArchivesKey.Open(compressionKey, kCompressionHistoryArchivesKeyName, KEY_READ) ==
ERROR_SUCCESS)
- {
+ {
for (;;)
{
wchar_t numberString[16];
@@ -267,9 +267,9 @@ void ReadCompressionInfo(NCompression::CInfo &info)
{
CKey optionsKey;
- if(optionsKey.Open(compressionKey, kCompressionOptionsKeyName, KEY_READ) ==
+ if(optionsKey.Open(compressionKey, kCompressionOptionsKeyName, KEY_READ) ==
ERROR_SUCCESS)
- {
+ {
CSysStringVector formatIDs;
optionsKey.EnumKeys(formatIDs);
for(int i = 0; i < formatIDs.Size(); i++)
@@ -302,10 +302,10 @@ void ReadCompressionInfo(NCompression::CInfo &info)
CSysString archiveType;
if (compressionKey.QueryValue(kCompressionLastFormatValueName, archiveType) == ERROR_SUCCESS)
info.ArchiveType = GetUnicodeString(archiveType);
- if (compressionKey.QueryValue(kCompressionShowPasswordValueName,
+ if (compressionKey.QueryValue(kCompressionShowPasswordValueName,
info.ShowPassword) != ERROR_SUCCESS)
info.ShowPassword = false;
- if (compressionKey.QueryValue(kCompressionEncryptHeadersValueName,
+ if (compressionKey.QueryValue(kCompressionEncryptHeadersValueName,
info.EncryptHeaders) != ERROR_SUCCESS)
info.EncryptHeaders = false;
/*
diff --git a/CPP/7zip/UI/Common/ZipRegistry.h b/CPP/7zip/UI/Common/ZipRegistry.h
index 753287d9..30be8d89 100755
--- a/CPP/7zip/UI/Common/ZipRegistry.h
+++ b/CPP/7zip/UI/Common/ZipRegistry.h
@@ -31,9 +31,9 @@ namespace NCompression {
UInt32 Order;
UInt32 BlockLogSize;
UInt32 NumThreads;
- void ResetForLevelChange()
- {
- BlockLogSize = NumThreads = Level = Dictionary = Order = UInt32(-1);
+ void ResetForLevelChange()
+ {
+ BlockLogSize = NumThreads = Level = Dictionary = Order = UInt32(-1);
Method.Empty();
// EncryptionMethod.Empty();
// Options.Empty();
diff --git a/CPP/7zip/UI/Console/Console.dsp b/CPP/7zip/UI/Console/Console.dsp
index e8f83664..ba5cd727 100755
--- a/CPP/7zip/UI/Console/Console.dsp
+++ b/CPP/7zip/UI/Console/Console.dsp
@@ -316,6 +316,10 @@ SOURCE=..\..\..\Windows\System.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Windows\Time.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Windows\Time.h
# End Source File
# End Group
diff --git a/CPP/7zip/UI/Console/ConsoleClose.h b/CPP/7zip/UI/Console/ConsoleClose.h
index 3c5fd55d..9019c4ce 100755
--- a/CPP/7zip/UI/Console/ConsoleClose.h
+++ b/CPP/7zip/UI/Console/ConsoleClose.h
@@ -14,7 +14,7 @@ public:
virtual ~CCtrlHandlerSetter();
};
-class CCtrlBreakException
+class CCtrlBreakException
{};
void CheckCtrlBreak();
diff --git a/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp b/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
index d693cb4b..65b74fce 100755
--- a/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
+++ b/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
@@ -24,9 +24,9 @@ using namespace NWindows;
using namespace NFile;
using namespace NDirectory;
-static const char *kTestingString = "Testing ";
-static const char *kExtractingString = "Extracting ";
-static const char *kSkippingString = "Skipping ";
+static const char *kTestString = "Testing ";
+static const char *kExtractString = "Extracting ";
+static const char *kSkipString = "Skipping ";
// static const char *kCantAutoRename = "can not create file with auto name\n";
// static const char *kCantRenameFile = "can not rename existing file\n";
@@ -64,7 +64,7 @@ STDMETHODIMP CExtractCallbackConsole::AskOverwrite(
const wchar_t *newName, const FILETIME *, const UInt64 *,
Int32 *answer)
{
- (*OutStream) << "file " << existName <<
+ (*OutStream) << "file " << existName <<
"\nalready exists. Overwrite with " << endl;
(*OutStream) << newName;
@@ -72,25 +72,13 @@ STDMETHODIMP CExtractCallbackConsole::AskOverwrite(
switch(overwriteAnswer)
{
- case NUserAnswerMode::kQuit:
- return E_ABORT;
- case NUserAnswerMode::kNo:
- *answer = NOverwriteAnswer::kNo;
- break;
- case NUserAnswerMode::kNoAll:
- *answer = NOverwriteAnswer::kNoToAll;
- break;
- case NUserAnswerMode::kYesAll:
- *answer = NOverwriteAnswer::kYesToAll;
- break;
- case NUserAnswerMode::kYes:
- *answer = NOverwriteAnswer::kYes;
- break;
- case NUserAnswerMode::kAutoRename:
- *answer = NOverwriteAnswer::kAutoRename;
- break;
- default:
- return E_FAIL;
+ case NUserAnswerMode::kQuit: return E_ABORT;
+ case NUserAnswerMode::kNo: *answer = NOverwriteAnswer::kNo; break;
+ case NUserAnswerMode::kNoAll: *answer = NOverwriteAnswer::kNoToAll; break;
+ case NUserAnswerMode::kYesAll: *answer = NOverwriteAnswer::kYesToAll; break;
+ case NUserAnswerMode::kYes: *answer = NOverwriteAnswer::kYes; break;
+ case NUserAnswerMode::kAutoRename: *answer = NOverwriteAnswer::kAutoRename; break;
+ default: return E_FAIL;
}
return S_OK;
}
@@ -99,15 +87,9 @@ STDMETHODIMP CExtractCallbackConsole::PrepareOperation(const wchar_t *name, bool
{
switch (askExtractMode)
{
- case NArchive::NExtract::NAskMode::kExtract:
- (*OutStream) << kExtractingString;
- break;
- case NArchive::NExtract::NAskMode::kTest:
- (*OutStream) << kTestingString;
- break;
- case NArchive::NExtract::NAskMode::kSkip:
- (*OutStream) << kSkippingString;
- break;
+ case NArchive::NExtract::NAskMode::kExtract: (*OutStream) << kExtractString; break;
+ case NArchive::NExtract::NAskMode::kTest: (*OutStream) << kTestString; break;
+ case NArchive::NExtract::NAskMode::kSkip: (*OutStream) << kSkipString; break;
};
(*OutStream) << name;
if (position != 0)
@@ -154,11 +136,20 @@ STDMETHODIMP CExtractCallbackConsole::SetOperationResult(Int32 operationResult,
return S_OK;
}
+#ifndef _NO_CRYPTO
+
+HRESULT CExtractCallbackConsole::SetPassword(const UString &password)
+{
+ PasswordIsDefined = true;
+ Password = password;
+ return S_OK;
+}
+
STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
{
if (!PasswordIsDefined)
{
- Password = GetPassword(OutStream);
+ Password = GetPassword(OutStream);
PasswordIsDefined = true;
}
CMyComBSTR tempName(Password);
@@ -166,6 +157,8 @@ STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
return S_OK;
}
+#endif
+
HRESULT CExtractCallbackConsole::BeforeOpen(const wchar_t *name)
{
NumArchives++;
@@ -180,10 +173,19 @@ HRESULT CExtractCallbackConsole::OpenResult(const wchar_t * /* name */, HRESULT
if (result != S_OK)
{
(*OutStream) << "Error: ";
- if (encrypted)
- (*OutStream) << "Can not open encrypted archive. Wrong password?";
+ if (result == S_FALSE)
+ {
+ (*OutStream) << (encrypted ?
+ "Can not open encrypted archive. Wrong password?" :
+ "Can not open file as archive");
+ }
else
- (*OutStream) << "Can not open file as archive";
+ {
+ if (result == E_OUTOFMEMORY)
+ (*OutStream) << "Can't allocate required memory";
+ else
+ (*OutStream) << NError::MyFormatMessage(result);
+ }
(*OutStream) << endl;
NumArchiveErrors++;
}
@@ -203,7 +205,7 @@ HRESULT CExtractCallbackConsole::ExtractResult(HRESULT result)
(*OutStream) << endl;
if (NumFileErrorsInCurrentArchive == 0)
(*OutStream) << kEverythingIsOk << endl;
- else
+ else
{
NumArchiveErrors++;
(*OutStream) << "Sub items Errors: " << NumFileErrorsInCurrentArchive << endl;
@@ -226,10 +228,3 @@ HRESULT CExtractCallbackConsole::ExtractResult(HRESULT result)
(*OutStream) << endl;
return S_OK;
}
-
-HRESULT CExtractCallbackConsole::SetPassword(const UString &password)
-{
- PasswordIsDefined = true;
- Password = password;
- return S_OK;
-}
diff --git a/CPP/7zip/UI/Console/ExtractCallbackConsole.h b/CPP/7zip/UI/Console/ExtractCallbackConsole.h
index 7e5d9c5d..e42ca6f4 100755
--- a/CPP/7zip/UI/Console/ExtractCallbackConsole.h
+++ b/CPP/7zip/UI/Console/ExtractCallbackConsole.h
@@ -10,13 +10,20 @@
#include "../../Archive/IArchive.h"
#include "../Common/ArchiveExtractCallback.h"
-class CExtractCallbackConsole:
+class CExtractCallbackConsole:
public IExtractCallbackUI,
+ #ifndef _NO_CRYPTO
public ICryptoGetTextPassword,
+ #endif
public CMyUnknownImp
{
public:
- MY_UNKNOWN_IMP2(IFolderArchiveExtractCallback, ICryptoGetTextPassword)
+ MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
+ #ifndef _NO_CRYPTO
+ MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
+ #endif
+ MY_QUERYINTERFACE_END
+ MY_ADDREF_RELEASE
STDMETHOD(SetTotal)(UInt64 total);
STDMETHOD(SetCompleted)(const UInt64 *completeValue);
@@ -31,19 +38,20 @@ public:
STDMETHOD(MessageError)(const wchar_t *message);
STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
- // ICryptoGetTextPassword
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
HRESULT BeforeOpen(const wchar_t *name);
HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
HRESULT ThereAreNoFiles();
HRESULT ExtractResult(HRESULT result);
+
+ #ifndef _NO_CRYPTO
HRESULT SetPassword(const UString &password);
+ STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-public:
bool PasswordIsDefined;
UString Password;
+
+ #endif
UInt64 NumArchives;
UInt64 NumArchiveErrors;
diff --git a/CPP/7zip/UI/Console/List.cpp b/CPP/7zip/UI/Console/List.cpp
index 6ba2830e..82a08f2f 100755
--- a/CPP/7zip/UI/Console/List.cpp
+++ b/CPP/7zip/UI/Console/List.cpp
@@ -14,6 +14,7 @@
#include "Windows/Defs.h"
#include "Windows/PropVariantConversions.h"
#include "Windows/FileDir.h"
+#include "Windows/Error.h"
#include "../../Archive/IArchive.h"
@@ -30,17 +31,17 @@ struct CPropIdToName
const wchar_t *Name;
};
-static CPropIdToName kPropIdToName[] =
+static CPropIdToName kPropIdToName[] =
{
{ kpidPath, L"Path" },
{ kpidName, L"Name" },
- { kpidIsFolder, L"Folder" },
+ { kpidIsDir, L"Folder" },
{ kpidSize, L"Size" },
- { kpidPackedSize, L"Packed Size" },
- { kpidAttributes, L"Attributes" },
- { kpidCreationTime, L"Created" },
- { kpidLastAccessTime, L"Accessed" },
- { kpidLastWriteTime, L"Modified" },
+ { kpidPackSize, L"Packed Size" },
+ { kpidAttrib, L"Attributes" },
+ { kpidCTime, L"Created" },
+ { kpidATime, L"Accessed" },
+ { kpidMTime, L"Modified" },
{ kpidSolid, L"Solid" },
{ kpidCommented, L"Commented" },
{ kpidEncrypted, L"Encrypted" },
@@ -59,7 +60,7 @@ static CPropIdToName kPropIdToName[] =
{ kpidComment, L"Comment" },
{ kpidPosition, L"Position" },
{ kpidPrefix, L"Prefix" },
- { kpidNumSubFolders, L"Folders" },
+ { kpidNumSubDirs, L"Folders" },
{ kpidNumSubFiles, L"Files" },
{ kpidUnpackVer, L"Version" },
{ kpidVolume, L"Volume" },
@@ -67,32 +68,33 @@ static CPropIdToName kPropIdToName[] =
{ kpidOffset, L"Offset" },
{ kpidLinks, L"Links" },
{ kpidNumBlocks, L"Blocks" },
- { kpidNumVolumes, L"Volumes" }
+ { kpidNumVolumes, L"Volumes" },
+
+ { kpidBit64, L"64-bit" },
+ { kpidBigEndian, L"Big-endian" },
+ { kpidCpu, L"CPU" },
+ { kpidPhySize, L"Physical Size" },
+ { kpidHeadersSize, L"Headers Size" },
+ { kpidChecksum, L"Checksum" },
+ { kpidCharacts, L"Characteristics" },
+ { kpidVa, L"Virtual Address" },
+ { kpidFreeSpace, L"Free Space" },
+ { kpidClusterSize, L"Cluster Size" }
};
-static const char kEmptyAttributeChar = '.';
-static const char kDirectoryAttributeChar = 'D';
-static const char kReadonlyAttributeChar = 'R';
-static const char kHiddenAttributeChar = 'H';
-static const char kSystemAttributeChar = 'S';
-static const char kArchiveAttributeChar = 'A';
+static const char kEmptyAttribChar = '.';
static const char *kListing = "Listing archive: ";
static const wchar_t *kFilesMessage = L"files";
static const wchar_t *kDirsMessage = L"folders";
-static void GetAttributesString(DWORD wa, bool directory, char *s)
+static void GetAttribString(DWORD wa, bool isDir, char *s)
{
- s[0] = ((wa & FILE_ATTRIBUTE_DIRECTORY) != 0 || directory) ?
- kDirectoryAttributeChar: kEmptyAttributeChar;
- s[1] = ((wa & FILE_ATTRIBUTE_READONLY) != 0)?
- kReadonlyAttributeChar: kEmptyAttributeChar;
- s[2] = ((wa & FILE_ATTRIBUTE_HIDDEN) != 0) ?
- kHiddenAttributeChar: kEmptyAttributeChar;
- s[3] = ((wa & FILE_ATTRIBUTE_SYSTEM) != 0) ?
- kSystemAttributeChar: kEmptyAttributeChar;
- s[4] = ((wa & FILE_ATTRIBUTE_ARCHIVE) != 0) ?
- kArchiveAttributeChar: kEmptyAttributeChar;
+ s[0] = ((wa & FILE_ATTRIBUTE_DIRECTORY) != 0 || isDir) ? 'D' : kEmptyAttribChar;
+ s[1] = ((wa & FILE_ATTRIBUTE_READONLY) != 0) ? 'R': kEmptyAttribChar;
+ s[2] = ((wa & FILE_ATTRIBUTE_HIDDEN) != 0) ? 'H': kEmptyAttribChar;
+ s[3] = ((wa & FILE_ATTRIBUTE_SYSTEM) != 0) ? 'S': kEmptyAttribChar;
+ s[4] = ((wa & FILE_ATTRIBUTE_ARCHIVE) != 0) ? 'A': kEmptyAttribChar;
s[5] = '\0';
}
@@ -123,12 +125,12 @@ struct CFieldInfoInit
int Width;
};
-CFieldInfoInit kStandardFieldTable[] =
+CFieldInfoInit kStandardFieldTable[] =
{
- { kpidLastWriteTime, L" Date Time", kLeft, kLeft, 0, 19 },
- { kpidAttributes, L"Attr", kRight, kCenter, 1, 5 },
+ { kpidMTime, L" Date Time", kLeft, kLeft, 0, 19 },
+ { kpidAttrib, L"Attr", kRight, kCenter, 1, 5 },
{ kpidSize, L"Size", kRight, kRight, 1, 12 },
- { kpidPackedSize, L"Compressed", kRight, kRight, 1, 12 },
+ { kpidPackSize, L"Compressed", kRight, kRight, 1, 12 },
{ kpidPath, L"Name", kLeft, kLeft, 2, 24 }
};
@@ -168,12 +170,11 @@ public:
HRESULT Init(IInArchive *archive);
void PrintTitle();
void PrintTitleLines();
- HRESULT PrintItemInfo(IInArchive *archive,
+ HRESULT PrintItemInfo(IInArchive *archive,
const UString &defaultItemName,
- const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo,
UInt32 index,
bool techMode);
- HRESULT PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
+ HRESULT PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
const UInt64 *size, const UInt64 *compressedSize);
};
@@ -204,7 +205,9 @@ static UString GetPropName(PROPID propID, BSTR name)
}
if (name)
return name;
- return L"?";
+ wchar_t s[32];
+ ConvertUInt64ToString(propID, s);
+ return s;
}
HRESULT CFieldPrinter::Init(IInArchive *archive)
@@ -232,7 +235,7 @@ void CFieldPrinter::PrintTitle()
{
const CFieldInfo &fieldInfo = _fields[i];
PrintSpaces(fieldInfo.PrefixSpacesWidth);
- PrintString(fieldInfo.TitleAdjustment,
+ PrintString(fieldInfo.TitleAdjustment,
((fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width), fieldInfo.Name);
}
}
@@ -255,16 +258,16 @@ BOOL IsFileTimeZero(CONST FILETIME *lpFileTime)
}
static const char *kEmptyTimeString = " ";
-void PrintTime(const NCOM::CPropVariant &propVariant)
+void PrintTime(const NCOM::CPropVariant &prop)
{
- if (propVariant.vt != VT_FILETIME)
+ if (prop.vt != VT_FILETIME)
throw "incorrect item";
- if (IsFileTimeZero(&propVariant.filetime))
+ if (IsFileTimeZero(&prop.filetime))
g_StdOut << kEmptyTimeString;
else
{
FILETIME localFileTime;
- if (!FileTimeToLocalFileTime(&propVariant.filetime, &localFileTime))
+ if (!FileTimeToLocalFileTime(&prop.filetime, &localFileTime))
throw "FileTimeToLocalFileTime error";
char s[32];
if (ConvertFileTimeToString(localFileTime, s, true, true))
@@ -274,9 +277,8 @@ void PrintTime(const NCOM::CPropVariant &propVariant)
}
}
-HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
- const UString &defaultItemName,
- const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo,
+HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
+ const UString &defaultItemName,
UInt32 index,
bool techMode)
{
@@ -294,32 +296,27 @@ HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
if (!techMode)
PrintSpaces(fieldInfo.PrefixSpacesWidth);
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (fieldInfo.PropID == kpidPath)
{
UString s;
RINOK(GetArchiveItemPath(archive, index, defaultItemName, s));
- propVariant = s;
+ prop = s;
}
else
{
- RINOK(archive->GetProperty(index, fieldInfo.PropID, &propVariant));
+ RINOK(archive->GetProperty(index, fieldInfo.PropID, &prop));
}
if (techMode)
{
g_StdOut << fieldInfo.Name << " = ";
}
int width = (fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width;
- if (propVariant.vt == VT_EMPTY)
+ if (prop.vt == VT_EMPTY)
{
switch(fieldInfo.PropID)
{
- case kpidPath:
- propVariant = defaultItemName;
- break;
- case kpidLastWriteTime:
- propVariant = archiveFileInfo.LastWriteTime;
- break;
+ case kpidPath: prop = defaultItemName; break;
default:
if (techMode)
g_StdOut << endl;
@@ -328,33 +325,33 @@ HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
continue;
}
}
- if (fieldInfo.PropID == kpidLastWriteTime)
+ if (fieldInfo.PropID == kpidMTime)
{
- PrintTime(propVariant);
+ PrintTime(prop);
}
- else if (fieldInfo.PropID == kpidAttributes)
+ else if (fieldInfo.PropID == kpidAttrib)
{
- if (propVariant.vt != VT_UI4)
+ if (prop.vt != VT_UI4)
throw "incorrect item";
- UInt32 attributes = propVariant.ulVal;
+ UInt32 attributes = prop.ulVal;
bool isFolder;
RINOK(IsArchiveItemFolder(archive, index, isFolder));
char s[8];
- GetAttributesString(attributes, isFolder, s);
+ GetAttribString(attributes, isFolder, s);
g_StdOut << s;
}
- else if (propVariant.vt == VT_BSTR)
+ else if (prop.vt == VT_BSTR)
{
if (techMode)
- g_StdOut << propVariant.bstrVal;
+ g_StdOut << prop.bstrVal;
else
- PrintString(fieldInfo.TextAdjustment, width, propVariant.bstrVal);
+ PrintString(fieldInfo.TextAdjustment, width, prop.bstrVal);
}
else
{
- UString s = ConvertPropertyToString(propVariant, fieldInfo.PropID);
- s.Replace(wchar_t(0xA), L' ');
- s.Replace(wchar_t(0xD), L' ');
+ UString s = ConvertPropertyToString(prop, fieldInfo.PropID);
+ s.Replace(wchar_t(0xA), L' ');
+ s.Replace(wchar_t(0xD), L' ');
if (techMode)
g_StdOut << s;
@@ -376,17 +373,17 @@ void PrintNumberString(EAdjustment adjustment, int width, const UInt64 *value)
}
-HRESULT CFieldPrinter::PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
+HRESULT CFieldPrinter::PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
const UInt64 *size, const UInt64 *compressedSize)
{
for (int i = 0; i < _fields.Size(); i++)
{
const CFieldInfo &fieldInfo = _fields[i];
PrintSpaces(fieldInfo.PrefixSpacesWidth);
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (fieldInfo.PropID == kpidSize)
PrintNumberString(fieldInfo.TextAdjustment, fieldInfo.Width, size);
- else if (fieldInfo.PropID == kpidPackedSize)
+ else if (fieldInfo.PropID == kpidPackSize)
PrintNumberString(fieldInfo.TextAdjustment, fieldInfo.Width, compressedSize);
else if (fieldInfo.PropID == kpidPath)
{
@@ -402,7 +399,7 @@ HRESULT CFieldPrinter::PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
temp += kDirsMessage;
PrintString(fieldInfo.TextAdjustment, 0, temp);
}
- else
+ else
PrintString(fieldInfo.TextAdjustment, fieldInfo.Width, L"");
}
return S_OK;
@@ -410,20 +407,23 @@ HRESULT CFieldPrinter::PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
bool GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, UInt64 &value)
{
- NCOM::CPropVariant propVariant;
- if (archive->GetProperty(index, propID, &propVariant) != S_OK)
+ NCOM::CPropVariant prop;
+ if (archive->GetProperty(index, propID, &prop) != S_OK)
throw "GetPropertyValue error";
- if (propVariant.vt == VT_EMPTY)
+ if (prop.vt == VT_EMPTY)
return false;
- value = ConvertPropVariantToUInt64(propVariant);
+ value = ConvertPropVariantToUInt64(prop);
return true;
}
-HRESULT ListArchives(
- CCodecs *codecs,
+HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
- bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password, UInt64 &numErrors)
+ bool enableHeaders, bool techMode,
+ #ifndef _NO_CRYPTO
+ bool &passwordEnabled, UString &password,
+ #endif
+ UInt64 &numErrors)
{
numErrors = 0;
CFieldPrinter fieldPrinter;
@@ -435,14 +435,8 @@ HRESULT ListArchives(
for (int i = 0; i < archivePaths.Size(); i++)
{
const UString &archiveName = archivePaths[i];
- NFile::NFind::CFileInfoW archiveFileInfo;
- if (!NFile::NFind::FindFile(archiveName, archiveFileInfo) || archiveFileInfo.IsDirectory())
- {
- g_StdOut << endl << "Error: " << archiveName << " is not archive" << endl;
- numErrors++;
- continue;
- }
- if (archiveFileInfo.IsDirectory())
+ NFile::NFind::CFileInfoW fi;
+ if (!NFile::NFind::FindFile(archiveName, fi) || fi.IsDir())
{
g_StdOut << endl << "Error: " << archiveName << " is not file" << endl;
numErrors++;
@@ -453,13 +447,27 @@ HRESULT ListArchives(
COpenCallbackConsole openCallback;
openCallback.OutStream = &g_StdOut;
+
+ #ifndef _NO_CRYPTO
+
openCallback.PasswordIsDefined = passwordEnabled;
openCallback.Password = password;
- HRESULT result = MyOpenArchive(codecs, archiveName, archiveLink, &openCallback);
+ #endif
+
+ HRESULT result = MyOpenArchive(codecs, formatIndices, archiveName, archiveLink, &openCallback);
if (result != S_OK)
{
- g_StdOut << endl << "Error: " << archiveName << " is not supported archive" << endl;
+ if (result == E_ABORT)
+ return result;
+ g_StdOut << endl << "Error: " << archiveName << ": ";
+ if (result == S_FALSE)
+ g_StdOut << "is not supported archive";
+ else if (result == E_OUTOFMEMORY)
+ g_StdOut << "Can't allocate required memory";
+ else
+ g_StdOut << NError::MyFormatMessage(result);
+ g_StdOut << endl;
numErrors++;
continue;
}
@@ -534,14 +542,14 @@ HRESULT ListArchives(
if (!wildcardCensor.CheckPath(filePath, !isFolder))
continue;
- fieldPrinter.PrintItemInfo(archive, defaultItemName, archiveFileInfo, i, techMode);
+ fieldPrinter.PrintItemInfo(archive, defaultItemName, i, techMode);
UInt64 packSize, unpackSize;
if (!GetUInt64Value(archive, i, kpidSize, unpackSize))
unpackSize = 0;
else
totalUnPackSizePointer = &totalUnPackSize;
- if (!GetUInt64Value(archive, i, kpidPackedSize, packSize))
+ if (!GetUInt64Value(archive, i, kpidPackSize, packSize))
packSize = 0;
else
totalPackSizePointer = &totalPackSize;
diff --git a/CPP/7zip/UI/Console/List.h b/CPP/7zip/UI/Console/List.h
index 6e9fa240..bb4287e6 100755
--- a/CPP/7zip/UI/Console/List.h
+++ b/CPP/7zip/UI/Console/List.h
@@ -6,11 +6,14 @@
#include "Common/Wildcard.h"
#include "../Common/LoadCodecs.h"
-HRESULT ListArchives(
- CCodecs *codecs,
+HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
- bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password, UInt64 &errors);
+ bool enableHeaders, bool techMode,
+ #ifndef _NO_CRYPTO
+ bool &passwordEnabled, UString &password,
+ #endif
+ UInt64 &errors);
#endif
diff --git a/CPP/7zip/UI/Console/Main.cpp b/CPP/7zip/UI/Console/Main.cpp
index 265d2212..87d48e95 100755
--- a/CPP/7zip/UI/Console/Main.cpp
+++ b/CPP/7zip/UI/Console/Main.cpp
@@ -40,8 +40,8 @@
#include "../../MyVersion.h"
#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
}
#endif
@@ -64,7 +64,7 @@ static const char *kCopyrightString = "\n7-Zip"
" " MY_VERSION_COPYRIGHT_DATE "\n";
-static const char *kHelpString =
+static const char *kHelpString =
"\nUsage: 7z"
#ifdef _NO_CRYPTO
"r"
@@ -96,7 +96,9 @@ static const char *kHelpString =
" -i[r[-|0]]{@listfile|!wildcard}: Include filenames\n"
" -m{Parameters}: set compression Method\n"
" -o{Directory}: set Output directory\n"
+ #ifndef _NO_CRYPTO
" -p{Password}: set Password\n"
+ #endif
" -r[-|0]: Recurse subdirectories\n"
" -scs{UTF-8 | WIN | DOS}: set charset for list files\n"
" -sfx[{name}]: Create SFX archive\n"
@@ -117,6 +119,7 @@ static const char *kHelpString =
static const char *kEverythingIsOk = "Everything is Ok";
static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
+static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
static const wchar_t *kDefaultSfxModule = L"7zCon.sfx";
@@ -148,7 +151,7 @@ static void ShowCopyrightAndHelp(CStdOutStream &s, bool needHelp)
{
s << kCopyrightString;
// s << "# CPUs: " << (UInt64)NWindows::NSystem::GetNumberOfProcessors() << "\n";
- if (needHelp)
+ if (needHelp)
s << kHelpString;
}
@@ -175,18 +178,20 @@ static inline char GetHex(Byte value)
return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
}
+const char *kUnsupportedArcTypeMessage = "Unsupported archive type";
+
int Main2(
- #ifndef _WIN32
+ #ifndef _WIN32
int numArguments, const char *arguments[]
#endif
)
{
- #ifdef _WIN32
+ #ifdef _WIN32
SetFileApisToOEM();
#endif
UStringVector commandStrings;
- #ifdef _WIN32
+ #ifdef _WIN32
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
#else
GetArguments(numArguments, arguments, commandStrings);
@@ -240,6 +245,17 @@ int Main2(
throw CSystemException(result);
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
+
+ if (codecs->Formats.Size() == 0 &&
+ (isExtractGroupCommand ||
+ options.Command.CommandType == NCommandType::kList ||
+ options.Command.IsFromUpdateGroup()))
+ throw kNoFormats;
+
+ CIntVector formatIndices;
+ if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices))
+ throw kUnsupportedArcTypeMessage;
+
if (options.Command.CommandType == NCommandType::kInfo)
{
stdStream << endl << "Formats:" << endl;
@@ -373,14 +389,21 @@ int Main2(
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
ecs->OutStream = &stdStream;
+
+ #ifndef _NO_CRYPTO
ecs->PasswordIsDefined = options.PasswordEnabled;
ecs->Password = options.Password;
+ #endif
+
ecs->Init();
COpenCallbackConsole openCallback;
openCallback.OutStream = &stdStream;
+
+ #ifndef _NO_CRYPTO
openCallback.PasswordIsDefined = options.PasswordEnabled;
openCallback.Password = options.Password;
+ #endif
CExtractOptions eo;
eo.StdOutMode = options.StdOutMode;
@@ -396,9 +419,10 @@ int Main2(
CDecompressStat stat;
HRESULT result = DecompressArchives(
codecs,
- options.ArchivePathsSorted,
+ formatIndices,
+ options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
+ options.WildcardCensor.Pairs.Front().Head,
eo, &openCallback, ecs, errorMessage, stat);
if (!errorMessage.IsEmpty())
{
@@ -430,7 +454,7 @@ int Main2(
stdStream << "Folders: " << stat.NumFolders << endl;
if (stat.NumFiles != 1 || stat.NumFolders != 0)
stdStream << "Files: " << stat.NumFiles << endl;
- stdStream
+ stdStream
<< "Size: " << stat.UnpackSize << endl
<< "Compressed: " << stat.PackSize << endl;
}
@@ -439,13 +463,17 @@ int Main2(
UInt64 numErrors = 0;
HRESULT result = ListArchives(
codecs,
- options.ArchivePathsSorted,
+ formatIndices,
+ options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
- options.EnableHeaders,
+ options.WildcardCensor.Pairs.Front().Head,
+ options.EnableHeaders,
options.TechMode,
- options.PasswordEnabled,
- options.Password, numErrors);
+ #ifndef _NO_CRYPTO
+ options.PasswordEnabled,
+ options.Password,
+ #endif
+ numErrors);
if (numErrors > 0)
{
g_StdOut << endl << "Errors: " << numErrors;
@@ -463,28 +491,33 @@ int Main2(
if (uo.SfxMode && uo.SfxModule.IsEmpty())
uo.SfxModule = kDefaultSfxModule;
- bool passwordIsDefined =
- options.PasswordEnabled && !options.Password.IsEmpty();
-
COpenCallbackConsole openCallback;
openCallback.OutStream = &stdStream;
+
+ #ifndef _NO_CRYPTO
+ bool passwordIsDefined =
+ options.PasswordEnabled && !options.Password.IsEmpty();
openCallback.PasswordIsDefined = passwordIsDefined;
openCallback.Password = options.Password;
+ #endif
CUpdateCallbackConsole callback;
callback.EnablePercents = options.EnablePercents;
+
+ #ifndef _NO_CRYPTO
callback.PasswordIsDefined = passwordIsDefined;
callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
callback.Password = options.Password;
+ #endif
callback.StdOutMode = uo.StdOutMode;
callback.Init(&stdStream);
CUpdateErrorInfo errorInfo;
- if (!uo.Init(codecs, options.ArchiveName, options.ArcType))
- throw "Unsupported archive type";
- HRESULT result = UpdateArchive(codecs,
- options.WildcardCensor, uo,
+ if (!uo.Init(codecs, formatIndices, options.ArchiveName))
+ throw kUnsupportedArcTypeMessage;
+ HRESULT result = UpdateArchive(codecs,
+ options.WildcardCensor, uo,
errorInfo, &openCallback, &callback);
int exitCode = NExitCode::kSuccess;
@@ -557,7 +590,7 @@ int Main2(
}
return exitCode;
}
- else
+ else
PrintHelpAndExit(stdStream);
return 0;
}
diff --git a/CPP/7zip/UI/Console/MainAr.cpp b/CPP/7zip/UI/Console/MainAr.cpp
index 6cc5cf9d..02918d79 100755
--- a/CPP/7zip/UI/Console/MainAr.cpp
+++ b/CPP/7zip/UI/Console/MainAr.cpp
@@ -28,7 +28,7 @@ static inline bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -36,7 +36,7 @@ static inline bool IsItWindowsNT()
#endif
extern int Main2(
- #ifndef _WIN32
+ #ifndef _WIN32
int numArguments, const char *arguments[]
#endif
);
@@ -50,7 +50,7 @@ static const char *kInternalExceptionMessage = "\n\nInternal Error #";
int MY_CDECL main
(
-#ifndef _WIN32
+#ifndef _WIN32
int numArguments, const char *arguments[]
#endif
)
@@ -62,7 +62,7 @@ int numArguments, const char *arguments[]
#ifndef _WIN64
if (!IsItWindowsNT())
{
- (*g_StdStream) << "This program requires Windows NT/2000/XP/2003/Vista";
+ (*g_StdStream) << "This program requires Windows NT/2000/2003/2008/XP/Vista";
return NExitCode::kFatalError;
}
#endif
@@ -112,7 +112,7 @@ int numArguments, const char *arguments[]
}
UString message;
NError::MyFormatMessage(systemError.ErrorCode, message);
- (*g_StdStream) << endl << endl << "System error:" << endl <<
+ (*g_StdStream) << endl << endl << "System error:" << endl <<
message << endl;
return (NExitCode::kFatalError);
}
diff --git a/CPP/7zip/UI/Console/OpenCallbackConsole.cpp b/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
index 06ff165f..892123d4 100755
--- a/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
+++ b/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
@@ -7,30 +7,32 @@
#include "ConsoleClose.h"
#include "UserInputUtils.h"
-HRESULT COpenCallbackConsole::CheckBreak()
+HRESULT COpenCallbackConsole::Open_CheckBreak()
{
if (NConsoleClose::TestBreakSignal())
return E_ABORT;
return S_OK;
}
-HRESULT COpenCallbackConsole::SetTotal(const UInt64 *, const UInt64 *)
+HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *)
{
- return CheckBreak();
+ return Open_CheckBreak();
}
-HRESULT COpenCallbackConsole::SetCompleted(const UInt64 *, const UInt64 *)
+HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *)
{
- return CheckBreak();
+ return Open_CheckBreak();
}
-HRESULT COpenCallbackConsole::CryptoGetTextPassword(BSTR *password)
+#ifndef _NO_CRYPTO
+
+HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
{
PasswordWasAsked = true;
- RINOK(CheckBreak());
+ RINOK(Open_CheckBreak());
if (!PasswordIsDefined)
{
- Password = GetPassword(OutStream);
+ Password = GetPassword(OutStream);
PasswordIsDefined = true;
}
CMyComBSTR temp(Password);
@@ -38,21 +40,21 @@ HRESULT COpenCallbackConsole::CryptoGetTextPassword(BSTR *password)
return S_OK;
}
-HRESULT COpenCallbackConsole::GetPasswordIfAny(UString &password)
+HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password)
{
if (PasswordIsDefined)
password = Password;
return S_OK;
}
-bool COpenCallbackConsole::WasPasswordAsked()
+bool COpenCallbackConsole::Open_WasPasswordAsked()
{
return PasswordWasAsked;
}
-void COpenCallbackConsole::ClearPasswordWasAskedFlag()
+void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag()
{
PasswordWasAsked = false;
}
-
+#endif
diff --git a/CPP/7zip/UI/Console/OpenCallbackConsole.h b/CPP/7zip/UI/Console/OpenCallbackConsole.h
index db0e9bd8..c002e6a7 100755
--- a/CPP/7zip/UI/Console/OpenCallbackConsole.h
+++ b/CPP/7zip/UI/Console/OpenCallbackConsole.h
@@ -9,19 +9,16 @@
class COpenCallbackConsole: public IOpenCallbackUI
{
public:
- HRESULT CheckBreak();
- HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes);
- HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes);
- HRESULT CryptoGetTextPassword(BSTR *password);
- HRESULT GetPasswordIfAny(UString &password);
- bool WasPasswordAsked();
- void ClearPasswordWasAskedFlag();
+ INTERFACE_IOpenCallbackUI(;)
CStdOutStream *OutStream;
+
+ #ifndef _NO_CRYPTO
bool PasswordIsDefined;
- UString Password;
bool PasswordWasAsked;
+ UString Password;
COpenCallbackConsole(): PasswordIsDefined(false), PasswordWasAsked(false) {}
+ #endif
};
#endif
diff --git a/CPP/7zip/UI/Console/PercentPrinter.cpp b/CPP/7zip/UI/Console/PercentPrinter.cpp
index 47aafd73..28452b17 100755
--- a/CPP/7zip/UI/Console/PercentPrinter.cpp
+++ b/CPP/7zip/UI/Console/PercentPrinter.cpp
@@ -65,25 +65,25 @@ void CPercentPrinter::RePrintRatio()
int i;
if (m_NumExtraChars == 0)
{
- for (i = 0; i < extraSize; i++)
+ for (i = 0; i < extraSize; i++)
*p++ = ' ';
m_NumExtraChars = extraSize;
}
- for (i = 0; i < m_NumExtraChars; i++)
+ for (i = 0; i < m_NumExtraChars; i++)
*p++ = '\b';
m_NumExtraChars = extraSize;
for (; size < m_NumExtraChars; size++)
*p++ = ' ';
MyStringCopy(p, s);
(*OutStream) << fullString;
- OutStream->Flush();
+ OutStream->Flush();
m_PrevValue = m_CurValue;
}
void CPercentPrinter::PrintRatio()
{
- if (m_CurValue < m_PrevValue + m_MinStepSize &&
+ if (m_CurValue < m_PrevValue + m_MinStepSize &&
m_CurValue + m_MinStepSize > m_PrevValue && m_NumExtraChars != 0)
return;
RePrintRatio();
diff --git a/CPP/7zip/UI/Console/PercentPrinter.h b/CPP/7zip/UI/Console/PercentPrinter.h
index e8b40916..97f2e6ad 100755
--- a/CPP/7zip/UI/Console/PercentPrinter.h
+++ b/CPP/7zip/UI/Console/PercentPrinter.h
@@ -16,7 +16,7 @@ class CPercentPrinter
public:
CStdOutStream *OutStream;
- CPercentPrinter(UInt64 minStepSize = 1): m_MinStepSize(minStepSize),
+ CPercentPrinter(UInt64 minStepSize = 1): m_MinStepSize(minStepSize),
m_PrevValue(0), m_CurValue(0), m_Total(1), m_NumExtraChars(0) {}
void SetTotal(UInt64 total) { m_Total = total; m_PrevValue = 0; }
void SetRatio(UInt64 doneValue) { m_CurValue = doneValue; }
diff --git a/CPP/7zip/UI/Console/StdAfx.h b/CPP/7zip/UI/Console/StdAfx.h
index 8531cc9c..2e4be10b 100755
--- a/CPP/7zip/UI/Console/StdAfx.h
+++ b/CPP/7zip/UI/Console/StdAfx.h
@@ -6,4 +6,4 @@
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
-#endif
+#endif
diff --git a/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp b/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
index dd4e2b9e..f8621567 100755
--- a/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
+++ b/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
@@ -42,6 +42,11 @@ HRESULT CUpdateCallbackConsole::StartScanning()
return S_OK;
}
+HRESULT CUpdateCallbackConsole::ScanProgress(UInt64 /* numFolders */, UInt64 /* numFiles */, const wchar_t * /* path */)
+{
+ return CheckBreak();
+}
+
HRESULT CUpdateCallbackConsole::CanNotFindError(const wchar_t *name, DWORD systemError)
{
CantFindFiles.Add(name);
@@ -71,7 +76,7 @@ HRESULT CUpdateCallbackConsole::StartArchive(const wchar_t *name, bool updating)
if(updating)
(*OutStream) << kUpdatingArchiveMessage;
else
- (*OutStream) << kCreatingArchiveMessage;
+ (*OutStream) << kCreatingArchiveMessage;
if (name != 0)
(*OutStream) << name;
else
@@ -186,21 +191,32 @@ HRESULT CUpdateCallbackConsole::SetOperationResult(Int32 )
{
m_NeedBeClosed = true;
m_NeedNewLine = true;
- return S_OK;
+ return S_OK;
}
HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
- if (!PasswordIsDefined)
+ #ifdef _NO_CRYPTO
+
+ *passwordIsDefined = false;
+ CMyComBSTR tempName(L"");
+ *password = tempName.Detach();
+
+ #else
+
+ if (!PasswordIsDefined)
{
if (AskPassword)
{
- Password = GetPassword(OutStream);
+ Password = GetPassword(OutStream);
PasswordIsDefined = true;
}
}
*passwordIsDefined = BoolToInt(PasswordIsDefined);
CMyComBSTR tempName(Password);
*password = tempName.Detach();
+
+ #endif
+
return S_OK;
}
diff --git a/CPP/7zip/UI/Console/UpdateCallbackConsole.h b/CPP/7zip/UI/Console/UpdateCallbackConsole.h
index d04e1ad4..da8d8cc2 100755
--- a/CPP/7zip/UI/Console/UpdateCallbackConsole.h
+++ b/CPP/7zip/UI/Console/UpdateCallbackConsole.h
@@ -21,15 +21,18 @@ public:
bool EnablePercents;
bool StdOutMode;
+ #ifndef _NO_CRYPTO
bool PasswordIsDefined;
UString Password;
bool AskPassword;
+ #endif
-
- CUpdateCallbackConsole():
+ CUpdateCallbackConsole():
m_PercentPrinter(1 << 16),
+ #ifndef _NO_CRYPTO
PasswordIsDefined(false),
AskPassword(false),
+ #endif
StdOutMode(false),
EnablePercents(true),
m_WarningsMode(false)
diff --git a/CPP/7zip/UI/Console/UserInputUtils.cpp b/CPP/7zip/UI/Console/UserInputUtils.cpp
index 164af99c..8a202c2c 100755
--- a/CPP/7zip/UI/Console/UserInputUtils.cpp
+++ b/CPP/7zip/UI/Console/UserInputUtils.cpp
@@ -15,7 +15,7 @@ static const char kAutoRename = 'U';
static const char kQuit = 'Q';
static const char *kFirstQuestionMessage = "?\n";
-static const char *kHelpQuestionMessage =
+static const char *kHelpQuestionMessage =
"(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename / (Q)uit? ";
// return true if pressed Quite;
@@ -54,5 +54,5 @@ UString GetPassword(CStdOutStream *outStream)
(*outStream) << "\nEnter password:";
outStream->Flush();
AString oemPassword = g_StdIn.ScanStringUntilNewLine();
- return MultiByteToUnicodeString(oemPassword, CP_OEMCP);
+ return MultiByteToUnicodeString(oemPassword, CP_OEMCP);
}
diff --git a/CPP/7zip/UI/Console/afxres.h b/CPP/7zip/UI/Console/afxres.h
deleted file mode 100755
index c2fadd4a..00000000
--- a/CPP/7zip/UI/Console/afxres.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <winresrc.h>
diff --git a/CPP/7zip/UI/Console/makefile b/CPP/7zip/UI/Console/makefile
index dc347889..1fde7c66 100755
--- a/CPP/7zip/UI/Console/makefile
+++ b/CPP/7zip/UI/Console/makefile
@@ -47,6 +47,7 @@ WIN_OBJS = \
$O\PropVariantConversions.obj \
$O\Registry.obj \
$O\System.obj \
+ $O\Time.obj \
7ZIP_COMMON_OBJS = \
$O\FilePathAutoRename.obj \
diff --git a/CPP/7zip/UI/Explorer/ContextMenu.cpp b/CPP/7zip/UI/Explorer/ContextMenu.cpp
index 5a736eb1..0b16bc89 100755
--- a/CPP/7zip/UI/Explorer/ContextMenu.cpp
+++ b/CPP/7zip/UI/Explorer/ContextMenu.cpp
@@ -25,7 +25,7 @@
#include "../Common/ZipRegistry.h"
#include "../Common/ArchiveName.h"
-#ifdef LANG
+#ifdef LANG
#include "../FileManager/LangUtils.h"
#endif
@@ -70,7 +70,7 @@ HRESULT CZipContextMenu::GetFileNames(LPDATAOBJECT dataObject, UStringVector &fi
return S_OK;
}
-STDMETHODIMP CZipContextMenu::Initialize(LPCITEMIDLIST pidlFolder,
+STDMETHODIMP CZipContextMenu::Initialize(LPCITEMIDLIST pidlFolder,
LPDATAOBJECT dataObject, HKEY /* hkeyProgID */)
{
// OutputDebugString(TEXT("::Initialize\r\n"));
@@ -97,7 +97,7 @@ STDMETHODIMP CZipContextMenu::Initialize(LPCITEMIDLIST pidlFolder,
return GetFileNames(dataObject, _fileNames);
}
-STDMETHODIMP CZipContextMenu::InitContextMenu(const wchar_t * /* folder */,
+STDMETHODIMP CZipContextMenu::InitContextMenu(const wchar_t * /* folder */,
const wchar_t **names, UINT32 numFiles)
{
_fileNames.Clear();
@@ -135,94 +135,94 @@ struct CContextMenuCommand
UINT32 LangID;
};
-static CContextMenuCommand g_Commands[] =
+static CContextMenuCommand g_Commands[] =
{
- {
+ {
NContextMenuFlags::kOpen,
- CZipContextMenu::kOpen,
- L"Open",
- IDS_CONTEXT_OPEN,
- IDS_CONTEXT_OPEN_HELP,
+ CZipContextMenu::kOpen,
+ L"Open",
+ IDS_CONTEXT_OPEN,
+ IDS_CONTEXT_OPEN_HELP,
0x02000103
},
- {
- NContextMenuFlags::kExtract,
- CZipContextMenu::kExtract,
- L"Extract",
- IDS_CONTEXT_EXTRACT,
- IDS_CONTEXT_EXTRACT_HELP,
- 0x02000105
+ {
+ NContextMenuFlags::kExtract,
+ CZipContextMenu::kExtract,
+ L"Extract",
+ IDS_CONTEXT_EXTRACT,
+ IDS_CONTEXT_EXTRACT_HELP,
+ 0x02000105
},
- {
- NContextMenuFlags::kExtractHere,
- CZipContextMenu::kExtractHere,
- L"ExtractHere",
- IDS_CONTEXT_EXTRACT_HERE,
- IDS_CONTEXT_EXTRACT_HERE_HELP,
+ {
+ NContextMenuFlags::kExtractHere,
+ CZipContextMenu::kExtractHere,
+ L"ExtractHere",
+ IDS_CONTEXT_EXTRACT_HERE,
+ IDS_CONTEXT_EXTRACT_HERE_HELP,
0x0200010B
},
- {
- NContextMenuFlags::kExtractTo,
- CZipContextMenu::kExtractTo,
- L"ExtractTo",
- IDS_CONTEXT_EXTRACT_TO,
- IDS_CONTEXT_EXTRACT_TO_HELP,
+ {
+ NContextMenuFlags::kExtractTo,
+ CZipContextMenu::kExtractTo,
+ L"ExtractTo",
+ IDS_CONTEXT_EXTRACT_TO,
+ IDS_CONTEXT_EXTRACT_TO_HELP,
0x0200010D
},
- {
- NContextMenuFlags::kTest,
- CZipContextMenu::kTest,
- L"Test",
- IDS_CONTEXT_TEST,
- IDS_CONTEXT_TEST_HELP,
+ {
+ NContextMenuFlags::kTest,
+ CZipContextMenu::kTest,
+ L"Test",
+ IDS_CONTEXT_TEST,
+ IDS_CONTEXT_TEST_HELP,
0x02000109
},
- {
- NContextMenuFlags::kCompress,
- CZipContextMenu::kCompress,
- L"Compress",
- IDS_CONTEXT_COMPRESS,
- IDS_CONTEXT_COMPRESS_HELP,
- 0x02000107,
+ {
+ NContextMenuFlags::kCompress,
+ CZipContextMenu::kCompress,
+ L"Compress",
+ IDS_CONTEXT_COMPRESS,
+ IDS_CONTEXT_COMPRESS_HELP,
+ 0x02000107,
},
- {
- NContextMenuFlags::kCompressEmail,
- CZipContextMenu::kCompressEmail,
- L"CompressEmail",
- IDS_CONTEXT_COMPRESS_EMAIL,
- IDS_CONTEXT_COMPRESS_EMAIL_HELP,
+ {
+ NContextMenuFlags::kCompressEmail,
+ CZipContextMenu::kCompressEmail,
+ L"CompressEmail",
+ IDS_CONTEXT_COMPRESS_EMAIL,
+ IDS_CONTEXT_COMPRESS_EMAIL_HELP,
0x02000111
},
- {
- NContextMenuFlags::kCompressTo7z,
- CZipContextMenu::kCompressTo7z,
- L"CompressTo7z",
- IDS_CONTEXT_COMPRESS_TO,
- IDS_CONTEXT_COMPRESS_TO_HELP,
+ {
+ NContextMenuFlags::kCompressTo7z,
+ CZipContextMenu::kCompressTo7z,
+ L"CompressTo7z",
+ IDS_CONTEXT_COMPRESS_TO,
+ IDS_CONTEXT_COMPRESS_TO_HELP,
0x0200010F
},
- {
- NContextMenuFlags::kCompressTo7zEmail,
- CZipContextMenu::kCompressTo7zEmail,
- L"CompressTo7zEmail",
- IDS_CONTEXT_COMPRESS_TO_EMAIL,
- IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP,
+ {
+ NContextMenuFlags::kCompressTo7zEmail,
+ CZipContextMenu::kCompressTo7zEmail,
+ L"CompressTo7zEmail",
+ IDS_CONTEXT_COMPRESS_TO_EMAIL,
+ IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP,
0x02000113
},
- {
- NContextMenuFlags::kCompressToZip,
- CZipContextMenu::kCompressToZip,
- L"CompressToZip",
- IDS_CONTEXT_COMPRESS_TO,
- IDS_CONTEXT_COMPRESS_TO_HELP,
+ {
+ NContextMenuFlags::kCompressToZip,
+ CZipContextMenu::kCompressToZip,
+ L"CompressToZip",
+ IDS_CONTEXT_COMPRESS_TO,
+ IDS_CONTEXT_COMPRESS_TO_HELP,
0x0200010F
},
- {
- NContextMenuFlags::kCompressToZipEmail,
- CZipContextMenu::kCompressToZipEmail,
- L"CompressToZipEmail",
- IDS_CONTEXT_COMPRESS_TO_EMAIL,
- IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP,
+ {
+ NContextMenuFlags::kCompressToZipEmail,
+ CZipContextMenu::kCompressToZipEmail,
+ L"CompressToZipEmail",
+ IDS_CONTEXT_COMPRESS_TO_EMAIL,
+ IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP,
0x02000113
}
};
@@ -235,7 +235,7 @@ int FindCommand(CZipContextMenu::ECommandInternalID &id)
return -1;
}
-void CZipContextMenu::FillCommand(ECommandInternalID id,
+void CZipContextMenu::FillCommand(ECommandInternalID id,
UString &mainString, CCommandMapItem &commandMapItem)
{
int i = FindCommand(id);
@@ -245,7 +245,7 @@ void CZipContextMenu::FillCommand(ECommandInternalID id,
commandMapItem.CommandInternalID = command.CommandInternalID;
commandMapItem.Verb = (UString)kMainVerb + (UString)command.Verb;
commandMapItem.HelpString = LangString(command.ResourceHelpID, command.LangID + 1);
- mainString = LangString(command.ResourceID, command.LangID);
+ mainString = LangString(command.ResourceID, command.LangID);
}
static bool MyInsertMenu(CMenu &menu, int pos, UINT id, const UString &s)
@@ -253,12 +253,12 @@ static bool MyInsertMenu(CMenu &menu, int pos, UINT id, const UString &s)
CMenuItem menuItem;
menuItem.fType = MFT_STRING;
menuItem.fMask = MIIM_TYPE | MIIM_ID;
- menuItem.wID = id;
+ menuItem.wID = id;
menuItem.StringValue = s;
return menu.InsertItem(pos, true, menuItem);
}
-static const wchar_t *kArcExts[] =
+static const wchar_t *kArcExts[] =
{
L"7z",
L"bz2",
@@ -289,9 +289,9 @@ static UString GetSubFolderNameForExtract(const UString &archiveName)
if (dotPos > 0)
{
const UString ext2 = res.Mid(dotPos + 1);
- if (ext.CompareNoCase(L"rar") == 0 &&
- (ext2.CompareNoCase(L"part001") == 0 ||
- ext2.CompareNoCase(L"part01") == 0 ||
+ if (ext.CompareNoCase(L"rar") == 0 &&
+ (ext2.CompareNoCase(L"part001") == 0 ||
+ ext2.CompareNoCase(L"part01") == 0 ||
ext2.CompareNoCase(L"part1") == 0) ||
IsItArcExt(ext2) && ext.CompareNoCase(L"001") == 0)
res = res.Left(dotPos);
@@ -309,10 +309,23 @@ static UString GetReducedString(const UString &s)
return s.Left(kFirstPartSize) + UString(L" ... ") + s.Right(kMaxSize - kFirstPartSize);
}
-static const wchar_t *kExtractExludeExtensions[] =
+static const wchar_t *kExtractExludeExtensions[] =
{
- L"txt", L"htm", L"html", L"xml",
- L"bmp", L"gif", L"jpeg", L"jpg"
+ L"txt", L"htm", L"html", L"xml", L"xsd", L"xsl", L"xslt", L"asp", L"aspx", L"css", L"shtml",
+ L"bmp", L"gif", L"jpeg", L"jpg", L"png", L"tiff", L"ico",
+ L"3gp", L"avi", L"mov", L"mpeg", L"mpg", L"mpe", L"wmv",
+ L"aac", L"ape", L"fla", L"flac", L"la", L"mp3", L"m4a", L"mp4", L"ofr", L"ogg",
+ L"pac", L"ra", L"rm", L"rka", L"shn", L"swa", L"tta", L"wv", L"wma", L"wav",
+ L"ps", L"eps",
+ L"inl", L"inc", L"idl", L"h", L"hpp", L"hxx", L"c", L"cpp", L"cxx", L"rc", L"java",
+ L"cs", L"pas", L"bas", L"vb", L"cls", L"ctl", L"frm", L"dlg", L"def",
+ L"f77", L"f", L"f90", L"f95",
+ L"asm", L"sql", L"manifest", L"dep",
+ L"mak", L"clw", L"csproj", L"vcproj", L"sln", L"dsp", L"dsw",
+ L"bat", L"cmd",
+ L"awk", L"sed", L"hta", L"js", L"php", L"php3", L"php4", L"php5",
+ L"phptml", L"pl", L"pm", L"py", L"pyo", L"rb", L"sh", L"tcl", L"vbs",
+ L"tex", L"ans", L"asc", L"srt", L"reg", L"ini", L"rtf", L"pdf"
};
static bool DoNeedExtract(const UString &name)
@@ -334,11 +347,11 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
LoadLangOneTime();
if(_fileNames.Size() == 0)
return E_FAIL;
- UINT currentCommandID = commandIDFirst;
+ UINT currentCommandID = commandIDFirst;
if ((flags & 0x000F) != CMF_NORMAL &&
(flags & CMF_VERBSONLY) == 0 &&
- (flags & CMF_EXPLORE) == 0)
- return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID);
+ (flags & CMF_EXPLORE) == 0)
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID);
_commandMap.Clear();
@@ -359,7 +372,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.HelpString = LangString(IDS_CONTEXT_CAPTION_HELP, 0x02000102);
_commandMap.Add(commandMapItem);
- menuItem.wID = currentCommandID++;
+ menuItem.wID = currentCommandID++;
subIndex = 0;
}
else
@@ -381,14 +394,14 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
NFile::NFind::CFileInfoW fileInfo;
if (!NFile::NFind::FindFile(fileName, fileInfo))
return E_FAIL;
- if (!fileInfo.IsDirectory() && DoNeedExtract(fileInfo.Name))
+ if (!fileInfo.IsDir() && DoNeedExtract(fileInfo.Name))
{
// Open
if ((contextMenuFlags & NContextMenuFlags::kOpen) != 0)
{
CCommandMapItem commandMapItem;
FillCommand(kOpen, mainString, commandMapItem);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
}
}
@@ -402,7 +415,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
NFile::NFind::CFileInfoW fileInfo;
if (!NFile::NFind::FindFile(_fileNames[i], fileInfo))
return E_FAIL;
- if (!fileInfo.IsDirectory() && DoNeedExtract(fileInfo.Name))
+ if (!fileInfo.IsDir() && DoNeedExtract(fileInfo.Name))
needExtract = true;
}
const UString &fileName = _fileNames.Front();
@@ -423,7 +436,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
else
commandMapItem.Folder = folderPrefix;
commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(L'\\');
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
}
@@ -432,7 +445,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
{
CCommandMapItem commandMapItem;
FillCommand(kExtractHere, mainString, commandMapItem);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
if (_dropMode)
commandMapItem.Folder = _dropPath;
else
@@ -450,14 +463,14 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if (_fileNames.Size() == 1)
folder = GetSubFolderNameForExtract(fileInfo.Name);
else
- folder = L'*';
+ folder = L'*';
if (_dropMode)
commandMapItem.Folder = _dropPath;
else
commandMapItem.Folder = folderPrefix;
commandMapItem.Folder += folder;
s = MyFormatNew(s, GetReducedString(UString(L"\"") + folder + UString(L"\\\"")));
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
}
// Test
@@ -465,7 +478,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
{
CCommandMapItem commandMapItem;
FillCommand(kTest, mainString, commandMapItem);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
}
}
@@ -485,7 +498,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = archivePathPrefix;
commandMapItem.Archive = archiveName;
FillCommand(kCompress, mainString, commandMapItem);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
}
@@ -496,7 +509,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
CCommandMapItem commandMapItem;
commandMapItem.Archive = archiveName;
FillCommand(kCompressEmail, mainString, commandMapItem);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
}
@@ -514,7 +527,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.ArchiveType = L"7z";
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
s = MyFormatNew(s, t);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
}
@@ -528,7 +541,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.ArchiveType = L"7z";
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
s = MyFormatNew(s, t);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
}
@@ -546,7 +559,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.ArchiveType = L"zip";
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\"");
s = MyFormatNew(s, t);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
}
@@ -560,7 +573,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.ArchiveType = L"zip";
UString t = UString(L"\"") + GetReducedString(archiveNameZip) + UString(L"\"");
s = MyFormatNew(s, t);
- MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
+ MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
}
}
@@ -568,14 +581,14 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
// don't use InsertMenu: See MSDN:
// PRB: Duplicate Menu Items In the File Menu For a Shell Context Menu Extension
- // ID: Q214477
+ // ID: Q214477
if (cascadedMenu)
{
CMenuItem menuItem;
menuItem.fType = MFT_STRING;
menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
- menuItem.wID = currentCommandID++;
+ menuItem.wID = currentCommandID++;
menuItem.hSubMenu = popupMenu.Detach();
menuDestroyer.Disable();
menuItem.StringValue = LangString(IDS_CONTEXT_POPUP_CAPTION, 0x02000101);
@@ -584,7 +597,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
menu.InsertItem(indexMenu++, true, menuItem);
}
- return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID - commandIDFirst);
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID - commandIDFirst);
}
@@ -671,14 +684,14 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
case kCompressToZip:
case kCompressToZipEmail:
{
- bool email =
- (commandInternalID == kCompressEmail) ||
+ bool email =
+ (commandInternalID == kCompressEmail) ||
(commandInternalID == kCompressTo7zEmail) ||
(commandInternalID == kCompressToZipEmail);
- bool showDialog =
- (commandInternalID == kCompress) ||
+ bool showDialog =
+ (commandInternalID == kCompress) ||
(commandInternalID == kCompressEmail);
- CompressFiles(commandMapItem.Folder,
+ CompressFiles(commandMapItem.Folder,
commandMapItem.Archive, commandMapItem.ArchiveType,
_fileNames, email, showDialog, false);
break;
@@ -687,7 +700,7 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
}
catch(...)
{
- MyMessageBox(IDS_ERROR, 0x02000605);
+ ShowErrorMessageRes(IDS_ERROR, 0x02000605);
}
return S_OK;
}
@@ -702,17 +715,17 @@ static void MyCopyString(void *dest, const wchar_t *src, bool writeInUnicode)
lstrcpyA((char *)dest, GetAnsiString(src));
}
-STDMETHODIMP CZipContextMenu::GetCommandString(UINT_PTR commandOffset, UINT uType,
+STDMETHODIMP CZipContextMenu::GetCommandString(UINT_PTR commandOffset, UINT uType,
UINT * /* pwReserved */ , LPSTR pszName, UINT /* cchMax */)
{
int cmdOffset = (int)commandOffset;
switch(uType)
- {
+ {
case GCS_VALIDATEA:
case GCS_VALIDATEW:
if(cmdOffset < 0 || cmdOffset >= _commandMap.Size())
return S_FALSE;
- else
+ else
return S_OK;
}
if(cmdOffset < 0 || cmdOffset >= _commandMap.Size())
diff --git a/CPP/7zip/UI/Explorer/ContextMenu.h b/CPP/7zip/UI/Explorer/ContextMenu.h
index 88b33178..be9f9167 100755
--- a/CPP/7zip/UI/Explorer/ContextMenu.h
+++ b/CPP/7zip/UI/Explorer/ContextMenu.h
@@ -4,7 +4,7 @@
#define __CONTEXTMENU_H
// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
+DEFINE_GUID(CLSID_CZipContextMenu,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
#include "Common/MyString.h"
@@ -13,7 +13,7 @@ DEFINE_GUID(CLSID_CZipContextMenu,
#include "../FileManager/MyCom2.h"
-class CZipContextMenu:
+class CZipContextMenu:
public IContextMenu,
public IShellExtInit,
public IInitContextMenu,
@@ -53,7 +53,7 @@ public:
///////////////////////////////
// IShellExtInit
- STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,
+ STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,
LPDATAOBJECT dataObject, HKEY hkeyProgID);
/////////////////////////////
@@ -67,7 +67,7 @@ public:
// IInitContextMenu
- STDMETHOD(InitContextMenu)(const wchar_t *folder, const wchar_t **names, UINT32 numFiles);
+ STDMETHOD(InitContextMenu)(const wchar_t *folder, const wchar_t **names, UINT32 numFiles);
private:
UStringVector _fileNames;
bool _dropMode;
@@ -76,7 +76,7 @@ private:
HRESULT GetFileNames(LPDATAOBJECT dataObject, UStringVector &fileNames);
int FindVerb(const UString &verb);
- void FillCommand(ECommandInternalID id, UString &mainString,
+ void FillCommand(ECommandInternalID id, UString &mainString,
CCommandMapItem &commandMapItem);
public:
CZipContextMenu();
diff --git a/CPP/7zip/UI/Explorer/ContextMenuFlags.h b/CPP/7zip/UI/Explorer/ContextMenuFlags.h
index d138baf9..248b7602 100755
--- a/CPP/7zip/UI/Explorer/ContextMenuFlags.h
+++ b/CPP/7zip/UI/Explorer/ContextMenuFlags.h
@@ -22,13 +22,13 @@ namespace NContextMenuFlags
const UINT32 kCompressToZip = 1 << 12;
const UINT32 kCompressToZipEmail = 1 << 13;
- inline UINT32 GetDefaultFlags() {
- return
- kOpen | kTest |
+ inline UINT32 GetDefaultFlags() {
+ return
+ kOpen | kTest |
kExtract | kExtractHere | kExtractTo |
- kCompress | kCompressEmail |
- kCompressTo7z | kCompressTo7zEmail |
- kCompressToZip | kCompressToZipEmail; }
+ kCompress | kCompressEmail |
+ kCompressTo7z | kCompressTo7zEmail |
+ kCompressToZip | kCompressToZipEmail; }
}
#endif
diff --git a/CPP/7zip/UI/Explorer/DllExports.cpp b/CPP/7zip/UI/Explorer/DllExports.cpp
index 6072e92a..6fed7cda 100755
--- a/CPP/7zip/UI/Explorer/DllExports.cpp
+++ b/CPP/7zip/UI/Explorer/DllExports.cpp
@@ -42,8 +42,8 @@ static LPCTSTR kApprovedKeyPath = TEXT("Software\\Microsoft\\Windows\\CurrentVer
// #define ODS(sz) OutputDebugString(L#sz)
-class CShellExtClassFactory:
- public IClassFactory,
+class CShellExtClassFactory:
+ public IClassFactory,
public CMyUnknownImp
{
public:
@@ -89,7 +89,7 @@ static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -107,7 +107,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
return FALSE;
#else
g_IsNT = IsItWindowsNT();
- #endif
+ #endif
}
else if (dwReason == DLL_PROCESS_DETACH)
{
@@ -183,7 +183,7 @@ static BOOL RegisterServer(CLSID clsid, LPCWSTR title)
if (!NDLL::MyGetModuleFileName(g_hInstance, modulePath))
return FALSE;
- CRegItem clsidEntries[] =
+ CRegItem clsidEntries[] =
{
HKEY_CLASSES_ROOT, kClsidMask, NULL, title,
HKEY_CLASSES_ROOT, kClsidInprocMask, NULL, modulePath,
@@ -197,7 +197,7 @@ static BOOL RegisterServer(CLSID clsid, LPCWSTR title)
TCHAR subKey[MAX_PATH];
wsprintf(subKey, clsidEntries[i].SubKey, clsidString);
NRegistry::CKey key;
- if (key.Create(clsidEntries[i].hRootKey, subKey, NULL,
+ if (key.Create(clsidEntries[i].hRootKey, subKey, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE) != NOERROR)
return FALSE;
key.SetValue(clsidEntries[i].ValueName, clsidEntries[i].Data);
@@ -206,7 +206,7 @@ static BOOL RegisterServer(CLSID clsid, LPCWSTR title)
if(IsItWindowsNT())
{
NRegistry::CKey key;
- if (key.Create(HKEY_LOCAL_MACHINE, kApprovedKeyPath, NULL,
+ if (key.Create(HKEY_LOCAL_MACHINE, kApprovedKeyPath, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE) == NOERROR)
key.SetValue(GetUnicodeString(clsidString), title);
}
@@ -249,8 +249,8 @@ STDAPI DllUnregisterServer(void)
}
STDAPI CreateObject(
- const GUID *classID,
- const GUID *interfaceID,
+ const GUID *classID,
+ const GUID *interfaceID,
void **outObject)
{
LoadLangOneTime();
diff --git a/CPP/7zip/UI/Explorer/Explorer.dsp b/CPP/7zip/UI/Explorer/Explorer.dsp
index 811ee2c5..a4c99ed6 100755
--- a/CPP/7zip/UI/Explorer/Explorer.dsp
+++ b/CPP/7zip/UI/Explorer/Explorer.dsp
@@ -430,6 +430,14 @@ SOURCE=..\..\..\Windows\Control\Dialog.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Windows\Control\ListView.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Windows\Control\ListView.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Windows\Control\PropertyPage.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/Explorer/FoldersPage.cpp b/CPP/7zip/UI/Explorer/FoldersPage.cpp
index b3470390..67d5e867 100755
--- a/CPP/7zip/UI/Explorer/FoldersPage.cpp
+++ b/CPP/7zip/UI/Explorer/FoldersPage.cpp
@@ -17,7 +17,7 @@
using namespace NWindows;
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_FOLDERS_STATIC_WORKING_FOLDER, 0x01000210 },
{ IDC_FOLDERS_WORK_RADIO_SYSTEM, 0x01000211 },
@@ -35,14 +35,14 @@ static const int kWorkModeButtons[] =
static const int kNumWorkModeButtons = sizeof(kWorkModeButtons) / sizeof(kWorkModeButtons[0]);
-bool CFoldersPage::OnInit()
+bool CFoldersPage::OnInit()
{
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
ReadWorkDirInfo(m_WorkDirInfo);
CheckButton(IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, m_WorkDirInfo.ForRemovableOnly);
- CheckRadioButton(kWorkModeButtons[0], kWorkModeButtons[kNumWorkModeButtons - 1],
+ CheckRadioButton(kWorkModeButtons[0], kWorkModeButtons[kNumWorkModeButtons - 1],
kWorkModeButtons[m_WorkDirInfo.Mode]);
m_WorkPath.Init(*this, IDC_FOLDERS_WORK_EDIT_PATH);
@@ -100,7 +100,7 @@ void CFoldersPage::ModifiedEvent()
}
bool CFoldersPage::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+{
for (int i = 0; i < kNumWorkModeButtons; i++)
if (buttonID == kWorkModeButtons[i])
{
@@ -132,7 +132,7 @@ bool CFoldersPage::OnCommand(int code, int itemID, LPARAM lParam)
return CPropertyPage::OnCommand(code, itemID, lParam);
}
-void CFoldersPage::OnFoldersWorkButtonPath()
+void CFoldersPage::OnFoldersWorkButtonPath()
{
UString currentPath;
m_WorkPath.GetText(currentPath);
@@ -142,7 +142,7 @@ void CFoldersPage::OnFoldersWorkButtonPath()
m_WorkPath.SetText(resultPath);
}
-LONG CFoldersPage::OnApply()
+LONG CFoldersPage::OnApply()
{
GetWorkDir(m_WorkDirInfo);
SaveWorkDirInfo(m_WorkDirInfo);
@@ -151,7 +151,7 @@ LONG CFoldersPage::OnApply()
static LPCWSTR kFoldersTopic = L"fm/plugins/7-zip/options.htm#folders";
-void CFoldersPage::OnNotifyHelp()
+void CFoldersPage::OnNotifyHelp()
{
ShowHelpWindow(NULL, kFoldersTopic);
}
diff --git a/CPP/7zip/UI/Explorer/FoldersPage.rc b/CPP/7zip/UI/Explorer/FoldersPage.rc
index cb9694a6..7b2d4231 100755
--- a/CPP/7zip/UI/Explorer/FoldersPage.rc
+++ b/CPP/7zip/UI/Explorer/FoldersPage.rc
@@ -18,19 +18,19 @@ CAPTION "Folders"
MY_FONT
BEGIN
GROUPBOX "&Working folder", IDC_FOLDERS_STATIC_WORKING_FOLDER, marg, marg, xSize2, 98
- CONTROL "&System temp folder", IDC_FOLDERS_WORK_RADIO_SYSTEM, "Button", BS_AUTORADIOBUTTON | WS_GROUP,
+ CONTROL "&System temp folder", IDC_FOLDERS_WORK_RADIO_SYSTEM, "Button", BS_AUTORADIOBUTTON | WS_GROUP,
gPos, 20, gSize, 10
- CONTROL "&Current", IDC_FOLDERS_WORK_RADIO_CURRENT, "Button", BS_AUTORADIOBUTTON,
+ CONTROL "&Current", IDC_FOLDERS_WORK_RADIO_CURRENT, "Button", BS_AUTORADIOBUTTON,
gPos, 34, gSize, 10
- CONTROL "Specified:", IDC_FOLDERS_WORK_RADIO_SPECIFIED, "Button", BS_AUTORADIOBUTTON,
+ CONTROL "Specified:", IDC_FOLDERS_WORK_RADIO_SPECIFIED, "Button", BS_AUTORADIOBUTTON,
gPos, 48, gSize, 10
EDITTEXT IDC_FOLDERS_WORK_EDIT_PATH, gPos2, 63, gSize - marg3 - bDotsSize - 10, 14, ES_AUTOHSCROLL
PUSHBUTTON "...", IDC_FOLDERS_WORK_BUTTON_PATH, xSize - marg - marg2 - bDotsSize, 63, bDotsSize, bYSize
- CONTROL "Use for removable drives only", IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Use for removable drives only", IDC_FOLDERS_WORK_CHECK_FOR_REMOVABLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
gPos, 87, gSize, 10
END
-STRINGTABLE
+STRINGTABLE
BEGIN
IDS_FOLDERS_SET_WORK_PATH_TITLE "Specify a location for temporary archive files."
END
diff --git a/CPP/7zip/UI/Explorer/MyMessages.cpp b/CPP/7zip/UI/Explorer/MyMessages.cpp
index 58ab1f85..62ac42ec 100755
--- a/CPP/7zip/UI/Explorer/MyMessages.cpp
+++ b/CPP/7zip/UI/Explorer/MyMessages.cpp
@@ -7,50 +7,52 @@
#include "Windows/Error.h"
#include "Windows/ResourceString.h"
-#ifdef LANG
+#ifdef LANG
#include "../FileManager/LangUtils.h"
#endif
using namespace NWindows;
-void MyMessageBox(HWND window, LPCWSTR message)
-{
- ::MessageBoxW(window, message, L"7-Zip", 0);
+void ShowErrorMessage(HWND window, LPCWSTR message)
+{
+ ::MessageBoxW(window, message, L"7-Zip", MB_OK | MB_ICONSTOP);
}
-void MyMessageBoxResource(HWND window, UINT32 id
- #ifdef LANG
- ,UINT32 langID
+void ShowErrorMessageHwndRes(HWND window, UINT resID
+ #ifdef LANG
+ , UInt32 langID
#endif
)
{
- #ifdef LANG
- MyMessageBox(window, LangString(id, langID));
+ ShowErrorMessage(window,
+ #ifdef LANG
+ LangString(resID, langID)
#else
- MyMessageBox(window, MyLoadStringW(id));
+ MyLoadStringW(resID)
#endif
+ );
}
-void MyMessageBox(UINT32 id
- #ifdef LANG
- ,UINT32 langID
+void ShowErrorMessageRes(UINT resID
+ #ifdef LANG
+ , UInt32 langID
#endif
)
{
- MyMessageBoxResource(0, id
- #ifdef LANG
+ ShowErrorMessageHwndRes(0, resID
+ #ifdef LANG
, langID
#endif
);
}
-void ShowErrorMessage(HWND window, DWORD message)
+void ShowErrorMessageDWORD(HWND window, DWORD errorCode)
{
- MyMessageBox(window, NError::MyFormatMessageW(message));
+ ShowErrorMessage(window, NError::MyFormatMessageW(errorCode));
}
void ShowLastErrorMessage(HWND window)
{
- ShowErrorMessage(window, ::GetLastError());
+ ShowErrorMessageDWORD(window, ::GetLastError());
}
diff --git a/CPP/7zip/UI/Explorer/MyMessages.h b/CPP/7zip/UI/Explorer/MyMessages.h
index 5bd63cc4..10da975b 100755
--- a/CPP/7zip/UI/Explorer/MyMessages.h
+++ b/CPP/7zip/UI/Explorer/MyMessages.h
@@ -4,27 +4,25 @@
#define __MYMESSAGES_H
#include "Common/MyString.h"
+#include "Common/Types.h"
-void MyMessageBox(HWND window, LPCWSTR message);
+void ShowErrorMessage(HWND window, LPCWSTR message);
+inline void ShowErrorMessage(LPCWSTR message) { ShowErrorMessage(0, message); }
-inline void MyMessageBox(LPCWSTR message)
- { MyMessageBox(0, message); }
-
-void MyMessageBoxResource(HWND window, UINT32 id
- #ifdef LANG
- ,UINT32 langID
+void ShowErrorMessageHwndRes(HWND window, UINT resID
+ #ifdef LANG
+ , UInt32 langID
#endif
);
-void MyMessageBox(UINT32 id
- #ifdef LANG
- ,UINT32 langID
+void ShowErrorMessageRes(UINT resID
+ #ifdef LANG
+ , UInt32 langID
#endif
);
-void ShowErrorMessage(HWND window, DWORD errorMessage);
-inline void ShowErrorMessage(DWORD errorMessage)
- { ShowErrorMessage(0, errorMessage); }
+// void ShowErrorMessageDWORD(HWND window, DWORD errorCode);
+// inline void ErrorMessageDWORD(DWORD errorCode) { ShowErrorMessageDWORD(0, errorCode); }
void ShowLastErrorMessage(HWND window = 0);
#endif
diff --git a/CPP/7zip/UI/Explorer/OptionsDialog.cpp b/CPP/7zip/UI/Explorer/OptionsDialog.cpp
index 4b2d3b51..b0deaf0d 100755
--- a/CPP/7zip/UI/Explorer/OptionsDialog.cpp
+++ b/CPP/7zip/UI/Explorer/OptionsDialog.cpp
@@ -34,11 +34,11 @@ static INT_PTR OptionsDialog(HWND hwndOwner)
page.Page = pagePinters[i];
pages.Add(page);
}
- return NControl::MyPropertySheet(pages, hwndOwner,
+ return NControl::MyPropertySheet(pages, hwndOwner,
LangString(IDS_CONFIG_DIALOG_CAPTION, 0x01000000));
}
-STDMETHODIMP CSevenZipOptions::PluginOptions(HWND hWnd,
+STDMETHODIMP CSevenZipOptions::PluginOptions(HWND hWnd,
IPluginOptionsCallback * /* callback */)
{
/*
diff --git a/CPP/7zip/UI/Explorer/OptionsDialog.h b/CPP/7zip/UI/Explorer/OptionsDialog.h
index affa4329..ac51f6e3 100755
--- a/CPP/7zip/UI/Explorer/OptionsDialog.h
+++ b/CPP/7zip/UI/Explorer/OptionsDialog.h
@@ -7,10 +7,10 @@
#include "Common/MyCom.h"
// {23170F69-40C1-278D-1000-000100020000}
-DEFINE_GUID(CLSID_CSevenZipOptions,
+DEFINE_GUID(CLSID_CSevenZipOptions,
0x23170F69, 0x40C1, 0x278D, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-class CSevenZipOptions:
+class CSevenZipOptions:
public IPluginOptions,
public CMyUnknownImp
{
diff --git a/CPP/7zip/UI/Explorer/RegistryContextMenu.cpp b/CPP/7zip/UI/Explorer/RegistryContextMenu.cpp
index 73a8420e..ee0078b7 100755
--- a/CPP/7zip/UI/Explorer/RegistryContextMenu.cpp
+++ b/CPP/7zip/UI/Explorer/RegistryContextMenu.cpp
@@ -61,7 +61,7 @@ static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
}
bool CheckContextMenuHandler()
-{
+{
return CheckContextMenuHandlerCommon(kRootKeyNameForFile) &&
// CheckContextMenuHandlerCommon(kRootKeyNameForFolder) &&
CheckContextMenuHandlerCommon(kRootKeyNameForDirectory) &&
@@ -86,12 +86,12 @@ static void DeleteDragDropMenuHandlerCommon(const CSysString &keyName)
}
void DeleteContextMenuHandler()
-{
- DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
+{
+ DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
DeleteContextMenuHandlerCommon(kRootKeyNameForFolder);
DeleteContextMenuHandlerCommon(kRootKeyNameForDirectory);
DeleteContextMenuHandlerCommon(kRootKeyNameForDrive);
- DeleteDragDropMenuHandlerCommon(kRootKeyNameForFile);
+ DeleteDragDropMenuHandlerCommon(kRootKeyNameForFile);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForFolder);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForDirectory);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForDrive);
@@ -116,8 +116,8 @@ static void AddDragDropMenuHandlerCommon(const CSysString &keyName)
}
void AddContextMenuHandler()
-{
- AddContextMenuHandlerCommon(kRootKeyNameForFile);
+{
+ AddContextMenuHandlerCommon(kRootKeyNameForFile);
// AddContextMenuHandlerCommon(kRootKeyNameForFolder);
AddContextMenuHandlerCommon(kRootKeyNameForDirectory);
diff --git a/CPP/7zip/UI/Explorer/StdAfx.h b/CPP/7zip/UI/Explorer/StdAfx.h
index b9c0ee3a..d978a3a4 100755
--- a/CPP/7zip/UI/Explorer/StdAfx.h
+++ b/CPP/7zip/UI/Explorer/StdAfx.h
@@ -4,7 +4,7 @@
#define __STDAFX_H
#define _WIN32_WINNT 0x0400
-// it's hack for Windows NT supporting
+// it's hack for Windows NT supporting
#define WINVER 0x0400
// #define _WIN32_IE 0x0500
@@ -23,4 +23,4 @@
#include "Common/NewHandler.h"
-#endif
+#endif
diff --git a/CPP/7zip/UI/Explorer/SystemPage.cpp b/CPP/7zip/UI/Explorer/SystemPage.cpp
index dd60b6d5..602e4387 100755
--- a/CPP/7zip/UI/Explorer/SystemPage.cpp
+++ b/CPP/7zip/UI/Explorer/SystemPage.cpp
@@ -21,7 +21,7 @@
using namespace NContextMenuFlags;
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, 0x01000301},
{ IDC_SYSTEM_CASCADED_MENU, 0x01000302},
@@ -37,7 +37,7 @@ struct CContextMenuItem
UInt32 Flag;
};
-static CContextMenuItem kMenuItems[] =
+static CContextMenuItem kMenuItems[] =
{
{ IDS_CONTEXT_OPEN, 0x02000103, kOpen},
{ IDS_CONTEXT_EXTRACT, 0x02000105, kExtract},
@@ -61,7 +61,7 @@ bool CSystemPage::OnInit()
_initMode = true;
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
+ CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
NZipRootRegistry::CheckContextMenuHandler());
CheckButton(IDC_SYSTEM_CASCADED_MENU, ReadCascadedMenu());
@@ -73,29 +73,18 @@ bool CSystemPage::OnInit()
m_ListView.Attach(GetItem(IDC_SYSTEM_OPTIONS_LIST));
/*
- CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
+ CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
NRegistryAssociations::CheckContextMenuHandler());
*/
UInt32 newFlags = LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT;
m_ListView.SetExtendedListViewStyle(newFlags, newFlags);
- UString s; // = TEXT("Items"); // LangLoadString(IDS_PROPERTY_EXTENSION, 0x02000205);
- LVCOLUMNW column;
- column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
- column.cx = 270;
- column.fmt = LVCFMT_LEFT;
- column.pszText = (LPWSTR)(LPCWSTR)s;
- column.iSubItem = 0;
- m_ListView.InsertColumn(0, &column);
+ m_ListView.InsertColumn(0, L"", 270);
for (int i = 0; i < kNumMenuItems; i++)
{
CContextMenuItem &menuItem = kMenuItems[i];
- LVITEMW item;
- item.iItem = i;
- item.mask = LVIF_TEXT | LVIF_PARAM;
- item.lParam = i;
UString s = LangString(menuItem.ControlID, menuItem.LangID);
@@ -126,11 +115,7 @@ bool CSystemPage::OnInit()
}
}
- // UString MyFormatNew(const UString &format, const UString &argument);
-
- item.pszText = (LPWSTR)(LPCWSTR)s;
- item.iSubItem = 0;
- int itemIndex = m_ListView.InsertItem(&item);
+ int itemIndex = m_ListView.InsertItem(i, s);
m_ListView.SetCheckState(itemIndex, ((contextMenuFlags & menuItem.Flag) != 0));
}
@@ -170,7 +155,7 @@ void CSystemPage::OnNotifyHelp()
}
bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+{
switch(buttonID)
{
case IDC_SYSTEM_CASCADED_MENU:
@@ -182,8 +167,8 @@ bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND)
}
-bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
-{
+bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
+{
if (lParam->hwndFrom == HWND(m_ListView))
{
switch(lParam->code)
@@ -191,8 +176,8 @@ bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
case (LVN_ITEMCHANGED):
return OnItemChanged((const NMLISTVIEW *)lParam);
}
- }
- return CPropertyPage::OnNotify(controlID, lParam);
+ }
+ return CPropertyPage::OnNotify(controlID, lParam);
}
diff --git a/CPP/7zip/UI/Explorer/SystemPage.rc b/CPP/7zip/UI/Explorer/SystemPage.rc
index a3b36409..611fd58b 100755
--- a/CPP/7zip/UI/Explorer/SystemPage.rc
+++ b/CPP/7zip/UI/Explorer/SystemPage.rc
@@ -10,15 +10,15 @@ IDD_SYSTEM DIALOG 0, 0, xSize, ySize MY_PAGE_STYLE
CAPTION "System"
MY_FONT
BEGIN
- CONTROL "Integrate 7-Zip to shell context menu", IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Integrate 7-Zip to shell context menu", IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
+ "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, marg, xSize2, 10
- CONTROL "Cascaded context menu", IDC_SYSTEM_CASCADED_MENU,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Cascaded context menu", IDC_SYSTEM_CASCADED_MENU,
+ "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 21, xSize2, 10
- LTEXT "Context menu items:", IDC_SYSTEM_STATIC_CONTEXT_MENU_ITEMS,
+ LTEXT "Context menu items:", IDC_SYSTEM_STATIC_CONTEXT_MENU_ITEMS,
marg, 37, xSize2, 8
- CONTROL "List1", IDC_SYSTEM_OPTIONS_LIST, "SysListView32",
- LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,
+ CONTROL "List1", IDC_SYSTEM_OPTIONS_LIST, "SysListView32",
+ LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,
marg, 50, xSize2, ySize - marg - 50
END
diff --git a/CPP/7zip/UI/Explorer/makefile b/CPP/7zip/UI/Explorer/makefile
index c58531d8..ab9aff10 100755
--- a/CPP/7zip/UI/Explorer/makefile
+++ b/CPP/7zip/UI/Explorer/makefile
@@ -43,6 +43,7 @@ WIN_OBJS = \
WIN_CTRL_OBJS = \
$O\Dialog.obj \
+ $O\ListView.obj \
$O\PropertyPage.obj \
UI_COMMON_OBJS = \
diff --git a/CPP/7zip/UI/Explorer/resource.h b/CPP/7zip/UI/Explorer/resource.h
index aec1e7cd..75fa4981 100755
--- a/CPP/7zip/UI/Explorer/resource.h
+++ b/CPP/7zip/UI/Explorer/resource.h
@@ -1,31 +1,31 @@
-#define IDS_CONTEXT_EXTRACT 42
-#define IDS_CONTEXT_EXTRACT_HELP 43
-#define IDS_CONTEXT_COMPRESS 44
-#define IDS_CONTEXT_COMPRESS_HELP 45
-#define IDS_CONTEXT_OPEN 46
-#define IDS_CONTEXT_OPEN_HELP 47
-#define IDS_CONTEXT_TEST 48
-#define IDS_CONTEXT_TEST_HELP 49
-#define IDS_CONTEXT_CAPTION_HELP 50
-#define IDS_CONTEXT_POPUP_CAPTION 51
+#define IDS_CONTEXT_EXTRACT 142
+#define IDS_CONTEXT_EXTRACT_HELP 143
+#define IDS_CONTEXT_COMPRESS 144
+#define IDS_CONTEXT_COMPRESS_HELP 145
+#define IDS_CONTEXT_OPEN 146
+#define IDS_CONTEXT_OPEN_HELP 147
+#define IDS_CONTEXT_TEST 148
+#define IDS_CONTEXT_TEST_HELP 149
+#define IDS_CONTEXT_CAPTION_HELP 150
+#define IDS_CONTEXT_POPUP_CAPTION 151
-#define IDS_CONTEXT_EXTRACT_HERE 52
-#define IDS_CONTEXT_EXTRACT_HERE_HELP 53
+#define IDS_CONTEXT_EXTRACT_HERE 152
+#define IDS_CONTEXT_EXTRACT_HERE_HELP 153
-#define IDS_CONTEXT_EXTRACT_TO 54
-#define IDS_CONTEXT_EXTRACT_TO_HELP 55
+#define IDS_CONTEXT_EXTRACT_TO 154
+#define IDS_CONTEXT_EXTRACT_TO_HELP 155
-#define IDS_CONTEXT_COMPRESS_TO 56
-#define IDS_CONTEXT_COMPRESS_TO_HELP 57
+#define IDS_CONTEXT_COMPRESS_TO 156
+#define IDS_CONTEXT_COMPRESS_TO_HELP 157
-#define IDS_CONTEXT_COMPRESS_EMAIL 58
-#define IDS_CONTEXT_COMPRESS_EMAIL_HELP 59
+#define IDS_CONTEXT_COMPRESS_EMAIL 158
+#define IDS_CONTEXT_COMPRESS_EMAIL_HELP 159
-#define IDS_CONTEXT_COMPRESS_TO_EMAIL 60
-#define IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP 61
+#define IDS_CONTEXT_COMPRESS_TO_EMAIL 160
+#define IDS_CONTEXT_COMPRESS_TO_EMAIL_HELP 161
-#define IDS_CONTEXT_FOLDER 70
-#define IDS_CONTEXT_ARCHIVE 71
+#define IDS_CONTEXT_FOLDER 170
+#define IDS_CONTEXT_ARCHIVE 171
#define IDS_ERROR 100
#define IDS_CONFIG_DIALOG_CAPTION 102
diff --git a/CPP/7zip/UI/Far/ExtractEngine.cpp b/CPP/7zip/UI/Far/ExtractEngine.cpp
index 2ffb14c1..89dacf59 100755
--- a/CPP/7zip/UI/Far/ExtractEngine.cpp
+++ b/CPP/7zip/UI/Far/ExtractEngine.cpp
@@ -26,8 +26,8 @@ CExtractCallBackImp::~CExtractCallBackImp()
void CExtractCallBackImp::Init(
UINT codePage,
- CProgressBox *progressBox,
- bool passwordIsDefined,
+ CProgressBox *progressBox,
+ bool passwordIsDefined,
const UString &password)
{
m_PasswordIsDefined = passwordIsDefined;
@@ -36,28 +36,30 @@ void CExtractCallBackImp::Init(
m_ProgressBox = progressBox;
}
-STDMETHODIMP CExtractCallBackImp::SetTotal(UINT64 size)
+STDMETHODIMP CExtractCallBackImp::SetTotal(UInt64 size)
{
- if (m_ProgressBox != 0)
- {
- m_ProgressBox->SetTotal(size);
- m_ProgressBox->PrintCompeteValue(0);
- }
+ _total = size;
+ _totalIsDefined = true;
return S_OK;
}
-STDMETHODIMP CExtractCallBackImp::SetCompleted(const UINT64 *completeValue)
+STDMETHODIMP CExtractCallBackImp::SetCompleted(const UInt64 *completeValue)
{
- if(WasEscPressed())
+ if (WasEscPressed())
return E_ABORT;
- if (m_ProgressBox != 0 && completeValue != NULL)
- m_ProgressBox->PrintCompeteValue(*completeValue);
+ _processedIsDefined = (completeValue != NULL);
+ if (_processedIsDefined)
+ _processed = *completeValue;
+ if (m_ProgressBox != 0)
+ m_ProgressBox->Progress(
+ _totalIsDefined ? &_total: NULL,
+ _processedIsDefined ? &_processed: NULL, AString());
return S_OK;
}
STDMETHODIMP CExtractCallBackImp::AskOverwrite(
- const wchar_t *existName, const FILETIME *existTime, const UINT64 *existSize,
- const wchar_t *newName, const FILETIME *newTime, const UINT64 *newSize,
+ const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
+ const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
INT32 *answer)
{
NOverwriteDialog::CFileInfo oldFileInfo, newFileInfo;
@@ -76,7 +78,7 @@ STDMETHODIMP CExtractCallBackImp::AskOverwrite(
newFileInfo.Size = *newSize;
newFileInfo.Name = GetSystemString(newName, m_CodePage);
- NOverwriteDialog::NResult::EEnum result =
+ NOverwriteDialog::NResult::EEnum result =
NOverwriteDialog::Execute(oldFileInfo, newFileInfo);
switch(result)
@@ -106,9 +108,9 @@ STDMETHODIMP CExtractCallBackImp::AskOverwrite(
return S_OK;
}
-STDMETHODIMP CExtractCallBackImp::PrepareOperation(const wchar_t *name, bool /* isFolder */, INT32 /* askExtractMode */, const UINT64 * /* position */)
+STDMETHODIMP CExtractCallBackImp::PrepareOperation(const wchar_t *name, bool /* isFolder */, INT32 /* askExtractMode */, const UInt64 * /* position */)
{
- if(WasEscPressed())
+ if (WasEscPressed())
return E_ABORT;
m_CurrentFilePath = name;
return S_OK;
@@ -137,12 +139,12 @@ STDMETHODIMP CExtractCallBackImp::SetOperationResult(INT32 operationResult, bool
idMessage = NMessageID::kExtractUnsupportedMethod;
break;
case NArchive::NExtract::NOperationResult::kCRCError:
- idMessage = encrypted ?
+ idMessage = encrypted ?
NMessageID::kExtractCRCFailedEncrypted :
NMessageID::kExtractCRCFailed;
break;
case NArchive::NExtract::NOperationResult::kDataError:
- idMessage = encrypted ?
+ idMessage = encrypted ?
NMessageID::kExtractDataErrorEncrypted :
NMessageID::kExtractDataError;
break;
@@ -150,7 +152,7 @@ STDMETHODIMP CExtractCallBackImp::SetOperationResult(INT32 operationResult, bool
return E_FAIL;
}
char buffer[512];
- const AString s = GetSystemString(m_CurrentFilePath, m_CodePage);
+ const AString s = UnicodeStringToMultiByte(m_CurrentFilePath, m_CodePage);
sprintf(buffer, g_StartupInfo.GetMsgString(idMessage), (const char *)s);
if (g_StartupInfo.ShowMessage(buffer) == -1)
return E_ABORT;
diff --git a/CPP/7zip/UI/Far/ExtractEngine.h b/CPP/7zip/UI/Far/ExtractEngine.h
index 5cccf6ef..62486fb1 100755
--- a/CPP/7zip/UI/Far/ExtractEngine.h
+++ b/CPP/7zip/UI/Far/ExtractEngine.h
@@ -11,7 +11,7 @@
#include "ProgressBox.h"
-class CExtractCallBackImp:
+class CExtractCallBackImp:
public IFolderArchiveExtractCallback,
public ICryptoGetTextPassword,
public CMyUnknownImp
@@ -20,15 +20,15 @@ public:
MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
// IProgress
- STDMETHOD(SetTotal)(UINT64 size);
- STDMETHOD(SetCompleted)(const UINT64 *completeValue);
+ STDMETHOD(SetTotal)(UInt64 size);
+ STDMETHOD(SetCompleted)(const UInt64 *completeValue);
// IExtractCallBack
STDMETHOD(AskOverwrite)(
- const wchar_t *existName, const FILETIME *existTime, const UINT64 *existSize,
- const wchar_t *newName, const FILETIME *newTime, const UINT64 *newSize,
+ const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
+ const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
INT32 *result);
- STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, INT32 askExtractMode, const UINT64 *position);
+ STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, INT32 askExtractMode, const UInt64 *position);
STDMETHOD(MessageError)(const wchar_t *message);
STDMETHOD(SetOperationResult)(INT32 resultEOperationResult, bool encrypted);
@@ -36,14 +36,22 @@ public:
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
private:
+ UInt64 _total;
+ UInt64 _processed;
+
+ bool _totalIsDefined;
+ bool _processedIsDefined;
+
UString m_CurrentFilePath;
+ /*
struct CProcessedFileInfo
{
- FILETIME UTCLastWriteTime;
- bool IsDirectory;
+ FILETIME MTime;
+ bool isDir;
UINT32 Attributes;
} m_ProcessedFileInfo;
+ */
CProgressBox *m_ProgressBox;
UINT m_CodePage;
@@ -53,15 +61,16 @@ private:
void CreateComplexDirectory(const UStringVector &dirPathParts);
/*
- void GetPropertyValue(LPITEMIDLIST anItemIDList, PROPID aPropId,
+ void GetPropertyValue(LPITEMIDLIST anItemIDList, PROPID aPropId,
PROPVARIANT *aValue);
bool IsEncrypted(LPITEMIDLIST anItemIDList);
*/
void AddErrorMessage(LPCTSTR message);
public:
+ CExtractCallBackImp(): _totalIsDefined(false), _processedIsDefined(false) {}
~CExtractCallBackImp();
- void Init(UINT codePage,
- CProgressBox *progressBox,
+ void Init(UINT codePage,
+ CProgressBox *progressBox,
bool passwordIsDefined, const UString &password);
};
diff --git a/CPP/7zip/UI/Far/Far.dsp b/CPP/7zip/UI/Far/Far.dsp
index 17392f74..8c1d1357 100755
--- a/CPP/7zip/UI/Far/Far.dsp
+++ b/CPP/7zip/UI/Far/Far.dsp
@@ -336,6 +336,10 @@ SOURCE=..\..\..\Windows\Synchronization.cpp
SOURCE=..\..\..\Windows\Synchronization.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Windows\Time.cpp
+# End Source File
# End Group
# Begin Group "UI Common"
diff --git a/CPP/7zip/UI/Far/FarUtils.cpp b/CPP/7zip/UI/Far/FarUtils.cpp
index c4a30524..e06bfe3e 100755
--- a/CPP/7zip/UI/Far/FarUtils.cpp
+++ b/CPP/7zip/UI/Far/FarUtils.cpp
@@ -15,7 +15,7 @@ namespace NFar {
CStartupInfo g_StartupInfo;
-void CStartupInfo::Init(const PluginStartupInfo &pluginStartupInfo,
+void CStartupInfo::Init(const PluginStartupInfo &pluginStartupInfo,
const CSysString &pliginNameForRegestry)
{
m_Data = pluginStartupInfo;
@@ -29,18 +29,18 @@ const char *CStartupInfo::GetMsgString(int messageId)
return (const char*)m_Data.GetMsg(m_Data.ModuleNumber, messageId);
}
-int CStartupInfo::ShowMessage(unsigned int flags,
+int CStartupInfo::ShowMessage(unsigned int flags,
const char *helpTopic, const char **items, int numItems, int numButtons)
{
- return m_Data.Message(m_Data.ModuleNumber, flags, (char *)helpTopic,
+ return m_Data.Message(m_Data.ModuleNumber, flags, (char *)helpTopic,
(char **)items, numItems, numButtons);
}
namespace NMessageID
{
- enum
+ enum
{
- kOk,
+ kOk,
kCancel,
kWarning,
kError
@@ -49,10 +49,47 @@ namespace NMessageID
int CStartupInfo::ShowMessage(const char *message)
{
- const char *messagesItems[]= { GetMsgString(NMessageID::kError), message,
- GetMsgString(NMessageID::kOk) };
- return ShowMessage(FMSG_WARNING, NULL, messagesItems,
- sizeof(messagesItems) / sizeof(messagesItems[0]), 1);
+ const char *items[]= { GetMsgString(NMessageID::kError), message, GetMsgString(NMessageID::kOk) };
+ return ShowMessage(FMSG_WARNING, NULL, items, sizeof(items) / sizeof(items[0]), 1);
+}
+
+static void SplitString(const AString &srcString, AStringVector &destStrings)
+{
+ destStrings.Clear();
+ AString string;
+ int len = srcString.Length();
+ if (len == 0)
+ return;
+ for (int i = 0; i < len; i++)
+ {
+ char c = srcString[i];
+ if (c == '\n')
+ {
+ if (!string.IsEmpty())
+ {
+ destStrings.Add(string);
+ string.Empty();
+ }
+ }
+ else
+ string += c;
+ }
+ if (!string.IsEmpty())
+ destStrings.Add(string);
+}
+
+int CStartupInfo::ShowMessageLines(const char *message)
+{
+ AStringVector strings;
+ SplitString(message, strings);
+ const int kNumStringsMax = 20;
+ const char *items[kNumStringsMax + 1] = { GetMsgString(NMessageID::kError) };
+ int pos = 1;
+ for (int i = 0; i < strings.Size() && pos < kNumStringsMax; i++)
+ items[pos++] = strings[i];
+ items[pos++] = GetMsgString(NMessageID::kOk);
+
+ return ShowMessage(FMSG_WARNING, NULL, items, pos, 1);
}
int CStartupInfo::ShowMessage(int messageId)
@@ -60,10 +97,10 @@ int CStartupInfo::ShowMessage(int messageId)
return ShowMessage(GetMsgString(messageId));
}
-int CStartupInfo::ShowDialog(int X1, int Y1, int X2, int Y2,
+int CStartupInfo::ShowDialog(int X1, int Y1, int X2, int Y2,
const char *helpTopic, struct FarDialogItem *items, int numItems)
{
- return m_Data.Dialog(m_Data.ModuleNumber, X1, Y1, X2, Y2, (char *)helpTopic,
+ return m_Data.Dialog(m_Data.ModuleNumber, X1, Y1, X2, Y2, (char *)helpTopic,
items, numItems);
}
@@ -75,7 +112,7 @@ int CStartupInfo::ShowDialog(int sizeX, int sizeY,
inline static BOOL GetBOOLValue(bool v) { return (v? TRUE: FALSE); }
-void CStartupInfo::InitDialogItems(const CInitDialogItem *srcItems,
+void CStartupInfo::InitDialogItems(const CInitDialogItem *srcItems,
FarDialogItem *destItems, int numItems)
{
for (int i = 0; i < numItems; i++)
@@ -136,19 +173,19 @@ CSysString CStartupInfo::GetFullKeyName(const CSysString &keyName) const
}
-LONG CStartupInfo::CreateRegKey(HKEY parentKey,
+LONG CStartupInfo::CreateRegKey(HKEY parentKey,
const CSysString &keyName, NRegistry::CKey &destKey) const
{
return destKey.Create(parentKey, GetFullKeyName(keyName));
}
-LONG CStartupInfo::OpenRegKey(HKEY parentKey,
- const CSysString &keyName, NRegistry::CKey &destKey) const
+LONG CStartupInfo::OpenRegKey(HKEY parentKey,
+ const CSysString &keyName, NRegistry::CKey &destKey) const
{
return destKey.Open(parentKey, GetFullKeyName(keyName));
}
-void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
+void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
LPCTSTR valueName, LPCTSTR value) const
{
NRegistry::CKey regKey;
@@ -156,7 +193,7 @@ void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
regKey.SetValue(valueName, value);
}
-void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
+void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
LPCTSTR valueName, UINT32 value) const
{
NRegistry::CKey regKey;
@@ -164,7 +201,7 @@ void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
regKey.SetValue(valueName, value);
}
-void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
+void CStartupInfo::SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
LPCTSTR valueName, bool value) const
{
NRegistry::CKey regKey;
@@ -289,7 +326,7 @@ int CStartupInfo::Menu(
struct FarMenuItem *items,
int numItems)
{
- return m_Data.Menu(m_Data.ModuleNumber, x, y, maxHeight, flags, (char *)title,
+ return m_Data.Menu(m_Data.ModuleNumber, x, y, maxHeight, flags, (char *)title,
(char *)aBottom, (char *)helpTopic, breakKeys, breakCode, items, numItems);
}
@@ -308,7 +345,7 @@ int CStartupInfo::Menu(
unsigned int flags,
const char *title,
const char *helpTopic,
- const CSysStringVector &items,
+ const CSysStringVector &items,
int selectedItem)
{
CRecordVector<FarMenuItem> farMenuItems;
@@ -368,9 +405,14 @@ void PrintErrorMessage(const char *message, int code)
void PrintErrorMessage(const char *message, const char *text)
{
CSysString tmp = message;
- tmp += ": ";
+ tmp += ":\n";
tmp += text;
- g_StartupInfo.ShowMessage(tmp);
+ g_StartupInfo.ShowMessageLines(tmp);
+}
+
+void PrintErrorMessage(const char *message, const wchar_t *text)
+{
+ PrintErrorMessage(message, UnicodeStringToMultiByte(text, CP_OEMCP));
}
bool WasEscPressed()
diff --git a/CPP/7zip/UI/Far/FarUtils.h b/CPP/7zip/UI/Far/FarUtils.h
index 4e2f83cd..e0126cdc 100755
--- a/CPP/7zip/UI/Far/FarUtils.h
+++ b/CPP/7zip/UI/Far/FarUtils.h
@@ -49,37 +49,38 @@ class CStartupInfo
CSysString m_RegistryPath;
CSysString GetFullKeyName(const CSysString &keyName) const;
- LONG CreateRegKey(HKEY parentKey,
+ LONG CreateRegKey(HKEY parentKey,
const CSysString &keyName, NWindows::NRegistry::CKey &destKey) const;
- LONG OpenRegKey(HKEY parentKey,
+ LONG OpenRegKey(HKEY parentKey,
const CSysString &keyName, NWindows::NRegistry::CKey &destKey) const;
public:
- void Init(const PluginStartupInfo &pluginStartupInfo,
+ void Init(const PluginStartupInfo &pluginStartupInfo,
const CSysString &pliginNameForRegestry);
const char *GetMsgString(int messageId);
- int ShowMessage(unsigned int flags, const char *helpTopic,
+ int ShowMessage(unsigned int flags, const char *helpTopic,
const char **items, int numItems, int numButtons);
int ShowMessage(const char *message);
+ int ShowMessageLines(const char *message);
int ShowMessage(int messageId);
- int ShowDialog(int X1, int Y1, int X2, int Y2,
+ int ShowDialog(int X1, int Y1, int X2, int Y2,
const char *helpTopic, struct FarDialogItem *items, int numItems);
int ShowDialog(int sizeX, int sizeY,
const char *helpTopic, struct FarDialogItem *items, int numItems);
- void InitDialogItems(const CInitDialogItem *srcItems,
+ void InitDialogItems(const CInitDialogItem *srcItems,
FarDialogItem *destItems, int numItems);
HANDLE SaveScreen(int X1, int Y1, int X2, int Y2);
HANDLE SaveScreen();
void RestoreScreen(HANDLE handle);
- void SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
+ void SetRegKeyValue(HKEY parentKey, const CSysString &keyName,
const LPCTSTR valueName, LPCTSTR value) const;
- void SetRegKeyValue(HKEY hRoot, const CSysString &keyName,
+ void SetRegKeyValue(HKEY hRoot, const CSysString &keyName,
const LPCTSTR valueName, UINT32 value) const;
- void SetRegKeyValue(HKEY hRoot, const CSysString &keyName,
+ void SetRegKeyValue(HKEY hRoot, const CSysString &keyName,
const LPCTSTR valueName, bool value) const;
CSysString QueryRegKeyValue(HKEY parentKey, const CSysString &keyName,
@@ -124,17 +125,17 @@ public:
unsigned int flags,
const char *title,
const char *helpTopic,
- const CSysStringVector &items,
+ const CSysStringVector &items,
int selectedItem);
- int Editor(const char *fileName, const char *title,
+ int Editor(const char *fileName, const char *title,
int X1, int Y1, int X2, int Y2, DWORD flags, int startLine, int startChar)
- { return m_Data.Editor((char *)fileName, (char *)title, X1, Y1, X2, Y2,
+ { return m_Data.Editor((char *)fileName, (char *)title, X1, Y1, X2, Y2,
flags, startLine, startChar); }
int Editor(const char *fileName)
{ return Editor(fileName, NULL, 0, 0, -1, -1, 0, -1, -1); }
- int Viewer(const char *fileName, const char *title,
+ int Viewer(const char *fileName, const char *title,
int X1, int Y1, int X2, int Y2, DWORD flags)
{ return m_Data.Viewer((char *)fileName, (char *)title, X1, Y1, X2, Y2, flags); }
int Viewer(const char *fileName)
@@ -157,7 +158,8 @@ public:
extern CStartupInfo g_StartupInfo;
void PrintErrorMessage(const char *message, int code);
-void PrintErrorMessage(const char *message, const char *aText);
+void PrintErrorMessage(const char *message, const char *text);
+void PrintErrorMessage(const char *message, const wchar_t *text);
#define MY_TRY_BEGIN try\
{
@@ -170,8 +172,10 @@ void PrintErrorMessage(const char *message, const char *aText);
#define MY_TRY_END2(x, y) }\
catch(int n) { PrintErrorMessage(x, n); return y; }\
- catch(const CSysString &s) { PrintErrorMessage(x, s); return y; }\
+ catch(const AString &s) { PrintErrorMessage(x, s); return y; }\
catch(const char *s) { PrintErrorMessage(x, s); return y; }\
+ catch(const UString &s) { PrintErrorMessage(x, s); return y; }\
+ catch(const wchar_t *s) { PrintErrorMessage(x, s); return y; }\
catch(...) { g_StartupInfo.ShowMessage(x); return y; }
bool WasEscPressed();
diff --git a/CPP/7zip/UI/Far/Main.cpp b/CPP/7zip/UI/Far/Main.cpp
index 0409855d..39c84391 100755
--- a/CPP/7zip/UI/Far/Main.cpp
+++ b/CPP/7zip/UI/Far/Main.cpp
@@ -43,11 +43,11 @@ static const char *kHelpTopicConfig = "Config";
extern "C"
{
void WINAPI SetStartupInfo(struct PluginStartupInfo *info);
- HANDLE WINAPI OpenFilePlugin(char *name, const unsigned char *Data,
+ HANDLE WINAPI OpenFilePlugin(char *name, const unsigned char *Data,
unsigned int DataSize);
HANDLE WINAPI OpenPlugin(int openFrom, int item);
void WINAPI ClosePlugin(HANDLE plugin);
- int WINAPI GetFindData(HANDLE plugin, struct PluginPanelItem **panelItems,
+ int WINAPI GetFindData(HANDLE plugin, struct PluginPanelItem **panelItems,
int *itemsNumber, int OpMode);
void WINAPI FreeFindData(HANDLE plugin, struct PluginPanelItem *panelItems,
int itemsNumber);
@@ -71,7 +71,7 @@ static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -84,7 +84,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
g_hInstance = hInstance;
#ifndef _UNICODE
g_IsNT = IsItWindowsNT();
- #endif
+ #endif
}
return TRUE;
}
@@ -96,19 +96,17 @@ static struct COptions
static const char *kPliginNameForRegestry = "7-ZIP";
-// #define MY_TRY_BEGIN MY_TRY_BEGIN NCOM::CComInitializer aComInitializer;
-
void WINAPI SetStartupInfo(struct PluginStartupInfo *info)
{
MY_TRY_BEGIN;
g_StartupInfo.Init(*info, kPliginNameForRegestry);
g_Options.Enabled = g_StartupInfo.QueryRegKeyValue(
- HKEY_CURRENT_USER, kRegisrtryMainKeyName,
+ HKEY_CURRENT_USER, kRegisrtryMainKeyName,
kRegisrtryValueNameEnabled, kPluginEnabledDefault);
MY_TRY_END1("SetStartupInfo");
}
-class COpenArchiveCallback:
+class COpenArchiveCallback:
public IArchiveOpenCallback,
public IArchiveOpenVolumeCallback,
public IProgress,
@@ -117,14 +115,20 @@ class COpenArchiveCallback:
{
DWORD m_StartTickValue;
bool m_MessageBoxIsShown;
- CMessageBox *m_MessageBox;
- UINT64 m_NumFiles;
- UINT64 m_NumFilesMax;
- UINT64 m_NumFilesPrev;
- bool m_NumFilesDefined;
- UINT64 m_NumBytes;
- bool m_NumBytesDefined;
- UINT32 m_PrevTickCount;
+
+ CProgressBox _progressBox;
+
+ UInt64 _numFilesTotal;
+ UInt64 _numFilesCur;
+ UInt64 _numBytesTotal;
+ UInt64 _numBytesCur;
+
+ bool _numFilesTotalDefined;
+ bool _numFilesCurDefined;
+ bool _numBytesTotalDefined;
+ bool _numBytesCurDefined;
+
+ DWORD m_PrevTickCount;
NWindows::NFile::NFind::CFileInfoW _fileInfo;
public:
@@ -141,12 +145,12 @@ public:
)
// IProgress
- STDMETHOD(SetTotal)(UINT64 total);
- STDMETHOD(SetCompleted)(const UINT64 *aCompleteValue);
+ STDMETHOD(SetTotal)(UInt64 total);
+ STDMETHOD(SetCompleted)(const UInt64 *aCompleteValue);
// IArchiveOpenCallback
- STDMETHOD(SetTotal)(const UINT64 *numFiles, const UINT64 *numBytes);
- STDMETHOD(SetCompleted)(const UINT64 *numFiles, const UINT64 *numBytes);
+ STDMETHOD(SetTotal)(const UInt64 *numFiles, const UInt64 *numBytes);
+ STDMETHOD(SetCompleted)(const UInt64 *numFiles, const UInt64 *numBytes);
// IArchiveOpenVolumeCallback
STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value);
@@ -155,18 +159,21 @@ public:
// ICryptoGetTextPassword
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
- void Init(CMessageBox *messageBox)
+ void Init()
{
PasswordIsDefined = false;
- m_NumFilesMax = 0;
+ _numFilesTotalDefined = false;
+ _numFilesCurDefined = false;
+ _numBytesTotalDefined = false;
+ _numBytesCurDefined = false;
+
m_MessageBoxIsShown = false;
m_PrevTickCount = GetTickCount();
- m_MessageBox = messageBox;
}
- void ShowMessage(const UINT64 *completed);
+ void ShowMessage();
- void LoadFileInfo(const UString &folderPrefix,
+ void LoadFileInfo(const UString &folderPrefix,
const UString &fileName)
{
_folderPrefix = folderPrefix;
@@ -175,15 +182,17 @@ public:
}
};
-void COpenArchiveCallback::ShowMessage(const UINT64 *completed)
+void COpenArchiveCallback::ShowMessage()
{
- UINT32 currentTime = GetTickCount();
+ DWORD currentTime = GetTickCount();
if (!m_MessageBoxIsShown)
{
- if (currentTime - m_PrevTickCount < 400)
+ if (currentTime - m_PrevTickCount < 100)
return;
- m_MessageBox->Init(g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
- g_StartupInfo.GetMsgString(NMessageID::kReading), 2, 30);
+ _progressBox.Init(
+ // g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
+ g_StartupInfo.GetMsgString(NMessageID::kReading), 48);
+
m_MessageBoxIsShown = true;
}
else
@@ -192,72 +201,96 @@ void COpenArchiveCallback::ShowMessage(const UINT64 *completed)
return;
}
m_PrevTickCount = currentTime;
- char aMessage[256];
- sprintf(aMessage, "%5I64u", m_NumFilesMax);
- char aMessage2[256];
- aMessage2[0] = '\0';
- if (completed != NULL)
- sprintf(aMessage2, "%5I64u", *completed);
- const char *aMessages[2] =
- {aMessage, aMessage2 };
- m_MessageBox->ShowProcessMessages(aMessages);
+
+ UInt64 total = 0, cur = 0;
+ bool curIsDefined = false, totalIsDefined = false;
+
+ char message[256] = { 0 };
+ if (_numFilesCurDefined)
+ ConvertUInt64ToStringAligned(_numFilesCur, message, 5);
+
+ if (_numFilesTotalDefined)
+ {
+ strcat(message, " / ");
+ ConvertUInt64ToStringAligned(_numFilesTotal, message + strlen(message), 5);
+ total = _numFilesTotal;
+ totalIsDefined = true;
+ if (_numFilesCurDefined)
+ {
+ cur = _numFilesCur;
+ curIsDefined = true;
+ }
+ }
+ else if (_numBytesTotalDefined)
+ {
+ total = _numBytesTotal;
+ totalIsDefined = true;
+ if (_numBytesCurDefined)
+ {
+ cur = _numBytesCur;
+ curIsDefined = true;
+ }
+ }
+ _progressBox.Progress(
+ totalIsDefined ? &total: NULL,
+ curIsDefined ? &cur: NULL,
+ message);
}
-STDMETHODIMP COpenArchiveCallback::SetTotal(const UINT64 *numFiles, const UINT64 *numBytes)
+STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64 *numBytes)
{
if (WasEscPressed())
return E_ABORT;
- m_NumFilesDefined = (numFiles != NULL);
- if (m_NumFilesDefined)
- m_NumFiles = *numFiles;
- m_NumBytesDefined = (numBytes != NULL);
- if (m_NumBytesDefined)
- m_NumBytes = *numBytes;
+
+ _numFilesTotalDefined = (numFiles != NULL);
+ if (_numFilesTotalDefined)
+ _numFilesTotal = *numFiles;
+
+ _numBytesTotalDefined = (numBytes != NULL);
+ if (_numBytesTotalDefined)
+ _numBytesTotal = *numBytes;
+
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::SetCompleted(const UINT64 *numFiles, const UINT64 * /* numBytes */)
+STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *numFiles, const UInt64 *numBytes)
{
if (WasEscPressed())
return E_ABORT;
- if (numFiles == NULL)
- return S_OK;
- m_NumFilesMax = *numFiles;
+
+ _numFilesCurDefined = (numFiles != NULL);
+ if (_numFilesCurDefined)
+ _numFilesCur = *numFiles;
+
+ _numBytesCurDefined = (numBytes != NULL);
+ if (_numBytesCurDefined)
+ _numBytesCur = *numBytes;
+
// if (*numFiles % 100 != 0)
// return S_OK;
- ShowMessage(NULL);
+ ShowMessage();
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::SetTotal(const UINT64 /* total */)
+STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 /* total */)
{
if (WasEscPressed())
return E_ABORT;
- /*
- aNumFilesDefined = (numFiles != NULL);
- if (aNumFilesDefined)
- aNumFiles = *numFiles;
- aNumBytesDefined = (numBytes != NULL);
- if (aNumBytesDefined)
- aNumBytes = *numBytes;
- */
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::SetCompleted(const UINT64 *completed)
+STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *completed)
{
if (WasEscPressed())
return E_ABORT;
if (completed == NULL)
return S_OK;
- // if (*completed % 100 != 0)
- // return S_OK;
- ShowMessage(completed);
+ ShowMessage();
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
+STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
IInStream **inStream)
{
if (WasEscPressed())
@@ -266,7 +299,7 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
UString fullPath = _folderPrefix + name;
if (!NWindows::NFile::NFind::FindFile(fullPath, _fileInfo))
return S_FALSE;
- if (_fileInfo.IsDirectory())
+ if (_fileInfo.IsDir())
return S_FALSE;
CInFileStream *inFile = new CInFileStream;
CMyComPtr<IInStream> inStreamTemp = inFile;
@@ -279,32 +312,18 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value)
{
- NWindows::NCOM::CPropVariant propVariant;
+ NWindows::NCOM::CPropVariant prop;
switch(propID)
{
- case kpidName:
- propVariant = GetUnicodeString(_fileInfo.Name, CP_OEMCP);
- break;
- case kpidIsFolder:
- propVariant = _fileInfo.IsDirectory();
- break;
- case kpidSize:
- propVariant = _fileInfo.Size;
- break;
- case kpidAttributes:
- propVariant = (UINT32)_fileInfo.Attributes;
- break;
- case kpidLastAccessTime:
- propVariant = _fileInfo.LastAccessTime;
- break;
- case kpidCreationTime:
- propVariant = _fileInfo.CreationTime;
- break;
- case kpidLastWriteTime:
- propVariant = _fileInfo.LastWriteTime;
- break;
+ case kpidName: prop = GetUnicodeString(_fileInfo.Name, CP_OEMCP); break;
+ case kpidIsDir: prop = _fileInfo.IsDir(); break;
+ case kpidSize: prop = _fileInfo.Size; break;
+ case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
+ case kpidCTime: prop = _fileInfo.CTime; break;
+ case kpidATime: prop = _fileInfo.ATime; break;
+ case kpidMTime: prop = _fileInfo.MTime; break;
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
@@ -315,7 +334,7 @@ HRESULT GetPassword(UString &password)
password.Empty();
CInitDialogItem initItems[]=
{
- { DI_DOUBLEBOX, 3, 1, 72, 4, false, false, 0, false, NMessageID::kGetPasswordTitle, NULL, NULL },
+ { DI_DOUBLEBOX, 3, 1, 72, 4, false, false, 0, false, NMessageID::kGetPasswordTitle, NULL, NULL },
{ DI_TEXT, 5, 2, 0, 0, false, false, DIF_SHOWAMPERSAND, false, NMessageID::kEnterPasswordForFile, NULL, NULL },
{ DI_PSWEDIT, 5, 3, 70, 3, true, false, 0, true, -1, "", NULL }
};
@@ -329,7 +348,7 @@ HRESULT GetPassword(UString &password)
return (E_ABORT);
AString oemPassword = dialogItems[2].Data;
- password = MultiByteToUnicodeString(oemPassword, CP_OEMCP);
+ password = MultiByteToUnicodeString(oemPassword, CP_OEMCP);
return S_OK;
}
@@ -346,14 +365,14 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
}
/*
-HRESULT OpenArchive(const CSysString &fileName,
- IInFolderArchive **archiveHandlerResult,
+HRESULT OpenArchive(const CSysString &fileName,
+ IInFolderArchive **archiveHandlerResult,
CArchiverInfo &archiverInfoResult,
UString &defaultName,
IArchiveOpenCallback *openArchiveCallback)
{
- HRESULT OpenArchive(const CSysString &fileName,
- IInArchive **archive,
+ HRESULT OpenArchive(const CSysString &fileName,
+ IInArchive **archive,
CArchiverInfo &archiverInfoResult,
IArchiveOpenCallback *openArchiveCallback);
}
@@ -371,7 +390,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
NFile::NFind::CFileInfoW fileInfo;
if (!NFile::NFind::FindFile(fullName, fileInfo))
return INVALID_HANDLE_VALUE;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
return INVALID_HANDLE_VALUE;
@@ -380,19 +399,18 @@ static HANDLE MyOpenFilePlugin(const char *name)
// CArchiverInfo archiverInfoResult;
// ::OutputDebugString("before OpenArchive\n");
- COpenArchiveCallback *openArchiveCallbackSpec = new COpenArchiveCallback;
-
- CMyComPtr<IArchiveOpenCallback> openArchiveCallback = openArchiveCallbackSpec;
-
- // if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0)
CScreenRestorer screenRestorer;
- CMessageBox m_MessageBox;
{
screenRestorer.Save();
}
- openArchiveCallbackSpec->Init(&m_MessageBox);
+
+ COpenArchiveCallback *openArchiveCallbackSpec = new COpenArchiveCallback;
+ CMyComPtr<IArchiveOpenCallback> openArchiveCallback = openArchiveCallbackSpec;
+
+ // if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0)
+ openArchiveCallbackSpec->Init();
openArchiveCallbackSpec->LoadFileInfo(
- fullName.Left(fileNamePartStartIndex),
+ fullName.Left(fileNamePartStartIndex),
fullName.Mid(fileNamePartStartIndex));
// ::OutputDebugString("before OpenArchive\n");
@@ -402,7 +420,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
HRESULT result = archiveHandler->Open(
GetUnicodeString(fullName, CP_OEMCP), &archiveType, openArchiveCallback);
/*
- HRESULT result = ::OpenArchive(fullName, &archiveHandler,
+ HRESULT result = ::OpenArchive(fullName, &archiveHandler,
archiverInfoResult, defaultName, openArchiveCallback);
*/
if (result != S_OK)
@@ -415,8 +433,8 @@ static HANDLE MyOpenFilePlugin(const char *name)
// ::OutputDebugString("after OpenArchive\n");
CPlugin *plugin = new CPlugin(
- fullName,
- // defaultName,
+ fullName,
+ // defaultName,
archiveHandler,
(const wchar_t *)archiveType
);
@@ -428,7 +446,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
return (HANDLE)(plugin);
}
-HANDLE WINAPI OpenFilePlugin(char *name,
+HANDLE WINAPI OpenFilePlugin(char *name,
const unsigned char * /* data */, unsigned int /* dataSize */)
{
MY_TRY_BEGIN;
@@ -449,7 +467,7 @@ HANDLE WINAPI OpenPlugin(int openFrom, int item)
CSysString fileName = (const char *)(UINT_PTR)item;
if(fileName.IsEmpty())
return INVALID_HANDLE_VALUE;
- if (fileName.Length() >= 2 &&
+ if (fileName.Length() >= 2 &&
fileName[0] == '\"' && fileName[fileName.Length() - 1] == '\"')
fileName = fileName.Mid(1, fileName.Length() - 2);
@@ -509,13 +527,13 @@ void WINAPI FreeFindData(HANDLE plugin, struct PluginPanelItem *panelItems,
{
MY_TRY_BEGIN;
((CPlugin *)plugin)->FreeFindData(panelItems, itemsNumber);
- MY_TRY_END1("FreeFindData");
+ MY_TRY_END1("FreeFindData");
}
int WINAPI GetFiles(HANDLE plugin, struct PluginPanelItem *panelItems,
int itemsNumber, int move, char *destPath, int opMode)
{
- MY_TRY_BEGIN;
+ MY_TRY_BEGIN;
return(((CPlugin *)plugin)->GetFiles(panelItems, itemsNumber, move, destPath, opMode));
MY_TRY_END2("GetFiles", NFileOperationReturnCode::kError);
}
@@ -546,7 +564,7 @@ void WINAPI GetPluginInfo(struct PluginInfo *info)
info->PluginConfigStrings = (char **)pluginCfgStrings;
info->PluginConfigStringsNumber = sizeof(pluginCfgStrings) / sizeof(pluginCfgStrings[0]);
info->CommandPrefix = (char *)kCommandPrefix;
- MY_TRY_END1("GetPluginInfo");
+ MY_TRY_END1("GetPluginInfo");
}
int WINAPI Configure(int /* itemNumber */)
@@ -572,7 +590,7 @@ int WINAPI Configure(int /* itemNumber */)
FarDialogItem dialogItems[kNumDialogItems];
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
- int askCode = g_StartupInfo.ShowDialog(76, kYSize,
+ int askCode = g_StartupInfo.ShowDialog(76, kYSize,
kHelpTopicConfig, dialogItems, kNumDialogItems);
if (askCode != kOkButtonIndex)
@@ -590,7 +608,7 @@ void WINAPI GetOpenPluginInfo(HANDLE plugin,struct OpenPluginInfo *info)
{
MY_TRY_BEGIN;
((CPlugin *)plugin)->GetOpenPluginInfo(info);
- MY_TRY_END1("GetOpenPluginInfo");
+ MY_TRY_END1("GetOpenPluginInfo");
}
int WINAPI PutFiles(HANDLE plugin, struct PluginPanelItem *panelItems,
@@ -606,7 +624,7 @@ int WINAPI DeleteFiles(HANDLE plugin, PluginPanelItem *panelItems,
{
MY_TRY_BEGIN;
return(((CPlugin *)plugin)->DeleteFiles(panelItems, itemsNumber, opMode));
- MY_TRY_END2("DeleteFiles", FALSE);
+ MY_TRY_END2("DeleteFiles", FALSE);
}
int WINAPI ProcessKey(HANDLE plugin, int key, unsigned int controlState)
diff --git a/CPP/7zip/UI/Far/Messages.h b/CPP/7zip/UI/Far/Messages.h
index 9d3060a1..1281b235 100755
--- a/CPP/7zip/UI/Far/Messages.h
+++ b/CPP/7zip/UI/Far/Messages.h
@@ -7,7 +7,7 @@ namespace NMessageID {
enum EEnum
{
- kOk,
+ kOk,
kCancel,
kWarning,
@@ -24,22 +24,22 @@ enum EEnum
kExtension,
kIsFolder,
kSize,
- kPackedSize,
+ kPackSize,
kAttributes,
- kCreationTime,
- kLastAccessTime,
- kLastWriteTime,
- kSolid,
- kCommented,
- kEncrypted,
- kSplitBefore,
+ kCTime,
+ kATime,
+ kMTime,
+ kSolid,
+ kCommented,
+ kEncrypted,
+ kSplitBefore,
kSplitAfter,
- kDictionarySize,
- kCRC,
+ kDictionarySize,
+ kCRC,
kType,
kAnti,
- kMethod,
- kHostOS,
+ kMethod,
+ kHostOS,
kFileSystem,
kUser,
kGroup,
@@ -56,6 +56,15 @@ enum EEnum
kNumBlocks,
kNumVolumes,
+ kBit64,
+ kBigEndian,
+ kCpu,
+ kPhySize,
+ kHeadersSize,
+ kChecksum,
+ kCharacts,
+ kVa,
+
kGetPasswordTitle,
kEnterPasswordForFile,
diff --git a/CPP/7zip/UI/Far/OverwriteDialog.cpp b/CPP/7zip/UI/Far/OverwriteDialog.cpp
index 9272942f..6935fa10 100755
--- a/CPP/7zip/UI/Far/OverwriteDialog.cpp
+++ b/CPP/7zip/UI/Far/OverwriteDialog.cpp
@@ -27,7 +27,7 @@ struct CFileInfoStrings
};
void SetFileInfoStrings(const CFileInfo &fileInfo,
- CFileInfoStrings &fileInfoStrings)
+ CFileInfoStrings &fileInfoStrings)
{
char buffer[256];
@@ -70,7 +70,7 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf
{ DI_DOUBLEBOX, 3, 1, kXSize - 4, kYSize - 2, false, false, 0, false, NMessageID::kOverwriteTitle, NULL, NULL },
{ DI_TEXT, 5, 2, 0, 0, false, false, 0, false, NMessageID::kOverwriteMessage1, NULL, NULL },
- { DI_TEXT, 3, 3, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
+ { DI_TEXT, 3, 3, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
{ DI_TEXT, 5, 4, 0, 0, false, false, 0, false, NMessageID::kOverwriteMessageWouldYouLike, NULL, NULL },
@@ -84,7 +84,7 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf
{ DI_TEXT, 7, 13, 0, 0, false, false, 0, false, -1, newFileInfoStrings.Size, NULL },
{ DI_TEXT, 7, 14, 0, 0, false, false, 0, false, -1, newFileInfoStrings.Time, NULL },
- { DI_TEXT, 3, kYSize - 5, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
+ { DI_TEXT, 3, kYSize - 5, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
{ DI_BUTTON, 0, kYSize - 4, 0, 0, true, false, DIF_CENTERGROUP, true, NMessageID::kOverwriteYes, NULL, NULL },
{ DI_BUTTON, 0, kYSize - 4, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kOverwriteYesToAll, NULL, NULL },
@@ -97,7 +97,7 @@ NResult::EEnum Execute(const CFileInfo &oldFileInfo, const CFileInfo &newFileInf
const int kNumDialogItems = sizeof(anInitItems) / sizeof(anInitItems[0]);
FarDialogItem aDialogItems[kNumDialogItems];
g_StartupInfo.InitDialogItems(anInitItems, aDialogItems, kNumDialogItems);
- int anAskCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
+ int anAskCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
NULL, aDialogItems, kNumDialogItems);
const int kButtonStartPos = kNumDialogItems - 6;
if (anAskCode >= kButtonStartPos && anAskCode < kNumDialogItems)
diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp
index 40851c0c..65253f01 100755
--- a/CPP/7zip/UI/Far/Plugin.cpp
+++ b/CPP/7zip/UI/Far/Plugin.cpp
@@ -4,34 +4,24 @@
#include "Plugin.h"
+#include "Common/IntToString.h"
#include "Common/StringConvert.h"
#include "Common/Wildcard.h"
-#include "Windows/PropVariantConversions.h"
-#include "Windows/FileName.h"
#include "Windows/FileDir.h"
+#include "Windows/FileName.h"
+#include "Windows/PropVariantConversions.h"
#include "../Common/PropIDUtils.h"
-#include "Messages.h"
#include "FarUtils.h"
+#include "Messages.h"
using namespace NWindows;
using namespace NFar;
-CSysString ConvertPropertyToString2(const PROPVARIANT &propVariant, PROPID propID)
-{
- if (propVariant.vt == VT_BSTR)
- return GetSystemString(propVariant.bstrVal, CP_OEMCP);
- if (propVariant.vt != VT_BOOL)
- return GetSystemString(ConvertPropertyToString(propVariant, propID), CP_OEMCP);
- int messageID = VARIANT_BOOLToBool(propVariant.boolVal) ?
- NMessageID::kYes : NMessageID::kNo;
- return g_StartupInfo.GetMsgString(messageID);
-}
-
-CPlugin::CPlugin(const UString &fileName,
- // const UString &defaultName,
+CPlugin::CPlugin(const UString &fileName,
+ // const UString &defaultName,
IInFolderArchive *archiveHandler,
UString archiveTypeName
):
@@ -53,19 +43,19 @@ CPlugin::~CPlugin()
static void MyGetFileTime(IFolderFolder *anArchiveFolder, UInt32 itemIndex,
PROPID propID, FILETIME &fileTime)
{
- NCOM::CPropVariant propVariant;
- if (anArchiveFolder->GetProperty(itemIndex, propID, &propVariant) != S_OK)
+ NCOM::CPropVariant prop;
+ if (anArchiveFolder->GetProperty(itemIndex, propID, &prop) != S_OK)
throw 271932;
- if (propVariant.vt == VT_EMPTY)
+ if (prop.vt == VT_EMPTY)
{
fileTime.dwHighDateTime = 0;
fileTime.dwLowDateTime = 0;
}
- else
+ else
{
- if (propVariant.vt != VT_FILETIME)
+ if (prop.vt != VT_FILETIME)
throw 4191730;
- fileTime = propVariant.filetime;
+ fileTime = prop.filetime;
}
}
@@ -74,14 +64,14 @@ static void MyGetFileTime(IFolderFolder *anArchiveFolder, UInt32 itemIndex,
void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
{
- NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(itemIndex, kpidName, &propVariant) != S_OK)
+ NCOM::CPropVariant prop;
+ if (_folder->GetProperty(itemIndex, kpidName, &prop) != S_OK)
throw 271932;
- if (propVariant.vt != VT_BSTR)
+ if (prop.vt != VT_BSTR)
throw 272340;
- CSysString oemString = UnicodeStringToMultiByte(propVariant.bstrVal, CP_OEMCP);
+ CSysString oemString = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
const int kFileNameSizeMax = (int)(sizeof(panelItem.FindData.cFileName) / sizeof(panelItem.FindData.cFileName[0]) - 1);
if (oemString.Length() > kFileNameSizeMax)
oemString = oemString.Left(kFileNameSizeMax);
@@ -92,49 +82,49 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
MyStringCopy(panelItem.FindData.cFileName, (const char *)oemString);
panelItem.FindData.cAlternateFileName[0] = 0;
- if (_folder->GetProperty(itemIndex, kpidAttributes, &propVariant) != S_OK)
+ if (_folder->GetProperty(itemIndex, kpidAttrib, &prop) != S_OK)
throw 271932;
- if (propVariant.vt == VT_UI4)
- panelItem.FindData.dwFileAttributes = propVariant.ulVal;
- else if (propVariant.vt == VT_EMPTY)
- panelItem.FindData.dwFileAttributes = m_FileInfo.Attributes;
+ if (prop.vt == VT_UI4)
+ panelItem.FindData.dwFileAttributes = prop.ulVal;
+ else if (prop.vt == VT_EMPTY)
+ panelItem.FindData.dwFileAttributes = m_FileInfo.Attrib;
else
throw 21631;
- if (_folder->GetProperty(itemIndex, kpidIsFolder, &propVariant) != S_OK)
+ if (_folder->GetProperty(itemIndex, kpidIsDir, &prop) != S_OK)
throw 271932;
- if (propVariant.vt == VT_BOOL)
+ if (prop.vt == VT_BOOL)
{
- if (VARIANT_BOOLToBool(propVariant.boolVal))
+ if (VARIANT_BOOLToBool(prop.boolVal))
panelItem.FindData.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
}
- else if (propVariant.vt != VT_EMPTY)
+ else if (prop.vt != VT_EMPTY)
throw 21632;
- if (_folder->GetProperty(itemIndex, kpidSize, &propVariant) != S_OK)
+ if (_folder->GetProperty(itemIndex, kpidSize, &prop) != S_OK)
throw 271932;
UInt64 length;
- if (propVariant.vt == VT_EMPTY)
+ if (prop.vt == VT_EMPTY)
length = 0;
else
- length = ::ConvertPropVariantToUInt64(propVariant);
+ length = ::ConvertPropVariantToUInt64(prop);
panelItem.FindData.nFileSizeLow = (UInt32)length;
panelItem.FindData.nFileSizeHigh = (UInt32)(length >> 32);
- MyGetFileTime(_folder, itemIndex, kpidCreationTime, panelItem.FindData.ftCreationTime);
- MyGetFileTime(_folder, itemIndex, kpidLastAccessTime, panelItem.FindData.ftLastAccessTime);
- MyGetFileTime(_folder, itemIndex, kpidLastWriteTime, panelItem.FindData.ftLastWriteTime);
+ MyGetFileTime(_folder, itemIndex, kpidCTime, panelItem.FindData.ftCreationTime);
+ MyGetFileTime(_folder, itemIndex, kpidATime, panelItem.FindData.ftLastAccessTime);
+ MyGetFileTime(_folder, itemIndex, kpidMTime, panelItem.FindData.ftLastWriteTime);
- if (panelItem.FindData.ftLastWriteTime.dwHighDateTime == 0 &&
+ if (panelItem.FindData.ftLastWriteTime.dwHighDateTime == 0 &&
panelItem.FindData.ftLastWriteTime.dwLowDateTime == 0)
- panelItem.FindData.ftLastWriteTime = m_FileInfo.LastWriteTime;
+ panelItem.FindData.ftLastWriteTime = m_FileInfo.MTime;
- if (_folder->GetProperty(itemIndex, kpidPackedSize, &propVariant) != S_OK)
+ if (_folder->GetProperty(itemIndex, kpidPackSize, &prop) != S_OK)
throw 271932;
- if (propVariant.vt == VT_EMPTY)
+ if (prop.vt == VT_EMPTY)
length = 0;
else
- length = ::ConvertPropVariantToUInt64(propVariant);
+ length = ::ConvertPropVariantToUInt64(prop);
panelItem.PackSize = UInt32(length);
panelItem.PackSizeHigh = UInt32(length >> 32);
@@ -151,7 +141,7 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
panelItem.Reserved[2] = 0;
}
-int CPlugin::GetFindData(PluginPanelItem **panelItems,
+int CPlugin::GetFindData(PluginPanelItem **panelItems,
int *itemsNumber, int opMode)
{
// CScreenRestorer screenRestorer;
@@ -221,12 +211,12 @@ int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
if (path == L"\\")
{
_folder.Release();
- m_ArchiveHandler->BindToRootFolder(&_folder);
+ m_ArchiveHandler->BindToRootFolder(&_folder);
}
else if (path == L"..")
{
CMyComPtr<IFolderFolder> newFolder;
- _folder->BindToParentFolder(&newFolder);
+ _folder->BindToParentFolder(&newFolder);
if (newFolder == NULL)
throw 40312;
_folder = newFolder;
@@ -238,7 +228,7 @@ int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
if (path[0] == L'\\')
{
_folder.Release();
- m_ArchiveHandler->BindToRootFolder(&_folder);
+ m_ArchiveHandler->BindToRootFolder(&_folder);
path = path.Mid(1);
}
UStringVector pathParts;
@@ -257,7 +247,7 @@ void CPlugin::GetPathParts(UStringVector &pathParts)
for (;;)
{
CMyComPtr<IFolderFolder> newFolder;
- folderItem->BindToParentFolder(&newFolder);
+ folderItem->BindToParentFolder(&newFolder);
if (newFolder == NULL)
break;
NCOM::CPropVariant prop;
@@ -289,17 +279,17 @@ struct CPROPIDToName
int PluginID;
};
-static CPROPIDToName kPROPIDToName[] =
+static CPROPIDToName kPROPIDToName[] =
{
{ kpidName, NMessageID::kName },
{ kpidExtension, NMessageID::kExtension },
- { kpidIsFolder, NMessageID::kIsFolder },
+ { kpidIsDir, NMessageID::kIsFolder },
{ kpidSize, NMessageID::kSize },
- { kpidPackedSize, NMessageID::kPackedSize },
- { kpidAttributes, NMessageID::kAttributes },
- { kpidCreationTime, NMessageID::kCreationTime },
- { kpidLastAccessTime, NMessageID::kLastAccessTime },
- { kpidLastWriteTime, NMessageID::kLastWriteTime },
+ { kpidPackSize, NMessageID::kPackSize },
+ { kpidAttrib, NMessageID::kAttributes },
+ { kpidCTime, NMessageID::kCTime },
+ { kpidATime, NMessageID::kATime },
+ { kpidMTime, NMessageID::kMTime },
{ kpidSolid, NMessageID::kSolid },
{ kpidCommented, NMessageID::kCommented },
{ kpidEncrypted, NMessageID::kEncrypted },
@@ -317,7 +307,7 @@ static CPROPIDToName kPROPIDToName[] =
{ kpidBlock, NMessageID::kBlock },
{ kpidComment, NMessageID::kComment },
{ kpidPosition, NMessageID::kPosition },
- { kpidNumSubFolders, NMessageID::kNumSubFolders },
+ { kpidNumSubDirs, NMessageID::kNumSubFolders },
{ kpidNumSubFiles, NMessageID::kNumSubFiles },
{ kpidUnpackVer, NMessageID::kUnpackVer },
{ kpidVolume, NMessageID::kVolume },
@@ -325,7 +315,16 @@ static CPROPIDToName kPROPIDToName[] =
{ kpidOffset, NMessageID::kOffset },
{ kpidLinks, NMessageID::kLinks },
{ kpidNumBlocks, NMessageID::kNumBlocks },
- { kpidNumVolumes, NMessageID::kNumVolumes }
+ { kpidNumVolumes, NMessageID::kNumVolumes },
+
+ { kpidBit64, NMessageID::kBit64 },
+ { kpidBigEndian, NMessageID::kBigEndian },
+ { kpidCpu, NMessageID::kCpu },
+ { kpidPhySize, NMessageID::kPhySize },
+ { kpidHeadersSize, NMessageID::kHeadersSize },
+ { kpidChecksum, NMessageID::kChecksum },
+ { kpidCharacts, NMessageID::kCharacts },
+ { kpidVa, NMessageID::kVa }
};
static const int kNumPROPIDToName = sizeof(kPROPIDToName) / sizeof(kPROPIDToName[0]);
@@ -347,15 +346,15 @@ struct CPropertyIDInfo
// char CharID;
};
-static CPropertyIDInfo kPropertyIDInfos[] =
+static CPropertyIDInfo kPropertyIDInfos[] =
{
{ kpidName, "N", 0},
{ kpidSize, "S", 8},
{ kpidPackedSize, "P", 8},
- { kpidAttributes, "A", 0},
- { kpidCreationTime, "DC", 14},
- { kpidLastAccessTime, "DA", 14},
- { kpidLastWriteTime, "DM", 14},
+ { kpidAttrib, "A", 0},
+ { kpidCTime, "DC", 14},
+ { kpidATime, "DA", 14},
+ { kpidMTime, "DM", 14},
{ kpidSolid, NULL, 0, 'S'},
{ kpidEncrypted, NULL, 0, 'P'}
@@ -368,7 +367,7 @@ static CPropertyIDInfo kPropertyIDInfos[] =
// { kpidType, L"Type" }
};
-static const int kNumPropertyIDInfos = sizeof(kPropertyIDInfos) /
+static const int kNumPropertyIDInfos = sizeof(kPropertyIDInfos) /
sizeof(kPropertyIDInfos[0]);
static int FindPropertyInfo(PROPID propID)
@@ -415,6 +414,88 @@ void CPlugin::AddColumn(PROPID propID)
}
*/
+static AString GetNameOfProp(PROPID propID, const wchar_t *name)
+{
+ int index = FindPropertyToName(propID);
+ if (index < 0)
+ {
+ if (name)
+ return UnicodeStringToMultiByte((const wchar_t *)name, CP_OEMCP);
+ char s[32];
+ ConvertUInt64ToString(propID, s);
+ return s;
+ }
+ return g_StartupInfo.GetMsgString(kPROPIDToName[index].PluginID);
+}
+
+static AString GetNameOfProp2(PROPID propID, const wchar_t *name)
+{
+ AString s = GetNameOfProp(propID, name);
+ if (s.Length() > (kInfoPanelLineSize - 1))
+ s = s.Left(kInfoPanelLineSize - 1);
+ return s;
+}
+
+static AString ConvertSizeToString(UInt64 value)
+{
+ char s[32];
+ ConvertUInt64ToString(value, s);
+ int i = MyStringLen(s);
+ int pos = sizeof(s) / sizeof(s[0]);
+ s[--pos] = L'\0';
+ while (i > 3)
+ {
+ s[--pos] = s[--i];
+ s[--pos] = s[--i];
+ s[--pos] = s[--i];
+ s[--pos] = ' ';
+ }
+ while (i > 0)
+ s[--pos] = s[--i];
+ return s + pos;
+}
+
+static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID)
+{
+ AString s;
+
+ if (prop.vt == VT_BSTR)
+ s = GetSystemString(prop.bstrVal, CP_OEMCP);
+ else if (prop.vt == VT_BOOL)
+ {
+ int messageID = VARIANT_BOOLToBool(prop.boolVal) ?
+ NMessageID::kYes : NMessageID::kNo;
+ return g_StartupInfo.GetMsgString(messageID);
+ }
+ else if (prop.vt != VT_EMPTY)
+ {
+ if ((
+ propID == kpidSize ||
+ propID == kpidPackSize ||
+ propID == kpidNumSubDirs ||
+ propID == kpidNumSubFiles ||
+ propID == kpidNumBlocks ||
+ propID == kpidPhySize ||
+ propID == kpidHeadersSize ||
+ propID == kpidClusterSize
+ ) && (prop.vt == VT_UI8 || prop.vt == VT_UI4))
+ s = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
+ else
+ s = UnicodeStringToMultiByte(ConvertPropertyToString(prop, propID), CP_OEMCP);
+ }
+ s.Replace((char)0xA, ' ');
+ s.Replace((char)0xD, ' ');
+ return s;
+}
+
+static AString PropToString2(const NCOM::CPropVariant &prop, PROPID propID)
+{
+ AString s = PropToString(prop, propID);
+ if (s.Length() > (kInfoPanelLineSize - 1))
+ s = s.Left(kInfoPanelLineSize - 1);
+ return s;
+}
+
void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
{
info->StructSize = sizeof(*info);
@@ -439,10 +520,10 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
name = fullName.Mid(index);
}
- m_PannelTitle =
- UString(L' ') +
- _archiveTypeName +
- UString(L':') +
+ m_PannelTitle =
+ UString(L' ') +
+ _archiveTypeName +
+ UString(L':') +
name +
UString(L' ');
if (!m_CurrentDir.IsEmpty())
@@ -463,46 +544,73 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
int numItems = 2;
- CMyComPtr<IFolderProperties> folderProperties;
- _folder.QueryInterface(IID_IFolderProperties, &folderProperties);
- if (folderProperties)
{
- UInt32 numProps;
- if (folderProperties->GetNumberOfFolderProperties(&numProps) == S_OK)
+ CMyComPtr<IFolderProperties> folderProperties;
+ _folder.QueryInterface(IID_IFolderProperties, &folderProperties);
+ if (folderProperties)
+ {
+ UInt32 numProps;
+ if (folderProperties->GetNumberOfFolderProperties(&numProps) == S_OK)
+ {
+ for (UInt32 i = 0; i < numProps && numItems < kNumInfoLinesMax; i++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (folderProperties->GetFolderPropertyInfo(i, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (_folder->GetFolderProperty(propID, &prop) != S_OK || prop.vt == VT_EMPTY)
+ continue;
+
+ InfoPanelLine &item = m_InfoLines[numItems++];
+ MyStringCopy(item.Text, (const char *)GetNameOfProp2(propID, name));
+ MyStringCopy(item.Data, (const char *)PropToString2(prop, propID));
+ }
+ }
+ }
+ }
+
+ if (numItems < kNumInfoLinesMax)
+ {
+ InfoPanelLine &item = m_InfoLines[numItems++];
+ MyStringCopy(item.Text, "");
+ MyStringCopy(item.Data, "");
+ item.Separator = TRUE;
+ }
+
+ {
+ CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
+ _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
+ if (getFolderArchiveProperties)
{
- for (UInt32 i = 0; i < numProps && numItems < kNumInfoLinesMax; i++)
+ CMyComPtr<IFolderArchiveProperties> getProps;
+ getFolderArchiveProperties->GetFolderArchiveProperties(&getProps);
+ if (getProps)
{
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- if (folderProperties->GetFolderPropertyInfo(i, &name, &propID, &vt) != S_OK)
- continue;
-
- InfoPanelLine &item = m_InfoLines[numItems];
- int index = FindPropertyToName(propID);
- AString s;
- if (index < 0)
+ UInt32 numProps;
+ if (getProps->GetNumberOfArchiveProperties(&numProps) == S_OK)
{
- if (name != 0)
- s = (const char *)UnicodeStringToMultiByte((const wchar_t *)name, CP_OEMCP);
+ /*
+ if (numProps > 0)
+ message += kSeparator;
+ */
+ for (UInt32 i = 0; i < numProps && numItems < kNumInfoLinesMax; i++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (getProps->GetArchivePropertyInfo(i, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (getProps->GetArchiveProperty(propID, &prop) != S_OK || prop.vt == VT_EMPTY)
+ continue;
+ InfoPanelLine &item = m_InfoLines[numItems++];
+ MyStringCopy(item.Text, (const char *)GetNameOfProp2(propID, name));
+ MyStringCopy(item.Data, (const char *)PropToString2(prop, propID));
+
+ }
}
- else
- s = g_StartupInfo.GetMsgString(kPROPIDToName[index].PluginID);
-
- if (s.Length() > (kInfoPanelLineSize - 1))
- s = s.Left(kInfoPanelLineSize - 1);
- MyStringCopy(item.Text, (const char *)s);
-
- NCOM::CPropVariant propVariant;
- if (_folder->GetFolderProperty(propID, &propVariant) != S_OK)
- continue;
- s = ConvertPropertyToString2(propVariant, propID);
- s.Replace((char)0xA, ' ');
- s.Replace((char)0xD, ' ');
- if (s.Length() > (kInfoPanelLineSize - 1))
- s = s.Left(kInfoPanelLineSize - 1);
- MyStringCopy(item.Data, (const char *)s);
- numItems++;
}
}
}
@@ -523,10 +631,10 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
AddColumn(kpidName);
AddColumn(kpidSize);
AddColumn(kpidPackedSize);
- AddColumn(kpidLastWriteTime);
- AddColumn(kpidCreationTime);
- AddColumn(kpidLastAccessTime);
- AddColumn(kpidAttributes);
+ AddColumn(kpidMTime);
+ AddColumn(kpidCTime);
+ AddColumn(kpidATime);
+ AddColumn(kpidAttrib);
PanelMode.ColumnTypes = (char *)(const char *)PanelModeColumnTypes;
PanelMode.ColumnWidths = (char *)(const char *)PanelModeColumnWidths;
@@ -565,8 +673,8 @@ HRESULT CPlugin::ShowAttributesWindow()
PluginPanelItem pluginPanelItem;
if (!g_StartupInfo.ControlGetActivePanelCurrentItemInfo(pluginPanelItem))
return S_FALSE;
- if (strcmp(pluginPanelItem.FindData.cFileName, "..") == 0 &&
- NFile::NFind::NAttributes::IsDirectory(pluginPanelItem.FindData.dwFileAttributes))
+ if (strcmp(pluginPanelItem.FindData.cFileName, "..") == 0 &&
+ NFile::NFind::NAttributes::IsDir(pluginPanelItem.FindData.dwFileAttributes))
return S_FALSE;
int itemIndex = pluginPanelItem.UserData;
@@ -580,63 +688,57 @@ HRESULT CPlugin::ShowAttributesWindow()
PROPID propID;
VARTYPE vt;
RINOK(_folder->GetPropertyInfo(i, &name, &propID, &vt));
- CArchiveItemProperty destProperty;
- destProperty.Type = vt;
- destProperty.ID = propID;
- if (destProperty.ID == kpidPath)
- destProperty.ID = kpidName;
- AString propName;
- {
- if (name != NULL)
- destProperty.Name = UnicodeStringToMultiByte((const wchar_t *)name, CP_OEMCP);
- else
- destProperty.Name = "?";
- }
- properties.Add(destProperty);
+ CArchiveItemProperty prop;
+ prop.Type = vt;
+ prop.ID = propID;
+ if (prop.ID == kpidPath)
+ prop.ID = kpidName;
+ prop.Name = GetNameOfProp(propID, name);
+ properties.Add(prop);
}
int size = 2;
CRecordVector<CInitDialogItem> initDialogItems;
int xSize = 70;
- CInitDialogItem initDialogItem =
+ CInitDialogItem idi =
{ DI_DOUBLEBOX, 3, 1, xSize - 4, size - 2, false, false, 0, false, NMessageID::kProperties, NULL, NULL };
- initDialogItems.Add(initDialogItem);
+ initDialogItems.Add(idi);
AStringVector values;
for (i = 0; i < properties.Size(); i++)
{
const CArchiveItemProperty &property = properties[i];
- CInitDialogItem initDialogItem =
+ CInitDialogItem idi =
{ DI_TEXT, 5, 3 + i, 0, 0, false, false, 0, false, 0, NULL, NULL };
int index = FindPropertyToName(property.ID);
if (index < 0)
{
- initDialogItem.DataMessageId = -1;
- initDialogItem.DataString = property.Name;
+ idi.DataMessageId = -1;
+ idi.DataString = property.Name;
}
else
- initDialogItem.DataMessageId = kPROPIDToName[index].PluginID;
- initDialogItems.Add(initDialogItem);
+ idi.DataMessageId = kPROPIDToName[index].PluginID;
+ initDialogItems.Add(idi);
- NCOM::CPropVariant propVariant;
- RINOK(_folder->GetProperty(itemIndex, property.ID, &propVariant));
- CSysString s = ConvertPropertyToString2(propVariant, property.ID);
+ NCOM::CPropVariant prop;
+ RINOK(_folder->GetProperty(itemIndex, property.ID, &prop));
+ CSysString s = PropToString(prop, property.ID);
values.Add(s);
{
- CInitDialogItem initDialogItem =
+ CInitDialogItem idi =
{ DI_TEXT, 30, 3 + i, 0, 0, false, false, 0, false, -1, NULL, NULL };
- initDialogItems.Add(initDialogItem);
+ initDialogItems.Add(idi);
}
}
int numLines = values.Size();
for (i = 0; i < numLines; i++)
{
- CInitDialogItem &initDialogItem = initDialogItems[1 + i * 2 + 1];
- initDialogItem.DataString = values[i];
+ CInitDialogItem &idi = initDialogItems[1 + i * 2 + 1];
+ idi.DataString = values[i];
}
int numDialogItems = initDialogItems.Size();
@@ -645,7 +747,7 @@ HRESULT CPlugin::ShowAttributesWindow()
dialogItems.Reserve(numDialogItems);
for (i = 0; i < numDialogItems; i++)
dialogItems.Add(FarDialogItem());
- g_StartupInfo.InitDialogItems(&initDialogItems.Front(),
+ g_StartupInfo.InitDialogItems(&initDialogItems.Front(),
&dialogItems.Front(), numDialogItems);
int maxLen = 0;
@@ -695,8 +797,8 @@ int CPlugin::ProcessKey(int key, unsigned int controlState)
PanelInfo panelInfo;
g_StartupInfo.ControlGetActivePanelInfo(panelInfo);
GetFilesReal(panelInfo.SelectedItems,
- panelInfo.SelectedItemsNumber, FALSE,
- UnicodeStringToMultiByte(folderPath, CP_OEMCP), OPM_SILENT, true);
+ panelInfo.SelectedItemsNumber, FALSE,
+ UnicodeStringToMultiByte(folderPath, CP_OEMCP), OPM_SILENT, true);
g_StartupInfo.Control(this, FCTL_UPDATEPANEL, NULL);
g_StartupInfo.Control(this, FCTL_REDRAWPANEL, NULL);
g_StartupInfo.Control(this, FCTL_UPDATEANOTHERPANEL, NULL);
diff --git a/CPP/7zip/UI/Far/Plugin.h b/CPP/7zip/UI/Far/Plugin.h
index d9b99fa9..034b1556 100755
--- a/CPP/7zip/UI/Far/Plugin.h
+++ b/CPP/7zip/UI/Far/Plugin.h
@@ -13,7 +13,7 @@
#include "FarUtils.h"
-const UInt32 kNumInfoLinesMax = 30; // Change it;
+const UInt32 kNumInfoLinesMax = 64;
class CPlugin
{
@@ -53,8 +53,8 @@ public:
UString Password;
- CPlugin(const UString &fileName,
- // const UString &aDefaultName,
+ CPlugin(const UString &fileName,
+ // const UString &aDefaultName,
IInFolderArchive *archiveHandler,
UString archiveTypeName
);
@@ -73,10 +73,10 @@ public:
HRESULT ExtractFiles(
bool decompressAllItems,
- const UINT32 *indices,
- UINT32 numIndices,
- bool silent,
- NExtract::NPathMode::EEnum pathMode,
+ const UINT32 *indices,
+ UINT32 numIndices,
+ bool silent,
+ NExtract::NPathMode::EEnum pathMode,
NExtract::NOverwriteMode::EEnum overwriteMode,
const UString &destPath,
bool passwordIsDefined, const UString &password);
@@ -84,7 +84,7 @@ public:
NFar::NFileOperationReturnCode::EEnum GetFiles(struct PluginPanelItem *aPanelItem, int itemsNumber,
int move, char *destPath, int opMode);
- NFar::NFileOperationReturnCode::EEnum GetFilesReal(struct PluginPanelItem *aPanelItems,
+ NFar::NFileOperationReturnCode::EEnum GetFilesReal(struct PluginPanelItem *aPanelItems,
int itemsNumber, int move, const char *_aDestPath, int opMode, bool aShowBox);
NFar::NFileOperationReturnCode::EEnum PutFiles(struct PluginPanelItem *aPanelItems, int itemsNumber,
diff --git a/CPP/7zip/UI/Far/PluginCommon.cpp b/CPP/7zip/UI/Far/PluginCommon.cpp
index 3e8e3cee..ce1a18bb 100755
--- a/CPP/7zip/UI/Far/PluginCommon.cpp
+++ b/CPP/7zip/UI/Far/PluginCommon.cpp
@@ -5,7 +5,7 @@
#include "Plugin.h"
/*
-void CPlugin::AddRealIndexOfFile(const CArchiveFolderItem &aFolder,
+void CPlugin::AddRealIndexOfFile(const CArchiveFolderItem &aFolder,
int anIndexInVector, vector<int> &aRealIndexes)
{
const CArchiveFolderFileItem &anItem = aFolder.m_FileSubItems[anIndexInVector];
@@ -15,7 +15,7 @@ void CPlugin::AddRealIndexOfFile(const CArchiveFolderItem &aFolder,
aRealIndexes.push_back(aHandlerItemIndex);
}
-void CPlugin::AddRealIndexes(const CArchiveFolderItem &anItem,
+void CPlugin::AddRealIndexes(const CArchiveFolderItem &anItem,
vector<int> &aRealIndexes)
{
int aHandlerItemIndex = m_ProxyHandler->GetHandlerItemIndex(anItem.m_Properties);
@@ -28,7 +28,7 @@ void CPlugin::AddRealIndexes(const CArchiveFolderItem &anItem,
}
-void CPlugin::GetRealIndexes(PluginPanelItem *aPanelItems, int anItemsNumber,
+void CPlugin::GetRealIndexes(PluginPanelItem *aPanelItems, int anItemsNumber,
vector<int> &aRealIndexes)
{
aRealIndexes.clear();
diff --git a/CPP/7zip/UI/Far/PluginDelete.cpp b/CPP/7zip/UI/Far/PluginDelete.cpp
index 95e43a36..a1dfb915 100755
--- a/CPP/7zip/UI/Far/PluginDelete.cpp
+++ b/CPP/7zip/UI/Far/PluginDelete.cpp
@@ -54,11 +54,11 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems,
}
else if (numItems > 1)
{
- sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles),
+ sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles),
numItems);
msgItems[1] = msg;
}
- if (g_StartupInfo.ShowMessage(FMSG_WARNING, NULL, msgItems,
+ if (g_StartupInfo.ShowMessage(FMSG_WARNING, NULL, msgItems,
sizeof(msgItems) / sizeof(msgItems[0]), 2) != 0)
return (FALSE);
}
@@ -71,8 +71,9 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems,
screenRestorer.Save();
progressBoxPointer = &progressBox;
- progressBox.Init(g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
- g_StartupInfo.GetMsgString(NMessageID::kDeleting), 1 << 17);
+ progressBox.Init(
+ // g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
+ g_StartupInfo.GetMsgString(NMessageID::kDeleting), 48);
}
NWorkDir::CInfo workDirInfo;
@@ -112,11 +113,11 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems,
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
- updateCallbackSpec->Init(m_ArchiveHandler, &progressBox);
+ updateCallbackSpec->Init(/* m_ArchiveHandler, */ &progressBox);
result = outArchive->DeleteItems(
- tempFileName,
+ tempFileName,
&indices.Front(), indices.Size(),
updateCallback);
updateCallback.Release();
diff --git a/CPP/7zip/UI/Far/PluginRead.cpp b/CPP/7zip/UI/Far/PluginRead.cpp
index 503ff639..7cf7c3c6 100755
--- a/CPP/7zip/UI/Far/PluginRead.cpp
+++ b/CPP/7zip/UI/Far/PluginRead.cpp
@@ -24,14 +24,14 @@ static const char *kHelpTopicExtrFromSevenZip = "Extract";
static const char kDirDelimiter = '\\';
-static const char *kExractPathHistoryName = "7-ZipExtractPath";
+static const char *kExractPathHistoryName = "7-ZipExtractPath";
HRESULT CPlugin::ExtractFiles(
bool decompressAllItems,
- const UINT32 *indices,
- UINT32 numIndices,
+ const UINT32 *indices,
+ UINT32 numIndices,
bool silent,
- NExtract::NPathMode::EEnum pathMode,
+ NExtract::NPathMode::EEnum pathMode,
NExtract::NOverwriteMode::EEnum overwriteMode,
const UString &destPath,
bool passwordIsDefined, const UString &password)
@@ -44,8 +44,9 @@ HRESULT CPlugin::ExtractFiles(
screenRestorer.Save();
progressBoxPointer = &progressBox;
- progressBox.Init(g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
- g_StartupInfo.GetMsgString(NMessageID::kExtracting), 1 << 17);
+ progressBox.Init(
+ // g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
+ g_StartupInfo.GetMsgString(NMessageID::kExtracting), 48);
}
@@ -54,10 +55,10 @@ HRESULT CPlugin::ExtractFiles(
extractCallbackSpec->Init(
CP_OEMCP,
- progressBoxPointer,
+ progressBoxPointer,
/*
GetDefaultName(m_FileName, m_ArchiverInfo.Extension),
- m_FileInfo.LastWriteTime, m_FileInfo.Attributes,
+ m_FileInfo.MTime, m_FileInfo.Attributes,
*/
passwordIsDefined, password);
@@ -74,14 +75,14 @@ HRESULT CPlugin::ExtractFiles(
}
}
-NFileOperationReturnCode::EEnum CPlugin::GetFiles(struct PluginPanelItem *panelItems,
+NFileOperationReturnCode::EEnum CPlugin::GetFiles(struct PluginPanelItem *panelItems,
int itemsNumber, int move, char *_aDestPath, int opMode)
{
- return GetFilesReal(panelItems, itemsNumber, move,
+ return GetFilesReal(panelItems, itemsNumber, move,
_aDestPath, opMode, (opMode & OPM_SILENT) == 0);
}
-NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *panelItems,
+NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *panelItems,
int itemsNumber, int move, const char *_aDestPath, int opMode, bool showBox)
{
if(move != 0)
@@ -130,31 +131,31 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
// { DI_EDIT, 5, 3, kXSize - 6, 3, true, false, 0, false, -1, destPath, NULL},
{ DI_SINGLEBOX, 4, 5, kXMid - 2, 5 + 4, false, false, 0, false, NMessageID::kExtractPathMode, NULL, NULL },
- { DI_RADIOBUTTON, 6, 6, 0, 0, false,
- extractionInfo.PathMode == NExtract::NPathMode::kFullPathnames,
+ { DI_RADIOBUTTON, 6, 6, 0, 0, false,
+ extractionInfo.PathMode == NExtract::NPathMode::kFullPathnames,
DIF_GROUP, false, NMessageID::kExtractPathFull, NULL, NULL },
- { DI_RADIOBUTTON, 6, 7, 0, 0, false,
+ { DI_RADIOBUTTON, 6, 7, 0, 0, false,
extractionInfo.PathMode == NExtract::NPathMode::kCurrentPathnames,
0, false, NMessageID::kExtractPathCurrent, NULL, NULL },
{ DI_RADIOBUTTON, 6, 8, 0, 0, false,
- extractionInfo.PathMode == NExtract::NPathMode::kNoPathnames,
+ extractionInfo.PathMode == NExtract::NPathMode::kNoPathnames,
false, 0, NMessageID::kExtractPathNo, NULL, NULL },
{ DI_SINGLEBOX, kXMid, 5, kXSize - 6, 5 + kNumOverwriteOptions, false, false, 0, false, NMessageID::kExtractOwerwriteMode, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false,
- extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAskBefore,
+ { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false,
+ extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAskBefore,
DIF_GROUP, false, NMessageID::kExtractOwerwriteAsk, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false,
- extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kWithoutPrompt,
+ { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false,
+ extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kWithoutPrompt,
0, false, NMessageID::kExtractOwerwritePrompt, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false,
- extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkipExisting,
+ { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false,
+ extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkipExisting,
0, false, NMessageID::kExtractOwerwriteSkip, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 9, 0, 0, false,
- extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRename,
+ { DI_RADIOBUTTON, kXMid + 2, 9, 0, 0, false,
+ extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRename,
0, false, NMessageID::kExtractOwerwriteAutoRename, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false,
- extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting,
+ { DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false,
+ extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting,
0, false, NMessageID::kExtractOwerwriteAutoRenameExisting, NULL, NULL },
{ DI_SINGLEBOX, 4, 10, kXMid- 2, 10 + 3, false, false, 0, false, NMessageID::kExtractFilesMode, NULL, NULL },
@@ -164,7 +165,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
{ DI_SINGLEBOX, kXMid, kPasswordYPos, kXSize - 6, kPasswordYPos + 2, false, false, 0, false, NMessageID::kExtractPassword, NULL, NULL },
{ DI_PSWEDIT, kXMid + 2, kPasswordYPos + 1, kXSize - 8, 12, false, false, 0, false, -1, oemPassword, NULL},
- { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
+ { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, true, NMessageID::kExtractExtract, NULL, NULL },
@@ -179,7 +180,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
for (;;)
{
- int askCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
+ int askCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
kHelpTopicExtrFromSevenZip, dialogItems, kNumDialogItems);
if (askCode != kOkButtonIndex)
return NFileOperationReturnCode::kInterruptedByUser;
@@ -239,7 +240,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
throw 31806;
oemPassword = dialogItems[kPasswordIndex].Data;
- password = MultiByteToUnicodeString(oemPassword, CP_OEMCP);
+ password = MultiByteToUnicodeString(oemPassword, CP_OEMCP);
passwordIsDefined = !password.IsEmpty();
}
@@ -255,11 +256,11 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
for (int i = 0; i < itemsNumber; i++)
indices.Add(panelItems[i].UserData);
- HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber,
- !showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode,
- MultiByteToUnicodeString(destPath, CP_OEMCP),
+ HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber,
+ !showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode,
+ MultiByteToUnicodeString(destPath, CP_OEMCP),
passwordIsDefined, password);
- // HRESULT result = ExtractFiles(decompressAllItems, realIndices, !showBox,
+ // HRESULT result = ExtractFiles(decompressAllItems, realIndices, !showBox,
// extractionInfo, destPath, passwordIsDefined, password);
if (result != S_OK)
{
diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp
index 80f9916a..2f7fbc83 100755
--- a/CPP/7zip/UI/Far/PluginWrite.cpp
+++ b/CPP/7zip/UI/Far/PluginWrite.cpp
@@ -34,9 +34,9 @@ static const char *kHelpTopic = "Update";
static LPCWSTR kTempArcivePrefix = L"7zA";
-static const char *kArchiveHistoryKeyName = "7-ZipArcName";
+static const char *kArchiveHistoryKeyName = "7-ZipArcName";
-static UINT32 g_MethodMap[] = { 0, 1, 3, 5, 7, 9 };
+static UINT32 g_MethodMap[] = { 0, 1, 3, 5, 7, 9 };
static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method)
{
@@ -55,7 +55,7 @@ static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method)
}
NFileOperationReturnCode::EEnum CPlugin::PutFiles(
- struct PluginPanelItem *panelItems, int numItems,
+ struct PluginPanelItem *panelItems, int numItems,
int moveMode, int opMode)
{
if(moveMode != 0)
@@ -95,17 +95,17 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
struct CInitDialogItem initItems[]={
{ DI_DOUBLEBOX, 3, 1, 72, kYSize - 2, false, false, 0, false, NMessageID::kUpdateTitle, NULL, NULL },
{ DI_SINGLEBOX, 4, 2, kXMid - 2, 2 + 7, false, false, 0, false, NMessageID::kUpdateMethod, NULL, NULL },
- { DI_RADIOBUTTON, 6, 3, 0, 0, methodIndex == 0, methodIndex == 0,
+ { DI_RADIOBUTTON, 6, 3, 0, 0, methodIndex == 0, methodIndex == 0,
DIF_GROUP, false, NMessageID::kUpdateMethodStore, NULL, NULL },
- { DI_RADIOBUTTON, 6, 4, 0, 0, methodIndex == 1, methodIndex == 1,
+ { DI_RADIOBUTTON, 6, 4, 0, 0, methodIndex == 1, methodIndex == 1,
0, false, NMessageID::kUpdateMethodFastest, NULL, NULL },
- { DI_RADIOBUTTON, 6, 5, 0, 0, methodIndex == 2, methodIndex == 2,
+ { DI_RADIOBUTTON, 6, 5, 0, 0, methodIndex == 2, methodIndex == 2,
0, false, NMessageID::kUpdateMethodFast, NULL, NULL },
- { DI_RADIOBUTTON, 6, 6, 0, 0, methodIndex == 3, methodIndex == 3,
+ { DI_RADIOBUTTON, 6, 6, 0, 0, methodIndex == 3, methodIndex == 3,
0, false, NMessageID::kUpdateMethodNormal, NULL, NULL },
- { DI_RADIOBUTTON, 6, 7, 0, 0, methodIndex == 4, methodIndex == 4,
+ { DI_RADIOBUTTON, 6, 7, 0, 0, methodIndex == 4, methodIndex == 4,
0, false, NMessageID::kUpdateMethodMaximum, NULL, NULL },
- { DI_RADIOBUTTON, 6, 8, 0, 0, methodIndex == 5, methodIndex == 5,
+ { DI_RADIOBUTTON, 6, 8, 0, 0, methodIndex == 5, methodIndex == 5,
0, false, NMessageID::kUpdateMethodUltra, NULL, NULL },
{ DI_SINGLEBOX, kXMid, 2, 70, 2 + 5, false, false, 0, false, NMessageID::kUpdateMode, NULL, NULL },
@@ -113,12 +113,12 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
DIF_GROUP, false, NMessageID::kUpdateModeAdd, NULL, NULL },
{ DI_RADIOBUTTON, kXMid + 2, 4, 0, 0, false, false,
0, false, NMessageID::kUpdateModeUpdate, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false, false,
+ { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false, false,
0, false, NMessageID::kUpdateModeFreshen, NULL, NULL },
{ DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, false,
0, false, NMessageID::kUpdateModeSynchronize, NULL, NULL },
- { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
+ { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, true, NMessageID::kUpdateAdd, NULL, NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kCancel, NULL, NULL }
@@ -128,7 +128,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
const int kOkButtonIndex = kNumDialogItems - 2;
FarDialogItem dialogItems[kNumDialogItems];
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
- int askCode = g_StartupInfo.ShowDialog(76, kYSize,
+ int askCode = g_StartupInfo.ShowDialog(76, kYSize,
kHelpTopic, dialogItems, kNumDialogItems);
if (askCode != kOkButtonIndex)
return NFileOperationReturnCode::kInterruptedByUser;
@@ -184,8 +184,9 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
screenRestorer.Save();
progressBoxPointer = &progressBox;
- progressBox.Init(g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
- g_StartupInfo.GetMsgString(NMessageID::kUpdating), 1 << 16);
+ progressBox.Init(
+ // g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
+ g_StartupInfo.GetMsgString(NMessageID::kUpdating), 48);
}
////////////////////////////
@@ -223,8 +224,8 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
// CSysString aCurrentFolder;
// MyGetCurrentDirectory(aCurrentFolder);
- // outArchive->SetFiles(MultiByteToUnicodeString(aCurrentFolder, CP_OEMCP),
- outArchive->SetFiles(L"",
+ // outArchive->SetFiles(MultiByteToUnicodeString(aCurrentFolder, CP_OEMCP),
+ outArchive->SetFiles(L"",
&fileNamePointers.Front(), fileNamePointers.Size());
BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
@@ -233,7 +234,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
- updateCallbackSpec->Init(m_ArchiveHandler, &progressBox);
+ updateCallbackSpec->Init(/* m_ArchiveHandler, */ &progressBox);
if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK)
return NFileOperationReturnCode::kError;
@@ -243,8 +244,8 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
outArchive.Release();
/*
- HRESULT result = Compress(fileNames, anArchivePrefix, *actionSet,
- m_ProxyHandler.get(),
+ HRESULT result = Compress(fileNames, anArchivePrefix, *actionSet,
+ m_ProxyHandler.get(),
m_ArchiverInfo.ClassID, compressionInfo.Method == 0,
compressionInfo.Method == 2, tempFileName, progressBoxPointer);
*/
@@ -305,7 +306,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
{
const PluginPanelItem &aPluginPanelItem = panelItems[i];
bool result;
- if(NFile::NFind::NAttributes::IsDirectory(aPluginPanelItem.FindData.dwFileAttributes))
+ if(NFile::NFind::NAttributes::IsDir(aPluginPanelItem.FindData.dwFileAttributes))
result = NFile::NDirectory::RemoveDirectoryWithSubItems(
aPluginPanelItem.FindData.cFileName);
else
@@ -397,7 +398,7 @@ UString CParsedPath::MergePath() const
/*
// {23170F69-40C1-278A-1000-000100030000}
-DEFINE_GUID(CLSID_CAgentArchiveHandler,
+DEFINE_GUID(CLSID_CAgentArchiveHandler,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00);
*/
@@ -412,11 +413,11 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
{
const PluginPanelItem &panelItem = pluginPanelItems[i];
CSysString fullName;
- if (strcmp(panelItem.FindData.cFileName, "..") == 0 &&
- NFind::NAttributes::IsDirectory(panelItem.FindData.dwFileAttributes))
+ if (strcmp(panelItem.FindData.cFileName, "..") == 0 &&
+ NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes))
return E_FAIL;
- if (strcmp(panelItem.FindData.cFileName, ".") == 0 &&
- NFind::NAttributes::IsDirectory(panelItem.FindData.dwFileAttributes))
+ if (strcmp(panelItem.FindData.cFileName, ".") == 0 &&
+ NFind::NAttributes::IsDir(panelItem.FindData.dwFileAttributes))
return E_FAIL;
if (!MyGetFullPathName(panelItem.FindData.cFileName, fullName))
return E_FAIL;
@@ -498,7 +499,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
char updateAddToArchiveString[512];
const AString s = GetSystemString(arcInfo.Name, CP_OEMCP);
- sprintf(updateAddToArchiveString,
+ sprintf(updateAddToArchiveString,
g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), (const char *)s);
int methodIndex = 0;
@@ -520,34 +521,34 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
// { DI_EDIT, 5, 3, 70, 3, true, false, 0, false, -1, archiveName, NULL},
{ DI_SINGLEBOX, 4, 4, kXMid - 2, 4 + 7, false, false, 0, false, NMessageID::kUpdateMethod, NULL, NULL },
- { DI_RADIOBUTTON, 6, 5, 0, 0, false, methodIndex == 0,
+ { DI_RADIOBUTTON, 6, 5, 0, 0, false, methodIndex == 0,
DIF_GROUP, false, NMessageID::kUpdateMethodStore, NULL, NULL },
- { DI_RADIOBUTTON, 6, 6, 0, 0, false, methodIndex == 1,
+ { DI_RADIOBUTTON, 6, 6, 0, 0, false, methodIndex == 1,
0, false, NMessageID::kUpdateMethodFastest, NULL, NULL },
- { DI_RADIOBUTTON, 6, 7, 0, 0, false, methodIndex == 2,
+ { DI_RADIOBUTTON, 6, 7, 0, 0, false, methodIndex == 2,
0, false, NMessageID::kUpdateMethodFast, NULL, NULL },
- { DI_RADIOBUTTON, 6, 8, 0, 0, false, methodIndex == 3,
+ { DI_RADIOBUTTON, 6, 8, 0, 0, false, methodIndex == 3,
0, false, NMessageID::kUpdateMethodNormal, NULL, NULL },
- { DI_RADIOBUTTON, 6, 9, 0, 0, false, methodIndex == 4,
+ { DI_RADIOBUTTON, 6, 9, 0, 0, false, methodIndex == 4,
false, 0, NMessageID::kUpdateMethodMaximum, NULL, NULL },
- { DI_RADIOBUTTON, 6, 10, 0, 0, false, methodIndex == 5,
+ { DI_RADIOBUTTON, 6, 10, 0, 0, false, methodIndex == 5,
false, 0, NMessageID::kUpdateMethodUltra, NULL, NULL },
{ DI_SINGLEBOX, kXMid, 4, 70, 4 + 5, false, false, 0, false, NMessageID::kUpdateMode, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false,
+ { DI_RADIOBUTTON, kXMid + 2, 5, 0, 0, false,
actionSet == &kAddActionSet,
DIF_GROUP, false, NMessageID::kUpdateModeAdd, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false,
+ { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false,
actionSet == &kUpdateActionSet,
0, false, NMessageID::kUpdateModeUpdate, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false,
+ { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false,
actionSet == &kFreshActionSet,
0, false, NMessageID::kUpdateModeFreshen, NULL, NULL },
- { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false,
+ { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false,
actionSet == &kSynchronizeActionSet,
0, false, NMessageID::kUpdateModeSynchronize, NULL, NULL },
- { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
+ { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, true, NMessageID::kUpdateAdd, NULL, NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kUpdateSelectArchiver, NULL, NULL },
@@ -561,7 +562,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
FarDialogItem dialogItems[kNumDialogItems];
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
- int askCode = g_StartupInfo.ShowDialog(76, kYSize,
+ int askCode = g_StartupInfo.ShowDialog(76, kYSize,
kHelpTopic, dialogItems, kNumDialogItems);
archiveNameA = dialogItems[kArchiveNameIndex].Data;
@@ -598,7 +599,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
}
}
- int index = g_StartupInfo.Menu(FMENU_AUTOHIGHLIGHT,
+ int index = g_StartupInfo.Menu(FMENU_AUTOHIGHLIGHT,
g_StartupInfo.GetMsgString(NMessageID::kUpdateSelectArchiverMenuTitle),
NULL, archiverNames, archiverIndex);
if(index >= 0)
@@ -672,8 +673,9 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
screenRestorer.Save();
progressBoxPointer = &progressBox;
- progressBox.Init(g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
- g_StartupInfo.GetMsgString(NMessageID::kUpdating), 1 << 16);
+ progressBox.Init(
+ // g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
+ g_StartupInfo.GetMsgString(NMessageID::kUpdating), 48);
NFind::CFileInfoW fileInfo;
@@ -683,7 +685,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
CMyComPtr<IInFolderArchive> archiveHandler;
if(NFind::FindFile(fullArchiveName, fileInfo))
{
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
throw "There is Directory with such name";
CAgent *agentSpec = new CAgent;
@@ -691,8 +693,8 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
// CLSID realClassID;
CMyComBSTR archiveType;
RINOK(agentSpec->Open(
- GetUnicodeString(fullArchiveName, CP_OEMCP),
- // &realClassID,
+ GetUnicodeString(fullArchiveName, CP_OEMCP),
+ // &realClassID,
&archiveType,
NULL));
@@ -730,8 +732,8 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
outArchive->SetFolder(NULL);
// CSysString aCurrentFolder;
// MyGetCurrentDirectory(aCurrentFolder);
- // outArchive->SetFiles(MultiByteToUnicodeString(aCurrentFolder, CP_OEMCP),
- outArchive->SetFiles(L"",
+ // outArchive->SetFiles(MultiByteToUnicodeString(aCurrentFolder, CP_OEMCP),
+ outArchive->SetFiles(L"",
&fileNamePointers.Front(), fileNamePointers.Size());
BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
@@ -740,14 +742,14 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
- updateCallbackSpec->Init(archiveHandler, &progressBox);
+ updateCallbackSpec->Init(/* archiveHandler, */ &progressBox);
RINOK(SetOutProperties(outArchive, compressionInfo.Level));
HRESULT result = outArchive->DoOperation(
codecs, archiverIndex,
- tempFileName, actionSetByte,
+ tempFileName, actionSetByte,
NULL, updateCallback);
updateCallback.Release();
outArchive.Release();
diff --git a/CPP/7zip/UI/Far/ProgressBox.cpp b/CPP/7zip/UI/Far/ProgressBox.cpp
index d708331a..b13b0b51 100755
--- a/CPP/7zip/UI/Far/ProgressBox.cpp
+++ b/CPP/7zip/UI/Far/ProgressBox.cpp
@@ -5,100 +5,108 @@
#include <stdio.h>
#include "ProgressBox.h"
-
+#include "Common/IntToString.h"
#include "FarUtils.h"
-using namespace NFar;
-
-static void CopySpaces(char *destString, int numSpaces)
+static void CopySpaces(char *dest, int numSpaces)
{
int i;
- for(i = 0; i < numSpaces; i++)
- destString[i] = ' ';
- destString[i] = '\0';
+ for (i = 0; i < numSpaces; i++)
+ dest[i] = ' ';
+ dest[i] = '\0';
}
-/////////////////////////////////
-// CMessageBox
+void ConvertUInt64ToStringAligned(UInt64 value, char *s, int alignSize)
+{
+ char temp[32];
+ ConvertUInt64ToString(value, temp);
+ int len = (int)strlen(temp);
+ int numSpaces = 0;
+ if (len < alignSize)
+ {
+ numSpaces = alignSize - len;
+ CopySpaces(s, numSpaces);
+ }
+ strcpy(s + numSpaces, temp);
+}
-const int kNumStringsMax = 10;
-void CMessageBox::Init(const CSysString &title, const CSysString &message,
- int numStrings, int width)
-{
- if (numStrings > kNumStringsMax)
- throw 120620;
- m_NumStrings = numStrings;
- m_Width = width;
+// ---------- CMessageBox ----------
- m_Title = title;
- m_Message = message;
-}
+static const int kMaxLen = 255;
-const int kNumStaticStrings = 2;
+void CMessageBox::Init(const AString &title, int width)
+{
+ _title = title;
+ _width = MyMin(width, kMaxLen);
+}
-void CMessageBox::ShowProcessMessages(const char *messages[])
+void CMessageBox::ShowMessages(const char *strings[], int numStrings)
{
+ const int kNumStaticStrings = 1;
+ const int kNumStringsMax = 10;
+
+ if (numStrings > kNumStringsMax)
+ numStrings = kNumStringsMax;
+
const char *msgItems[kNumStaticStrings + kNumStringsMax];
- msgItems[0] = m_Title;
- msgItems[1] = m_Message;
+ msgItems[0] = _title;
- char formattedMessages[kNumStringsMax][256];
+ char formattedMessages[kNumStringsMax][kMaxLen + 1];
- for (int i = 0; i < m_NumStrings; i++)
+ for (int i = 0; i < numStrings; i++)
{
char *formattedMessage = formattedMessages[i];
- int len = (int)strlen(messages[i]);
- int size = MyMax(m_Width, len);
- int startPos = (size - len) / 2;
- CopySpaces(formattedMessage, startPos);
- MyStringCopy(formattedMessage + startPos, messages[i]);
- CopySpaces(formattedMessage + startPos + len, size - startPos - len);
+ const char *s = strings[i];
+ int len = (int)strlen(s);
+ if (len < kMaxLen)
+ {
+ int size = MyMax(_width, len);
+ int startPos = (size - len) / 2;
+ CopySpaces(formattedMessage, startPos);
+ strcpy(formattedMessage + startPos, s);
+ CopySpaces(formattedMessage + startPos + len, size - startPos - len);
+ }
+ else
+ {
+ strncpy(formattedMessage, s, kMaxLen);
+ formattedMessage[kMaxLen] = 0;
+ }
msgItems[kNumStaticStrings + i] = formattedMessage;
}
-
- g_StartupInfo.ShowMessage(0, NULL, msgItems, kNumStaticStrings + m_NumStrings, 0);
+ NFar::g_StartupInfo.ShowMessage(0, NULL, msgItems, kNumStaticStrings + numStrings, 0);
}
-/////////////////////////////////
-// CProgressBox
-
-void CProgressBox::Init(const CSysString &title, const CSysString &message,
- UInt64 step)
-{
- CMessageBox::Init(title, message, 1, 22);
- m_Step = step;
- m_CompletedPrev = 0;
- m_Total = 0;
-}
-
-
-void CProgressBox::ShowProcessMessage(const char *message)
-{
- CMessageBox::ShowProcessMessages(&message);
-}
-void CProgressBox::PrintPercent(UInt64 percent)
-{
- char valueBuffer[32];
- sprintf(valueBuffer, "%I64u%%", percent);
- ShowProcessMessage(valueBuffer);
-}
+// ---------- CProgressBox ----------
-void CProgressBox::SetTotal(UInt64 total)
+void CProgressBox::Init(const AString &title, int width)
{
- m_Total = total;
+ CMessageBox::Init(title, width);
+ _prevMessage.Empty();
+ _prevPercentMessage.Empty();
+ _wasShown = false;
}
-void CProgressBox::PrintCompeteValue(UInt64 completed)
+void CProgressBox::Progress(const UInt64 *total, const UInt64 *completed, const AString &message)
{
- if (completed >= m_CompletedPrev + m_Step || completed < m_CompletedPrev ||
- completed == 0)
+ AString percentMessage;
+ if (total != 0 && completed != 0)
{
- if (m_Total == 0)
- PrintPercent(0);
- else
- PrintPercent(completed * 100 / m_Total);
- m_CompletedPrev = completed;
+ UInt64 totalVal = *total;
+ if (totalVal == 0)
+ totalVal = 1;
+ char buf[32];
+ ConvertUInt64ToStringAligned(*completed * 100 / totalVal, buf, 3);
+ strcat(buf, "%");
+ percentMessage = buf;
+ }
+ if (message != _prevMessage || percentMessage != _prevPercentMessage || !_wasShown)
+ {
+ _prevMessage = message;
+ _prevPercentMessage = percentMessage;
+ const char *strings[] = { message, percentMessage };
+ ShowMessages(strings, sizeof(strings) / sizeof(strings[0]));
+ _wasShown = true;
}
}
diff --git a/CPP/7zip/UI/Far/ProgressBox.h b/CPP/7zip/UI/Far/ProgressBox.h
index 9e6f671a..2bada8e9 100755
--- a/CPP/7zip/UI/Far/ProgressBox.h
+++ b/CPP/7zip/UI/Far/ProgressBox.h
@@ -6,30 +6,25 @@
#include "Common/MyString.h"
#include "Common/Types.h"
+void ConvertUInt64ToStringAligned(UInt64 value, char *s, int alignSize);
+
class CMessageBox
{
- CSysString m_Title;
- CSysString m_Message;
- int m_NumStrings;
- int m_Width;
+ AString _title;
+ int _width;
public:
- void Init(const CSysString &title,
- const CSysString &message, int numStrings, int width);
- void ShowProcessMessages(const char *messages[]);
+ void Init(const AString &title, int width);
+ void ShowMessages(const char *strings[], int numStrings);
};
class CProgressBox: public CMessageBox
{
- UInt64 m_Total;
- UInt64 m_CompletedPrev;
- UInt64 m_Step;
+ AString _prevMessage;
+ AString _prevPercentMessage;
+ bool _wasShown;
public:
- void Init(const CSysString &title,
- const CSysString &message, UInt64 step);
- void ShowProcessMessage(const char *message);
- void PrintPercent(UInt64 percent);
- void PrintCompeteValue(UInt64 completed);
- void SetTotal(UInt64 total);
+ void Init(const AString &title, int width);
+ void Progress(const UInt64 *total, const UInt64 *completed, const AString &message);
};
#endif
diff --git a/CPP/7zip/UI/Far/UpdateCallback100.cpp b/CPP/7zip/UI/Far/UpdateCallback100.cpp
index ce4fa05e..dc90c810 100755
--- a/CPP/7zip/UI/Far/UpdateCallback100.cpp
+++ b/CPP/7zip/UI/Far/UpdateCallback100.cpp
@@ -15,22 +15,18 @@ STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 /* numFiles */)
return S_OK;
}
-STDMETHODIMP CUpdateCallback100Imp::SetTotal(UINT64 aSize)
+STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
{
- if (m_ProgressBox != 0)
- {
- m_ProgressBox->SetTotal(aSize);
- m_ProgressBox->PrintCompeteValue(0);
- }
+ _total = size;
return S_OK;
}
-STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UINT64 *aCompleteValue)
+STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
{
- if(WasEscPressed())
+ if (WasEscPressed())
return E_ABORT;
- if (m_ProgressBox != 0 && aCompleteValue != NULL)
- m_ProgressBox->PrintCompeteValue(*aCompleteValue);
+ if (_progressBox != 0)
+ _progressBox->Progress(&_total, completeValue, AString());
return S_OK;
}
@@ -44,15 +40,14 @@ STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t* /* name */)
return S_OK;
}
-STDMETHODIMP CUpdateCallback100Imp::OperationResult(INT32 /* operationResult */)
+STDMETHODIMP CUpdateCallback100Imp::OperationResult(Int32 /* opRes */)
{
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message)
{
- CSysString s = UnicodeStringToMultiByte(message, CP_OEMCP);
- if (g_StartupInfo.ShowMessage(s) == -1)
+ if (g_StartupInfo.ShowMessage(UnicodeStringToMultiByte(message, CP_OEMCP)) == -1)
return E_ABORT;
return S_OK;
}
diff --git a/CPP/7zip/UI/Far/UpdateCallback100.h b/CPP/7zip/UI/Far/UpdateCallback100.h
index f12193e9..45f4daea 100755
--- a/CPP/7zip/UI/Far/UpdateCallback100.h
+++ b/CPP/7zip/UI/Far/UpdateCallback100.h
@@ -9,34 +9,25 @@
#include "ProgressBox.h"
-class CUpdateCallback100Imp:
+class CUpdateCallback100Imp:
public IFolderArchiveUpdateCallback,
public CMyUnknownImp
{
+ // CMyComPtr<IInFolderArchive> _archiveHandler;
+ CProgressBox *_progressBox;
+ UInt64 _total;
+
public:
MY_UNKNOWN_IMP
- // IProfress
-
- STDMETHOD(SetTotal)(UINT64 aSize);
- STDMETHOD(SetCompleted)(const UINT64 *aCompleteValue);
+ INTERFACE_IProgress(;)
+ INTERFACE_IFolderArchiveUpdateCallback(;)
- // IUpdateCallBack
- STDMETHOD(CompressOperation)(const wchar_t *aName);
- STDMETHOD(DeleteOperation)(const wchar_t *aName);
- STDMETHOD(OperationResult)(INT32 aOperationResult);
- STDMETHOD(UpdateErrorMessage)(const wchar_t *message);
- STDMETHOD(SetNumFiles)(UInt64 numFiles);
-
-private:
- CMyComPtr<IInFolderArchive> m_ArchiveHandler;
- CProgressBox *m_ProgressBox;
-public:
- void Init(IInFolderArchive *anArchiveHandler,
- CProgressBox *aProgressBox)
+ CUpdateCallback100Imp(): _total(0) {}
+ void Init(/* IInFolderArchive *archiveHandler, */ CProgressBox *progressBox)
{
- m_ArchiveHandler = anArchiveHandler;
- m_ProgressBox = aProgressBox;
+ // _archiveHandler = archiveHandler;
+ _progressBox = progressBox;
}
};
diff --git a/CPP/7zip/UI/Far/makefile b/CPP/7zip/UI/Far/makefile
index 1210e961..2c820077 100755
--- a/CPP/7zip/UI/Far/makefile
+++ b/CPP/7zip/UI/Far/makefile
@@ -39,6 +39,7 @@ WIN_OBJS = \
$O\PropVariantConversions.obj \
$O\Registry.obj \
$O\Synchronization.obj \
+ $O\Time.obj \
7ZIP_COMMON_OBJS = \
$O\FilePathAutoRename.obj \
diff --git a/CPP/7zip/UI/FileManager/AboutDialog.cpp b/CPP/7zip/UI/FileManager/AboutDialog.cpp
index fcdea7e0..a450a765 100755
--- a/CPP/7zip/UI/FileManager/AboutDialog.cpp
+++ b/CPP/7zip/UI/FileManager/AboutDialog.cpp
@@ -7,7 +7,7 @@
#include "HelpUtils.h"
#include "LangUtils.h"
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_ABOUT_STATIC_REGISTER_INFO, 0x01000103 },
{ IDC_ABOUT_BUTTON_SUPPORT, 0x01000104 },
@@ -23,7 +23,7 @@ static LPCTSTR kSupportPageURL = MY_HOME_PAGE TEXT("support.html");
static LPCWSTR kHelpTopic = L"start.htm";
-bool CAboutDialog::OnInit()
+bool CAboutDialog::OnInit()
{
LangSetWindowText(HWND(*this), 0x01000100);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
diff --git a/CPP/7zip/UI/FileManager/App.cpp b/CPP/7zip/UI/FileManager/App.cpp
index 4a4dcc96..ec1d2df4 100755
--- a/CPP/7zip/UI/FileManager/App.cpp
+++ b/CPP/7zip/UI/FileManager/App.cpp
@@ -3,22 +3,26 @@
#include "StdAfx.h"
#include "resource.h"
+#include "OverwriteDialogRes.h"
+#include "Common/IntToString.h"
#include "Common/StringConvert.h"
-#include "Windows/FileDir.h"
-#include "Windows/Error.h"
+
#include "Windows/COM.h"
+#include "Windows/Error.h"
+#include "Windows/FileDir.h"
+#include "Windows/PropVariant.h"
+#include "Windows/PropVariantConversions.h"
#include "Windows/Thread.h"
-#include "IFolder.h"
#include "App.h"
-
#include "CopyDialog.h"
-
#include "ExtractCallback.h"
-#include "ViewSettings.h"
-#include "RegistryUtils.h"
+#include "FormatUtils.h"
+#include "IFolder.h"
#include "LangUtils.h"
+#include "RegistryUtils.h"
+#include "ViewSettings.h"
using namespace NWindows;
using namespace NFile;
@@ -27,22 +31,23 @@ using namespace NFind;
extern DWORD g_ComCtl32Version;
extern HINSTANCE g_hInstance;
-static LPCWSTR kTempDirPrefix = L"7zE";
+static LPCWSTR kTempDirPrefix = L"7zE";
void CPanelCallbackImp::OnTab()
{
if (g_App.NumPanels != 1)
- _app->Panels[1 - _index].SetFocusToList();
+ _app->Panels[1 - _index].SetFocusToList();
_app->RefreshTitle();
}
void CPanelCallbackImp::SetFocusToPath(int index)
-{
+{
int newPanelIndex = index;
if (g_App.NumPanels == 1)
newPanelIndex = g_App.LastFocusedPanel;
- _app->Panels[newPanelIndex]._headerComboBox.SetFocus();
_app->RefreshTitle();
+ _app->Panels[newPanelIndex]._headerComboBox.SetFocus();
+ _app->Panels[newPanelIndex]._headerComboBox.ShowDropDown();
}
@@ -69,7 +74,7 @@ void CApp::SetListSettings()
/*
if (ReadSingleClick())
{
- extendedStyle |= LVS_EX_ONECLICKACTIVATE
+ extendedStyle |= LVS_EX_ONECLICKACTIVATE
| LVS_EX_TRACKSELECT;
if (ReadUnderline())
extendedStyle |= LVS_EX_UNDERLINEHOT;
@@ -99,10 +104,10 @@ void CApp::SetShowSystemMenu()
ShowSystemMenu = ReadShowSystemMenu();
}
-void CApp::CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted)
+HRESULT CApp::CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted)
{
if (PanelsCreated[panelIndex])
- return;
+ return S_OK;
m_PanelCallbackImp[panelIndex].Init(this, panelIndex);
UString path;
if (mainPath.IsEmpty())
@@ -113,9 +118,10 @@ void CApp::CreateOnePanel(int panelIndex, const UString &mainPath, bool &archive
else
path = mainPath;
int id = 1000 + 100 * panelIndex;
- Panels[panelIndex].Create(_window, _window,
- id, path, &m_PanelCallbackImp[panelIndex], &AppState, archiveIsOpened, encrypted);
+ RINOK(Panels[panelIndex].Create(_window, _window,
+ id, path, &m_PanelCallbackImp[panelIndex], &AppState, archiveIsOpened, encrypted));
PanelsCreated[panelIndex] = true;
+ return S_OK;
}
static void CreateToolbar(
@@ -124,27 +130,27 @@ static void CreateToolbar(
NWindows::NControl::CToolBar &toolBar,
bool LargeButtons)
{
- toolBar.Attach(::CreateWindowEx(0,
+ toolBar.Attach(::CreateWindowEx(0,
TOOLBARCLASSNAME,
NULL, 0
| WS_VISIBLE
| TBSTYLE_FLAT
- | TBSTYLE_TOOLTIPS
+ | TBSTYLE_TOOLTIPS
| WS_CHILD
| CCS_NOPARENTALIGN
- | CCS_NORESIZE
+ | CCS_NORESIZE
| CCS_NODIVIDER
// | TBSTYLE_AUTOSIZE
- // | CCS_ADJUSTABLE
+ // | CCS_ADJUSTABLE
,0,0,0,0, parent, NULL, g_hInstance, NULL));
- // TB_BUTTONSTRUCTSIZE message, which is required for
+ // TB_BUTTONSTRUCTSIZE message, which is required for
// backward compatibility.
toolBar.ButtonStructSize();
imageList.Create(
- LargeButtons ? 48: 24,
- LargeButtons ? 36: 24,
+ LargeButtons ? 48: 24,
+ LargeButtons ? 36: 24,
ILC_MASK, 0, 0);
toolBar.SetImageList(0, imageList);
}
@@ -154,20 +160,20 @@ struct CButtonInfo
UINT commandID;
UINT BitmapResID;
UINT Bitmap2ResID;
- UINT StringResID;
+ UINT StringResID;
UINT32 LangID;
UString GetText()const { return LangString(StringResID, LangID); };
};
-static CButtonInfo g_StandardButtons[] =
+static CButtonInfo g_StandardButtons[] =
{
{ IDM_COPY_TO, IDB_COPY, IDB_COPY2, IDS_BUTTON_COPY, 0x03020420},
{ IDM_MOVE_TO, IDB_MOVE, IDB_MOVE2, IDS_BUTTON_MOVE, 0x03020421},
{ IDM_DELETE, IDB_DELETE, IDB_DELETE2, IDS_BUTTON_DELETE, 0x03020422} ,
- { IDM_FILE_PROPERTIES, IDB_INFO, IDB_INFO2, IDS_BUTTON_INFO, 0x03020423}
+ { IDM_FILE_PROPERTIES, IDB_INFO, IDB_INFO2, IDS_BUTTON_INFO, 0x03020423}
};
-static CButtonInfo g_ArchiveButtons[] =
+static CButtonInfo g_ArchiveButtons[] =
{
{ kAddCommand, IDB_ADD, IDB_ADD2, IDS_ADD, 0x03020400},
{ kExtractCommand, IDB_EXTRACT, IDB_EXTRACT2, IDS_EXTRACT, 0x03020401},
@@ -190,37 +196,37 @@ bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, UStri
void SetButtonText(UINT32 commandID, UString &s)
{
- if (SetButtonText(commandID, g_StandardButtons,
+ if (SetButtonText(commandID, g_StandardButtons,
sizeof(g_StandardButtons) / sizeof(g_StandardButtons[0]), s))
return;
- SetButtonText(commandID, g_ArchiveButtons,
+ SetButtonText(commandID, g_ArchiveButtons,
sizeof(g_ArchiveButtons) / sizeof(g_ArchiveButtons[0]), s);
}
static void AddButton(
NControl::CImageList &imageList,
- NControl::CToolBar &toolBar,
+ NControl::CToolBar &toolBar,
CButtonInfo &butInfo,
bool showText,
bool large)
{
- TBBUTTON but;
- but.iBitmap = 0;
- but.idCommand = butInfo.commandID;
- but.fsState = TBSTATE_ENABLED;
+ TBBUTTON but;
+ but.iBitmap = 0;
+ but.idCommand = butInfo.commandID;
+ but.fsState = TBSTATE_ENABLED;
but.fsStyle = BTNS_BUTTON
- // | BTNS_AUTOSIZE
+ // | BTNS_AUTOSIZE
;
but.dwData = 0;
UString s = butInfo.GetText();
but.iString = 0;
if (showText)
- but.iString = (INT_PTR)(LPCWSTR)s;
+ but.iString = (INT_PTR)(LPCWSTR)s;
but.iBitmap = imageList.GetImageCount();
- HBITMAP b = ::LoadBitmap(g_hInstance,
- large ?
+ HBITMAP b = ::LoadBitmap(g_hInstance,
+ large ?
MAKEINTRESOURCE(butInfo.BitmapResID):
MAKEINTRESOURCE(butInfo.Bitmap2ResID));
if (b != 0)
@@ -245,7 +251,7 @@ static void AddBand(NControl::CReBar &reBar, NControl::CToolBar &toolBar)
REBARBANDINFO rbBand;
rbBand.cbSize = sizeof(REBARBANDINFO); // Required
- rbBand.fMask = RBBIM_STYLE
+ rbBand.fMask = RBBIM_STYLE
| RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;
rbBand.fStyle = RBBS_CHILDEDGE; // RBBS_NOGRIPPER;
rbBand.cxMinChild = size.cx; // rect.right - rect.left;
@@ -258,7 +264,7 @@ static void AddBand(NControl::CReBar &reBar, NControl::CToolBar &toolBar)
}
void CApp::ReloadToolbars()
-{
+{
if (!_rebar)
return;
HWND parent = _rebar;
@@ -276,7 +282,7 @@ void CApp::ReloadToolbars()
{
CreateToolbar(parent, _archiveButtonsImageList, _archiveToolBar, LargeButtons);
for (int i = 0; i < sizeof(g_ArchiveButtons) / sizeof(g_ArchiveButtons[0]); i++)
- AddButton(_archiveButtonsImageList, _archiveToolBar, g_ArchiveButtons[i],
+ AddButton(_archiveButtonsImageList, _archiveToolBar, g_ArchiveButtons[i],
ShowButtonsLables, LargeButtons);
AddBand(_rebar, _archiveToolBar);
}
@@ -285,7 +291,7 @@ void CApp::ReloadToolbars()
{
CreateToolbar(parent, _standardButtonsImageList, _standardToolBar, LargeButtons);
for (int i = 0; i < sizeof(g_StandardButtons) / sizeof(g_StandardButtons[0]); i++)
- AddButton(_standardButtonsImageList, _standardToolBar, g_StandardButtons[i],
+ AddButton(_standardButtonsImageList, _standardToolBar, g_StandardButtons[i],
ShowButtonsLables, LargeButtons);
AddBand(_rebar, _standardToolBar);
}
@@ -305,16 +311,16 @@ void CApp::ReloadRebar(HWND hwnd)
_rebar.Attach(::CreateWindowEx(WS_EX_TOOLWINDOW,
REBARCLASSNAME,
- NULL,
- WS_VISIBLE
- | WS_BORDER
- | WS_CHILD
- | WS_CLIPCHILDREN
- | WS_CLIPSIBLINGS
- // | CCS_NODIVIDER
+ NULL,
+ WS_VISIBLE
+ | WS_BORDER
+ | WS_CHILD
+ | WS_CLIPCHILDREN
+ | WS_CLIPSIBLINGS
+ // | CCS_NODIVIDER
// | CCS_NOPARENTALIGN // it's bead for moveing of two bands
// | CCS_TOP
- | RBS_VARHEIGHT
+ | RBS_VARHEIGHT
| RBS_BANDBORDERS
// | RBS_AUTOSIZE
,0,0,0,0, hwnd, NULL, g_hInstance, NULL));
@@ -329,7 +335,7 @@ void CApp::ReloadRebar(HWND hwnd)
ReloadToolbars();
}
-void CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted)
+HRESULT CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted)
{
ReadToolbar();
ReloadRebar(hwnd);
@@ -360,7 +366,7 @@ void CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archi
bool archiveIsOpened2 = false;
bool encrypted2 = false;
bool mainPanel = (i == LastFocusedPanel);
- CreateOnePanel(i, mainPanel ? mainPath : L"", archiveIsOpened2, encrypted2);
+ RINOK(CreateOnePanel(i, mainPanel ? mainPath : L"", archiveIsOpened2, encrypted2));
if (mainPanel)
{
archiveIsOpened = archiveIsOpened2;
@@ -369,17 +375,18 @@ void CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archi
}
SetFocusedPanel(LastFocusedPanel);
Panels[LastFocusedPanel].SetFocusToList();
+ return S_OK;
}
extern void MoveSubWindows(HWND hWnd);
-void CApp::SwitchOnOffOnePanel()
+HRESULT CApp::SwitchOnOffOnePanel()
{
if (NumPanels == 1)
{
NumPanels++;
bool archiveIsOpened, encrypted;
- CreateOnePanel(1 - LastFocusedPanel, UString(), archiveIsOpened, encrypted);
+ RINOK(CreateOnePanel(1 - LastFocusedPanel, UString(), archiveIsOpened, encrypted));
Panels[1 - LastFocusedPanel].Enable(true);
Panels[1 - LastFocusedPanel].Show(SW_SHOWNORMAL);
}
@@ -390,6 +397,7 @@ void CApp::SwitchOnOffOnePanel()
Panels[1 - LastFocusedPanel].Show(SW_HIDE);
}
MoveSubWindows(_window);
+ return S_OK;
}
void CApp::Save()
@@ -412,17 +420,17 @@ void CApp::Save()
void CApp::Release()
{
- // It's for unloading COM dll's: don't change it.
+ // It's for unloading COM dll's: don't change it.
for (int i = 0; i < kNumPanelsMax; i++)
Panels[i].Release();
}
static bool IsThereFolderOfPath(const UString &path)
{
- CFileInfoW fileInfo;
- if (!FindFile(path, fileInfo))
+ CFileInfoW fi;
+ if (!FindFile(path, fi))
return false;
- return fileInfo.IsDirectory();
+ return fi.IsDir();
}
// reduces path to part that exists on disk
@@ -470,6 +478,99 @@ static bool IsPathAbsolute(const UString &path)
return false;
}
+extern UString ConvertSizeToString(UInt64 value);
+
+static UString AddSizeValue(UInt64 size)
+{
+ return MyFormatNew(IDS_FILE_SIZE, 0x02000982, ConvertSizeToString(size));
+}
+
+static void AddValuePair1(UINT resourceID, UInt32 langID, UInt64 size, UString &s)
+{
+ s += LangString(resourceID, langID);
+ s += L" ";
+ s += AddSizeValue(size);
+ s += L"\n";
+}
+
+void AddValuePair2(UINT resourceID, UInt32 langID, UInt64 num, UInt64 size, UString &s)
+{
+ if (num == 0)
+ return;
+ s += LangString(resourceID, langID);
+ s += L" ";
+ s += ConvertSizeToString(num);
+
+ if (size != (UInt64)(Int64)-1)
+ {
+ s += L" ( ";
+ s += AddSizeValue(size);
+ s += L" )";
+ }
+ s += L"\n";
+}
+
+static void AddPropValueToSum(IFolderFolder *folder, int index, PROPID propID, UInt64 &sum)
+{
+ if (sum == (UInt64)(Int64)-1)
+ return;
+ NCOM::CPropVariant prop;
+ folder->GetProperty(index, propID, &prop);
+ switch(prop.vt)
+ {
+ case VT_UI4:
+ case VT_UI8:
+ sum += ConvertPropVariantToUInt64(prop);
+ break;
+ default:
+ sum = (UInt64)(Int64)-1;
+ }
+}
+
+UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
+{
+ UString info;
+ UInt64 numDirs, numFiles, filesSize, foldersSize;
+ numDirs = numFiles = filesSize = foldersSize = 0;
+ int i;
+ for (i = 0; i < indices.Size(); i++)
+ {
+ int index = indices[i];
+ if (IsItemFolder(index))
+ {
+ AddPropValueToSum(_folder, index, kpidSize, foldersSize);
+ numDirs++;
+ }
+ else
+ {
+ AddPropValueToSum(_folder, index, kpidSize, filesSize);
+ numFiles++;
+ }
+ }
+
+ AddValuePair2(IDS_FOLDERS_COLON, 0x02000321, numDirs, foldersSize, info);
+ AddValuePair2(IDS_FILES_COLON, 0x02000320, numFiles, filesSize, info);
+ int numDefined = ((foldersSize != (UInt64)(Int64)-1) && foldersSize != 0) ? 1: 0;
+ numDefined += ((filesSize != (UInt64)(Int64)-1) && filesSize != 0) ? 1: 0;
+ if (numDefined == 2)
+ AddValuePair1(IDS_SIZE_COLON, 0x02000322, filesSize + foldersSize, info);
+
+ info += L"\n";
+ info += _currentFolderPrefix;
+
+ for (i = 0; i < indices.Size() && i < kCopyDialog_NumInfoLines - 6; i++)
+ {
+ info += L"\n ";
+ int index = indices[i];
+ info += GetItemRelPath(index);
+ if (IsItemFolder(index))
+ info += L'\\';
+ }
+ if (i != indices.Size())
+ info += L"\n ...";
+ return info;
+}
+
void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
{
int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
@@ -481,7 +582,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
if (!srcPanel.DoesItSupportOperations())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
@@ -503,7 +604,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
}
else
{
- srcPanel.GetOperatedItemIndices(indices);
+ srcPanel.GetOperatedIndicesSmart(indices);
if (indices.Size() == 0)
return;
destPath = destPanel._currentFolderPrefix;
@@ -518,13 +619,15 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
copyDialog.Strings = copyFolders;
copyDialog.Value = destPath;
- copyDialog.Title = move ?
+ copyDialog.Title = move ?
LangString(IDS_MOVE, 0x03020202):
LangString(IDS_COPY, 0x03020201);
- copyDialog.Static = move ?
+ copyDialog.Static = move ?
LangString(IDS_MOVE_TO, 0x03020204):
LangString(IDS_COPY_TO, 0x03020203);
+ copyDialog.Info = srcPanel.GetItemsInfoString(indices);
+
if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
return;
@@ -532,7 +635,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
if (destPath.IsEmpty())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
@@ -540,7 +643,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
{
if (!srcPanel.IsFSFolder())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
destPath = srcPanel._currentFolderPrefix + destPath;
@@ -549,11 +652,11 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
if (destPath.Length() > 0 && destPath[0] == '\\')
if (destPath.Length() == 1 || destPath[1] != '\\')
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
- if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind('\\') == destPath.Length() - 1) ||
+ if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind('\\') == destPath.Length() - 1) ||
IsThereFolderOfPath(destPath))
{
NDirectory::CreateComplexDirectory(destPath);
@@ -562,7 +665,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
{
if (NumPanels < 2 || destPath != destPanel._currentFolderPrefix || !destPanel.DoesItSupportOperations())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
useDestPanel = true;
@@ -577,7 +680,7 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
NDirectory::CreateComplexDirectory(prefix);
if (!CheckFolderPath(prefix))
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
}
@@ -688,7 +791,7 @@ void CApp::OnSetSubFolder(int srcPanelIndex)
/*
- UString string = srcPanel._currentFolderPrefix +
+ UString string = srcPanel._currentFolderPrefix +
srcPanel.GetItemName(realIndex) + L'\\';
destPanel.BindToFolder(string);
*/
@@ -719,7 +822,7 @@ int CApp::GetFocusedPanelIndex() const
return 0;
for (int i = 0; i < kNumPanelsMax; i++)
{
- if (PanelsCreated[i] &&
+ if (PanelsCreated[i] &&
((HWND)Panels[i] == hwnd || Panels[i]._listView == hwnd))
return i;
}
@@ -745,7 +848,7 @@ void CApp::OnNotify(int /* ctrlID */, LPNMHDR pnmh)
}
return ;
}
- else
+ else
{
if (pnmh->code == TTN_GETDISPINFO)
{
@@ -772,7 +875,7 @@ void CApp::OnNotify(int /* ctrlID */, LPNMHDR pnmh)
}
void CApp::RefreshTitle(bool always)
-{
+{
UString path = GetFocusedPanel()._currentFolderPrefix;
if (path.IsEmpty())
path += LangString(IDS_APP_TITLE, 0x03000000);
@@ -783,7 +886,7 @@ void CApp::RefreshTitle(bool always)
}
void CApp::RefreshTitle(int panelIndex, bool always)
-{
+{
if (panelIndex != GetFocusedPanelIndex())
return;
RefreshTitle(always);
diff --git a/CPP/7zip/UI/FileManager/App.h b/CPP/7zip/UI/FileManager/App.h
index 2479d81e..d30e1151 100755
--- a/CPP/7zip/UI/FileManager/App.h
+++ b/CPP/7zip/UI/FileManager/App.h
@@ -16,7 +16,7 @@ const int kNumPanelsMax = 2;
extern void MoveSubWindows(HWND hWnd);
-enum
+enum
{
kAddCommand = kToolbarStartID,
kExtractCommand,
@@ -28,10 +28,10 @@ class CPanelCallbackImp: public CPanelCallback
CApp *_app;
int _index;
public:
- void Init(CApp *app, int index)
- {
+ void Init(CApp *app, int index)
+ {
_app = app;
- _index = index;
+ _index = index;
}
virtual void OnTab();
virtual void SetFocusToPath(int index);
@@ -42,11 +42,11 @@ public:
virtual void DragBegin();
virtual void DragEnd();
virtual void RefreshTitle(bool always);
-};
+};
class CApp;
-class CDropTarget:
+class CDropTarget:
public IDropTarget,
public CMyUnknownImp
{
@@ -54,7 +54,7 @@ class CDropTarget:
UStringVector m_SourcePaths;
int m_SelectionIndex;
bool m_DropIsAllowed; // = true, if data contain fillist
- bool m_PanelDropIsAllowed; // = false, if current target_panel is source_panel.
+ bool m_PanelDropIsAllowed; // = false, if current target_panel is source_panel.
// check it only if m_DropIsAllowed == true
int m_SubFolderIndex;
UString m_SubFolderName;
@@ -77,22 +77,22 @@ class CDropTarget:
public:
MY_UNKNOWN_IMP1_MT(IDropTarget)
- STDMETHOD(DragEnter)(IDataObject * dataObject, DWORD keyState,
+ STDMETHOD(DragEnter)(IDataObject * dataObject, DWORD keyState,
POINTL pt, DWORD *effect);
STDMETHOD(DragOver)(DWORD keyState, POINTL pt, DWORD * effect);
STDMETHOD(DragLeave)();
- STDMETHOD(Drop)(IDataObject * dataObject, DWORD keyState,
+ STDMETHOD(Drop)(IDataObject * dataObject, DWORD keyState,
POINTL pt, DWORD *effect);
- CDropTarget():
- TargetPanelIndex(-1),
- SrcPanelIndex(-1),
- m_IsAppTarget(false),
- m_Panel(0),
- App(0),
- m_PanelDropIsAllowed(false),
- m_DropIsAllowed(false),
- m_SelectionIndex(-1),
+ CDropTarget():
+ TargetPanelIndex(-1),
+ SrcPanelIndex(-1),
+ m_IsAppTarget(false),
+ m_Panel(0),
+ App(0),
+ m_PanelDropIsAllowed(false),
+ m_DropIsAllowed(false),
+ m_SelectionIndex(-1),
m_SubFolderIndex(-1),
m_SetPathIsOK(false) {}
@@ -138,18 +138,18 @@ public:
void SetFocusedPanel(int index)
{
- LastFocusedPanel = index;
+ LastFocusedPanel = index;
_dropTargetSpec->TargetPanelIndex = LastFocusedPanel;
}
void DragBegin(int panelIndex)
- {
+ {
_dropTargetSpec->TargetPanelIndex = (NumPanels > 1) ? 1 - panelIndex : panelIndex;
_dropTargetSpec->SrcPanelIndex = panelIndex;
}
void DragEnd()
- {
+ {
_dropTargetSpec->TargetPanelIndex = LastFocusedPanel;
_dropTargetSpec->SrcPanelIndex = -1;
}
@@ -159,8 +159,8 @@ public:
void OnSetSameFolder(int srcPanelIndex);
void OnSetSubFolder(int srcPanelIndex);
- void CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted);
- void Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted);
+ HRESULT CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted);
+ HRESULT Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted);
void Read();
void Save();
void Release();
@@ -253,7 +253,7 @@ public:
void RefreshView()
{ GetFocusedPanel().OnReload(); }
void RefreshAllPanels()
- {
+ {
for (int i = 0; i < NumPanels; i++)
{
int index = i;
@@ -264,7 +264,7 @@ public:
}
void SetListSettings();
void SetShowSystemMenu();
- void SwitchOnOffOnePanel();
+ HRESULT SwitchOnOffOnePanel();
bool GetFlatMode() { return Panels[LastFocusedPanel].GetFlatMode(); }
void ChangeFlatMode() { Panels[LastFocusedPanel].ChangeFlatMode(); }
@@ -293,41 +293,37 @@ public:
SaveToolbarsMask(mask);
}
void SwitchStandardToolbar()
- {
+ {
ShowStandardToolbar = !ShowStandardToolbar;
SaveToolbar();
ReloadRebar(g_HWND);
MoveSubWindows(_window);
}
void SwitchArchiveToolbar()
- {
+ {
ShowArchiveToolbar = !ShowArchiveToolbar;
SaveToolbar();
ReloadRebar(g_HWND);
MoveSubWindows(_window);
}
void SwitchButtonsLables()
- {
+ {
ShowButtonsLables = !ShowButtonsLables;
SaveToolbar();
ReloadRebar(g_HWND);
MoveSubWindows(_window);
}
void SwitchLargeButtons()
- {
+ {
LargeButtons = !LargeButtons;
SaveToolbar();
ReloadRebar(g_HWND);
MoveSubWindows(_window);
}
-
- void AddToArchive()
- { GetFocusedPanel().AddToArchive(); }
- void ExtractArchives()
- { GetFocusedPanel().ExtractArchives(); }
- void TestArchives()
- { GetFocusedPanel().TestArchives(); }
+ void AddToArchive() { GetFocusedPanel().AddToArchive(); }
+ void ExtractArchives() { GetFocusedPanel().ExtractArchives(); }
+ void TestArchives() { GetFocusedPanel().TestArchives(); }
void OnNotify(int ctrlID, LPNMHDR pnmh);
diff --git a/CPP/7zip/UI/FileManager/AppState.h b/CPP/7zip/UI/FileManager/AppState.h
index 318c0258..2b2a3e84 100755
--- a/CPP/7zip/UI/FileManager/AppState.h
+++ b/CPP/7zip/UI/FileManager/AppState.h
@@ -5,7 +5,7 @@
#include "Windows/Synchronization.h"
-void inline AddUniqueStringToHead(UStringVector &list,
+void inline AddUniqueStringToHead(UStringVector &list,
const UString &string)
{
for(int i = 0; i < list.Size();)
diff --git a/CPP/7zip/UI/FileManager/ClassDefs.cpp b/CPP/7zip/UI/FileManager/ClassDefs.cpp
index 0b4c9093..5b4401a1 100755
--- a/CPP/7zip/UI/FileManager/ClassDefs.cpp
+++ b/CPP/7zip/UI/FileManager/ClassDefs.cpp
@@ -13,5 +13,5 @@
#include "../Agent/Agent.h"
// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
+DEFINE_GUID(CLSID_CZipContextMenu,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
diff --git a/CPP/7zip/UI/FileManager/ComboDialog.cpp b/CPP/7zip/UI/FileManager/ComboDialog.cpp
index 83c142ff..807a5dd2 100755
--- a/CPP/7zip/UI/FileManager/ComboDialog.cpp
+++ b/CPP/7zip/UI/FileManager/ComboDialog.cpp
@@ -5,23 +5,23 @@
#include "Windows/Control/Static.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
using namespace NWindows;
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDOK, 0x02000702 },
{ IDCANCEL, 0x02000710 }
};
#endif
-bool CComboDialog::OnInit()
+bool CComboDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_comboBox.Attach(GetItem(IDC_COMBO_COMBO));
diff --git a/CPP/7zip/UI/FileManager/CopyDialog.cpp b/CPP/7zip/UI/FileManager/CopyDialog.cpp
index 77b62ec0..2bf60301 100755
--- a/CPP/7zip/UI/FileManager/CopyDialog.cpp
+++ b/CPP/7zip/UI/FileManager/CopyDialog.cpp
@@ -9,23 +9,23 @@
#include "Windows/Shell.h"
#include "Windows/FileName.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
using namespace NWindows;
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDOK, 0x02000702 },
{ IDCANCEL, 0x02000710 }
};
#endif
-bool CCopyDialog::OnInit()
+bool CCopyDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_path.Attach(GetItem(IDC_COPY_COMBO));
@@ -34,9 +34,10 @@ bool CCopyDialog::OnInit()
NControl::CStatic staticContol;
staticContol.Attach(GetItem(IDC_COPY_STATIC));
staticContol.SetText(Static);
- for(int i = 0; i < Strings.Size(); i++)
+ for (int i = 0; i < Strings.Size(); i++)
_path.AddString(Strings[i]);
_path.SetText(Value);
+ SetItemText(IDC_COPY_INFO, Info);
return CModalDialog::OnInit();
}
@@ -51,13 +52,13 @@ bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
-void CCopyDialog::OnButtonSetPath()
+void CCopyDialog::OnButtonSetPath()
{
UString currentPath;
_path.GetText(currentPath);
/*
- #ifdef LANG
+ #ifdef LANG
UString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
#else
UString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
diff --git a/CPP/7zip/UI/FileManager/CopyDialog.h b/CPP/7zip/UI/FileManager/CopyDialog.h
index ed894bf8..55872f1c 100755
--- a/CPP/7zip/UI/FileManager/CopyDialog.h
+++ b/CPP/7zip/UI/FileManager/CopyDialog.h
@@ -7,6 +7,8 @@
#include "Windows/Control/ComboBox.h"
#include "CopyDialogRes.h"
+const int kCopyDialog_NumInfoLines = 11;
+
class CCopyDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox _path;
@@ -20,6 +22,8 @@ public:
UString Value;
UStringVector Strings;
+ UString Info;
+
INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COPY, parentWindow); }
};
diff --git a/CPP/7zip/UI/FileManager/CopyDialog.rc b/CPP/7zip/UI/FileManager/CopyDialog.rc
index bf3aebde..1686adda 100755
--- a/CPP/7zip/UI/FileManager/CopyDialog.rc
+++ b/CPP/7zip/UI/FileManager/CopyDialog.rc
@@ -1,8 +1,11 @@
#include "CopyDialogRes.h"
#include "../../GuiCommon.rc"
+#undef infoSize
+#define infoSize 100
+
#define xSize2 346
-#define ySize2 57
+#define ySize2 (infoSize + 50)
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
@@ -17,12 +20,13 @@ MY_FONT
BEGIN
LTEXT "", IDC_COPY_STATIC, marg, marg, xSize2, 8
COMBOBOX IDC_COPY_COMBO, marg, 20, xSize2 - bDotsSize - 12, 65, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "...", IDC_COPY_SET_PATH, (xSize - marg - bDotsSize), 20, bDotsSize, 14, WS_GROUP
+ PUSHBUTTON "...", IDC_COPY_SET_PATH, (xSize - marg - bDotsSize), 20, bDotsSize, 14, WS_GROUP
+ LTEXT "", IDC_COPY_INFO, marg, bYPos - (infoSize + 2), xSize2, infoSize, SS_NOPREFIX | SS_LEFTNOWORDWRAP
DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
PUSHBUTTON "Cancel", IDCANCEL, b1XPos, bYPos, bXSize, bYSize
END
-STRINGTABLE DISCARDABLE
+STRINGTABLE DISCARDABLE
BEGIN
IDS_SET_FOLDER "Specify a location for output folder."
END
diff --git a/CPP/7zip/UI/FileManager/CopyDialogRes.h b/CPP/7zip/UI/FileManager/CopyDialogRes.h
index 7ec6162a..900bf29f 100755
--- a/CPP/7zip/UI/FileManager/CopyDialogRes.h
+++ b/CPP/7zip/UI/FileManager/CopyDialogRes.h
@@ -3,5 +3,6 @@
#define IDC_COPY_STATIC 1000
#define IDC_COPY_COMBO 1001
#define IDC_COPY_SET_PATH 1002
+#define IDC_COPY_INFO 1003
#define IDS_SET_FOLDER 210
diff --git a/CPP/7zip/UI/FileManager/EditPage.cpp b/CPP/7zip/UI/FileManager/EditPage.cpp
index 06bde407..69261eb6 100755
--- a/CPP/7zip/UI/FileManager/EditPage.cpp
+++ b/CPP/7zip/UI/FileManager/EditPage.cpp
@@ -18,7 +18,7 @@
using namespace NWindows;
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_EDIT_STATIC_EDITOR, 0x03010201}
};
diff --git a/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp b/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp
index ef9463fb..291ea1f1 100755
--- a/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp
+++ b/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp
@@ -5,7 +5,7 @@
#include "EnumFormatEtc.h"
#include "MyCom2.h"
-class CEnumFormatEtc :
+class CEnumFormatEtc :
public IEnumFORMATETC,
public CMyUnknownImp
{
@@ -13,7 +13,7 @@ public:
MY_UNKNOWN_IMP1_MT(IEnumFORMATETC)
STDMETHOD(Next)(ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched);
- STDMETHOD(Skip)(ULONG celt);
+ STDMETHOD(Skip)(ULONG celt);
STDMETHOD(Reset)(void);
STDMETHOD(Clone)(IEnumFORMATETC **ppEnumFormatEtc);
@@ -73,7 +73,7 @@ STDMETHODIMP CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG *pcel
copied++;
m_Index++;
}
- if(pceltFetched != 0)
+ if(pceltFetched != 0)
*pceltFetched = copied;
return (copied == celt) ? S_OK : S_FALSE;
}
diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/CPP/7zip/UI/FileManager/ExtractCallback.cpp
index 7998d5cc..d5f0e867 100755
--- a/CPP/7zip/UI/FileManager/ExtractCallback.cpp
+++ b/CPP/7zip/UI/FileManager/ExtractCallback.cpp
@@ -4,9 +4,10 @@
#include "ExtractCallback.h"
+#include "Windows/Error.h"
#include "Windows/FileFind.h"
#include "Windows/FileDir.h"
-#include "Windows/Error.h"
+#include "Windows/ResourceString.h"
#include "OverwriteDialog.h"
#ifndef _NO_CRYPTO
@@ -52,7 +53,7 @@ void CExtractCallbackImp::AddErrorMessage(LPCWSTR message)
Messages.Add(message);
}
-STDMETHODIMP CExtractCallbackImp::SetNumFiles(UInt64
+STDMETHODIMP CExtractCallbackImp::SetNumFiles(UInt64
#ifndef _SFX
numFiles
#endif
@@ -72,19 +73,57 @@ STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 total)
STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *value)
{
- for (;;)
- {
- if(ProgressDialog.ProgressSynch.GetStopped())
- return E_ABORT;
- if(!ProgressDialog.ProgressSynch.GetPaused())
- break;
- ::Sleep(100);
- }
+ RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
if (value != NULL)
ProgressDialog.ProgressSynch.SetPos(*value);
return S_OK;
}
+HRESULT CExtractCallbackImp::Open_CheckBreak()
+{
+ return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+}
+
+HRESULT CExtractCallbackImp::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
+{
+ // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
+ return S_OK;
+}
+
+HRESULT CExtractCallbackImp::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
+{
+ RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
+ // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesCur(*numFiles);
+ return S_OK;
+}
+
+#ifndef _NO_CRYPTO
+
+HRESULT CExtractCallbackImp::Open_CryptoGetTextPassword(BSTR *password)
+{
+ return CryptoGetTextPassword(password);
+}
+
+HRESULT CExtractCallbackImp::Open_GetPasswordIfAny(UString &password)
+{
+ if (PasswordIsDefined)
+ password = Password;
+ return S_OK;
+}
+
+bool CExtractCallbackImp::Open_WasPasswordAsked()
+{
+ return PasswordWasAsked;
+}
+
+void CExtractCallbackImp::Open_ClearPasswordWasAskedFlag()
+{
+ PasswordWasAsked = false;
+}
+
+#endif
+
+
#ifndef _SFX
STDMETHODIMP CExtractCallbackImp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
{
@@ -135,34 +174,20 @@ STDMETHODIMP CExtractCallbackImp::AskOverwrite(
dialog.NewFileInfo.Name = newName;
/*
- NOverwriteDialog::NResult::EEnum writeAnswer =
+ NOverwriteDialog::NResult::EEnum writeAnswer =
NOverwriteDialog::Execute(oldFileInfo, newFileInfo);
*/
- INT_PTR writeAnswer = dialog.Create(NULL); // ParentWindow doesn't work with 7z
+ INT_PTR writeAnswer = dialog.Create(ProgressDialog); // ParentWindow doesn't work with 7z
switch(writeAnswer)
{
- case IDCANCEL:
- return E_ABORT;
- // askResult = NAskOverwriteAnswer::kCancel;
- // break;
- case IDNO:
- *answer = NOverwriteAnswer::kNo;
- break;
- case IDC_BUTTON_OVERWRITE_NO_TO_ALL:
- *answer = NOverwriteAnswer::kNoToAll;
- break;
- case IDC_BUTTON_OVERWRITE_YES_TO_ALL:
- *answer = NOverwriteAnswer::kYesToAll;
- break;
- case IDC_BUTTON_OVERWRITE_AUTO_RENAME:
- *answer = NOverwriteAnswer::kAutoRename;
- break;
- case IDYES:
- *answer = NOverwriteAnswer::kYes;
- break;
- default:
- return E_FAIL;
+ case IDCANCEL: *answer = NOverwriteAnswer::kCancel; return E_ABORT;
+ case IDYES: *answer = NOverwriteAnswer::kYes; break;
+ case IDNO: *answer = NOverwriteAnswer::kNo; break;
+ case IDC_BUTTON_OVERWRITE_YES_TO_ALL: *answer = NOverwriteAnswer::kYesToAll; break;
+ case IDC_BUTTON_OVERWRITE_NO_TO_ALL: *answer = NOverwriteAnswer::kNoToAll; break;
+ case IDC_BUTTON_OVERWRITE_AUTO_RENAME: *answer = NOverwriteAnswer::kAutoRename; break;
+ default: return E_FAIL;
}
return S_OK;
}
@@ -203,13 +228,13 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 operationResult, bool
langID = 0x02000A91;
break;
case NArchive::NExtract::NOperationResult::kDataError:
- messageID = encrypted ?
+ messageID = encrypted ?
IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED:
IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR;
langID = encrypted ? 0x02000A94 : 0x02000A92;
break;
case NArchive::NExtract::NOperationResult::kCRCError:
- messageID = encrypted ?
+ messageID = encrypted ?
IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED:
IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC;
langID = encrypted ? 0x02000A95 : 0x02000A93;
@@ -223,10 +248,10 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 operationResult, bool
_needWriteArchivePath = false;
}
AddErrorMessage(
- MyFormatNew(messageID,
- #ifdef LANG
- langID,
- #endif
+ MyFormatNew(messageID,
+ #ifdef LANG
+ langID,
+ #endif
_currentFilePath));
}
}
@@ -276,11 +301,32 @@ HRESULT CExtractCallbackImp::OpenResult(const wchar_t *name, HRESULT result, boo
{
if (result != S_OK)
{
- MessageError(MyFormatNew(encrypted ? IDS_CANT_OPEN_ENCRYPTED_ARCHIVE : IDS_CANT_OPEN_ARCHIVE,
+ UString message;
+ if (result == S_FALSE)
+ {
+ message = MyFormatNew(encrypted ? IDS_CANT_OPEN_ENCRYPTED_ARCHIVE : IDS_CANT_OPEN_ARCHIVE,
#ifdef LANG
(encrypted ? 0x0200060A : 0x02000609),
#endif
- name));
+ name);
+ }
+ else
+ {
+ message = name;
+ message += L": ";
+ UString message2;
+ if (result == E_OUTOFMEMORY)
+ message2 =
+ #ifdef LANG
+ LangString(IDS_MEM_ERROR, 0x0200060B);
+ #else
+ MyLoadStringW(IDS_MEM_ERROR);
+ #endif
+ else
+ NError::MyFormatMessage(result, message2);
+ message += message2;
+ }
+ MessageError(message);
NumArchiveErrors++;
}
_currentArchivePath = name;
@@ -314,29 +360,27 @@ HRESULT CExtractCallbackImp::SetPassword(const UString &password)
STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
{
+ PasswordWasAsked = true;
if (!PasswordIsDefined)
{
CPasswordDialog dialog;
-
- if (dialog.Create(ParentWindow) == IDCANCEL)
+ if (dialog.Create(ProgressDialog) == IDCANCEL)
return E_ABORT;
-
Password = dialog.Password;
PasswordIsDefined = true;
}
CMyComBSTR tempName(Password);
*password = tempName.Detach();
-
return S_OK;
}
// IExtractCallBack3
STDMETHODIMP CExtractCallbackImp::AskWrite(
- const wchar_t *srcPath, Int32 srcIsFolder,
+ const wchar_t *srcPath, Int32 srcIsFolder,
const FILETIME *srcTime, const UInt64 *srcSize,
- const wchar_t *destPath,
- BSTR *destPathResult,
+ const wchar_t *destPath,
+ BSTR *destPathResult,
Int32 *writeAnswer)
{
UString destPathResultTemp = destPath;
@@ -357,7 +401,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
{
if (srcIsFolderSpec)
{
- if (!destFileInfo.IsDirectory())
+ if (!destFileInfo.IsDir())
{
UString message = UString(L"can not replace file \'")
+ destPathSpec +
@@ -368,7 +412,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
*writeAnswer = BoolToInt(false);
return S_OK;
}
- if (destFileInfo.IsDirectory())
+ if (destFileInfo.IsDir())
{
UString message = UString(L"can not replace folder \'")
+ destPathSpec +
@@ -385,10 +429,10 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
{
Int32 overwiteResult;
RINOK(AskOverwrite(
- destPathSpec,
- &destFileInfo.LastWriteTime, &destFileInfo.Size,
+ destPathSpec,
+ &destFileInfo.MTime, &destFileInfo.Size,
srcPath,
- srcTime, srcSize,
+ srcTime, srcSize,
&overwiteResult));
switch(overwiteResult)
{
@@ -432,7 +476,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
return E_ABORT;
}
}
- CMyComBSTR destPathResultBSTR = destPathResultTemp;
+ CMyComBSTR destPathResultBSTR(destPathResultTemp);
*destPathResult = destPathResultBSTR.Detach();
*writeAnswer = BoolToInt(true);
return S_OK;
diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.h b/CPP/7zip/UI/FileManager/ExtractCallback.h
index 13117871..ee46222a 100755
--- a/CPP/7zip/UI/FileManager/ExtractCallback.h
+++ b/CPP/7zip/UI/FileManager/ExtractCallback.h
@@ -5,6 +5,7 @@
#include "../Agent/IFolderArchive.h"
#include "Common/MyString.h"
+#include "../Common/ArchiveOpenCallback.h"
#ifdef _SFX
#include "ProgressDialog.h"
@@ -14,7 +15,7 @@
#include "Windows/ResourceString.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
@@ -24,8 +25,9 @@
#include "Common/MyCom.h"
#include "IFolder.h"
-class CExtractCallbackImp:
+class CExtractCallbackImp:
public IExtractCallbackUI,
+ public IOpenCallbackUI,
public IFolderOperationsExtractCallback,
// public IFolderArchiveExtractCallback, // mkultiple from IProgress
#ifndef _SFX
@@ -48,14 +50,13 @@ public:
MY_QUERYINTERFACE_END
MY_ADDREF_RELEASE
- // IProgress
- STDMETHOD(SetTotal)(UInt64 total);
- STDMETHOD(SetCompleted)(const UInt64 *value);
-
#ifndef _SFX
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
#endif
+ INTERFACE_IProgress(;)
+ INTERFACE_IOpenCallbackUI(;)
+
// IFolderArchiveExtractCallback
// STDMETHOD(SetTotalFiles)(UInt64 total);
// STDMETHOD(SetCompletedFiles)(const UInt64 *value);
@@ -81,12 +82,12 @@ public:
// IFolderOperationsExtractCallback
STDMETHOD(AskWrite)(
- const wchar_t *srcPath,
- Int32 srcIsFolder,
- const FILETIME *srcTime,
+ const wchar_t *srcPath,
+ Int32 srcIsFolder,
+ const FILETIME *srcTime,
const UInt64 *srcSize,
- const wchar_t *destPathRequest,
- BSTR *destPathResult,
+ const wchar_t *destPathRequest,
+ BSTR *destPathResult,
Int32 *writeAnswer);
STDMETHOD(ShowMessage)(const wchar_t *message);
STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath);
@@ -128,12 +129,14 @@ public:
#ifndef _NO_CRYPTO
bool PasswordIsDefined;
+ bool PasswordWasAsked;
UString Password;
#endif
- CExtractCallbackImp():
+ CExtractCallbackImp():
#ifndef _NO_CRYPTO
PasswordIsDefined(false),
+ PasswordWasAsked(false),
#endif
OverwriteMode(NExtract::NOverwriteMode::kAskBefore),
ParentWindow(0),
diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp
index 66e5a086..4e5a3724 100755
--- a/CPP/7zip/UI/FileManager/FM.cpp
+++ b/CPP/7zip/UI/FileManager/FM.cpp
@@ -5,8 +5,8 @@
#include "resource.h"
#include "Panel.h"
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
}
@@ -53,6 +53,7 @@ const int kNumDefaultPanels = 1;
const int kSplitterWidth = 4;
int kSplitterRateMax = 1 << 16;
+int kPanelSizeMin = 120;
// bool OnMenuCommand(HWND hWnd, int id);
@@ -77,7 +78,7 @@ class CSplitterPos
int _pos;
int _fullWidth;
void SetRatioFromPos(HWND hWnd)
- { _ratio = (_pos + kSplitterWidth / 2) * kSplitterRateMax /
+ { _ratio = (_pos + kSplitterWidth / 2) * kSplitterRateMax /
MyMax(GetWidth(hWnd), 1); }
public:
int GetPos() const
@@ -89,17 +90,22 @@ public:
return rect.right;
}
void SetRatio(HWND hWnd, int aRatio)
- {
- _ratio = aRatio;
+ {
+ _ratio = aRatio;
SetPosFromRatio(hWnd);
}
void SetPosPure(HWND hWnd, int pos)
{
int posMax = GetWidth(hWnd) - kSplitterWidth;
- if (pos > posMax)
- pos = posMax;
- if (pos < 0)
- pos = 0;
+ if (posMax < kPanelSizeMin * 2)
+ pos = posMax / 2;
+ else
+ {
+ if (pos > posMax - kPanelSizeMin)
+ pos = posMax - kPanelSizeMin;
+ else if (pos < kPanelSizeMin)
+ pos = kPanelSizeMin;
+ }
_pos = pos;
}
void SetPos(HWND hWnd, int pos)
@@ -109,23 +115,23 @@ public:
SetRatioFromPos(hWnd);
}
void SetPosFromRatio(HWND hWnd)
- {
+ {
int fullWidth = GetWidth(hWnd);
- if (_fullWidth != fullWidth)
+ if (_fullWidth != fullWidth && fullWidth != 0)
{
_fullWidth = fullWidth;
- SetPosPure(hWnd, GetWidth(hWnd) * _ratio / kSplitterRateMax - kSplitterWidth / 2);
+ SetPosPure(hWnd, GetWidth(hWnd) * _ratio / kSplitterRateMax - kSplitterWidth / 2);
}
}
};
-bool g_CanChangeSplitter = false;
-UINT32 g_SplitterPos = 0;
-CSplitterPos g_Splitter;
-bool g_PanelsInfoDefined = false;
+static bool g_CanChangeSplitter = false;
+static UINT32 g_SplitterPos = 0;
+static CSplitterPos g_Splitter;
+static bool g_PanelsInfoDefined = false;
-int g_StartCaptureMousePos;
-int g_StartCaptureSplitterPos;
+static int g_StartCaptureMousePos;
+static int g_StartCaptureSplitterPos;
CApp g_App;
@@ -141,7 +147,7 @@ static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -164,11 +170,11 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
/*
//If it is already running, then focus on the window
hWnd = FindWindow(windowClass, title);
- if (hWnd)
+ if (hWnd)
{
- SetForegroundWindow ((HWND) (((DWORD)hWnd) | 0x01));
+ SetForegroundWindow ((HWND) (((DWORD)hWnd) | 0x01));
return 0;
- }
+ }
*/
WNDCLASSW wc;
@@ -237,7 +243,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
placement.length = sizeof(placement);
if (wnd.GetPlacement(&placement))
{
- if (nCmdShow == SW_SHOWNORMAL || nCmdShow == SW_SHOW ||
+ if (nCmdShow == SW_SHOWNORMAL || nCmdShow == SW_SHOW ||
nCmdShow == SW_SHOWDEFAULT)
{
if (maximized)
@@ -276,7 +282,7 @@ static void GetCommands(const UString &aCommandLine, UString &aCommands)
break;
}
}
- else
+ else
aProgramName += aChar;
}
aCommands = aCommandLine.Mid(i);
@@ -294,7 +300,7 @@ DWORD GetDllVersion(LPCTSTR lpszDllName)
pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion");
/*Because some DLLs might not implement this function, you
- must test for it explicitly. Depending on the particular
+ must test for it explicitly. Depending on the particular
DLL, the lack of a DllGetVersion function can be a useful
indicator of the version.
*/
@@ -345,7 +351,7 @@ bool IsLargePageSupported()
#else
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
if (versionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || versionInfo.dwMajorVersion < 5)
return false;
@@ -382,7 +388,7 @@ enum Enum
}
-static const CSwitchForm kSwitchForms[kNumSwitches] =
+static const CSwitchForm kSwitchForms[kNumSwitches] =
{
{ L"SOA", NSwitchType::kSimple, false },
};
@@ -405,7 +411,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /*
g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll"));
// OleInitialize is required for drag and drop.
- OleInitialize(NULL);
+ OleInitialize(NULL);
// Maybe needs CoInitializeEx also ?
// NCOM::CComInitializer comInitializer;
@@ -429,18 +435,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /*
UStringVector commandStrings;
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
NCommandLineParser::CParser parser(kNumSwitches);
- try
- {
- parser.ParseStrings(kSwitchForms, commandStrings);
+ try
+ {
+ parser.ParseStrings(kSwitchForms, commandStrings);
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
- if(nonSwitchStrings.Size() > 1)
+ if(nonSwitchStrings.Size() > 1)
{
g_MainPath = nonSwitchStrings[1];
// g_OpenArchive = parser[NKey::kOpenArachive].ThereIs;
CFileInfoW fileInfo;
if (FindFile(g_MainPath, fileInfo))
{
- if (!fileInfo.IsDirectory())
+ if (!fileInfo.IsDir())
g_OpenArchive = true;
}
}
@@ -452,7 +458,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /*
SetMemoryLock();
MSG msg;
- if (!InitInstance (hInstance, nCmdShow))
+ if (!InitInstance (hInstance, nCmdShow))
return FALSE;
MyLoadMenu(g_HWND);
@@ -461,9 +467,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /*
if (g_IsNT)
{
HACCEL hAccels = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_ACCELERATOR1));
- while (GetMessageW(&msg, NULL, 0, 0))
+ while (GetMessageW(&msg, NULL, 0, 0))
{
- if (TranslateAcceleratorW(g_HWND, hAccels, &msg) == 0)
+ if (TranslateAcceleratorW(g_HWND, hAccels, &msg) == 0)
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
@@ -474,9 +480,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /*
#endif
{
HACCEL hAccels = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
- while (GetMessage(&msg, NULL, 0, 0))
+ while (GetMessage(&msg, NULL, 0, 0))
{
- if (TranslateAccelerator(g_HWND, hAccels, &msg) == 0)
+ if (TranslateAccelerator(g_HWND, hAccels, &msg) == 0)
{
// if (g_Hwnd != NULL || !IsDialogMessage(g_Hwnd, &msg))
// if (!IsDialogMessage(g_Hwnd, &msg))
@@ -502,9 +508,9 @@ static void SaveWindowInfo(HWND aWnd)
placement.length = sizeof(placement);
if (!::GetWindowPlacement(aWnd, &placement))
return;
- SaveWindowSize(placement.rcNormalPosition,
+ SaveWindowSize(placement.rcNormalPosition,
BOOLToBool(::IsZoomed(aWnd)));
- SavePanelsInfo(g_App.NumPanels, g_App.LastFocusedPanel,
+ SavePanelsInfo(g_App.NumPanels, g_App.LastFocusedPanel,
g_Splitter.GetPos());
}
@@ -527,11 +533,11 @@ void ExecuteCommand(UINT commandID)
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
- switch (message)
+ switch (message)
{
case WM_COMMAND:
- wmId = LOWORD(wParam);
- wmEvent = HIWORD(wParam);
+ wmId = LOWORD(wParam);
+ wmEvent = HIWORD(wParam);
if ((HWND) lParam != NULL && wmEvent != 0)
break;
if (wmId >= kToolbarStartID)
@@ -568,7 +574,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
InitCommonControlsEx(&icex);
// Toolbar buttons used to create the first 4 buttons.
- TBBUTTON tbb [ ] =
+ TBBUTTON tbb [ ] =
{
// {0, 0, TBSTATE_ENABLED, BTNS_SEP, 0L, 0},
// {VIEW_PARENTFOLDER, kParentFolderID, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
@@ -578,11 +584,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int baseID = 100;
NWindows::NControl::CToolBar aToolBar;
- aToolBar.Attach(::CreateToolbarEx (hWnd,
- WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS, // | TBSTYLE_FLAT
- baseID + 2, 11,
- (HINSTANCE)HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR,
- (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
+ aToolBar.Attach(::CreateToolbarEx (hWnd,
+ WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS, // | TBSTYLE_FLAT
+ baseID + 2, 11,
+ (HINSTANCE)HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR,
+ (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
0, 0, 100, 30, sizeof (TBBUTTON)));
*/
// HCURSOR cursor = ::LoadCursor(0, IDC_SIZEWE);
@@ -613,18 +619,36 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
NFile::NFind::CFileInfoW fileInfo;
if (NFile::NFind::FindFile(g_MainPath, fileInfo))
- if (!fileInfo.IsDirectory())
+ if (!fileInfo.IsDir())
needOpenFile = true;
}
- g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted);
+ HRESULT res = g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted);
- if (needOpenFile && !archiveIsOpened)
+ if (res == E_ABORT)
{
- UString message;
- if (encrypted)
- message = MyFormatNew(IDS_CANT_OPEN_ENCRYPTED_ARCHIVE, 0x0200060A, g_MainPath);
+ return -1;
+ }
+ if (needOpenFile && !archiveIsOpened || res != S_OK)
+ {
+ UString message = L"Error";
+ if (res == S_FALSE || res == S_OK)
+ {
+ if (encrypted)
+ message = MyFormatNew(IDS_CANT_OPEN_ENCRYPTED_ARCHIVE, 0x0200060A, g_MainPath);
+ else
+ message = MyFormatNew(IDS_CANT_OPEN_ARCHIVE, 0x02000609, g_MainPath);
+ }
else
- message = MyFormatNew(IDS_CANT_OPEN_ARCHIVE, 0x02000609, g_MainPath);
+ {
+ if (res != S_OK)
+ {
+ if (res == E_OUTOFMEMORY)
+ message = LangString(IDS_MEM_ERROR, 0x0200060B);
+ else
+ if (!NError::MyFormatMessage(res, message))
+ message = L"Error";
+ }
+ }
MessageBoxW(0, message, L"7-zip", MB_ICONERROR);
return -1;
}
@@ -637,7 +661,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
case WM_DESTROY:
{
- // ::DragAcceptFiles(hWnd, FALSE);
+ // ::DragAcceptFiles(hWnd, FALSE);
RevokeDragDrop(hWnd);
g_App._dropTarget.Release();
@@ -663,11 +687,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
::ReleaseCapture();
break;
}
- case WM_MOUSEMOVE:
+ case WM_MOUSEMOVE:
{
if ((wParam & MK_LBUTTON) != 0 && ::GetCapture() == hWnd)
{
- g_Splitter.SetPos(hWnd, g_StartCaptureSplitterPos +
+ g_Splitter.SetPos(hWnd, g_StartCaptureSplitterPos +
(short)LOWORD(lParam) - g_StartCaptureMousePos);
MoveSubWindows(hWnd);
}
@@ -704,7 +728,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
/*
case WM_ACTIVATE:
{
- int fActive = LOWORD(wParam);
+ int fActive = LOWORD(wParam);
switch (fActive)
{
case WA_INACTIVE:
@@ -786,6 +810,10 @@ void MoveSubWindows(HWND hWnd)
if (g_App._rebar)
headerSize = Window_GetRealHeight(g_App._rebar);
int ySize = MyMax((int)(rect.bottom - headerSize), 0);
+
+ // It's for such case: Minimize / Close:
+ if (xSize == 0 && ySize == 0)
+ return;
if (g_App.NumPanels > 1)
{
diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp
index d2284325..8a3ddc83 100755
--- a/CPP/7zip/UI/FileManager/FM.dsp
+++ b/CPP/7zip/UI/FileManager/FM.dsp
@@ -947,6 +947,10 @@ SOURCE=..\..\..\Windows\Thread.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Windows\Time.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Windows\Time.h
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/FileManager/FSDrives.cpp b/CPP/7zip/UI/FileManager/FSDrives.cpp
index 42540287..6fd8d708 100755
--- a/CPP/7zip/UI/FileManager/FSDrives.cpp
+++ b/CPP/7zip/UI/FileManager/FSDrives.cpp
@@ -23,16 +23,16 @@ using namespace NWindows;
using namespace NFile;
using namespace NFind;
-static const STATPROPSTG kProperties[] =
+static const STATPROPSTG kProperties[] =
{
{ NULL, kpidName, VT_BSTR},
- // { NULL, kpidIsFolder, VT_BOOL},
+ // { NULL, kpidIsDir, VT_BOOL},
{ L"Total Size", kpidTotalSize, VT_UI8},
{ L"Free Space", kpidFreeSpace, VT_UI8},
{ NULL, kpidType, VT_BSTR},
{ L"Label", kpidVolumeName, VT_BSTR},
{ L"File system", kpidFileSystem, VT_BSTR},
- { L"Cluster Size", kpidClusterSize, VT_UI8}
+ { L"Cluster Size", kpidClusterSize, VT_UI8}
};
static const wchar_t *kDriveTypes[] =
@@ -54,31 +54,31 @@ STDMETHODIMP CFSDrives::LoadItems()
MyGetLogicalDriveStrings(driveStrings);
for (int i = 0; i < driveStrings.Size(); i++)
{
- CDriveInfo driveInfo;
+ CDriveInfo di;
const UString &driveName = driveStrings[i];
- driveInfo.FullSystemName = driveName;
+ di.FullSystemName = driveName;
- driveInfo.Name = driveInfo.FullSystemName.Left(
- driveInfo.FullSystemName.Length() - 1);
- driveInfo.ClusterSize = 0;
- driveInfo.DriveSize = 0;
- driveInfo.FreeSpace = 0;
+ di.Name = di.FullSystemName.Left(
+ di.FullSystemName.Length() - 1);
+ di.ClusterSize = 0;
+ di.DriveSize = 0;
+ di.FreeSpace = 0;
UINT driveType = NFile::NSystem::MyGetDriveType(driveName);
if (driveType < sizeof(kDriveTypes) / sizeof(kDriveTypes[0]))
{
- driveInfo.Type = kDriveTypes[driveType];
+ di.Type = kDriveTypes[driveType];
}
bool needRead = true;
if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE)
{
/*
DWORD dwSerialNumber;`
- if (!::GetVolumeInformation(driveInfo.FullSystemName,
- NULL, 0, &dwSerialNumber, NULL, NULL, NULL, 0))
+ if (!::GetVolumeInformation(di.FullSystemName,
+ NULL, 0, &dwSerialNumber, NULL, NULL, NULL, 0))
*/
- driveInfo.KnownSizes = false;
+ di.KnownSizes = false;
{
needRead = false;
}
@@ -87,18 +87,18 @@ STDMETHODIMP CFSDrives::LoadItems()
{
UString volumeName, fileSystemName;
DWORD volumeSerialNumber, maximumComponentLength, fileSystemFlags;
- NFile::NSystem::MyGetVolumeInformation(driveName,
+ NFile::NSystem::MyGetVolumeInformation(driveName,
volumeName,
- &volumeSerialNumber, &maximumComponentLength, &fileSystemFlags,
+ &volumeSerialNumber, &maximumComponentLength, &fileSystemFlags,
fileSystemName);
- driveInfo.VolumeName = volumeName;
- driveInfo.FileSystemName = fileSystemName;
+ di.VolumeName = volumeName;
+ di.FileSystemName = fileSystemName;
NFile::NSystem::MyGetDiskFreeSpace(driveName,
- driveInfo.ClusterSize, driveInfo.DriveSize, driveInfo.FreeSpace);
- driveInfo.KnownSizes = true;
+ di.ClusterSize, di.DriveSize, di.FreeSpace);
+ di.KnownSizes = true;
}
- _drives.Add(driveInfo);
+ _drives.Add(di);
}
return S_OK;
}
@@ -113,39 +113,20 @@ STDMETHODIMP CFSDrives::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT
{
if (itemIndex >= (UInt32)_drives.Size())
return E_INVALIDARG;
- NCOM::CPropVariant propVariant;
- const CDriveInfo &driveInfo = _drives[itemIndex];
+ NCOM::CPropVariant prop;
+ const CDriveInfo &di = _drives[itemIndex];
switch(propID)
{
- case kpidIsFolder:
- propVariant = true;
- break;
- case kpidName:
- propVariant = driveInfo.Name;
- break;
- case kpidTotalSize:
- if (driveInfo.KnownSizes)
- propVariant = driveInfo.DriveSize;
- break;
- case kpidFreeSpace:
- if (driveInfo.KnownSizes)
- propVariant = driveInfo.FreeSpace;
- break;
- case kpidClusterSize:
- if (driveInfo.KnownSizes)
- propVariant = driveInfo.ClusterSize;
- break;
- case kpidType:
- propVariant = driveInfo.Type;
- break;
- case kpidVolumeName:
- propVariant = driveInfo.VolumeName;
- break;
- case kpidFileSystem:
- propVariant = driveInfo.FileSystemName;
- break;
+ case kpidIsDir: prop = true; break;
+ case kpidName: prop = di.Name; break;
+ case kpidTotalSize: if (di.KnownSizes) prop = di.DriveSize; break;
+ case kpidFreeSpace: if (di.KnownSizes) prop = di.FreeSpace; break;
+ case kpidClusterSize: if (di.KnownSizes) prop = di.ClusterSize; break;
+ case kpidType: prop = di.Type; break;
+ case kpidVolumeName: prop = di.VolumeName; break;
+ case kpidFileSystem: prop = di.FileSystemName; break;
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
@@ -164,17 +145,17 @@ STDMETHODIMP CFSDrives::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
*resultFolder = 0;
if (index >= (UInt32)_drives.Size())
return E_INVALIDARG;
- const CDriveInfo &driveInfo = _drives[index];
+ const CDriveInfo &di = _drives[index];
if (_volumeMode)
{
*resultFolder = 0;
CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
CMyComPtr<IFolderFolder> subFolder = folderSpec;
- RINOK(folderSpec->Init(driveInfo.Name));
+ RINOK(folderSpec->Init(di.Name));
*resultFolder = subFolder.Detach();
return S_OK;
}
- return BindToFolderSpec(driveInfo.FullSystemName, resultFolder);
+ return BindToFolderSpec(di.FullSystemName, resultFolder);
}
STDMETHODIMP CFSDrives::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
@@ -194,7 +175,7 @@ STDMETHODIMP CFSDrives::GetNumberOfProperties(UInt32 *numProperties)
return S_OK;
}
-STDMETHODIMP CFSDrives::GetPropertyInfo(UInt32 index,
+STDMETHODIMP CFSDrives::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -224,9 +205,9 @@ STDMETHODIMP CFSDrives::GetFolderProperty(PROPID propID, PROPVARIANT *value)
STDMETHODIMP CFSDrives::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
{
*iconIndex = 0;
- const CDriveInfo &driveInfo = _drives[index];
+ const CDriveInfo &di = _drives[index];
int iconIndexTemp;
- if (GetRealIconIndex(driveInfo.FullSystemName, 0, iconIndexTemp) != 0)
+ if (GetRealIconIndex(di.FullSystemName, 0, iconIndexTemp) != 0)
{
*iconIndex = iconIndexTemp;
return S_OK;
diff --git a/CPP/7zip/UI/FileManager/FSDrives.h b/CPP/7zip/UI/FileManager/FSDrives.h
index 527c2438..84db5b7e 100755
--- a/CPP/7zip/UI/FileManager/FSDrives.h
+++ b/CPP/7zip/UI/FileManager/FSDrives.h
@@ -24,7 +24,7 @@ struct CDriveInfo
UString FileSystemName;
};
-class CFSDrives:
+class CFSDrives:
public IFolderFolder,
public IFolderGetSystemIconIndex,
public CMyUnknownImp
diff --git a/CPP/7zip/UI/FileManager/FSFolder.cpp b/CPP/7zip/UI/FileManager/FSFolder.cpp
index aeb3b333..a3e4787a 100755
--- a/CPP/7zip/UI/FileManager/FSFolder.cpp
+++ b/CPP/7zip/UI/FileManager/FSFolder.cpp
@@ -32,16 +32,16 @@ using namespace NFind;
namespace NFsFolder {
-static STATPROPSTG kProperties[] =
+static STATPROPSTG kProperties[] =
{
{ NULL, kpidName, VT_BSTR},
- // { NULL, kpidIsFolder, VT_BOOL},
+ // { NULL, kpidIsDir, VT_BOOL},
{ NULL, kpidSize, VT_UI8},
- { NULL, kpidLastWriteTime, VT_FILETIME},
- { NULL, kpidCreationTime, VT_FILETIME},
- { NULL, kpidLastAccessTime, VT_FILETIME},
- { NULL, kpidAttributes, VT_UI4},
- { NULL, kpidPackedSize, VT_UI8},
+ { NULL, kpidMTime, VT_FILETIME},
+ { NULL, kpidCTime, VT_FILETIME},
+ { NULL, kpidATime, VT_FILETIME},
+ { NULL, kpidAttrib, VT_UI4},
+ { NULL, kpidPackSize, VT_UI8},
{ NULL, kpidComment, VT_BSTR},
{ NULL, kpidPrefix, VT_BSTR}
};
@@ -51,8 +51,8 @@ HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
_parentFolder = parentFolder;
_path = path;
- _findChangeNotification.FindFirst(_path, false,
- FILE_NOTIFY_CHANGE_FILE_NAME |
+ _findChangeNotification.FindFirst(_path, false,
+ FILE_NOTIFY_CHANGE_FILE_NAME |
FILE_NOTIFY_CHANGE_DIR_NAME |
FILE_NOTIFY_CHANGE_ATTRIBUTES |
FILE_NOTIFY_CHANGE_SIZE |
@@ -79,7 +79,7 @@ HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles,
CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
{
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
UInt64 subFolders, subFiles, subSize;
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name, subFolders, subFiles, subSize, progress));
@@ -106,11 +106,11 @@ HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path)
{
fileInfo.CompressedSizeIsDefined = false;
/*
- if (!GetCompressedFileSize(_path + fileInfo.Name,
+ if (!GetCompressedFileSize(_path + fileInfo.Name,
fileInfo.CompressedSize))
fileInfo.CompressedSize = fileInfo.Size;
*/
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
// fileInfo.Size = GetFolderSize(_path + fileInfo.Name);
fileInfo.Size = 0;
@@ -124,7 +124,7 @@ HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path)
for (int i = 0; i < dirItem.Files.Size(); i++)
{
CDirItem &item = dirItem.Files[i];
- if (item.IsDirectory())
+ if (item.IsDir())
LoadSubItems(item, path + item.Name + L'\\');
}
return S_OK;
@@ -144,7 +144,7 @@ void CFSFolder::AddRefs(CDirItem &dirItem)
for (i = 0; i < dirItem.Files.Size(); i++)
{
CDirItem &item = dirItem.Files[i];
- if (item.IsDirectory())
+ if (item.IsDir())
AddRefs(item);
}
}
@@ -233,7 +233,7 @@ STDMETHODIMP CFSFolder::GetNumberOfSubFolders(UInt32 *numSubFolders)
{
UInt32 numSubFoldersLoc = 0;
for (int i = 0; i < _files.Size(); i++)
- if (_files[i].IsDirectory())
+ if (_files[i].IsDir())
numSubFoldersLoc++;
*numSubFolders = numSubFoldersLoc;
return S_OK;
@@ -262,61 +262,47 @@ bool MyGetCompressedFileSizeW(LPCWSTR fileName, UInt64 &size)
STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (itemIndex >= (UInt32)_refs.Size())
return E_INVALIDARG;
CDirItem &fileInfo = *_refs[itemIndex];
switch(propID)
{
- case kpidIsFolder:
- propVariant = fileInfo.IsDirectory();
- break;
- case kpidName:
- propVariant = fileInfo.Name;
- break;
- case kpidSize:
- propVariant = fileInfo.Size;
- break;
- case kpidPackedSize:
+ case kpidIsDir: prop = fileInfo.IsDir(); break;
+ case kpidName: prop = fileInfo.Name; break;
+ case kpidSize: if (!fileInfo.IsDir()) prop = fileInfo.Size; break;
+ case kpidPackSize:
if (!fileInfo.CompressedSizeIsDefined)
{
fileInfo.CompressedSizeIsDefined = true;
- if (fileInfo.IsDirectory () ||
+ if (fileInfo.IsDir () ||
!MyGetCompressedFileSizeW(_path + GetRelPath(fileInfo), fileInfo.CompressedSize))
fileInfo.CompressedSize = fileInfo.Size;
}
- propVariant = fileInfo.CompressedSize;
- break;
- case kpidAttributes:
- propVariant = (UInt32)fileInfo.Attributes;
- break;
- case kpidCreationTime:
- propVariant = fileInfo.CreationTime;
- break;
- case kpidLastAccessTime:
- propVariant = fileInfo.LastAccessTime;
- break;
- case kpidLastWriteTime:
- propVariant = fileInfo.LastWriteTime;
+ prop = fileInfo.CompressedSize;
break;
+ case kpidAttrib: prop = (UInt32)fileInfo.Attrib; break;
+ case kpidCTime: prop = fileInfo.CTime; break;
+ case kpidATime: prop = fileInfo.ATime; break;
+ case kpidMTime: prop = fileInfo.MTime; break;
case kpidComment:
{
LoadComments();
UString comment;
if (_comments.GetValue(GetRelPath(fileInfo), comment))
- propVariant = comment;
+ prop = comment;
break;
}
case kpidPrefix:
{
if (_flatMode)
{
- propVariant = GetPrefix(fileInfo);
+ prop = GetPrefix(fileInfo);
}
break;
}
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
@@ -351,7 +337,7 @@ STDMETHODIMP CFSFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
*resultFolder = 0;
const CDirItem &fileInfo = *_refs[index];
- if (!fileInfo.IsDirectory())
+ if (!fileInfo.IsDir())
return E_INVALIDARG;
return BindToFolderSpec(GetRelPath(fileInfo), resultFolder);
}
@@ -414,7 +400,7 @@ STDMETHODIMP CFSFolder::GetNumberOfProperties(UInt32 *numProperties)
return S_OK;
}
-STDMETHODIMP CFSFolder::GetPropertyInfo(UInt32 index,
+STDMETHODIMP CFSFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -459,7 +445,7 @@ STDMETHODIMP CFSFolder::WasChanged(INT32 *wasChanged)
_findChangeNotification.FindNext();
wasChangedMain = true;
}
- else
+ else
break;
}
*wasChanged = BoolToInt(wasChangedMain);
@@ -475,7 +461,7 @@ STDMETHODIMP CFSFolder::Clone(IFolderFolder **resultFolder)
return S_OK;
}
-HRESULT CFSFolder::GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
+HRESULT CFSFolder::GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress)
{
numFiles = numFolders = size = 0;
@@ -486,7 +472,7 @@ HRESULT CFSFolder::GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
if (index >= _refs.Size())
return E_INVALIDARG;
const CDirItem &fileInfo = *_refs[index];
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
UInt64 subFolders, subFiles, subSize;
RINOK(GetFolderSize(_path + GetRelPath(fileInfo), subFolders, subFiles, subSize, progress));
@@ -507,7 +493,7 @@ HRESULT CFSFolder::GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
{
const CDirItem &fileInfo = *_refs[index];
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
/*
CMyComPtr<IFolderFolder> subFolder;
@@ -516,7 +502,7 @@ HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
subFolder.QueryInterface(&aFolderReload);
aFolderReload->Reload();
UInt32 numItems;
- RINOK(subFolder->GetNumberOfItems(&numItems));
+ RINOK(subFolder->GetNumberOfItems(&numItems));
CMyComPtr<IFolderGetItemFullSize> aGetItemFullSize;
subFolder.QueryInterface(&aGetItemFullSize);
for (UInt32 i = 0; i < numItems; i++)
@@ -535,13 +521,13 @@ HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
STDMETHODIMP CFSFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
{
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (index >= (UInt32)_refs.Size())
return E_INVALIDARG;
UInt64 size = 0;
HRESULT result = GetItemFullSize(index, size, progress);
- propVariant = size;
- propVariant.Detach(value);
+ prop = size;
+ prop.Detach(value);
return result;
}
@@ -603,7 +589,7 @@ STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress
const CDirItem &fileInfo = *_refs[indices[i]];
const UString fullPath = _path + GetRelPath(fileInfo);
bool result;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
result = NDirectory::RemoveDirectoryWithSubItems(fullPath);
else
result = NDirectory::DeleteFileAlways(fullPath);
@@ -615,7 +601,7 @@ STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress
return S_OK;
}
-STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
+STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
const PROPVARIANT *value, IProgress * /* progress */)
{
if (index >= (UInt32)_refs.Size())
@@ -661,7 +647,7 @@ STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
const CDirItem &fileInfo = *_refs[index];
*iconIndex = 0;
int iconIndexTemp;
- if (GetRealIconIndex(_path + GetRelPath(fileInfo), fileInfo.Attributes, iconIndexTemp) != 0)
+ if (GetRealIconIndex(_path + GetRelPath(fileInfo), fileInfo.Attrib, iconIndexTemp) != 0)
{
*iconIndex = iconIndexTemp;
return S_OK;
diff --git a/CPP/7zip/UI/FileManager/FSFolder.h b/CPP/7zip/UI/FileManager/FSFolder.h
index d938969f..ca229055 100755
--- a/CPP/7zip/UI/FileManager/FSFolder.h
+++ b/CPP/7zip/UI/FileManager/FSFolder.h
@@ -37,7 +37,7 @@ struct CDirItem: public CFileInfoEx
}
};
-class CFSFolder:
+class CFSFolder:
public IFolderFolder,
public IFolderWasChanged,
public IFolderOperations,
@@ -87,7 +87,7 @@ private:
NWindows::NFile::NFind::CFindChangeNotification _findChangeNotification;
- HRESULT GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
+ HRESULT GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress);
HRESULT GetItemFullSize(int index, UInt64 &size, IProgress *progress);
HRESULT GetComplexName(const wchar_t *name, UString &resultPath);
diff --git a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
index 32823fb9..8818b6a9 100755
--- a/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
+++ b/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
@@ -27,7 +27,7 @@ static bool IsItWindows2000orHigher()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
(versionInfo.dwMajorVersion >= 5);
@@ -78,7 +78,7 @@ typedef BOOL (WINAPI * CopyFileExPointerW)(
);
#ifndef _UNICODE
-static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
+static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
static CSysString GetSysPath(LPCWSTR sysPath)
{ return UnicodeStringToMultiByte(sysPath, GetCurrentCodePage()); }
#endif
@@ -194,7 +194,7 @@ static HRESULT MyCopyFile(
RINOK(callback->AskWrite(
srcPath,
BoolToInt(false),
- &srcFileInfo.LastWriteTime, &srcFileInfo.Size,
+ &srcFileInfo.MTime, &srcFileInfo.Size,
destPath,
&destPathResult,
&writeAskResult));
@@ -205,8 +205,8 @@ static HRESULT MyCopyFile(
if (!MyCopyFile(srcPath, destPathNew, callback, completedSize))
{
UString message = NError::MyFormatMessageW(GetLastError()) +
- UString(L" \'") +
- UString(destPathNew) +
+ UString(L" \'") +
+ UString(destPathNew) +
UString(L"\'");
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -230,7 +230,7 @@ static HRESULT CopyFolder(
{
if (destPath.Length() == len || destPath[len] == L'\\')
{
- UString message = UString(L"can not copy folder \'") +
+ UString message = UString(L"can not copy folder \'") +
destPath + UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -249,7 +249,7 @@ static HRESULT CopyFolder(
{
const UString srcPath2 = srcPath + UString(L"\\") + fileInfo.Name;
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize));
}
@@ -261,7 +261,7 @@ static HRESULT CopyFolder(
return S_OK;
}
-STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
+STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
if (numItems == 0)
@@ -287,7 +287,7 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
if (!NDirectory::CreateComplexDirectory(destPath)))
{
DWORD lastError = ::GetLastError();
- UString message = UString(L"can not create folder ") +
+ UString message = UString(L"can not create folder ") +
destPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -303,7 +303,7 @@ STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
if (!directName)
destPath2 += fileInfo.Name;
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
}
@@ -340,8 +340,8 @@ HRESULT MyMoveFile(
RINOK(callback->AskWrite(
srcPath,
BoolToInt(false),
- &srcFileInfo.LastWriteTime, &srcFileInfo.Size,
- destPath,
+ &srcFileInfo.MTime, &srcFileInfo.Size,
+ destPath,
&destPathResult,
&writeAskResult));
if (IntToBool(writeAskResult))
@@ -371,7 +371,7 @@ HRESULT MyMoveFolder(
{
if (destPath.Length() == len || destPath[len] == L'\\')
{
- UString message = UString(L"can not move folder \'") +
+ UString message = UString(L"can not move folder \'") +
destPath + UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -394,7 +394,7 @@ HRESULT MyMoveFolder(
{
const UString srcPath2 = srcPath + UString(L"\\") + fileInfo.Name;
const UString destPath2 = destPath + UString(L"\\") + fileInfo.Name;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize));
}
@@ -414,8 +414,8 @@ HRESULT MyMoveFolder(
}
STDMETHODIMP CFSFolder::MoveTo(
- const UInt32 *indices,
- UInt32 numItems,
+ const UInt32 *indices,
+ UInt32 numItems,
const wchar_t *path,
IFolderOperationsExtractCallback *callback)
{
@@ -439,7 +439,7 @@ STDMETHODIMP CFSFolder::MoveTo(
else
if (!NDirectory::CreateComplexDirectory(destPath))
{
- UString message = UString(L"can not create folder ") +
+ UString message = UString(L"can not create folder ") +
destPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
@@ -454,7 +454,7 @@ STDMETHODIMP CFSFolder::MoveTo(
if (!directName)
destPath2 += fileInfo.Name;
UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
}
@@ -480,7 +480,7 @@ STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
CFileInfoW fileInfo;
if (!FindFile(path, fileInfo))
return ::GetLastError();
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
{
UInt64 subFolders, subFiles, subSize;
RINOK(GetFolderSize(path + UString(L"\\") + fileInfo.Name, subFolders, subFiles, subSize, progress));
diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
index a3a19414..f93c0943 100755
--- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
+++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
@@ -2,11 +2,14 @@
#include "StdAfx.h"
+#include "resource.h"
+
#include "Common/StringConvert.h"
#include "Windows/Defs.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/DLL.h"
+#include "Windows/Thread.h"
#include "IFolder.h"
#include "RegistryAssociations.h"
@@ -14,12 +17,37 @@
#include "OpenCallback.h"
#include "PluginLoader.h"
+#include "LangUtils.h"
#include "../Agent/Agent.h"
using namespace NWindows;
using namespace NRegistryAssociations;
-static int FindPlugin(const CObjectVector<CPluginInfo> &plugins,
+struct CThreadArchiveOpen
+{
+ UString Path;
+ CMyComPtr<IFolderManager> FolderManager;
+ CMyComPtr<IProgress> OpenCallback;
+ COpenArchiveCallback *OpenCallbackSpec;
+
+ CMyComPtr<IFolderFolder> Folder;
+ HRESULT Result;
+
+ void Process()
+ {
+ OpenCallbackSpec->ProgressDialog.WaitCreating();
+ Result = FolderManager->OpenFolderFile(Path, &Folder, OpenCallback);
+ OpenCallbackSpec->ProgressDialog.MyClose();
+ }
+
+ static THREAD_FUNC_DECL MyThreadFunction(void *param)
+ {
+ ((CThreadArchiveOpen *)param)->Process();
+ return 0;
+ }
+};
+
+static int FindPlugin(const CObjectVector<CPluginInfo> &plugins,
const UString &pluginName)
{
for (int i = 0; i < plugins.Size(); i++)
@@ -29,13 +57,12 @@ static int FindPlugin(const CObjectVector<CPluginInfo> &plugins,
}
HRESULT OpenFileFolderPlugin(
- const UString &path,
+ const UString &path,
HMODULE *module,
- IFolderFolder **resultFolder,
- HWND parentWindow,
- bool &encrypted)
+ IFolderFolder **resultFolder,
+ HWND parentWindow,
+ bool &encrypted, UString &password)
{
- encrypted = false;
CObjectVector<CPluginInfo> plugins;
ReadFileFolderPluginInfoList(plugins);
@@ -82,33 +109,50 @@ HRESULT OpenFileFolderPlugin(
if (!plugin.ClassIDDefined)
continue;
CPluginLibrary library;
- CMyComPtr<IFolderManager> folderManager;
- CMyComPtr<IFolderFolder> folder;
+
+ CThreadArchiveOpen t;
+
if (plugin.FilePath.IsEmpty())
- folderManager = new CArchiveFolderManager;
- else if (library.LoadAndCreateManager(plugin.FilePath, plugin.ClassID, &folderManager) != S_OK)
+ t.FolderManager = new CArchiveFolderManager;
+ else if (library.LoadAndCreateManager(plugin.FilePath, plugin.ClassID, &t.FolderManager) != S_OK)
continue;
- COpenArchiveCallback *openCallbackSpec = new COpenArchiveCallback;
- CMyComPtr<IProgress> openCallback = openCallbackSpec;
- openCallbackSpec->PasswordIsDefined = false;
- openCallbackSpec->ParentWindow = parentWindow;
- openCallbackSpec->LoadFileInfo(dirPrefix, fileName);
- HRESULT result = folderManager->OpenFolderFile(path, &folder, openCallback);
- if (openCallbackSpec->PasswordWasAsked)
- encrypted = true;
- if (result == S_OK)
+ t.OpenCallbackSpec = new COpenArchiveCallback;
+ t.OpenCallback = t.OpenCallbackSpec;
+ t.OpenCallbackSpec->PasswordIsDefined = encrypted;
+ t.OpenCallbackSpec->Password = password;
+ t.OpenCallbackSpec->ParentWindow = parentWindow;
+ t.OpenCallbackSpec->LoadFileInfo(dirPrefix, fileName);
+
+ t.Path = path;
+
+ UString progressTitle = LangString(IDS_OPENNING, 0x03020283);
+ t.OpenCallbackSpec->ProgressDialog.MainWindow = parentWindow;
+ t.OpenCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
+ t.OpenCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
+
+ NWindows::CThread thread;
+ if (thread.Create(CThreadArchiveOpen::MyThreadFunction, &t) != S_OK)
+ throw 271824;
+ t.OpenCallbackSpec->StartProgressDialog(progressTitle);
+
+ if (t.Result == E_ABORT)
+ return t.Result;
+
+ if (t.Result == S_OK)
{
+ // if (openCallbackSpec->PasswordWasAsked)
+ {
+ encrypted = t.OpenCallbackSpec->PasswordIsDefined;
+ password = t.OpenCallbackSpec->Password;
+ }
*module = library.Detach();
- *resultFolder = folder.Detach();
+ *resultFolder = t.Folder.Detach();
return S_OK;
}
- continue;
-
- /*
- if (result != S_FALSE)
- return result;
- */
+
+ if (t.Result != S_FALSE)
+ return t.Result;
}
return S_FALSE;
} \ No newline at end of file
diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
index 295048a9..9e5c66c7 100755
--- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
+++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
@@ -3,7 +3,7 @@
#ifndef __FILEFOLDERPLUGINOPEN_H
#define __FILEFOLDERPLUGINOPEN_H
-HRESULT OpenFileFolderPlugin(const UString &path,
- HMODULE *module, IFolderFolder **resultFolder, HWND parentWindow, bool &encrypted);
+HRESULT OpenFileFolderPlugin(const UString &path,
+ HMODULE *module, IFolderFolder **resultFolder, HWND parentWindow, bool &encrypted, UString &password);
#endif
diff --git a/CPP/7zip/UI/FileManager/FilePlugins.cpp b/CPP/7zip/UI/FileManager/FilePlugins.cpp
index 1812312e..173eeffa 100755
--- a/CPP/7zip/UI/FileManager/FilePlugins.cpp
+++ b/CPP/7zip/UI/FileManager/FilePlugins.cpp
@@ -57,7 +57,7 @@ void CExtDatabase::Read()
if (pluginInfo.FilePath.IsEmpty())
folderManager = new CArchiveFolderManager;
- else if (pluginLibrary.LoadAndCreateManager(pluginInfo.FilePath,
+ else if (pluginLibrary.LoadAndCreateManager(pluginInfo.FilePath,
pluginInfo.ClassID, &folderManager) != S_OK)
continue;
CMyComBSTR extBSTR;
diff --git a/CPP/7zip/UI/FileManager/FormatUtils.cpp b/CPP/7zip/UI/FileManager/FormatUtils.cpp
index 553d8bcd..98bb043e 100755
--- a/CPP/7zip/UI/FileManager/FormatUtils.cpp
+++ b/CPP/7zip/UI/FileManager/FormatUtils.cpp
@@ -24,17 +24,17 @@ UString MyFormatNew(const UString &format, const UString &argument)
return result;
}
-UString MyFormatNew(UINT resourceID,
+UString MyFormatNew(UINT resourceID,
#ifdef LANG
- UInt32 langID,
+ UInt32 langID,
#endif
const UString &argument)
{
return MyFormatNew(
#ifdef LANG
- LangString(resourceID, langID),
+ LangString(resourceID, langID),
#else
- NWindows::MyLoadStringW(resourceID),
+ NWindows::MyLoadStringW(resourceID),
#endif
argument);
}
diff --git a/CPP/7zip/UI/FileManager/FormatUtils.h b/CPP/7zip/UI/FileManager/FormatUtils.h
index 35536871..70a44434 100755
--- a/CPP/7zip/UI/FileManager/FormatUtils.h
+++ b/CPP/7zip/UI/FileManager/FormatUtils.h
@@ -9,9 +9,9 @@
UString NumberToString(UInt64 number);
UString MyFormatNew(const UString &format, const UString &argument);
-UString MyFormatNew(UINT resourceID,
+UString MyFormatNew(UINT resourceID,
#ifdef LANG
- UInt32 langID,
+ UInt32 langID,
#endif
const UString &argument);
diff --git a/CPP/7zip/UI/FileManager/IFolder.h b/CPP/7zip/UI/FileManager/IFolder.h
index fdd9fa3c..6709cd1e 100755
--- a/CPP/7zip/UI/FileManager/IFolder.h
+++ b/CPP/7zip/UI/FileManager/IFolder.h
@@ -10,7 +10,7 @@
namespace NPlugin
{
- enum
+ enum
{
kName = 0,
kType,
@@ -45,12 +45,12 @@ FOLDER_INTERFACE_SUB(IFolderOperationsExtractCallback, IProgress, 0x0B)
// STDMETHOD(SetTotalFiles)(UInt64 total) PURE;
// STDMETHOD(SetCompletedFiles)(const UInt64 *completedValue) PURE;
STDMETHOD(AskWrite)(
- const wchar_t *srcPath,
- Int32 srcIsFolder,
- const FILETIME *srcTime,
+ const wchar_t *srcPath,
+ Int32 srcIsFolder,
+ const FILETIME *srcTime,
const UInt64 *srcSize,
- const wchar_t *destPathRequest,
- BSTR *destPathResult,
+ const wchar_t *destPathRequest,
+ BSTR *destPathResult,
Int32 *writeAnswer) PURE;
STDMETHOD(ShowMessage)(const wchar_t *message) PURE;
STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath) PURE;
diff --git a/CPP/7zip/UI/FileManager/LangPage.cpp b/CPP/7zip/UI/FileManager/LangPage.cpp
index 3300213b..264872f6 100755
--- a/CPP/7zip/UI/FileManager/LangPage.cpp
+++ b/CPP/7zip/UI/FileManager/LangPage.cpp
@@ -12,7 +12,7 @@
#include "HelpUtils.h"
#include "LangUtils.h"
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_LANG_STATIC_LANG, 0x01000401}
};
@@ -40,7 +40,7 @@ bool CLangPage::OnInit()
for (int i = 0; i < langs.Size(); i++)
{
const CLangEx &lang = langs[i];
- UString name;
+ UString name;
UString englishName, nationalName;
if (lang.Lang.GetMessage(0x00000000, englishName))
name = englishName;
diff --git a/CPP/7zip/UI/FileManager/LangPage.h b/CPP/7zip/UI/FileManager/LangPage.h
index b28d6984..64825b8e 100755
--- a/CPP/7zip/UI/FileManager/LangPage.h
+++ b/CPP/7zip/UI/FileManager/LangPage.h
@@ -9,7 +9,7 @@
class CLangPage: public NWindows::NControl::CPropertyPage
{
NWindows::NControl::CComboBox _langCombo;
- UStringVector _paths;
+ UStringVector _paths;
public:
bool _langWasChanged;
virtual bool OnInit();
diff --git a/CPP/7zip/UI/FileManager/LangUtils.cpp b/CPP/7zip/UI/FileManager/LangUtils.cpp
index bf75df00..0591c73c 100755
--- a/CPP/7zip/UI/FileManager/LangUtils.cpp
+++ b/CPP/7zip/UI/FileManager/LangUtils.cpp
@@ -27,13 +27,13 @@ void ReloadLang()
if (!g_LangID.IsEmpty() && g_LangID != L"-")
{
UString langPath = g_LangID;
- if (langPath.Find('\\') < 0)
+ if (langPath.Find(WCHAR_PATH_SEPARATOR) < 0)
{
- if (langPath.Find('.') < 0)
+ if (langPath.Find(L'.') < 0)
langPath += L".txt";
UString folderPath;
if (GetProgramFolderPath(folderPath))
- langPath = folderPath + UString(L"Lang\\") + langPath;
+ langPath = folderPath + UString(L"Lang" WSTRING_PATH_SEPARATOR) + langPath;
}
g_Lang.Open(langPath);
}
@@ -94,12 +94,12 @@ void LoadLangs(CObjectVector<CLangEx> &langs)
UString folderPath;
if (!::GetProgramFolderPath(folderPath))
return;
- folderPath += L"Lang\\";
+ folderPath += L"Lang" WSTRING_PATH_SEPARATOR;
NWindows::NFile::NFind::CEnumeratorW enumerator(folderPath + L"*.txt");
NWindows::NFile::NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
{
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
continue;
CLangEx lang;
UString filePath = folderPath + fileInfo.Name;
diff --git a/CPP/7zip/UI/FileManager/ListViewDialog.cpp b/CPP/7zip/UI/FileManager/ListViewDialog.cpp
index 67423501..7a78fcde 100755
--- a/CPP/7zip/UI/FileManager/ListViewDialog.cpp
+++ b/CPP/7zip/UI/FileManager/ListViewDialog.cpp
@@ -3,18 +3,18 @@
#include "StdAfx.h"
#include "ListViewDialog.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDOK, 0x02000702 },
{ IDCANCEL, 0x02000710 }
};
#endif
-bool CListViewDialog::OnInit()
+bool CListViewDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_listView.Attach(GetItem(IDC_LISTVIEW_LIST));
@@ -28,15 +28,9 @@ bool CListViewDialog::OnInit()
_listView.InsertColumn(0, &columnInfo);
- for(int i = 0; i < Strings.Size(); i++)
- {
- LVITEMW item;
- item.mask = LVIF_TEXT;
- item.iItem = i;
- item.pszText = (LPWSTR)(LPCWSTR)Strings[i];
- item.iSubItem = 0;
- _listView.InsertItem(&item);
- }
+ for (int i = 0; i < Strings.Size(); i++)
+ _listView.InsertItem(i, Strings[i]);
+
if (Strings.Size() > 0)
_listView.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
StringsWereChanged = false;
diff --git a/CPP/7zip/UI/FileManager/ListViewDialog.rc b/CPP/7zip/UI/FileManager/ListViewDialog.rc
index e83f3330..cb456534 100755
--- a/CPP/7zip/UI/FileManager/ListViewDialog.rc
+++ b/CPP/7zip/UI/FileManager/ListViewDialog.rc
@@ -16,7 +16,7 @@ IDD_DIALOG_LISTVIEW DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
CAPTION "ListView"
MY_FONT
BEGIN
- CONTROL "List1", IDC_LISTVIEW_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
+ CONTROL "List1", IDC_LISTVIEW_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,
marg, marg, xSize2, ySize2 - bYSize - 10
DEFPUSHBUTTON "OK", IDOK, b2XPos, bYPos, bXSize, bYSize
diff --git a/CPP/7zip/UI/FileManager/MessagesDialog.cpp b/CPP/7zip/UI/FileManager/MessagesDialog.cpp
index 57879d64..201c0bae 100755
--- a/CPP/7zip/UI/FileManager/MessagesDialog.cpp
+++ b/CPP/7zip/UI/FileManager/MessagesDialog.cpp
@@ -6,14 +6,14 @@
#include "Common/IntToString.h"
#include "Windows/ResourceString.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
using namespace NWindows;
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDOK, 0x02000713 }
};
@@ -22,20 +22,10 @@ static CIDLangPair kIDLangPairs[] =
void CMessagesDialog::AddMessageDirect(LPCWSTR message)
{
int itemIndex = _messageList.GetItemCount();
- LVITEMW item;
- item.mask = LVIF_TEXT;
- item.iItem = itemIndex;
-
wchar_t sz[32];
ConvertInt64ToString(itemIndex, sz);
-
- item.pszText = sz;
- item.iSubItem = 0;
- _messageList.InsertItem(&item);
-
- item.pszText = (LPWSTR)message;
- item.iSubItem = 1;
- _messageList.SetItem(&item);
+ _messageList.InsertItem(itemIndex, sz);
+ _messageList.SetSubItem(itemIndex, 1, message);
}
void CMessagesDialog::AddMessage(LPCWSTR message)
@@ -52,39 +42,25 @@ void CMessagesDialog::AddMessage(LPCWSTR message)
AddMessageDirect(s);
}
-bool CMessagesDialog::OnInit()
+bool CMessagesDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x02000A00);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
_messageList.Attach(GetItem(IDC_MESSAGE_LIST));
_messageList.SetUnicodeFormat(true);
- LVCOLUMNW columnInfo;
- columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
- columnInfo.fmt = LVCFMT_LEFT;
- columnInfo.pszText = L"#";
- columnInfo.iSubItem = 0;
- columnInfo.cx = 30;
-
- _messageList.InsertColumn(0, &columnInfo);
-
-
- columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
- columnInfo.fmt = LVCFMT_LEFT;
- UString s =
- #ifdef LANG
- LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
- #else
- MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
- #endif
+ _messageList.InsertColumn(0, L"#", 30);
- columnInfo.pszText = (LPWSTR)(LPCWSTR)s;
- columnInfo.iSubItem = 1;
- columnInfo.cx = 600;
+ const UString s =
+ #ifdef LANG
+ LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
+ #else
+ MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
+ #endif
- _messageList.InsertColumn(1, &columnInfo);
+ _messageList.InsertColumn(1, s, 600);
for(int i = 0; i < Messages->Size(); i++)
AddMessage((*Messages)[i]);
diff --git a/CPP/7zip/UI/FileManager/MessagesDialog.rc b/CPP/7zip/UI/FileManager/MessagesDialog.rc
index fdefb172..bf1c56b0 100755
--- a/CPP/7zip/UI/FileManager/MessagesDialog.rc
+++ b/CPP/7zip/UI/FileManager/MessagesDialog.rc
@@ -15,7 +15,7 @@ MY_FONT
BEGIN
DEFPUSHBUTTON "&Close", IDOK, bXPos, bYPos, bXSize, bYSize
CONTROL "List1",IDC_MESSAGE_LIST,"SysListView32",
- LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
+ LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
marg, marg, xSize2, ySize2 - bYSize - 6
END
diff --git a/CPP/7zip/UI/FileManager/MyLoadMenu.cpp b/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
index 4ad152b1..c6f57f9e 100755
--- a/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
+++ b/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
@@ -41,7 +41,7 @@ struct CStringLangPair
UINT32 LangID;
};
-static CStringLangPair kStringLangPairs[] =
+static CStringLangPair kStringLangPairs[] =
{
{ L"&File", 0x03000102 },
{ L"&Edit", 0x03000103 },
@@ -57,7 +57,7 @@ UINT32 kToolbarsLangID = 0x03000451;
/*
static int FindStringLangItem(const UString &anItem)
{
- for (int i = 0; i < sizeof(kStringLangPairs) /
+ for (int i = 0; i < sizeof(kStringLangPairs) /
sizeof(kStringLangPairs[0]); i++)
if (anItem.CompareNoCase(kStringLangPairs[i].String) == 0)
return i;
@@ -65,7 +65,7 @@ static int FindStringLangItem(const UString &anItem)
}
*/
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
// File
{ IDM_FILE_OPEN, 0x03000210 },
@@ -151,9 +151,9 @@ public:
g_IsNew_fMask = false;
OSVERSIONINFO vi;
vi.dwOSVersionInfoSize = sizeof(vi);
- if (::GetVersionEx(&vi))
+ if (::GetVersionEx(&vi))
{
- g_IsNew_fMask = (vi.dwMajorVersion > 4 ||
+ g_IsNew_fMask = (vi.dwMajorVersion > 4 ||
(vi.dwMajorVersion == 4 && vi.dwMinorVersion > 0));
}
g_IsNew_fMask = false;
@@ -217,7 +217,7 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
}
else
{
- if (level == 0 && i < sizeof(kStringLangPairs) /
+ if (level == 0 && i < sizeof(kStringLangPairs) /
sizeof(kStringLangPairs[0]))
newString = LangString(kStringLangPairs[i].LangID);
else
@@ -339,7 +339,7 @@ void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
// View;
CMenu menu;
menu.Attach(hMenu);
- menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
+ menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
IDM_VIEW_LARGE_ICONS + g_App.GetListViewMode(), MF_BYCOMMAND);
menu.CheckItem(IDM_VIEW_TWO_PANELS, MF_BYCOMMAND |
((g_App.NumPanels == 2) ? MF_CHECKED : MF_UNCHECKED));
@@ -413,7 +413,8 @@ void OnMenuUnActivating(HWND hWnd)
*/
-void LoadFileMenu(HMENU hMenu, int startPos, bool /* forFileMode */, bool programMenu)
+void LoadFileMenu(HMENU hMenu, int startPos, bool programMenu,
+ bool isFsFolder, int numItems, bool allAreFiles)
{
{
CMenu srcMenu;
@@ -439,6 +440,10 @@ void LoadFileMenu(HMENU hMenu, int startPos, bool /* forFileMode */, bool progra
if (!programMenu)
if (item.wID == IDCLOSE)
continue;
+ bool isOneFsFile = (isFsFolder && numItems == 1 && allAreFiles);
+ if ((item.wID == IDM_FILE_SPLIT || item.wID == IDM_FILE_COMBINE) && !isOneFsFile)
+ item.fState |= MFS_DISABLED;
+
/*
bool createItem = (item.wID == IDM_CREATE_FOLDER || item.wID == IDM_CREATE_FILE);
if (forFileMode)
@@ -538,7 +543,7 @@ bool ExecuteFileCommand(int id)
break;
default:
return false;
- }
+ }
return true;
}
@@ -607,7 +612,7 @@ bool OnMenuCommand(HWND hWnd, int id)
/*
CMenu menu;
menu.Attach(::GetSubMenu(::GetMenu(hWnd), kViewMenuIndex));
- menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
+ menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
id, MF_BYCOMMAND);
*/
}
@@ -625,7 +630,7 @@ bool OnMenuCommand(HWND hWnd, int id)
}
case IDM_VIEW_ARANGE_BY_DATE:
{
- g_App.SortItemsWithPropID(kpidLastWriteTime);
+ g_App.SortItemsWithPropID(kpidMTime);
break;
}
case IDM_VIEW_ARANGE_BY_SIZE:
diff --git a/CPP/7zip/UI/FileManager/MyLoadMenu.h b/CPP/7zip/UI/FileManager/MyLoadMenu.h
index 490dc6d8..83c1d24f 100755
--- a/CPP/7zip/UI/FileManager/MyLoadMenu.h
+++ b/CPP/7zip/UI/FileManager/MyLoadMenu.h
@@ -10,7 +10,8 @@ void OnMenuActivating(HWND hWnd, HMENU hMenu, int position);
void MyLoadMenu(HWND hWnd);
bool OnMenuCommand(HWND hWnd, int id);
void MyLoadMenu();
-void LoadFileMenu(HMENU hMenu, int startPos, bool forFileMode, bool programMenu);
+void LoadFileMenu(HMENU hMenu, int startPos, bool programMenu,
+ bool isFsFolder, int numItems, bool allAreFiles);
bool ExecuteFileCommand(int id);
#endif
diff --git a/CPP/7zip/UI/FileManager/NetFolder.cpp b/CPP/7zip/UI/FileManager/NetFolder.cpp
index 7bd5d2e5..e03a06c5 100755
--- a/CPP/7zip/UI/FileManager/NetFolder.cpp
+++ b/CPP/7zip/UI/FileManager/NetFolder.cpp
@@ -16,7 +16,7 @@
using namespace NWindows;
using namespace NNet;
-static const STATPROPSTG kProperties[] =
+static const STATPROPSTG kProperties[] =
{
{ NULL, kpidName, VT_BSTR},
{ NULL, kpidLocalName, VT_BSTR},
@@ -63,7 +63,7 @@ void CNetFolder::Init(const UString &path)
return;
}
-void CNetFolder::Init(const NWindows::NNet::CResourceW *netResource,
+void CNetFolder::Init(const NWindows::NNet::CResourceW *netResource,
IFolderFolder *parentFolder, const UString &path)
{
_path = path;
@@ -105,7 +105,7 @@ STDMETHODIMP CNetFolder::LoadItems()
}
for (;;)
- {
+ {
CResourceEx resource;
DWORD result = enumerator.Next(resource);
if (result == NO_ERROR)
@@ -123,7 +123,7 @@ STDMETHODIMP CNetFolder::LoadItems()
}
else if (result == ERROR_NO_MORE_ITEMS)
break;
- else
+ else
return result;
}
@@ -162,31 +162,20 @@ STDMETHODIMP CNetFolder::GetNumberOfItems(UInt32 *numItems)
STDMETHODIMP CNetFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
const CResourceEx &item = _items[itemIndex];
switch(propID)
{
- case kpidIsFolder:
- propVariant = true;
- break;
+ case kpidIsDir: prop = true; break;
case kpidName:
// if (item.RemoteNameIsDefined)
- propVariant = item.Name;
- break;
- case kpidLocalName:
- if (item.LocalNameIsDefined)
- propVariant = item.LocalName;
- break;
- case kpidComment:
- if (item.CommentIsDefined)
- propVariant = item.Comment;
- break;
- case kpidProvider:
- if (item.ProviderIsDefined)
- propVariant = item.Provider;
+ prop = item.Name;
break;
+ case kpidLocalName: if (item.LocalNameIsDefined) prop = item.LocalName; break;
+ case kpidComment: if (item.CommentIsDefined) prop = item.Comment; break;
+ case kpidProvider: if (item.ProviderIsDefined) prop = item.Provider; break;
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
@@ -194,7 +183,7 @@ STDMETHODIMP CNetFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder
{
*resultFolder = 0;
const CResourceEx &resource = _items[index];
- if (resource.Usage == RESOURCEUSAGE_CONNECTABLE ||
+ if (resource.Usage == RESOURCEUSAGE_CONNECTABLE ||
resource.DisplayType == RESOURCEDISPLAYTYPE_SHARE)
{
NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
@@ -249,7 +238,7 @@ STDMETHODIMP CNetFolder::GetNumberOfProperties(UInt32 *numProperties)
return S_OK;
}
-STDMETHODIMP CNetFolder::GetPropertyInfo(UInt32 index,
+STDMETHODIMP CNetFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -280,7 +269,7 @@ STDMETHODIMP CNetFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
*iconIndex = 0;
const CResourceW &resource = _items[index];
int iconIndexTemp;
- if (resource.DisplayType == RESOURCEDISPLAYTYPE_SERVER ||
+ if (resource.DisplayType == RESOURCEDISPLAYTYPE_SERVER ||
resource.Usage == RESOURCEUSAGE_CONNECTABLE)
{
if (GetRealIconIndex(resource.RemoteName, 0, iconIndexTemp))
diff --git a/CPP/7zip/UI/FileManager/NetFolder.h b/CPP/7zip/UI/FileManager/NetFolder.h
index 0214cfdb..92471ec6 100755
--- a/CPP/7zip/UI/FileManager/NetFolder.h
+++ b/CPP/7zip/UI/FileManager/NetFolder.h
@@ -16,7 +16,7 @@ struct CResourceEx: public NWindows::NNet::CResourceW
UString Name;
};
-class CNetFolder:
+class CNetFolder:
public IFolderFolder,
public IFolderGetSystemIconIndex,
public CMyUnknownImp
@@ -41,7 +41,7 @@ private:
public:
void Init(const UString &path);
- void Init(const NWindows::NNet::CResourceW *netResource,
+ void Init(const NWindows::NNet::CResourceW *netResource,
IFolderFolder *parentFolder, const UString &path);
CNetFolder(): _netResourcePointer(0) {}
};
diff --git a/CPP/7zip/UI/FileManager/OpenCallback.cpp b/CPP/7zip/UI/FileManager/OpenCallback.cpp
index 70ec3f39..be40fc1c 100755
--- a/CPP/7zip/UI/FileManager/OpenCallback.cpp
+++ b/CPP/7zip/UI/FileManager/OpenCallback.cpp
@@ -11,69 +11,80 @@
#include "PasswordDialog.h"
-STDMETHODIMP COpenArchiveCallback::SetTotal(const UINT64 * /* numFiles */, const UINT64 * /* numBytes */)
+STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64 *numBytes)
{
+ {
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ _numFilesTotalDefined = (numFiles != NULL);
+ _numBytesTotalDefined = (numBytes != NULL);
+ if (_numFilesTotalDefined)
+ {
+ ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
+ ProgressDialog.ProgressSynch.SetProgress(*numFiles, 0);
+ }
+ else if (_numBytesTotalDefined)
+ ProgressDialog.ProgressSynch.SetProgress(*numBytes, 0);
+ }
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::SetCompleted(const UINT64 * /* numFiles */, const UINT64 * /* numBytes */)
+STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *numFiles, const UInt64 *numBytes)
{
+ NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
+ RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
+ if (numFiles != NULL)
+ {
+ ProgressDialog.ProgressSynch.SetNumFilesCur(*numFiles);
+ if (_numFilesTotalDefined)
+ ProgressDialog.ProgressSynch.SetPos(*numFiles);
+ }
+ if (numBytes != NULL && _numBytesTotalDefined)
+ ProgressDialog.ProgressSynch.SetPos(*numBytes);
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::SetTotal(const UINT64 /* total */)
+STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 total)
{
+ ProgressDialog.ProgressSynch.SetProgress(total, 0);
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::SetCompleted(const UINT64 * /* completed */)
+STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *completed)
{
+ RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
+ if (completed != NULL)
+ ProgressDialog.ProgressSynch.SetPos(*completed);
return S_OK;
}
STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value)
{
- NWindows::NCOM::CPropVariant propVariant;
+ NWindows::NCOM::CPropVariant prop;
if (_subArchiveMode)
{
switch(propID)
{
- case kpidName:
- propVariant = _subArchiveName;
- break;
+ case kpidName: prop = _subArchiveName; break;
}
- propVariant.Detach(value);
- return S_OK;
}
- switch(propID)
+ else
{
- case kpidName:
- propVariant = _fileInfo.Name;
- break;
- case kpidIsFolder:
- propVariant = _fileInfo.IsDirectory();
- break;
- case kpidSize:
- propVariant = _fileInfo.Size;
- break;
- case kpidAttributes:
- propVariant = (UINT32)_fileInfo.Attributes;
- break;
- case kpidLastAccessTime:
- propVariant = _fileInfo.LastAccessTime;
- break;
- case kpidCreationTime:
- propVariant = _fileInfo.CreationTime;
- break;
- case kpidLastWriteTime:
- propVariant = _fileInfo.LastWriteTime;
- break;
+ switch(propID)
+ {
+ case kpidName: prop = _fileInfo.Name; break;
+ case kpidIsDir: prop = _fileInfo.IsDir(); break;
+ case kpidSize: prop = _fileInfo.Size; break;
+ case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
+ case kpidCTime: prop = _fileInfo.CTime; break;
+ case kpidATime: prop = _fileInfo.ATime; break;
+ case kpidMTime: prop = _fileInfo.MTime; break;
+ }
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
-STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
+STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
IInStream **inStream)
{
*inStream = NULL;
@@ -86,7 +97,7 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
if (!NWindows::NFile::NFind::FindFile(fullPath, fileInfo))
return S_FALSE;
_fileInfo = fileInfo;
- if (_fileInfo.IsDirectory())
+ if (_fileInfo.IsDir())
return S_FALSE;
CInFileStream *inFile = new CInFileStream;
CMyComPtr<IInStream> inStreamTemp = inFile;
@@ -103,7 +114,7 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
{
CPasswordDialog dialog;
- if (dialog.Create(ParentWindow) == IDCANCEL)
+ if (dialog.Create(ProgressDialog) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
diff --git a/CPP/7zip/UI/FileManager/OpenCallback.h b/CPP/7zip/UI/FileManager/OpenCallback.h
index 15b50168..168f171b 100755
--- a/CPP/7zip/UI/FileManager/OpenCallback.h
+++ b/CPP/7zip/UI/FileManager/OpenCallback.h
@@ -11,7 +11,15 @@
#include "../../Archive/IArchive.h"
-class COpenArchiveCallback:
+
+#ifdef _SFX
+#include "ProgressDialog.h"
+#else
+#include "ProgressDialog2.h"
+#endif
+
+
+class COpenArchiveCallback:
public IArchiveOpenCallback,
public IArchiveOpenVolumeCallback,
public IArchiveOpenSetSubArchiveName,
@@ -21,6 +29,11 @@ class COpenArchiveCallback:
{
UString _folderPrefix;
NWindows::NFile::NFind::CFileInfoW _fileInfo;
+
+ bool _numFilesTotalDefined;
+ bool _numBytesTotalDefined;
+ NWindows::NSynchronization::CCriticalSection _criticalSection;
+
public:
bool PasswordIsDefined;
UString Password;
@@ -31,6 +44,8 @@ public:
UString _subArchiveName;
public:
+ CProgressDialog ProgressDialog;
+
MY_UNKNOWN_IMP5(
IArchiveOpenCallback,
IArchiveOpenVolumeCallback,
@@ -38,17 +53,9 @@ public:
IProgress,
ICryptoGetTextPassword)
- // IProgress
- STDMETHOD(SetTotal)(UINT64 total);
- STDMETHOD(SetCompleted)(const UINT64 *completeValue);
-
- // IArchiveOpenCallback
- STDMETHOD(SetTotal)(const UINT64 *numFiles, const UINT64 *numBytes);
- STDMETHOD(SetCompleted)(const UINT64 *numFiles, const UINT64 *numBytes);
-
- // IArchiveOpenVolumeCallback
- STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value);
- STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream);
+ INTERFACE_IProgress(;)
+ INTERFACE_IArchiveOpenCallback(;)
+ INTERFACE_IArchiveOpenVolumeCallback(;)
// ICryptoGetTextPassword
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
@@ -60,8 +67,12 @@ public:
return S_OK;
}
- COpenArchiveCallback()
+ COpenArchiveCallback():
+ ParentWindow(0)
{
+ _numFilesTotalDefined = false;
+ _numBytesTotalDefined = false;
+
_subArchiveMode = false;
PasswordIsDefined = false;
PasswordWasAsked = false;
@@ -79,7 +90,13 @@ public:
if (!NWindows::NFile::NFind::FindFile(_folderPrefix + fileName, _fileInfo))
throw 1;
}
- void ShowMessage(const UINT64 *completed);
+ void ShowMessage(const UInt64 *completed);
+
+ INT_PTR StartProgressDialog(const UString &title)
+ {
+ return ProgressDialog.Create(title, ParentWindow);
+ }
+
};
#endif
diff --git a/CPP/7zip/UI/FileManager/OverwriteDialog.cpp b/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
index 442df929..42c63266 100755
--- a/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
+++ b/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
@@ -15,14 +15,14 @@
// #include "../resource.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
using namespace NWindows;
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_OVERWRITE_HEADER, 0x02000901},
{ IDC_STATIC_OVERWRITE_QUESTION_BEGIN, 0x02000902 },
@@ -36,14 +36,14 @@ static CIDLangPair kIDLangPairs[] =
};
#endif
-void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
- const NOverwriteDialog::CFileInfo &fileInfo)
+void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
+ const NOverwriteDialog::CFileInfo &fileInfo)
{
UString sizeString;
if (fileInfo.SizeIsDefined)
- sizeString = MyFormatNew(IDS_FILE_SIZE,
- #ifdef LANG
- 0x02000982,
+ sizeString = MyFormatNew(IDS_FILE_SIZE,
+ #ifdef LANG
+ 0x02000982,
#endif
NumberToString(fileInfo.Size));
@@ -64,13 +64,13 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
if (fileInfo.TimeIsDefined)
{
UString timeString;
- FILETIME localFileTime;
+ FILETIME localFileTime;
if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime))
throw 4190402;
timeString = ConvertFileTimeToString(localFileTime);
- fullString +=
- #ifdef LANG
+ fullString +=
+ #ifdef LANG
LangString(IDS_FILE_MODIFIED, 0x02000983);
#else
MyLoadStringW(IDS_FILE_MODIFIED);
@@ -86,8 +86,8 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
SHFILEINFO shellFileInfo;
if (::SHGetFileInfo(
- GetSystemString(fileInfo.Name), FILE_ATTRIBUTE_NORMAL, &shellFileInfo,
- sizeof(shellFileInfo), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_LARGEICON))
+ GetSystemString(fileInfo.Name), FILE_ATTRIBUTE_NORMAL, &shellFileInfo,
+ sizeof(shellFileInfo), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_LARGEICON))
{
NControl::CStatic staticContol;
staticContol.Attach(GetItem(iconID));
@@ -95,21 +95,21 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
}
}
-bool COverwriteDialog::OnInit()
+bool COverwriteDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x02000900);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
- SetFileInfoControl(IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME,
+ SetFileInfoControl(IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME,
IDC_STATIC_OVERWRITE_OLD_FILE_ICON, OldFileInfo);
- SetFileInfoControl(IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME,
+ SetFileInfoControl(IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME,
IDC_STATIC_OVERWRITE_NEW_FILE_ICON, NewFileInfo);
return CModalDialog::OnInit();
}
-bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
switch(buttonID)
{
case IDYES:
diff --git a/CPP/7zip/UI/FileManager/OverwriteDialog.h b/CPP/7zip/UI/FileManager/OverwriteDialog.h
index fd7444eb..d206fb01 100755
--- a/CPP/7zip/UI/FileManager/OverwriteDialog.h
+++ b/CPP/7zip/UI/FileManager/OverwriteDialog.h
@@ -20,7 +20,7 @@ namespace NOverwriteDialog
class COverwriteDialog: public NWindows::NControl::CModalDialog
{
- void SetFileInfoControl(int textID, int iconID,
+ void SetFileInfoControl(int textID, int iconID,
const NOverwriteDialog::CFileInfo &fileInfo);
virtual bool OnInit();
bool OnButtonClicked(int buttonID, HWND buttonHWND);
diff --git a/CPP/7zip/UI/FileManager/Panel.cpp b/CPP/7zip/UI/FileManager/Panel.cpp
index 9807b958..e0ed7b50 100755
--- a/CPP/7zip/UI/FileManager/Panel.cpp
+++ b/CPP/7zip/UI/FileManager/Panel.cpp
@@ -21,6 +21,7 @@
#include "ExtractCallback.h"
#include "resource.h"
+#include "..\GUI\ExtractRes.h"
#include "../Agent/IFolderArchive.h"
@@ -28,6 +29,7 @@
#include "../Common/ArchiveName.h"
using namespace NWindows;
+using namespace NControl;
#ifndef _UNICODE
extern bool g_IsNT;
@@ -36,9 +38,6 @@ extern bool g_IsNT;
static const UINT_PTR kTimerID = 1;
static const UINT kTimerElapse = 1000;
-static LPCWSTR kSelectOneFile = L"Select one file";
-static LPCWSTR kSelectFiles = L"Select files";
-
static DWORD kStyles[4] = { LVS_ICON, LVS_SMALLICON, LVS_LIST, LVS_REPORT };
// static const int kCreateFolderID = 101;
@@ -49,7 +48,7 @@ extern DWORD g_ComCtl32Version;
void CPanel::Release()
{
- // It's for unloading COM dll's: don't change it.
+ // It's for unloading COM dll's: don't change it.
CloseOpenFolders();
_sevenZipContextMenu.Release();
_systemContextMenu.Release();
@@ -60,11 +59,17 @@ CPanel::~CPanel()
CloseOpenFolders();
}
+HWND CPanel::GetParent()
+{
+ HWND h = CWindow2::GetParent();
+ return (h == 0) ? _mainWindow : h;
+}
+
static LPCWSTR kClassName = L"7-Zip::Panel";
-LRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
- const UString &currentFolderPrefix, CPanelCallback *panelCallback, CAppState *appState,
+HRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
+ const UString &currentFolderPrefix, CPanelCallback *panelCallback, CAppState *appState,
bool &archiveIsOpened, bool &encrypted)
{
_mainWindow = mainWindow;
@@ -84,10 +89,10 @@ LRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
if (currentFolderPrefix[0] == L'.')
if (!NFile::NDirectory::MyGetFullPathName(currentFolderPrefix, cfp))
cfp = currentFolderPrefix;
- BindToPath(cfp, archiveIsOpened, encrypted);
+ RINOK(BindToPath(cfp, archiveIsOpened, encrypted));
- if (!CreateEx(0, kClassName, 0, WS_CHILD | WS_VISIBLE,
- 0, 0, _xSize, 260,
+ if (!CreateEx(0, kClassName, 0, WS_CHILD | WS_VISIBLE,
+ 0, 0, _xSize, 260,
parentWindow, (HMENU)(UINT_PTR)id, g_hInstance))
return E_FAIL;
return S_OK;
@@ -127,14 +132,14 @@ LRESULT CPanel::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return CWindow2::OnMessage(message, wParam, lParam);
}
-static LRESULT APIENTRY ListViewSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
+static LRESULT APIENTRY ListViewSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
CWindow tempDialog(hwnd);
CMyListView *w = (CMyListView *)(tempDialog.GetUserDataLongPtr());
if (w == NULL)
return 0;
return w->OnMessage(message, wParam, lParam);
-}
+}
LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -158,7 +163,7 @@ LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
// For Alt+Enter Beep disabling
UINT scanCode = (UINT)(lParam >> 16) & 0xFF;
UINT virtualKey = MapVirtualKey(scanCode, 1);
- if (virtualKey == VK_RETURN || virtualKey == VK_MULTIPLY ||
+ if (virtualKey == VK_RETURN || virtualKey == VK_MULTIPLY ||
virtualKey == VK_ADD || virtualKey == VK_SUBTRACT)
return 0;
}
@@ -208,48 +213,48 @@ LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
_panel->_lastFocusedIsList = true;
_panel->_panelCallback->PanelWasFocused();
}
- #ifndef _UNICODE
+ #ifndef _UNICODE
if (g_IsNT)
- return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
+ return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
else
#endif
- return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
+ return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
}
/*
-static LRESULT APIENTRY ComboBoxSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
+static LRESULT APIENTRY ComboBoxSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
CWindow tempDialog(hwnd);
CMyComboBox *w = (CMyComboBox *)(tempDialog.GetUserDataLongPtr());
if (w == NULL)
return 0;
return w->OnMessage(message, wParam, lParam);
-}
+}
LRESULT CMyComboBox::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
- return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
+ return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
}
*/
-static LRESULT APIENTRY ComboBoxEditSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
+static LRESULT APIENTRY ComboBoxEditSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
CWindow tempDialog(hwnd);
CMyComboBoxEdit *w = (CMyComboBoxEdit *)(tempDialog.GetUserDataLongPtr());
if (w == NULL)
return 0;
return w->OnMessage(message, wParam, lParam);
-}
+}
LRESULT CMyComboBoxEdit::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
// See MSDN / Subclassing a Combo Box / Creating a Combo-box Toolbar
- switch (message)
- {
- case WM_SYSKEYDOWN:
- switch (wParam)
- {
- case VK_F1:
- case VK_F2:
+ switch (message)
+ {
+ case WM_SYSKEYDOWN:
+ switch (wParam)
+ {
+ case VK_F1:
+ case VK_F2:
{
// check ALT
if ((lParam & (1<<29)) == 0)
@@ -260,20 +265,20 @@ LRESULT CMyComboBoxEdit::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
if (alt && !ctrl && !shift)
{
_panel->_panelCallback->SetFocusToPath(wParam == VK_F1 ? 0 : 1);
- return 0;
+ return 0;
}
- break;
+ break;
}
}
break;
- case WM_KEYDOWN:
- switch (wParam)
- {
- case VK_TAB:
- // SendMessage(hwndMain, WM_ENTER, 0, 0);
+ case WM_KEYDOWN:
+ switch (wParam)
+ {
+ case VK_TAB:
+ // SendMessage(hwndMain, WM_ENTER, 0, 0);
_panel->SetFocusToList();
- return 0;
- case VK_F9:
+ return 0;
+ case VK_F9:
{
bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
@@ -281,26 +286,35 @@ LRESULT CMyComboBoxEdit::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
if (!alt && !ctrl && !shift)
{
g_App.SwitchOnOffOnePanel();;
- return 0;
+ return 0;
}
- break;
+ break;
}
}
break;
- case WM_CHAR:
- switch (wParam)
- {
- case VK_TAB:
- case VK_ESCAPE:
- return 0;
- }
+ case WM_CHAR:
+ switch (wParam)
+ {
+ case VK_TAB:
+ case VK_ESCAPE:
+ return 0;
+ }
}
- #ifndef _UNICODE
+ #ifndef _UNICODE
if (g_IsNT)
- return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
+ return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
else
#endif
- return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
+ return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
+}
+
+static HIMAGELIST GetSysImageList(bool smallIcons)
+{
+ SHFILEINFO shellInfo;
+ return (HIMAGELIST)SHGetFileInfo(TEXT(""),
+ FILE_ATTRIBUTE_NORMAL |FILE_ATTRIBUTE_DIRECTORY,
+ &shellInfo, sizeof(shellInfo),
+ SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
}
bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
@@ -322,8 +336,8 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
if (_ListViewMode >= kNumListModes)
_ListViewMode = kNumListModes - 1;
- style |= kStyles[_ListViewMode]
- | WS_TABSTOP
+ style |= kStyles[_ListViewMode]
+ | WS_TABSTOP
| LVS_EDITLABELS;
if (_mySelectMode)
style |= LVS_SINGLESEL;
@@ -336,7 +350,7 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
DWORD exStyle;
exStyle = WS_EX_CLIENTEDGE;
- if (!_listView.CreateEx(exStyle, style, 0, 0, 116, 260,
+ if (!_listView.CreateEx(exStyle, style, 0, 0, 116, 260,
HWND(*this), (HMENU)(UINT_PTR)(_baseID + 1), g_hInstance, NULL))
return false;
@@ -347,32 +361,15 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
#ifndef _UNICODE
if(g_IsNT)
- _listView._origWindowProc =
+ _listView._origWindowProc =
(WNDPROC)_listView.SetLongPtrW(GWLP_WNDPROC, LONG_PTR(ListViewSubclassProc));
else
#endif
- _listView._origWindowProc =
+ _listView._origWindowProc =
(WNDPROC)_listView.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ListViewSubclassProc));
- SHFILEINFO shellInfo;
- HIMAGELIST imageList = (HIMAGELIST)SHGetFileInfo(TEXT(""),
- FILE_ATTRIBUTE_NORMAL |
- FILE_ATTRIBUTE_DIRECTORY,
- &shellInfo, sizeof(shellInfo),
- SHGFI_USEFILEATTRIBUTES |
- SHGFI_SYSICONINDEX |
- SHGFI_SMALLICON
- );
- _listView.SetImageList(imageList, LVSIL_SMALL);
- imageList = (HIMAGELIST)SHGetFileInfo(TEXT(""),
- FILE_ATTRIBUTE_NORMAL |
- FILE_ATTRIBUTE_DIRECTORY,
- &shellInfo, sizeof(shellInfo),
- SHGFI_USEFILEATTRIBUTES |
- SHGFI_SYSICONINDEX |
- SHGFI_ICON
- );
- _listView.SetImageList(imageList, LVSIL_NORMAL);
+ _listView.SetImageList(GetSysImageList(true), LVSIL_SMALL);
+ _listView.SetImageList(GetSysImageList(false), LVSIL_NORMAL);
// _exStyle |= LVS_EX_HEADERDRAGDROP;
// DWORD extendedStyle = _listView.GetExtendedListViewStyle();
@@ -384,14 +381,14 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
_listView.InvalidateRect(NULL, true);
_listView.Update();
- // Ensure that the common control DLL is loaded.
+ // Ensure that the common control DLL is loaded.
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx(&icex);
- TBBUTTON tbb [ ] =
+ TBBUTTON tbb [ ] =
{
// {0, 0, TBSTATE_ENABLED, BTNS_SEP, 0L, 0},
{VIEW_PARENTFOLDER, kParentFolderID, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
@@ -407,12 +404,12 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
_headerReBar.Attach(::CreateWindowEx(WS_EX_TOOLWINDOW,
REBARCLASSNAME,
- NULL, WS_VISIBLE | WS_BORDER | WS_CHILD |
- WS_CLIPCHILDREN | WS_CLIPSIBLINGS
- | CCS_NODIVIDER
- | CCS_NOPARENTALIGN
+ NULL, WS_VISIBLE | WS_BORDER | WS_CHILD |
+ WS_CLIPCHILDREN | WS_CLIPSIBLINGS
+ | CCS_NODIVIDER
+ | CCS_NOPARENTALIGN
| CCS_TOP
- | RBS_VARHEIGHT
+ | RBS_VARHEIGHT
| RBS_BANDBORDERS
,0,0,0,0, HWND(*this), NULL, g_hInstance, NULL));
}
@@ -421,8 +418,8 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
if (_headerReBar)
{
toolbarStyle |= 0
- // | WS_CLIPCHILDREN
- // | WS_CLIPSIBLINGS
+ // | WS_CLIPCHILDREN
+ // | WS_CLIPSIBLINGS
| TBSTYLE_TOOLTIPS
| CCS_NODIVIDER
@@ -431,11 +428,11 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
;
}
- _headerToolBar.Attach(::CreateToolbarEx ((*this), toolbarStyle,
- _baseID + 2, 11,
- (HINSTANCE)HINST_COMMCTRL,
- IDB_VIEW_SMALL_COLOR,
- (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
+ _headerToolBar.Attach(::CreateToolbarEx ((*this), toolbarStyle,
+ _baseID + 2, 11,
+ (HINSTANCE)HINST_COMMCTRL,
+ IDB_VIEW_SMALL_COLOR,
+ (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
0, 0, 0, 0, sizeof (TBBUTTON)));
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
@@ -444,19 +441,20 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
_headerComboBox.CreateEx(0, WC_COMBOBOXEXW, NULL,
WS_BORDER | WS_VISIBLE |WS_CHILD | CBS_DROPDOWN | CBS_AUTOHSCROLL,
- 0, 0, 100, 20,
+ 0, 0, 100, 520,
((_headerReBar == 0) ? HWND(*this) : _headerToolBar),
(HMENU)(UINT_PTR)(_comboBoxID),
g_hInstance, NULL);
- // _headerComboBox.SendMessage(CBEM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
+ _headerComboBox.SendMessage(CBEM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
+ _headerComboBox.SetImageList(GetSysImageList(true));
_headerComboBox.SetExtendedStyle(CBES_EX_PATHWORDBREAKPROC, CBES_EX_PATHWORDBREAKPROC);
/*
_headerComboBox.SetUserDataLongPtr(LONG_PTR(&_headerComboBox));
_headerComboBox._panel = this;
- _headerComboBox._origWindowProc =
+ _headerComboBox._origWindowProc =
(WNDPROC)_headerComboBox.SetLongPtr(GWLP_WNDPROC,
LONG_PTR(ComboBoxSubclassProc));
*/
@@ -468,15 +466,13 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
_comboBoxEdit._panel = this;
#ifndef _UNICODE
if(g_IsNT)
- _comboBoxEdit._origWindowProc =
+ _comboBoxEdit._origWindowProc =
(WNDPROC)_comboBoxEdit.SetLongPtrW(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
else
#endif
- _comboBoxEdit._origWindowProc =
+ _comboBoxEdit._origWindowProc =
(WNDPROC)_comboBoxEdit.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
-
-
if (_headerReBar)
{
REBARINFO rbi;
@@ -485,9 +481,9 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
rbi.himl = (HIMAGELIST)NULL;
_headerReBar.SetBarInfo(&rbi);
- // Send the TB_BUTTONSTRUCTSIZE message, which is required for
- // backward compatibility.
- // _headerToolBar.SendMessage(TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
+ // Send the TB_BUTTONSTRUCTSIZE message, which is required for
+ // backward compatibility.
+ // _headerToolBar.SendMessage(TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SIZE size;
_headerToolBar.GetMaxSize(&size);
@@ -540,7 +536,7 @@ void CPanel::OnDestroy()
CWindow2::OnDestroy();
}
-void CPanel::ChangeWindowSize(int xSize, int ySize)
+void CPanel::ChangeWindowSize(int xSize, int ySize)
{
int kHeaderSize;
int kStatusBarSize;
@@ -567,7 +563,7 @@ void CPanel::ChangeWindowSize(int xSize, int ySize)
else
{
_headerToolBar.Move(0, 0, xSize, 0);
- _headerComboBox.Move(kStartXPos, 2,
+ _headerComboBox.Move(kStartXPos, 2,
MyMax(xSize - kStartXPos - 10, kStartXPos), 0);
}
_listView.Move(0, kHeaderSize, xSize, yListViewSize);
@@ -577,7 +573,7 @@ void CPanel::ChangeWindowSize(int xSize, int ySize)
// _statusBar2.MoveWindow(0, 200, xSize, kStatusBar2Size);
}
-bool CPanel::OnSize(WPARAM /* wParam */, int xSize, int ySize)
+bool CPanel::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{
if (_headerReBar)
_headerReBar.Move(0, 0, xSize, 0);
@@ -611,7 +607,7 @@ bool CPanel::OnNotify(UINT /* controlID */, LPNMHDR header, LRESULT &result)
// if (header->hwndFrom == _listView)
else if (header->hwndFrom == _listView)
return OnNotifyList(header, result);
- else if (::GetParent(header->hwndFrom) == _listView &&
+ else if (::GetParent(header->hwndFrom) == _listView &&
header->code == NM_RCLICK)
return OnRightClick((LPNMITEMACTIVATE)header, result);
return false;
@@ -635,7 +631,8 @@ bool CPanel::OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result)
*/
if (itemID == _comboBoxID)
{
- OnComboBoxCommand(code, lParam);
+ if (OnComboBoxCommand(code, lParam, result))
+ return true;
}
return CWindow2::OnCommand(code, itemID, lParam, result);
}
@@ -649,7 +646,16 @@ void CPanel::MessageBox(LPCWSTR message)
void CPanel::MessageBoxMyError(LPCWSTR message)
{ MessageBox(message, L"Error"); }
void CPanel::MessageBoxError(HRESULT errorCode, LPCWSTR caption)
- { MessageBox(NError::MyFormatMessageW(errorCode), caption); }
+{
+ UString message;
+ if (errorCode == E_OUTOFMEMORY)
+ message = LangString(IDS_MEM_ERROR, 0x0200060B);
+ else
+ if (!NError::MyFormatMessage(errorCode, message))
+ message = L"Error";
+ MessageBox(message, caption);
+}
+
void CPanel::MessageBoxError(HRESULT errorCode)
{ MessageBoxError(errorCode, L"7-Zip"); }
void CPanel::MessageBoxLastError(LPCWSTR caption)
@@ -657,6 +663,10 @@ void CPanel::MessageBoxLastError(LPCWSTR caption)
void CPanel::MessageBoxLastError()
{ MessageBoxLastError(L"Error"); }
+void CPanel::MessageBoxErrorLang(UINT resourceID, UInt32 langID)
+ { MessageBox(LangString(resourceID, langID)); }
+
+
void CPanel::SetFocusToList()
{
_listView.SetFocus();
@@ -761,12 +771,12 @@ void CPanel::AddToArchive()
GetOperatedItemIndices(indices);
if (!IsFSFolder())
{
- MessageBox(L"Compress operation is not supported for that folder");
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
if (indices.Size() == 0)
{
- MessageBox(kSelectFiles);
+ MessageBoxErrorLang(IDS_SELECT_FILES, 0x03020A03);
return;
}
UStringVector names;
@@ -781,9 +791,9 @@ void CPanel::AddToArchive()
if (res != S_OK)
{
if (_currentFolderPrefix.Length() >= MAX_PATH)
- MessageBox(L"Can't call this operation for file with long path");
+ MessageBoxErrorLang(IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER, 0x03020A01);
else
- MessageBoxError(res, L"Error");
+ MessageBoxError(res);
}
// KillSelection();
}
@@ -799,6 +809,25 @@ static UString GetSubFolderNameForExtract(const UString &archiveName)
return res;
}
+void CPanel::GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths)
+{
+ for (int i = 0; i < indices.Size(); i++)
+ {
+ int index = indices[i];
+ if (IsItemFolder(index))
+ {
+ paths.Clear();
+ break;
+ }
+ paths.Add(_currentFolderPrefix + GetItemRelPath(index));
+ }
+ if (paths.Size() == 0)
+ {
+ MessageBoxErrorLang(IDS_SELECT_FILES, 0x03020A03);
+ return;
+ }
+}
+
void CPanel::ExtractArchives()
{
if (_parentFolders.Size() > 0)
@@ -809,22 +838,9 @@ void CPanel::ExtractArchives()
CRecordVector<UInt32> indices;
GetOperatedItemIndices(indices);
UStringVector paths;
- if (indices.Size() == 0)
- {
- // GetAllItemIndices(indices);
- MessageBox(kSelectOneFile);
+ GetFilePaths(indices, paths);
+ if (paths.IsEmpty())
return;
- }
- for (int i = 0; i < indices.Size(); i++)
- {
- int index = indices[i];
- if (IsItemFolder(index))
- {
- MessageBox(kSelectOneFile);
- return;
- }
- paths.Add(_currentFolderPrefix + GetItemRelPath(index));
- }
UString folderName;
if (indices.Size() == 1)
folderName = GetSubFolderNameForExtract(GetItemRelPath(indices[0]));
@@ -841,28 +857,28 @@ struct CThreadTest
CMyComPtr<IArchiveFolder> ArchiveFolder;
HRESULT Result;
- DWORD Test()
+ void Test()
{
ExtractCallbackSpec->ProgressDialog.WaitCreating();
- Result = ArchiveFolder->Extract(&Indices[0], Indices.Size(),
- NExtract::NPathMode::kFullPathnames, NExtract::NOverwriteMode::kAskBefore,
+ Result = ArchiveFolder->Extract(&Indices[0], Indices.Size(),
+ NExtract::NPathMode::kFullPathnames, NExtract::NOverwriteMode::kAskBefore,
NULL, BoolToInt(true), ExtractCallback);
ExtractCallbackSpec->ProgressDialog.MyClose();
- return 0;
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
- return ((CThreadTest*)param)->Test();
+ ((CThreadTest*)param)->Test();
+ return 0;
}
};
-static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 values, UString &s)
+static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
{
wchar_t sz[32];
s += LangString(resourceID, langID);
s += L" ";
- ConvertUInt64ToString(values, sz);
+ ConvertUInt64ToString(value, sz);
s += sz;
s += L"\n";
}
@@ -886,7 +902,7 @@ static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s
void CPanel::TestArchives()
{
CRecordVector<UInt32> indices;
- GetOperatedItemIndices(indices);
+ GetOperatedIndicesSmart(indices);
CMyComPtr<IArchiveFolder> archiveFolder;
_folder.QueryInterface(IID_IArchiveFolder, &archiveFolder);
if (archiveFolder)
@@ -901,8 +917,6 @@ void CPanel::TestArchives()
extracter.ExtractCallbackSpec->ShowMessages = true;
if (indices.IsEmpty())
- GetAllItemIndices(indices);
- if (indices.IsEmpty())
return;
extracter.Indices = indices;
@@ -946,25 +960,13 @@ void CPanel::TestArchives()
if (!IsFSFolder())
{
- MessageBox(L"Test archive operation is not supported for that folder");
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
UStringVector paths;
- if (indices.Size() == 0)
- {
- MessageBox(kSelectOneFile);
+ GetFilePaths(indices, paths);
+ if (paths.IsEmpty())
return;
- }
- for (int i = 0; i < indices.Size(); i++)
- {
- int index = indices[i];
- if (IsItemFolder(index))
- {
- MessageBox(kSelectOneFile);
- return;
- }
- paths.Add(_currentFolderPrefix + GetItemRelPath(index));
- }
::TestArchives(paths);
}
diff --git a/CPP/7zip/UI/FileManager/Panel.h b/CPP/7zip/UI/FileManager/Panel.h
index a9c6a304..86f3dc25 100755
--- a/CPP/7zip/UI/FileManager/Panel.h
+++ b/CPP/7zip/UI/FileManager/Panel.h
@@ -92,6 +92,11 @@ struct CFolderLink: public CTempFileInfo
{
NWindows::NDLL::CLibrary Library;
CMyComPtr<IFolderFolder> ParentFolder;
+ bool UsePassword;
+ UString Password;
+
+ UString VirtualPath;
+ CFolderLink(): UsePassword(false) {}
};
enum MyMessages
@@ -141,10 +146,8 @@ struct CSelectedState
CSelectedState(): FocusedItem(-1), SelectFocused(false) {}
};
-class CPanel:public NWindows::NControl::CWindow2
+class CPanel: public NWindows::NControl::CWindow2
{
- HWND _mainWindow;
-
CExtToIconMap _extToIconMap;
UINT _baseID;
int _comboBoxID;
@@ -158,7 +161,12 @@ class CPanel:public NWindows::NControl::CWindow2
virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
virtual void OnDestroy();
virtual bool OnNotify(UINT controlID, LPNMHDR lParam, LRESULT &result);
- void OnComboBoxCommand(UINT code, LPARAM &aParam);
+
+ void AddComboBoxItem(const UString &name, int iconIndex, int indent, bool addToList);
+
+ bool OnComboBoxCommand(UINT code, LPARAM param, LRESULT &result);
+
+ LRESULT OnNotifyComboBoxEnter(const UString &s);
bool OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result);
#ifndef _UNICODE
bool OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result);
@@ -175,6 +183,7 @@ class CPanel:public NWindows::NControl::CWindow2
bool OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result);
public:
+ HWND _mainWindow;
CPanelCallback *_panelCallback;
void DeleteItems(bool toRecycleBin);
@@ -217,6 +226,7 @@ public:
NWindows::NControl::CReBar _headerReBar;
NWindows::NControl::CToolBar _headerToolBar;
NWindows::NControl::CComboBoxEx _headerComboBox;
+ UStringVector ComboBoxPaths;
// CMyComboBox _headerComboBox;
CMyComboBoxEdit _comboBoxEdit;
CMyListView _listView;
@@ -235,6 +245,8 @@ public:
CSelectedState _selectedState;
+ HWND GetParent();
+
UInt32 GetRealIndex(const LVITEMW &item) const
{
/*
@@ -256,7 +268,7 @@ public:
}
UInt32 _ListViewMode;
- int _xSize;
+ int _xSize;
bool _flatMode;
@@ -287,7 +299,7 @@ public:
// PanelFolderChange.cpp
void SetToRootFolder();
- HRESULT BindToPath(const UString &fullPath, bool &archiveIsOpened, bool &encrypted); // can be prefix
+ HRESULT BindToPath(const UString &fullPath, bool &archiveIsOpened, bool &encrypted); // can be prefix
HRESULT BindToPathAndRefresh(const UString &path);
void OpenDrivesFolder();
@@ -302,9 +314,9 @@ public:
void OpenRootFolder();
- LRESULT Create(HWND mainWindow, HWND parentWindow,
+ HRESULT Create(HWND mainWindow, HWND parentWindow,
UINT id,
- const UString &currentFolderPrefix,
+ const UString &currentFolderPrefix,
CPanelCallback *panelCallback,
CAppState *appState, bool &archiveIsOpened, bool &encrypted);
void SetFocusToList();
@@ -314,13 +326,13 @@ public:
void ReadListViewInfo();
void SaveListViewInfo();
- CPanel() :
+ CPanel() :
// _virtualMode(flase),
_exStyle(0),
_showDots(false),
_showRealFileIcons(false),
- _needSaveInfo(false),
- _startGroupSelect(0),
+ _needSaveInfo(false),
+ _startGroupSelect(0),
_selectionIsDefined(false),
_ListViewMode(3),
_flatMode(false),
@@ -328,7 +340,7 @@ public:
_mySelectMode(false),
_enableItemChangeNotify(true),
_dontShowMode(false)
- {}
+ {}
void SetExtendedStyle()
{
@@ -361,19 +373,19 @@ public:
HRESULT CreateShellContextMenu(
const CRecordVector<UInt32> &operatedIndices,
CMyComPtr<IContextMenu> &systemContextMenu);
- void CreateSystemMenu(HMENU menu,
+ void CreateSystemMenu(HMENU menu,
const CRecordVector<UInt32> &operatedIndices,
CMyComPtr<IContextMenu> &systemContextMenu);
- void CreateSevenZipMenu(HMENU menu,
+ void CreateSevenZipMenu(HMENU menu,
const CRecordVector<UInt32> &operatedIndices,
CMyComPtr<IContextMenu> &sevenZipContextMenu);
- void CreateFileMenu(HMENU menu,
+ void CreateFileMenu(HMENU menu,
CMyComPtr<IContextMenu> &sevenZipContextMenu,
CMyComPtr<IContextMenu> &systemContextMenu,
bool programMenu);
void CreateFileMenu(HMENU menu);
bool InvokePluginCommand(int id);
- bool InvokePluginCommand(int id, IContextMenu *sevenZipContextMenu,
+ bool InvokePluginCommand(int id, IContextMenu *sevenZipContextMenu,
IContextMenu *systemContextMenu);
void InvokeSystemCommand(const char *command);
@@ -395,6 +407,7 @@ public:
void GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const;
void GetOperatedItemIndices(CRecordVector<UInt32> &indices) const;
void GetAllItemIndices(CRecordVector<UInt32> &indices) const;
+ void GetOperatedIndicesSmart(CRecordVector<UInt32> &indices) const;
// void GetOperatedListViewIndices(CRecordVector<UInt32> &indices) const;
void KillSelection();
@@ -419,24 +432,24 @@ public:
CPanel &_panel;
public:
- CDisableTimerProcessing(CPanel &panel): _panel(panel)
- {
+ CDisableTimerProcessing(CPanel &panel): _panel(panel)
+ {
Disable();
}
void Disable()
{
_processTimerMem = _panel._processTimer;
_processNotifyMem = _panel._processNotify;
- _panel._processTimer = false;
- _panel._processNotify = false;
+ _panel._processTimer = false;
+ _panel._processNotify = false;
}
void Restore()
{
- _panel._processTimer = _processTimerMem;
- _panel._processNotify = _processNotifyMem;
+ _panel._processTimer = _processTimerMem;
+ _panel._processNotify = _processNotifyMem;
}
- ~CDisableTimerProcessing()
- {
+ ~CDisableTimerProcessing()
+ {
Restore();
}
CDisableTimerProcessing& operator=(const CDisableTimerProcessing &) {; }
@@ -456,6 +469,7 @@ public:
void MessageBoxLastError(LPCWSTR caption);
void MessageBoxLastError();
+ void MessageBoxErrorLang(UINT resourceID, UInt32 langID);
void OpenFocusedItemAsInternal();
void OpenSelectedItems(bool internal);
@@ -464,14 +478,16 @@ public:
void OpenFolder(int index);
HRESULT OpenParentArchiveFolder();
- HRESULT OpenItemAsArchive(const UString &name,
+ HRESULT OpenItemAsArchive(const UString &name,
const UString &folderPath,
- const UString &filePath, bool &encrypted);
- HRESULT OpenItemAsArchive(const UString &aName);
+ const UString &filePath,
+ const UString &virtualFilePath,
+ bool &encrypted);
+ HRESULT OpenItemAsArchive(const UString &name);
HRESULT OpenItemAsArchive(int index);
void OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
bool editMode);
- HRESULT OnOpenItemChanged(const UString &folderPath, const UString &itemName);
+ HRESULT OnOpenItemChanged(const UString &folderPath, const UString &itemName, bool usePassword, const UString &password);
LRESULT OnOpenItemChanged(LPARAM lParam);
void OpenItem(int index, bool tryInternal, bool tryExternal);
@@ -491,13 +507,30 @@ public:
void OnRefreshStatusBar();
void AddToArchive();
+
+ void GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths);
void ExtractArchives();
void TestArchives();
- HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
- bool moveMode, bool showErrorMessages, UStringVector *messages);
+ HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
+ bool moveMode, bool showErrorMessages, UStringVector *messages,
+ bool &usePassword, UString &password);
+
+ HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
+ bool moveMode, bool showErrorMessages, UStringVector *messages)
+ {
+ bool usePassword = false;
+ UString password;
+ if (_parentFolders.Size() > 0)
+ {
+ const CFolderLink &fl = _parentFolders.Back();
+ usePassword = fl.UsePassword;
+ password = fl.Password;
+ }
+ return CopyTo(indices, folder, moveMode, showErrorMessages, messages, usePassword, password);
+ }
- HRESULT CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
+ HRESULT CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
bool showErrorMessages, UStringVector *messages);
void CopyFromNoAsk(const UStringVector &filePaths);
@@ -511,6 +544,8 @@ public:
void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always); }
void RefreshTitleAlways() { RefreshTitle(true); }
+
+ UString GetItemsInfoString(const CRecordVector<UInt32> &indices);
};
#endif
diff --git a/CPP/7zip/UI/FileManager/PanelCopy.cpp b/CPP/7zip/UI/FileManager/PanelCopy.cpp
index c5745010..8ad3d4c9 100755
--- a/CPP/7zip/UI/FileManager/PanelCopy.cpp
+++ b/CPP/7zip/UI/FileManager/PanelCopy.cpp
@@ -3,7 +3,7 @@
#include "StdAfx.h"
#include "Panel.h"
-#include "resource.h"
+#include "resource.h"
#include "LangUtils.h"
#include "ExtractCallback.h"
#include "Windows/Thread.h"
@@ -29,10 +29,10 @@ struct CThreadExtractInArchive2
{
ExtractCallbackSpec->ProgressDialog.WaitCreating();
if (MoveMode)
- Result = FolderOperations->MoveTo(&Indices.Front(), Indices.Size(),
+ Result = FolderOperations->MoveTo(&Indices.Front(), Indices.Size(),
DestPath, ExtractCallback);
else
- Result = FolderOperations->CopyTo(&Indices.Front(), Indices.Size(),
+ Result = FolderOperations->CopyTo(&Indices.Front(), Indices.Size(),
DestPath, ExtractCallback);
ExtractCallbackSpec->ProgressDialog.MyClose();
return 0;
@@ -44,8 +44,9 @@ struct CThreadExtractInArchive2
}
};
-HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
- bool moveMode, bool showErrorMessages, UStringVector *messages)
+HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
+ bool moveMode, bool showErrorMessages, UStringVector *messages,
+ bool &usePassword, UString &password)
{
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
@@ -68,7 +69,7 @@ HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &fold
extracter.ExtractCallbackSpec->ShowMessages = showErrorMessages;
extracter.ExtractCallbackSpec->ProgressDialog.CompressingMode = false;
- UString title = moveMode ?
+ UString title = moveMode ?
LangString(IDS_MOVING, 0x03020206):
LangString(IDS_COPYING, 0x03020205);
UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
@@ -83,6 +84,9 @@ HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &fold
extracter.DestPath = folder;
extracter.FolderOperations = folderOperations;
extracter.MoveMode = moveMode;
+
+ extracter.ExtractCallbackSpec->PasswordIsDefined = usePassword;
+ extracter.ExtractCallbackSpec->Password = password;
NWindows::CThread extractThread;
RINOK(extractThread.Create(CThreadExtractInArchive2::MyThreadFunction, &extracter));
@@ -90,7 +94,13 @@ HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &fold
if (messages != 0)
*messages = extracter.ExtractCallbackSpec->Messages;
- res = extracter.Result;
+ res = extracter.Result;
+
+ if (res == S_OK && extracter.ExtractCallbackSpec->Messages.IsEmpty())
+ {
+ usePassword = extracter.ExtractCallbackSpec->PasswordIsDefined;
+ password = extracter.ExtractCallbackSpec->Password;
+ }
}
RefreshTitleAlways();
return res;
@@ -126,7 +136,7 @@ struct CThreadUpdate
};
-HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
+HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
bool showErrorMessages, UStringVector *messages)
{
CMyComPtr<IFolderOperations> folderOperations;
diff --git a/CPP/7zip/UI/FileManager/PanelCrc.cpp b/CPP/7zip/UI/FileManager/PanelCrc.cpp
index 4ce435da..61490b57 100755
--- a/CPP/7zip/UI/FileManager/PanelCrc.cpp
+++ b/CPP/7zip/UI/FileManager/PanelCrc.cpp
@@ -4,8 +4,8 @@
#include "resource.h"
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
#include "../../../../C/7zCrc.h"
}
@@ -93,7 +93,7 @@ bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UStr
Prefixes.DeleteBack();
}
resPath += fileInfo.Name;
- if (!FlatMode && fileInfo.IsDirectory())
+ if (!FlatMode && fileInfo.IsDir())
{
UString prefix = resPath + (UString)(wchar_t)kDirDelimiter;
Enumerators.Add(NFind::CEnumeratorW(BasePrefix + prefix + (UString)(wchar_t)kAnyStringWildcard));
@@ -171,7 +171,7 @@ struct CThreadCrc
}
if (!filled)
break;
- if (!fileInfo.IsDirectory())
+ if (!fileInfo.IsDir())
totalSize += fileInfo.Size;
ProgressDialog->ProgressSynch.SetCurrentFileName(scanningStr + resPath);
ProgressDialog->ProgressSynch.SetProgress(totalSize, 0);
@@ -199,7 +199,7 @@ struct CThreadCrc
break;
UInt32 crc = CRC_INIT_VAL;
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
NumFolders++;
else
{
@@ -276,7 +276,7 @@ void CApp::CalculateCrc()
CPanel &srcPanel = Panels[srcPanelIndex];
if (!srcPanel.IsFSFolder())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
CRecordVector<UInt32> indices;
diff --git a/CPP/7zip/UI/FileManager/PanelDrag.cpp b/CPP/7zip/UI/FileManager/PanelDrag.cpp
index f242c8a1..25cbbc38 100755
--- a/CPP/7zip/UI/FileManager/PanelDrag.cpp
+++ b/CPP/7zip/UI/FileManager/PanelDrag.cpp
@@ -22,12 +22,12 @@ using namespace NWindows;
extern bool g_IsNT;
#endif
-static wchar_t *kTempDirPrefix = L"7zE";
-static LPCTSTR kSvenZipSetFolderFormat = TEXT("7-Zip::SetTargetFolder");
+static wchar_t *kTempDirPrefix = L"7zE";
+static LPCTSTR kSvenZipSetFolderFormat = TEXT("7-Zip::SetTargetFolder");
////////////////////////////////////////////////////////
-class CDataObject:
+class CDataObject:
public IDataObject,
public CMyUnknownImp
{
@@ -61,7 +61,7 @@ public:
CDataObject::CDataObject()
{
- m_SetFolderFormat = RegisterClipboardFormat(kSvenZipSetFolderFormat);
+ m_SetFolderFormat = RegisterClipboardFormat(kSvenZipSetFolderFormat);
m_Etc.cfFormat = CF_HDROP;
m_Etc.ptd = NULL;
m_Etc.dwAspect = DVASPECT_CONTENT;
@@ -70,13 +70,13 @@ CDataObject::CDataObject()
}
STDMETHODIMP CDataObject::SetData(LPFORMATETC etc, STGMEDIUM *medium, BOOL /* release */)
-{
- if (etc->cfFormat == m_SetFolderFormat && etc->tymed == TYMED_HGLOBAL &&
+{
+ if (etc->cfFormat == m_SetFolderFormat && etc->tymed == TYMED_HGLOBAL &&
etc->dwAspect == DVASPECT_CONTENT && medium->tymed == TYMED_HGLOBAL)
{
Path.Empty();
if (medium->hGlobal == 0)
- return S_OK;
+ return S_OK;
size_t size = GlobalSize(medium->hGlobal) / sizeof(wchar_t);
const wchar_t *src = (const wchar_t *)GlobalLock(medium->hGlobal);
if (src != 0)
@@ -89,10 +89,10 @@ STDMETHODIMP CDataObject::SetData(LPFORMATETC etc, STGMEDIUM *medium, BOOL /* re
Path += c;
}
GlobalUnlock(medium->hGlobal);
- return S_OK;
+ return S_OK;
}
}
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
static HGLOBAL DuplicateGlobalMem(HGLOBAL srcGlobal)
@@ -156,7 +156,7 @@ STDMETHODIMP CDataObject::EnumFormatEtc(DWORD direction, LPENUMFORMATETC FAR* en
////////////////////////////////////////////////////////
-class CDropSource:
+class CDropSource:
public IDropSource,
public CMyUnknownImp
{
@@ -199,8 +199,8 @@ STDMETHODIMP CDropSource::QueryContinueDrag(BOOL escapePressed, DWORD keyState)
}
if (needExtract)
{
- Result = Panel->CopyTo(Indices, Folder,
- false, // moveMode,
+ Result = Panel->CopyTo(Indices, Folder,
+ false, // moveMode,
false, // showMessages
&Messages);
if (Result != S_OK || !Messages.IsEmpty())
@@ -300,7 +300,7 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
// CSelectedState selState;
// SaveSelectedState(selState);
- UString dirPrefix;
+ UString dirPrefix;
NFile::NDirectory::CTempDirectoryW tempDirectory;
bool isFSFolder = IsFSFolder();
@@ -358,8 +358,8 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
if (!dataObjectSpec->Path.IsEmpty())
{
NFile::NName::NormalizeDirPathPrefix(dataObjectSpec->Path);
- res = CopyTo(indices, dataObjectSpec->Path,
- (effect == DROPEFFECT_MOVE),// dropSourceSpec->MoveMode,
+ res = CopyTo(indices, dataObjectSpec->Path,
+ (effect == DROPEFFECT_MOVE),// dropSourceSpec->MoveMode,
false, // showErrorMessages
&dropSourceSpec->Messages);
}
@@ -433,7 +433,7 @@ void CDropTarget::PositionCursor(POINTL ptl)
for (int i = 0; i < kNumPanelsMax; i++)
if (App->IsPanelVisible(i))
if (App->Panels[i].IsEnabled())
- if (ChildWindowFromPointEx(App->_window, pt2,
+ if (ChildWindowFromPointEx(App->_window, pt2,
CWP_SKIPINVISIBLE | CWP_SKIPDISABLED) == (HWND)App->Panels[i])
{
m_Panel = &App->Panels[i];
@@ -475,7 +475,7 @@ void CDropTarget::PositionCursor(POINTL ptl)
if (realIndex == kParentIndex)
return;
if (!m_Panel->IsItemFolder(realIndex))
- return;
+ return;
m_SubFolderIndex = realIndex;
m_SubFolderName = m_Panel->GetItemName(m_SubFolderIndex);
MySetDropHighlighted(m_Panel->_listView, index, true);
@@ -604,9 +604,9 @@ DWORD CDropTarget::GetEffect(DWORD keyState, POINTL /* pt */, DWORD allowedEffec
effect = allowedEffect & DROPEFFECT_MOVE;
if(effect == 0)
{
- if(allowedEffect & DROPEFFECT_COPY)
+ if(allowedEffect & DROPEFFECT_COPY)
effect = DROPEFFECT_COPY;
- if(allowedEffect & DROPEFFECT_MOVE)
+ if(allowedEffect & DROPEFFECT_MOVE)
{
if (IsItSameDrive())
effect = DROPEFFECT_MOVE;
@@ -634,7 +634,7 @@ UString CDropTarget::GetTargetPath() const
bool CDropTarget::SetPath(bool enablePath) const
{
- UINT setFolderFormat = RegisterClipboardFormat(kSvenZipSetFolderFormat);
+ UINT setFolderFormat = RegisterClipboardFormat(kSvenZipSetFolderFormat);
FORMATETC etc = { (CLIPFORMAT)setFolderFormat, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM medium;
@@ -666,7 +666,7 @@ bool CDropTarget::SetPath()
return m_SetPathIsOK;
}
-STDMETHODIMP CDropTarget::DragEnter(IDataObject * dataObject, DWORD keyState,
+STDMETHODIMP CDropTarget::DragEnter(IDataObject * dataObject, DWORD keyState,
POINTL pt, DWORD *effect)
{
GetNamesFromDataObject(dataObject, m_SourcePaths);
@@ -696,7 +696,7 @@ STDMETHODIMP CDropTarget::DragLeave()
// We suppose that there was ::DragOver for same POINTL_pt before ::Drop
// So SetPath() is same as in Drop.
-STDMETHODIMP CDropTarget::Drop(IDataObject *dataObject, DWORD keyState,
+STDMETHODIMP CDropTarget::Drop(IDataObject *dataObject, DWORD keyState,
POINTL pt, DWORD * effect)
{
QueryGetData(dataObject);
@@ -770,7 +770,7 @@ void CPanel::CompressDropFiles(const UStringVector &fileNames, const UString &fo
{
if (fileNames.Size() == 0)
return;
- const UString archiveName = CreateArchiveName(fileNames.Front(),
+ const UString archiveName = CreateArchiveName(fileNames.Front(),
(fileNames.Size() > 1), false);
bool createNewArchive = true;
if (!IsFSFolder())
@@ -785,7 +785,7 @@ void CPanel::CompressDropFiles(const UStringVector &fileNames, const UString &fo
if (IsFolderInTemp(folderPath2))
folderPath2 = L"C:\\"; // fix it
}
- CompressFiles(folderPath2, archiveName, L"", fileNames,
+ CompressFiles(folderPath2, archiveName, L"", fileNames,
false, // email
true, // showDialog
AreThereNamesFromTemp(fileNames) // waitFinish
diff --git a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
index d6fdcc98..47363ef4 100755
--- a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
+++ b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
@@ -34,6 +34,37 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool
archiveIsOpened = false;
encrypted = false;
CDisableTimerProcessing disableTimerProcessing1(*this);
+
+ if (_parentFolders.Size() > 0)
+ {
+ const UString &virtPath = _parentFolders.Back().VirtualPath;
+ if (fullPath.Left(virtPath.Length()) == virtPath)
+ {
+ for (;;)
+ {
+ CMyComPtr<IFolderFolder> newFolder;
+ HRESULT res = _folder->BindToParentFolder(&newFolder);
+ if (!newFolder || res != S_OK)
+ break;
+ _folder = newFolder;
+ }
+ UStringVector parts;
+ SplitPathToParts(fullPath.Mid(virtPath.Length()), parts);
+ for (int i = 0; i < parts.Size(); i++)
+ {
+ const UString &s = parts[i];
+ if ((i == 0 || i == parts.Size() - 1) && s.IsEmpty())
+ continue;
+ CMyComPtr<IFolderFolder> newFolder;
+ HRESULT res = _folder->BindToFolder(s, &newFolder);
+ if (!newFolder || res != S_OK)
+ break;
+ _folder = newFolder;
+ }
+ return S_OK;
+ }
+ }
+
CloseOpenFolders();
UString sysPath = fullPath;
CFileInfoW fileInfo;
@@ -59,7 +90,7 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool
if (_folder->BindToFolder(fullPath, &newFolder) == S_OK)
_folder = newFolder;
}
- else if (fileInfo.IsDirectory())
+ else if (fileInfo.IsDir())
{
NName::NormalizeDirPathPrefix(sysPath);
if (_folder->BindToFolder(sysPath, &newFolder) == S_OK)
@@ -77,8 +108,20 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool
UString fileName;
if (NDirectory::GetOnlyName(sysPath, fileName))
{
- if (OpenItemAsArchive(fileName, _currentFolderPrefix,
- _currentFolderPrefix + fileName, encrypted) == S_OK)
+ HRESULT res =
+ OpenItemAsArchive(fileName, _currentFolderPrefix,
+ _currentFolderPrefix + fileName,
+ _currentFolderPrefix + fileName,
+ encrypted);
+ if (res != S_FALSE)
+ {
+ RINOK(res);
+ }
+ /*
+ if (res == E_ABORT)
+ return res;
+ */
+ if (res == S_OK)
{
archiveIsOpened = true;
for (int i = reducedParts.Size() - 1; i >= 0; i--)
@@ -138,56 +181,79 @@ void CPanel::LoadFullPath()
_currentFolderPrefix += GetFolderPath(_folder);
}
+static int GetRealIconIndex(LPCWSTR path, DWORD attributes)
+{
+ int index = -1;
+ if (GetRealIconIndex(path, attributes, index) != 0)
+ return index;
+ return -1;
+}
+
void CPanel::LoadFullPathAndShow()
-{
+{
LoadFullPath();
_appState->FolderHistory.AddString(_currentFolderPrefix);
- // _headerComboBox.SendMessage(CB_RESETCONTENT, 0, 0);
- _headerComboBox.SetText(_currentFolderPrefix);
+ _headerComboBox.SetText(_currentFolderPrefix);
+ COMBOBOXEXITEM item;
+ item.mask = 0;
+
+ UString path = _currentFolderPrefix;
+ if (path.Length() > 3 && path[path.Length() - 1] == L'\\')
+ path.Delete(path.Length() - 1);
+
+ CFileInfoW info;
+ DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
+ if (NFile::NFind::FindFile(path, info))
+ attrib = info.Attrib;
+
+ item.iImage = GetRealIconIndex(path, attrib);
+
+ if (item.iImage >= 0)
+ {
+ item.iSelectedImage = item.iImage;
+ item.mask |= (CBEIF_IMAGE | CBEIF_SELECTEDIMAGE);
+ }
+ item.iItem = -1;
+ _headerComboBox.SetItem(&item);
+
RefreshTitle();
+}
- /*
- for (int i = 0; i < g_Folders.m_Strings.Size(); i++)
+LRESULT CPanel::OnNotifyComboBoxEnter(const UString &s)
+{
+ if (BindToPathAndRefresh(GetUnicodeString(s)) == S_OK)
{
- UString string = g_Folders.m_Strings[i];
- COMBOBOXEXITEM item;
- item.mask = CBEIF_TEXT;
- item.iItem = i;
- item.pszText = (LPTSTR)(LPCTSTR)string;
- _headerComboBox.InsertItem(&item);
+ PostMessage(kSetFocusToListView);
+ return TRUE;
}
- */
+ return FALSE;
}
bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result)
{
if (info->iWhy == CBENF_ESCAPE)
{
- _headerComboBox.SetText(_currentFolderPrefix);
+ _headerComboBox.SetText(_currentFolderPrefix);
PostMessage(kSetFocusToListView);
result = FALSE;
return true;
}
+
+ /*
if (info->iWhy == CBENF_DROPDOWN)
{
result = FALSE;
return true;
}
+ */
if (info->iWhy == CBENF_RETURN)
{
+ // When we use Edit control and press Enter.
UString s;
_headerComboBox.GetText(s);
- // length of NMCBEENDEDITW.szText is limited by MAX_PATH
- // if (BindToPathAndRefresh(info->szText) != S_OK)
- if (BindToPathAndRefresh(s) != S_OK)
- {
- result = TRUE;
- return true;
- }
- result = FALSE;
- PostMessage(kSetFocusToListView);
+ result = OnNotifyComboBoxEnter(s);
return true;
}
return false;
@@ -198,52 +264,144 @@ bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result)
{
if (info->iWhy == CBENF_ESCAPE)
{
- _headerComboBox.SetText(_currentFolderPrefix);
+ _headerComboBox.SetText(_currentFolderPrefix);
PostMessage(kSetFocusToListView);
result = FALSE;
return true;
}
+ /*
if (info->iWhy == CBENF_DROPDOWN)
{
result = FALSE;
return true;
}
+ */
if (info->iWhy == CBENF_RETURN)
{
- if (BindToPathAndRefresh(GetUnicodeString(info->szText)) != S_OK)
- {
- result = TRUE;
- return true;
- }
- result = FALSE;
- PostMessage(kSetFocusToListView);
+ UString s;
+ _headerComboBox.GetText(s);
+ // GetUnicodeString(info->szText)
+ result = OnNotifyComboBoxEnter(s);
return true;
}
return false;
}
#endif
-void CPanel::OnComboBoxCommand(UINT /* code */, LPARAM & /* param */)
+void CPanel::AddComboBoxItem(const UString &name, int iconIndex, int indent, bool addToList)
{
- /*
- if (code == CBN_SELENDOK)
+ COMBOBOXEXITEMW item;
+ item.mask = CBEIF_TEXT | CBEIF_INDENT;
+ item.iSelectedImage = item.iImage = iconIndex;
+ if (iconIndex >= 0)
+ item.mask |= (CBEIF_IMAGE | CBEIF_SELECTEDIMAGE);
+ item.iItem = -1;
+ item.iIndent = indent;
+ item.pszText = (LPWSTR)(LPCWSTR)name;
+ _headerComboBox.InsertItem(&item);
+ if (addToList)
+ ComboBoxPaths.Add(name);
+}
+
+extern UString RootFolder_GetName_Computer(int &iconIndex);
+extern UString RootFolder_GetName_Network(int &iconIndex);
+extern UString RootFolder_GetName_Documents(int &iconIndex);
+
+bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
+{
+ result = FALSE;
+ switch(code)
{
- UString path;
- if (!_headerComboBox.GetText(path))
- return;
- CRootFolder *rootFolderSpec = new CRootFolder;
- CMyComPtr<IFolderFolder> rootFolder = rootFolderSpec;
- rootFolderSpec->Init();
- CMyComPtr<IFolderFolder> newFolder;
- if (rootFolder->BindToFolder(path, &newFolder) != S_OK)
- return;
- _folder = newFolder;
- SetCurrentPathText();
- RefreshListCtrl(UString(), -1, UStringVector());
- PostMessage(kSetFocusToListView);
+ case CBN_DROPDOWN:
+ {
+ ComboBoxPaths.Clear();
+ _headerComboBox.ResetContent();
+
+ int iconIndex;
+ UString name;
+
+ int i;
+ UStringVector pathParts;
+
+ SplitPathToParts(_currentFolderPrefix, pathParts);
+ UString sumPass;
+ for (i = 0; i < pathParts.Size(); i++)
+ {
+ UString name = pathParts[i];
+ if (name.IsEmpty())
+ continue;
+ sumPass += name;
+ UString curName = sumPass;
+ if (i == 0)
+ curName += L"\\";
+ CFileInfoW info;
+ DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
+ if (NFile::NFind::FindFile(sumPass, info))
+ attrib = info.Attrib;
+ sumPass += L"\\";
+ AddComboBoxItem(name, GetRealIconIndex(curName, attrib), i, false);
+ ComboBoxPaths.Add(sumPass);
+ }
+
+ name = RootFolder_GetName_Documents(iconIndex);
+ AddComboBoxItem(name, iconIndex, 0, true);
+
+ name = RootFolder_GetName_Computer(iconIndex);
+ AddComboBoxItem(name, iconIndex, 0, true);
+
+ UStringVector driveStrings;
+ MyGetLogicalDriveStrings(driveStrings);
+ for (i = 0; i < driveStrings.Size(); i++)
+ {
+ UString s = driveStrings[i];
+ ComboBoxPaths.Add(s);
+ int iconIndex = GetRealIconIndex(s, 0);
+ if (s.Length() > 0 && s[s.Length() - 1] == '\\')
+ s.Delete(s.Length() - 1);
+ AddComboBoxItem(s, iconIndex, 1, false);
+ }
+
+ name = RootFolder_GetName_Network(iconIndex);
+ AddComboBoxItem(name, iconIndex, 0, true);
+
+ // UStringVector strings; _appState->FolderHistory.GetList(strings);
+
+ return false;
+ }
+
+ case CBN_SELENDOK:
+ {
+ code = code;
+ int index = _headerComboBox.GetCurSel();
+ if (index >= 0)
+ {
+ UString pass = ComboBoxPaths[index];
+ _headerComboBox.SetCurSel(-1);
+ _headerComboBox.SetText(pass); // it's fix for seclecting by mouse.
+ if (BindToPathAndRefresh(pass) == S_OK)
+ {
+ PostMessage(kSetFocusToListView);
+ return true;
+ }
+ }
+ return false;
+ }
+ /*
+ case CBN_CLOSEUP:
+ {
+ LoadFullPathAndShow();
+ true;
+
+ }
+ case CBN_SELCHANGE:
+ {
+ // LoadFullPathAndShow();
+ return true;
+ }
+ */
}
- */
+ return false;
}
bool CPanel::OnNotifyComboBox(LPNMHDR header, LRESULT &result)
@@ -254,6 +412,7 @@ bool CPanel::OnNotifyComboBox(LPNMHDR header, LRESULT &result)
{
_lastFocusedIsList = false;
_panelCallback->PanelWasFocused();
+ break;
}
#ifndef _UNICODE
case CBEN_ENDEDIT:
diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
index bf746282..afb376d0 100755
--- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
@@ -2,9 +2,9 @@
#include "StdAfx.h"
-#include "resource.h"
+#include "resource.h"
-#include "Common/StringConvert.h"
+#include "Common/StringConvert.h"
#include "Common/Random.h"
#include "Common/StringConvert.h"
#include "Common/AutoPtr.h"
@@ -14,14 +14,15 @@
#include "Windows/Thread.h"
#include "Windows/Synchronization.h"
#include "Windows/Error.h"
-// #include "Windows/COM.h"
#include "ExtractCallback.h"
+#include "UpdateCallback100.h"
#include "IFolder.h"
#include "FileFolderPluginOpen.h"
#include "FormatUtils.h"
#include "Panel.h"
#include "RegistryUtils.h"
+#include "LangUtils.h"
using namespace NWindows;
using namespace NSynchronization;
@@ -33,9 +34,8 @@ extern HWND g_HWND;
extern bool g_IsNT;
#endif
-static wchar_t *kTempDirPrefix = L"7zO";
+static wchar_t *kTempDirPrefix = L"7zO";
-static const wchar_t *virusMessage = L"File looks like virus (file name has long spaces in name). 7-Zip will not open it";
static bool IsNameVirus(const UString &name)
{
@@ -47,6 +47,9 @@ struct CTmpProcessInfo: public CTempFileInfo
HANDLE ProcessHandle;
HWND Window;
UString FullPathFolderPrefix;
+ bool UsePassword;
+ UString Password;
+ CTmpProcessInfo(): UsePassword(false) {}
};
class CTmpProcessInfoRelease
@@ -63,18 +66,21 @@ public:
}
};
-HRESULT CPanel::OpenItemAsArchive(const UString &name,
- const UString &folderPath, const UString &filePath, bool &encrypted)
+HRESULT CPanel::OpenItemAsArchive(const UString &name,
+ const UString &folderPath, const UString &filePath,
+ const UString &virtualFilePath,
+ bool &encrypted)
{
encrypted = false;
CFolderLink folderLink;
if (!NFile::NFind::FindFile(filePath, folderLink.FileInfo))
return E_FAIL;
- if (folderLink.FileInfo.IsDirectory())
+ if (folderLink.FileInfo.IsDir())
return S_FALSE;
folderLink.FilePath = filePath;
folderLink.FolderPath = folderPath;
+ folderLink.VirtualPath = virtualFilePath;
CMyComPtr<IFolderFolder> newFolder;
@@ -82,8 +88,13 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name,
// _password.Empty();
NDLL::CLibrary library;
- RINOK(OpenFileFolderPlugin(filePath, &library, &newFolder, GetParent(), encrypted));
+
+ UString password;
+ RINOK(OpenFileFolderPlugin(filePath, &library, &newFolder, GetParent(), encrypted, password));
+ folderLink.Password = password;
+ folderLink.UsePassword = encrypted;
+
folderLink.ParentFolder = _folder;
folderLink.ItemName = name;
_parentFolders.Add(folderLink);
@@ -100,7 +111,10 @@ HRESULT CPanel::OpenItemAsArchive(const UString &name,
HRESULT CPanel::OpenItemAsArchive(const UString &name)
{
bool encrypted;
- return OpenItemAsArchive(name, _currentFolderPrefix, _currentFolderPrefix + name, encrypted);
+ return OpenItemAsArchive(name, _currentFolderPrefix,
+ _currentFolderPrefix + name,
+ _currentFolderPrefix + name,
+ encrypted);
}
HRESULT CPanel::OpenItemAsArchive(int index)
@@ -120,17 +134,17 @@ HRESULT CPanel::OpenParentArchiveFolder()
NFind::CFileInfoW newFileInfo;
if (NFind::FindFile(folderLink.FilePath, newFileInfo))
{
- if (newFileInfo.Size != folderLink.FileInfo.Size ||
- CompareFileTime(&newFileInfo.LastWriteTime,
- &folderLink.FileInfo.LastWriteTime) != 0)
+ if (newFileInfo.Size != folderLink.FileInfo.Size ||
+ CompareFileTime(&newFileInfo.MTime, &folderLink.FileInfo.MTime) != 0)
{
- UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE,
+ UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE,
0x03020280, folderLink.ItemName);
if (::MessageBoxW(HWND(*this), message, L"7-Zip", MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
{
- if (OnOpenItemChanged(folderLink.FolderPath, folderLink.ItemName) != S_OK)
+ if (OnOpenItemChanged(folderLink.FolderPath, folderLink.ItemName,
+ folderLink.UsePassword, folderLink.Password) != S_OK)
{
- ::MessageBoxW(HWND(*this), MyFormatNew(IDS_CANNOT_UPDATE_FILE,
+ ::MessageBoxW(HWND(*this), MyFormatNew(IDS_CANNOT_UPDATE_FILE,
0x03020281, folderLink.FilePath), L"7-Zip", MB_OK | MB_ICONSTOP);
return S_OK;
}
@@ -141,17 +155,17 @@ HRESULT CPanel::OpenParentArchiveFolder()
return S_OK;
}
-static const wchar_t *kStartExtensions[] =
+static const wchar_t *kStartExtensions[] =
{
L"exe", L"bat", L"com",
L"chm",
L"msi", L"doc", L"xls", L"ppt", L"pps", L"wps", L"wpt", L"wks", L"xlr", L"wdb",
- L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb",
- L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn",
+ L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb",
+ L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn",
L"odt", L"ods",
- L"wb3",
+ L"wb3",
L"pdf"
};
@@ -198,7 +212,7 @@ static HANDLE StartEditApplication(const UString &path, HWND window)
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
- result = ::CreateProcessA(NULL, (CHAR *)(const CHAR *)GetSystemString(command),
+ result = ::CreateProcessA(NULL, (CHAR *)(const CHAR *)GetSystemString(command),
NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation);
}
else
@@ -213,7 +227,7 @@ static HANDLE StartEditApplication(const UString &path, HWND window)
startupInfo.cbReserved2 = 0;
startupInfo.lpReserved2 = 0;
- result = ::CreateProcessW(NULL, (WCHAR *)(const WCHAR *)command,
+ result = ::CreateProcessW(NULL, (WCHAR *)(const WCHAR *)command,
NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation);
}
@@ -222,7 +236,7 @@ static HANDLE StartEditApplication(const UString &path, HWND window)
::CloseHandle(processInformation.hThread);
return processInformation.hProcess;
}
- ::MessageBoxW(window, LangString(IDS_CANNOT_START_EDITOR, 0x03020282),
+ ::MessageBoxW(window, LangString(IDS_CANNOT_START_EDITOR, 0x03020282),
L"7-Zip", MB_OK | MB_ICONSTOP);
return 0;
}
@@ -279,7 +293,7 @@ static HANDLE StartApplication(const UString &path, HWND window)
switch(result)
{
case SE_ERR_NOASSOC:
- ::MessageBoxW(window,
+ ::MessageBoxW(window,
NError::MyFormatMessageW(::GetLastError()),
// L"There is no application associated with the given file name extension",
L"7-Zip", MB_OK | MB_ICONSTOP);
@@ -318,29 +332,39 @@ void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal)
UString name = GetItemRelPath(index);
if (IsNameVirus(name))
{
- MessageBoxMyError(virusMessage);
+ MessageBoxErrorLang(IDS_VIRUS, 0x03020284);
return;
}
UString fullPath = _currentFolderPrefix + name;
if (tryInternal)
if (!tryExternal || !DoItemAlwaysStart(name))
- if (OpenItemAsArchive(index) == S_OK)
+ {
+ HRESULT res = OpenItemAsArchive(index);
+ if (res == S_OK || res == E_ABORT)
return;
+ if (res != S_FALSE)
+ {
+ MessageBoxError(res);
+ return;
+ }
+ }
if (tryExternal)
{
- NDirectory::MySetCurrentDirectory(_currentFolderPrefix);
+ // SetCurrentDirectory opens HANDLE to folder!!!
+ // NDirectory::MySetCurrentDirectory(_currentFolderPrefix);
HANDLE hProcess = StartApplication(fullPath, (HWND)*this);
if (hProcess != 0)
::CloseHandle(hProcess);
}
}
-
-HRESULT CPanel::OnOpenItemChanged(const UString &folderPath, const UString &itemName)
+
+HRESULT CPanel::OnOpenItemChanged(const UString &folderPath, const UString &itemName,
+ bool usePassword, const UString &password)
{
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return E_FAIL;
}
UStringVector fileNames;
@@ -350,7 +374,12 @@ HRESULT CPanel::OnOpenItemChanged(const UString &folderPath, const UString &item
UString pathPrefix = folderPath;
NName::NormalizeDirPathPrefix(pathPrefix);
- return folderOperations->CopyFrom(pathPrefix, &fileNamePointers.Front(),fileNamePointers.Size(), NULL);
+
+ CUpdateCallback100Imp *callbackSpec = new CUpdateCallback100Imp;
+ CMyComPtr<IProgress> callback = callbackSpec;
+ callbackSpec->Init((HWND)*this, usePassword, password);
+
+ return folderOperations->CopyFrom(pathPrefix, &fileNamePointers.Front(), fileNamePointers.Size(), callback);
}
LRESULT CPanel::OnOpenItemChanged(LPARAM lParam)
@@ -363,7 +392,8 @@ LRESULT CPanel::OnOpenItemChanged(LPARAM lParam)
CSelectedState state;
SaveSelectedState(state);
- HRESULT result = OnOpenItemChanged(tmpProcessInfo.FolderPath, tmpProcessInfo.ItemName);
+ HRESULT result = OnOpenItemChanged(tmpProcessInfo.FolderPath, tmpProcessInfo.ItemName,
+ tmpProcessInfo.UsePassword, tmpProcessInfo.Password);
if (result != S_OK)
return 0;
RefreshListCtrl(state);
@@ -407,17 +437,16 @@ static THREAD_FUNC_DECL MyThreadFunction(void *param)
NFind::CFileInfoW newFileInfo;
if (NFind::FindFile(tmpProcessInfo->FilePath, newFileInfo))
{
- if (newFileInfo.Size != tmpProcessInfo->FileInfo.Size ||
- CompareFileTime(&newFileInfo.LastWriteTime,
- &tmpProcessInfo->FileInfo.LastWriteTime) != 0)
+ if (newFileInfo.Size != tmpProcessInfo->FileInfo.Size ||
+ CompareFileTime(&newFileInfo.MTime, &tmpProcessInfo->FileInfo.MTime) != 0)
{
- UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE,
+ UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE,
0x03020280, tmpProcessInfo->ItemName);
if (::MessageBoxW(g_HWND, message, L"7-Zip", MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
{
if (SendMessage(tmpProcessInfo->Window, kOpenItemChanged, 0, (LONG_PTR)tmpProcessInfo) != 1)
{
- ::MessageBoxW(g_HWND, MyFormatNew(IDS_CANNOT_UPDATE_FILE,
+ ::MessageBoxW(g_HWND, MyFormatNew(IDS_CANNOT_UPDATE_FILE,
0x03020281, tmpProcessInfo->FilePath), L"7-Zip", MB_OK | MB_ICONSTOP);
return 0;
}
@@ -428,20 +457,19 @@ static THREAD_FUNC_DECL MyThreadFunction(void *param)
return 0;
}
-void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
- bool editMode)
+void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode)
{
const UString name = GetItemName(index);
if (IsNameVirus(name))
{
- MessageBoxMyError(virusMessage);
+ MessageBoxErrorLang(IDS_VIRUS, 0x03020284);
return;
}
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
@@ -455,7 +483,24 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
indices.Add(index);
UStringVector messages;
- HRESULT result = CopyTo(indices, tempDirNorm, false, true, &messages);
+
+ bool usePassword = false;
+ UString password;
+ if (_parentFolders.Size() > 0)
+ {
+ const CFolderLink &fl = _parentFolders.Back();
+ usePassword = fl.UsePassword;
+ password = fl.Password;
+ }
+
+ HRESULT result = CopyTo(indices, tempDirNorm, false, true, &messages, usePassword, password);
+
+ if (_parentFolders.Size() > 0)
+ {
+ CFolderLink &fl = _parentFolders.Back();
+ fl.UsePassword = usePassword;
+ fl.Password = password;
+ }
if (!messages.IsEmpty())
return;
@@ -472,6 +517,9 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get();
tmpProcessInfo->FolderPath = tempDir;
tmpProcessInfo->FilePath = tempFilePath;
+ tmpProcessInfo->UsePassword = usePassword;
+ tmpProcessInfo->Password = password;
+
if (!NFind::FindFile(tempFilePath, tmpProcessInfo->FileInfo))
return;
@@ -480,7 +528,8 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
if (!tryExternal || !DoItemAlwaysStart(name))
{
bool encrypted;
- if (OpenItemAsArchive(name, tempDir, tempFilePath, encrypted) == S_OK)
+ if (OpenItemAsArchive(name, tempDir, tempFilePath,
+ _currentFolderPrefix + name, encrypted) == S_OK)
{
RefreshListCtrl();
return;
@@ -530,21 +579,18 @@ void DeleteOldTempFiles()
if(!NFile::NDirectory::MyGetTempPath(tempPath))
throw 1;
- SYSTEMTIME systemTime;
- ::GetSystemTime(&systemTime);
UINT64 currentFileTime;
- if(!::SystemTimeToFileTime(&systemTime, (FILETIME *)&currentFileTime))
- throw 2;
+ NTime::GetCurUtcFileTime(currentFileTime);
UString searchWildCard = tempPath + kTempDirPrefix + L"*.tmp";
searchWildCard += WCHAR(NName::kAnyStringWildcard);
NFind::CEnumeratorW enumerator(searchWildCard);
NFind::CFileInfoW fileInfo;
while(enumerator.Next(fileInfo))
{
- if (!fileInfo.IsDirectory())
+ if (!fileInfo.IsDir())
continue;
- const UINT64 &creationTime = *(const UINT64 *)(&fileInfo.CreationTime);
- if(CheckDeleteItem(creationTime, currentFileTime))
+ const UINT64 &cTime = *(const UINT64 *)(&fileInfo.CTime);
+ if(CheckDeleteItem(cTime, currentFileTime))
RemoveDirectoryWithSubItems(tempPath + fileInfo.Name);
}
}
diff --git a/CPP/7zip/UI/FileManager/PanelItems.cpp b/CPP/7zip/UI/FileManager/PanelItems.cpp
index 41ef45dd..89b47ec7 100755
--- a/CPP/7zip/UI/FileManager/PanelItems.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItems.cpp
@@ -4,19 +4,18 @@
#include "Common/StringConvert.h"
+#include "Windows/Menu.h"
#include "Windows/PropVariant.h"
#include "Windows/PropVariantConversions.h"
-#include "Windows/Menu.h"
#include "../../PropID.h"
-#include "Panel.h"
#include "resource.h"
-#include "RootFolder.h"
-
-#include "PropertyName.h"
#include "LangUtils.h"
+#include "Panel.h"
+#include "PropertyName.h"
+#include "RootFolder.h"
extern "C"
{
@@ -29,9 +28,9 @@ static int GetColumnAlign(PROPID propID, VARTYPE varType)
{
switch(propID)
{
- case kpidCreationTime:
- case kpidLastAccessTime:
- case kpidLastWriteTime:
+ case kpidCTime:
+ case kpidATime:
+ case kpidMTime:
return LVCFMT_LEFT;
}
switch(varType)
@@ -45,7 +44,7 @@ static int GetColumnAlign(PROPID propID, VARTYPE varType)
case VT_UINT:
case VT_I8:
case VT_UI8:
- case VT_BOOL:
+ case VT_BOOL:
return LVCFMT_RIGHT;
case VT_EMPTY:
@@ -84,7 +83,7 @@ void CPanel::InitColumns()
_needSaveInfo = true;
UInt32 numProperties;
- _folder->GetNumberOfProperties(&numProperties);
+ _folder->GetNumberOfProperties(&numProperties);
int i;
for (i = 0; i < (int)numProperties; i++)
{
@@ -95,24 +94,17 @@ void CPanel::InitColumns()
if (_folder->GetPropertyInfo(i, &name, &propID, &varType) != S_OK)
throw 1;
- CItemProperty destProperty;
- destProperty.Type = varType;
- destProperty.ID = propID;
- if (propID == kpidIsFolder)
+ if (propID == kpidIsDir)
continue;
- {
- if (name != NULL)
- destProperty.Name = name;
- else
- destProperty.Name = L"Error";
- }
- UString propName = GetNameOfProperty(propID);
- if (!propName.IsEmpty())
- destProperty.Name = propName;
- destProperty.Order = -1;
- destProperty.IsVisible = true;
- destProperty.Width = 100;
- _properties.Add(destProperty);
+
+ CItemProperty prop;
+ prop.Type = varType;
+ prop.ID = propID;
+ prop.Name = GetNameOfProperty(propID, name);
+ prop.Order = -1;
+ prop.IsVisible = true;
+ prop.Width = 100;
+ _properties.Add(prop);
}
// InitColumns2(sortID);
@@ -177,10 +169,7 @@ void CPanel::InsertColumn(int index)
column.fmt = GetColumnAlign(property.ID, property.Type);
column.iOrder = property.Order;
column.iSubItem = index;
- UString propertyName = GetNameOfProperty(property.ID);
- if (propertyName.IsEmpty())
- propertyName = property.Name;
- column.pszText = (wchar_t *)(const wchar_t *)propertyName;
+ column.pszText = (wchar_t *)(const wchar_t *)property.Name;
_listView.InsertColumn(index, &column);
}
@@ -338,7 +327,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
_listView.SetItemCount(numItems + (showDots ? 1 : 0));
_selectedStatusVector.Reserve(numItems);
- int cursorIndex = -1;
+ int cursorIndex = -1;
CMyComPtr<IFolderGetSystemIconIndex> folderGetSystemIconIndex;
if (!IsFSFolder() || _showRealFileIcons)
@@ -414,7 +403,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
item.pszText = (wchar_t *)(const wchar_t *)itemName;
NCOM::CPropVariant propVariant;
- _folder->GetProperty(i, kpidAttributes, &propVariant);
+ _folder->GetProperty(i, kpidAttrib, &propVariant);
UInt32 attributes = 0;
if (propVariant.vt == VT_UI4)
attributes = propVariant.ulVal;
@@ -459,7 +448,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
{
if (focusedPos >= _listView.GetItemCount())
focusedPos = _listView.GetItemCount() - 1;
- SetFocusedSelectedItem(focusedPos, true);
+ SetFocusedSelectedItem(focusedPos, showDots);
}
// m_RedrawEnabled = true;
_listView.EnsureVisible(_listView.GetFocusedItem(), false);
@@ -517,6 +506,13 @@ void CPanel::GetAllItemIndices(CRecordVector<UInt32> &indices) const
indices.Add(i);
}
+void CPanel::GetOperatedIndicesSmart(CRecordVector<UInt32> &indices) const
+{
+ GetOperatedItemIndices(indices);
+ if (indices.IsEmpty() || (indices.Size() == 1 && indices[0] == (UInt32)(Int32)-1))
+ GetAllItemIndices(indices);
+}
+
/*
void CPanel::GetOperatedListViewIndices(CRecordVector<UInt32> &indices) const
{
@@ -568,7 +564,7 @@ void CPanel::OpenSelectedItems(bool tryInternal)
GetOperatedItemIndices(indices);
if (indices.Size() > 20)
{
- MessageBox(LangString(IDS_TOO_MANY_ITEMS, 0x02000606));
+ MessageBoxErrorLang(IDS_TOO_MANY_ITEMS, 0x02000606);
return;
}
@@ -640,7 +636,7 @@ bool CPanel::IsItemFolder(int itemIndex) const
if (itemIndex == kParentIndex)
return true;
NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(itemIndex, kpidIsFolder, &propVariant) != S_OK)
+ if (_folder->GetProperty(itemIndex, kpidIsDir, &propVariant) != S_OK)
throw 2723400;
if (propVariant.vt == VT_BOOL)
return VARIANT_BOOLToBool(propVariant.boolVal);
@@ -745,7 +741,7 @@ bool CPanel::OnRightClick(LPNMITEMACTIVATE itemActiveate, LRESULT &result)
flags |= MF_GRAYED;
menu.AppendItem(flags, kCommandStart + i, GetSystemString(property.Name));
}
- int menuResult = menu.Track(TPM_LEFTALIGN | TPM_RETURNCMD | TPM_NONOTIFY,
+ int menuResult = menu.Track(TPM_LEFTALIGN | TPM_RETURNCMD | TPM_NONOTIFY,
point.x, point.y, _listView);
if (menuResult >= kCommandStart && menuResult <= kCommandStart + _properties.Size())
{
diff --git a/CPP/7zip/UI/FileManager/PanelKey.cpp b/CPP/7zip/UI/FileManager/PanelKey.cpp
index 218476ed..8e3eaaa1 100755
--- a/CPP/7zip/UI/FileManager/PanelKey.cpp
+++ b/CPP/7zip/UI/FileManager/PanelKey.cpp
@@ -16,11 +16,11 @@ struct CVKeyPropIDPair
PROPID PropID;
};
-static CVKeyPropIDPair g_VKeyPropIDPairs[] =
+static CVKeyPropIDPair g_VKeyPropIDPairs[] =
{
{ VK_F3, kpidName },
{ VK_F4, kpidExtension },
- { VK_F5, kpidLastWriteTime },
+ { VK_F5, kpidMTime },
{ VK_F6, kpidSize },
{ VK_F7, kpidNoProperty }
};
@@ -48,7 +48,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
result = 0;
- if (keyDownInfo->wVKey >= '0' && keyDownInfo->wVKey <= '9' &&
+ if (keyDownInfo->wVKey >= '0' && keyDownInfo->wVKey <= '9' &&
(rightCtrl || alt))
{
int index = keyDownInfo->wVKey - '0';
@@ -64,7 +64,7 @@ bool CPanel::OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result)
}
}
- if ((keyDownInfo->wVKey == VK_F2 ||
+ if ((keyDownInfo->wVKey == VK_F2 ||
keyDownInfo->wVKey == VK_F1) && alt && !ctrl && !shift)
{
_panelCallback->SetFocusToPath(keyDownInfo->wVKey == VK_F1 ? 0 : 1);
diff --git a/CPP/7zip/UI/FileManager/PanelListNotify.cpp b/CPP/7zip/UI/FileManager/PanelListNotify.cpp
index 572118d0..21600a68 100755
--- a/CPP/7zip/UI/FileManager/PanelListNotify.cpp
+++ b/CPP/7zip/UI/FileManager/PanelListNotify.cpp
@@ -51,7 +51,7 @@ static UString ConvertSizeToStringShort(UInt64 value)
return s;
}
-static UString ConvertSizeToString(UInt64 value)
+UString ConvertSizeToString(UInt64 value)
{
wchar_t s[32];
ConvertUInt64ToString(value, s);
@@ -90,22 +90,16 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
if (!defined)
{
NCOM::CPropVariant prop;
- _folder->GetProperty(index, kpidAttributes, &prop);
- UINT32 attributes = 0;
+ _folder->GetProperty(index, kpidAttrib, &prop);
+ UINT32 attrib = 0;
if (prop.vt == VT_UI4)
- attributes = prop.ulVal;
- else
- {
- if (IsItemFolder(index))
- attributes |= FILE_ATTRIBUTE_DIRECTORY;
- }
+ attrib = prop.ulVal;
+ else if (IsItemFolder(index))
+ attrib |= FILE_ATTRIBUTE_DIRECTORY;
if (_currentFolderPrefix.IsEmpty())
- {
throw 1;
- }
else
- item.iImage = _extToIconMap.GetIconIndex(attributes,
- GetSystemString(GetItemName(index)));
+ item.iImage = _extToIconMap.GetIconIndex(attrib, GetSystemString(GetItemName(index)));
}
// item.iImage = 1;
}
@@ -156,8 +150,8 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
if (_folder->GetProperty(realIndex, propID, &prop) != S_OK)
throw 2723407;
- if ((propID == kpidSize || propID == kpidPackedSize || propID == kpidClusterSize ||
- propID == kpidNumSubFolders || propID == kpidNumSubFiles) &&
+ if ((propID == kpidSize || propID == kpidPackSize || propID == kpidClusterSize ||
+ propID == kpidNumSubDirs || propID == kpidNumSubFiles) &&
(prop.vt == VT_UI8 || prop.vt == VT_UI4))
s = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
else if ((propID == kpidTotalSize || propID == kpidFreeSpace) &&
@@ -166,8 +160,8 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
else
{
s = ConvertPropertyToString(prop, propID, false);
- s.Replace(wchar_t(0xA), L' ');
- s.Replace(wchar_t(0xD), L' ');
+ s.Replace(wchar_t(0xA), L' ');
+ s.Replace(wchar_t(0xD), L' ');
}
int size = item.cchTextMax;
if(size > 0)
@@ -224,7 +218,7 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
//is the sub-item information being requested?
- if((dispInfo->item.mask & LVIF_TEXT) != 0 ||
+ if((dispInfo->item.mask & LVIF_TEXT) != 0 ||
(dispInfo->item.mask & LVIF_IMAGE) != 0)
SetItemText(dispInfo->item);
return false;
@@ -327,7 +321,7 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
bool CPanel::OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result)
{
- switch(lplvcd->nmcd.dwDrawStage)
+ switch(lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT :
result = CDRF_NOTIFYITEMDRAW;
@@ -410,8 +404,8 @@ void CPanel::OnRefreshStatusBar()
{
sizeString = ConvertSizeToString(GetItemSize(realIndex));
NCOM::CPropVariant prop;
- if (_folder->GetProperty(realIndex, kpidLastWriteTime, &prop) == S_OK)
- dateString = ConvertPropertyToString(prop, kpidLastWriteTime, false);
+ if (_folder->GetProperty(realIndex, kpidMTime, &prop) == S_OK)
+ dateString = ConvertPropertyToString(prop, kpidMTime, false);
}
}
_statusBar.SetText(2, sizeString);
diff --git a/CPP/7zip/UI/FileManager/PanelMenu.cpp b/CPP/7zip/UI/FileManager/PanelMenu.cpp
index 8ebbc8ac..c881d8b8 100755
--- a/CPP/7zip/UI/FileManager/PanelMenu.cpp
+++ b/CPP/7zip/UI/FileManager/PanelMenu.cpp
@@ -5,6 +5,7 @@
#include "Windows/COM.h"
#include "Windows/PropVariant.h"
#include "Windows/Clipboard.h"
+#include "Windows/PropVariantConversions.h"
#include "../Common/PropIDUtils.h"
#include "../../PropID.h"
@@ -20,7 +21,7 @@
using namespace NWindows;
// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
+DEFINE_GUID(CLSID_CZipContextMenu,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
static const UINT kSevenZipStartMenuID = kPluginMenuStartID ;
@@ -50,18 +51,30 @@ void CPanel::InvokeSystemCommand(const char *command)
static const wchar_t *kSeparator = L"--------------------------------------\n";
static const wchar_t *kPropValueSeparator = L": ";
-static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
+extern UString ConvertSizeToString(UInt64 value);
+
+static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
const NCOM::CPropVariant &prop, UString &s)
{
if (prop.vt != VT_EMPTY)
{
- UString name = GetNameOfProperty(propID);
- if (name.IsEmpty() && nameBSTR != NULL)
- name = nameBSTR;
- if (name.IsEmpty())
- name = L"?";
-
- const UString val = ConvertPropertyToString(prop, propID);
+ const UString name = GetNameOfProperty(propID, nameBSTR);
+ UString val;
+
+ if ((
+ propID == kpidSize ||
+ propID == kpidPackSize ||
+ propID == kpidNumSubDirs ||
+ propID == kpidNumSubFiles ||
+ propID == kpidNumBlocks ||
+ propID == kpidPhySize ||
+ propID == kpidHeadersSize ||
+ propID == kpidClusterSize
+ ) && (prop.vt == VT_UI8 || prop.vt == VT_UI4))
+ val = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
+ else
+ val = ConvertPropertyToString(prop, propID);
+
if (!val.IsEmpty())
{
s += name;
@@ -77,7 +90,7 @@ static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
}
void CPanel::Properties()
-{
+{
CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
_folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
if (!getFolderArchiveProperties)
@@ -224,7 +237,7 @@ void CPanel::EditPaste()
s += names[i];
}
- MessageBoxW(0, s, L"", 0);
+ MessageBoxW(0, s, L"", 0);
*/
// InvokeSystemCommand("paste");
@@ -239,7 +252,7 @@ HRESULT CPanel::CreateShellContextMenu(
CMyComPtr<IShellFolder> desktopFolder;
RINOK(::SHGetDesktopFolder(&desktopFolder));
- if (!desktopFolder)
+ if (!desktopFolder)
{
// ShowMessage("Failed to get Desktop folder.");
return E_FAIL;
@@ -253,7 +266,7 @@ HRESULT CPanel::CreateShellContextMenu(
LPITEMIDLIST parentPidl;
DWORD eaten;
RINOK(desktopFolder->ParseDisplayName(
- GetParent(), 0, (wchar_t *)(const wchar_t *)folderPath,
+ GetParent(), 0, (wchar_t *)(const wchar_t *)folderPath,
&eaten, &parentPidl, 0));
// Get an IShellFolder for the folder
@@ -261,7 +274,7 @@ HRESULT CPanel::CreateShellContextMenu(
CMyComPtr<IShellFolder> parentFolder;
RINOK(desktopFolder->BindToObject(parentPidl,
0, IID_IShellFolder, (void**)&parentFolder));
- if (!parentFolder)
+ if (!parentFolder)
{
// ShowMessage("Invalid file name.");
return E_FAIL;
@@ -276,7 +289,7 @@ HRESULT CPanel::CreateShellContextMenu(
UString fileName = GetItemRelPath(operatedIndices[i]);
if (IsFSDrivesFolder())
fileName += L'\\';
- RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
+ RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
(wchar_t *)(const wchar_t *)fileName, &eaten, &pidl, 0));
pidls.Add(pidl);
}
@@ -287,7 +300,7 @@ HRESULT CPanel::CreateShellContextMenu(
temp.mkid.cb = 0;
/*
LPITEMIDLIST pidl;
- HRESULT result = parentFolder->ParseDisplayName(GetParent(), 0,
+ HRESULT result = parentFolder->ParseDisplayName(GetParent(), 0,
L".\\", &eaten, &pidl, 0);
if (result != NOERROR)
return;
@@ -297,9 +310,9 @@ HRESULT CPanel::CreateShellContextMenu(
// Get the IContextMenu for the file.
CMyComPtr<IContextMenu> cm;
- RINOK( parentFolder->GetUIObjectOf(GetParent(), pidls.Size(),
+ RINOK( parentFolder->GetUIObjectOf(GetParent(), pidls.Size(),
(LPCITEMIDLIST *)&pidls.Front(), IID_IContextMenu, 0, (void**)&cm));
- if (!cm)
+ if (!cm)
{
// ShowMessage("Unable to get context menu interface.");
return E_FAIL;
@@ -308,7 +321,7 @@ HRESULT CPanel::CreateShellContextMenu(
return S_OK;
}
-void CPanel::CreateSystemMenu(HMENU menuSpec,
+void CPanel::CreateSystemMenu(HMENU menuSpec,
const CRecordVector<UInt32> &operatedIndices,
CMyComPtr<IContextMenu> &systemContextMenu)
{
@@ -326,7 +339,7 @@ void CPanel::CreateSystemMenu(HMENU menuSpec,
ci.hwnd = GetParent();
/*
- if (Sender == GoBtn)
+ if (Sender == GoBtn)
{
// Verbs that can be used are cut, paste,
// properties, delete, and so on.
@@ -346,8 +359,8 @@ void CPanel::CreateSystemMenu(HMENU menuSpec,
ShowMessage(
"Error copying file to clipboard.");
- }
- else
+ }
+ else
*/
{
// HMENU hMenu = CreatePopupMenu();
@@ -381,7 +394,7 @@ void CPanel::CreateSystemMenu(HMENU menuSpec,
menu.InsertItem(0, true, menuItem);
}
/*
- if (Cmd < 100 && Cmd != 0)
+ if (Cmd < 100 && Cmd != 0)
{
ci.lpVerb = MAKEINTRESOURCE(Cmd - 1);
ci.lpParameters = "";
@@ -393,7 +406,7 @@ void CPanel::CreateSystemMenu(HMENU menuSpec,
// inserted menu items.
else
// Find the menu item.
- for (int i = 0; i < popupMenu1->Items->Count; i++)
+ for (int i = 0; i < popupMenu1->Items->Count; i++)
{
TMenuItem* menu = popupMenu1->Items->Items[i];
// Call its OnClick handler.
@@ -411,7 +424,7 @@ void CPanel::CreateFileMenu(HMENU menuSpec)
CreateFileMenu(menuSpec, _sevenZipContextMenu, _systemContextMenu, true);
}
-void CPanel::CreateSevenZipMenu(HMENU menuSpec,
+void CPanel::CreateSevenZipMenu(HMENU menuSpec,
const CRecordVector<UInt32> &operatedIndices,
CMyComPtr<IContextMenu> &sevenZipContextMenu)
{
@@ -443,7 +456,7 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec,
if (initContextMenu->InitContextMenu(currentFolderUnicode, &namePointers.Front(),
operatedIndices.Size()) == S_OK)
{
- HRESULT res = contextMenu->QueryContextMenu(menu, 0, kSevenZipStartMenuID,
+ HRESULT res = contextMenu->QueryContextMenu(menu, 0, kSevenZipStartMenuID,
kSystemStartMenuID - 1, 0);
sevenZipMenuCreated = (HRESULT_SEVERITY(res) == SEVERITY_SUCCESS);
if (sevenZipMenuCreated)
@@ -454,7 +467,7 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec,
}
}
-void CPanel::CreateFileMenu(HMENU menuSpec,
+void CPanel::CreateFileMenu(HMENU menuSpec,
CMyComPtr<IContextMenu> &sevenZipContextMenu,
CMyComPtr<IContextMenu> &systemContextMenu,
bool programMenu)
@@ -475,7 +488,13 @@ void CPanel::CreateFileMenu(HMENU menuSpec,
if (menu.GetItemCount() > 0)
menu.AppendItem(MF_SEPARATOR, 0, (LPCTSTR)0);
- LoadFileMenu(menu, menu.GetItemCount(), !operatedIndices.IsEmpty(), programMenu);
+ int i;
+ for (i = 0; i < operatedIndices.Size(); i++)
+ if (IsItemFolder(operatedIndices[i]))
+ break;
+ bool allAreFiles = (i == operatedIndices.Size());
+ LoadFileMenu(menu, menu.GetItemCount(), programMenu,
+ IsFSFolder(), operatedIndices.Size(), allAreFiles);
}
bool CPanel::InvokePluginCommand(int id)
@@ -483,7 +502,7 @@ bool CPanel::InvokePluginCommand(int id)
return InvokePluginCommand(id, _sevenZipContextMenu, _systemContextMenu);
}
-bool CPanel::InvokePluginCommand(int id,
+bool CPanel::InvokePluginCommand(int id,
IContextMenu *sevenZipContextMenu, IContextMenu *systemContextMenu)
{
UInt32 offset;
@@ -576,7 +595,7 @@ bool CPanel::OnContextMenu(HANDLE windowHandle, int xPos, int yPos)
CMyComPtr<IContextMenu> systemContextMenu;
CreateFileMenu(menu, sevenZipContextMenu, systemContextMenu, false);
- int result = menu.Track(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY,
+ int result = menu.Track(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY,
xPos, yPos, _listView);
if (result == 0)
diff --git a/CPP/7zip/UI/FileManager/PanelOperations.cpp b/CPP/7zip/UI/FileManager/PanelOperations.cpp
index 2cdabdc1..76de0c1a 100755
--- a/CPP/7zip/UI/FileManager/PanelOperations.cpp
+++ b/CPP/7zip/UI/FileManager/PanelOperations.cpp
@@ -28,51 +28,88 @@ using namespace NFile;
extern bool g_IsNT;
#endif
-struct CThreadDelete
+enum EFolderOpType
{
- CMyComPtr<IFolderOperations> FolderOperations;
+ FOLDER_TYPE_CREATE_FOLDER = 0,
+ FOLDER_TYPE_DELETE = 1,
+ FOLDER_TYPE_RENAME = 2
+};
+
+struct CThreadFolderOperations
+{
+ EFolderOpType OpType;
+ UString Name;
+ UInt32 Index;
CRecordVector<UInt32> Indices;
+
+ CMyComPtr<IFolderOperations> FolderOperations;
CMyComPtr<IProgress> UpdateCallback;
CUpdateCallback100Imp *UpdateCallbackSpec;
HRESULT Result;
- DWORD Process()
+ CThreadFolderOperations(EFolderOpType opType);
+
+ void Process()
{
NCOM::CComInitializer comInitializer;
UpdateCallbackSpec->ProgressDialog.WaitCreating();
- Result = FolderOperations->Delete(&Indices.Front(), Indices.Size(), UpdateCallback);
+
+ switch(OpType)
+ {
+ case FOLDER_TYPE_CREATE_FOLDER:
+ Result = FolderOperations->CreateFolder(Name, UpdateCallback);
+ break;
+ case FOLDER_TYPE_DELETE:
+ Result = FolderOperations->Delete(&Indices.Front(), Indices.Size(), UpdateCallback);
+ break;
+ case FOLDER_TYPE_RENAME:
+ Result = FolderOperations->Rename(Index, Name, UpdateCallback);
+ break;
+ default:
+ Result = E_FAIL;
+ }
UpdateCallbackSpec->ProgressDialog.MyClose();
- return 0;
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
- return ((CThreadDelete *)param)->Process();
+ ((CThreadFolderOperations *)param)->Process();
+ return 0;
}
};
-struct CThreadCreateFolder
+CThreadFolderOperations::CThreadFolderOperations(EFolderOpType opType): OpType(opType) {};
+
+static void DoOperation(CThreadFolderOperations &op, CPanel &panel, const UString &progressTitle)
{
- CMyComPtr<IFolderOperations> FolderOperations;
- UString Name;
- CMyComPtr<IProgress> UpdateCallback;
- CUpdateCallback100Imp *UpdateCallbackSpec;
- HRESULT Result;
-
- DWORD Process()
- {
- NCOM::CComInitializer comInitializer;
- UpdateCallbackSpec->ProgressDialog.WaitCreating();
- Result = FolderOperations->CreateFolder(Name, UpdateCallback);
- UpdateCallbackSpec->ProgressDialog.MyClose();
- return 0;
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
+ op.UpdateCallbackSpec = new CUpdateCallback100Imp;
+ op.UpdateCallback = op.UpdateCallbackSpec;
+
+ bool usePassword = false;
+ UString password;
+ if (panel._parentFolders.Size() > 0)
{
- return ((CThreadCreateFolder *)param)->Process();
+ const CFolderLink &fl = panel._parentFolders.Back();
+ usePassword = fl.UsePassword;
+ password = fl.Password;
}
-};
+
+ op.UpdateCallbackSpec->Init(panel.GetParent(), usePassword, password);
+
+ op.UpdateCallbackSpec->ProgressDialog.MainWindow = panel._mainWindow;
+ op.UpdateCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
+ op.UpdateCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
+
+ // op.FolderOperations = folderOperations;
+ // op.Index = realIndex;
+ // op.Name = newName;
+ // HRESULT result = folderOperations->Rename(realIndex, newName, 0);
+
+ NWindows::CThread thread;
+ if (thread.Create(CThreadFolderOperations::MyThreadFunction, &op) != S_OK)
+ throw 271824;
+ op.UpdateCallbackSpec->StartProgressDialog(progressTitle);
+}
#ifndef _UNICODE
typedef int (WINAPI * SHFileOperationWP)(LPSHFILEOPSTRUCTW lpFileOp);
@@ -87,7 +124,7 @@ void CPanel::DeleteItems(bool toRecycleBin)
return;
CSelectedState state;
SaveSelectedState(state);
- bool useInternalDelete = false;
+ bool useInternalDelete = false;
if (IsFSFolder() && toRecycleBin)
{
#ifndef _UNICODE
@@ -143,7 +180,7 @@ void CPanel::DeleteItems(bool toRecycleBin)
{
if (toRecycleBin)
{
- MessageBoxMyError(L"You can't send file with long path to Recycle Bin");
+ MessageBoxErrorLang(IDS_ERROR_LONG_PATH_TO_RECYCLE, 0x03020218);
return;
}
useInternalDelete = true;
@@ -190,7 +227,7 @@ void CPanel::DeleteItemsInternal(CRecordVector<UInt32> &indices)
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
@@ -214,35 +251,19 @@ void CPanel::DeleteItemsInternal(CRecordVector<UInt32> &indices)
else
{
title = LangString(IDS_CONFIRM_ITEMS_DELETE, 0x03020212);
- message = MyFormatNew(IDS_WANT_TO_DELETE_ITEMS, 0x03020215,
+ message = MyFormatNew(IDS_WANT_TO_DELETE_ITEMS, 0x03020215,
NumberToString(indices.Size()));
}
if (::MessageBoxW(GetParent(), message, title, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
return;
{
- CThreadDelete deleter;
- deleter.UpdateCallbackSpec = new CUpdateCallback100Imp;
- deleter.UpdateCallback = deleter.UpdateCallbackSpec;
- deleter.UpdateCallbackSpec->Init(GetParent(), false, L"");
-
- UString progressTitle = LangString(IDS_DELETING, 0x03020216);
-
- deleter.UpdateCallbackSpec->ProgressDialog.MainWindow = _mainWindow;
- deleter.UpdateCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
- deleter.UpdateCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
-
- deleter.FolderOperations = folderOperations;
- deleter.Indices = indices;
-
- NWindows::CThread thread;
- if (thread.Create(CThreadDelete::MyThreadFunction, &deleter) != S_OK)
- throw 271824;
- deleter.UpdateCallbackSpec->StartProgressDialog(progressTitle);
-
- HRESULT result = deleter.Result;
- if (result != S_OK)
- MessageBoxError(result, LangString(IDS_ERROR_DELETING, 0x03020217));
+ CThreadFolderOperations op(FOLDER_TYPE_DELETE);
+ op.FolderOperations = folderOperations;
+ op.Indices = indices;
+ DoOperation(op, *this, LangString(IDS_DELETING, 0x03020216));
+ if (op.Result != S_OK)
+ MessageBoxError(op.Result, LangString(IDS_ERROR_DELETING, 0x03020217));
}
RefreshTitleAlways();
}
@@ -265,7 +286,7 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBoxMyError(L"Renaming is not supported");
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return FALSE;
}
const UString newName = lpnmh->item.pszText;
@@ -277,12 +298,21 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
if (realIndex == kParentIndex)
return FALSE;
const UString prefix = GetItemPrefix(realIndex);
- HRESULT result = folderOperations->Rename(realIndex, newName, 0);
- if (result != S_OK)
+
+
{
- MessageBoxError(result, LangString(IDS_ERROR_RENAMING, 0x03020221));
- return FALSE;
+ CThreadFolderOperations op(FOLDER_TYPE_RENAME);
+ op.FolderOperations = folderOperations;
+ op.Index = realIndex;
+ op.Name = newName;
+ DoOperation(op, *this, LangString(IDS_RENAMING, 0x03020220));
+ if (op.Result != S_OK)
+ {
+ MessageBoxError(op.Result, LangString(IDS_ERROR_RENAMING, 0x03020221));
+ return FALSE;
+ }
}
+
// Can't use RefreshListCtrl here.
// RefreshListCtrlSaveFocused();
_selectedState.FocusedName = prefix + newName;
@@ -291,7 +321,7 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
// We need clear all items to disable GetText before Reload:
// number of items can change.
// _listView.DeleteAllItems();
- // But seems it can still call GetText (maybe for current item)
+ // But seems it can still call GetText (maybe for current item)
// so we can't delete items.
_dontShowMode = true;
@@ -305,7 +335,7 @@ void CPanel::CreateFolder()
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
@@ -320,34 +350,17 @@ void CPanel::CreateFolder()
UString newName = comboDialog.Value;
- // HRESULT result = folderOperations->CreateFolder(newName, 0);
-
{
- CThreadCreateFolder upd;
- upd.UpdateCallbackSpec = new CUpdateCallback100Imp;
- upd.UpdateCallback = upd.UpdateCallbackSpec;
- upd.UpdateCallbackSpec->Init(GetParent(), false, L"");
-
- UString progressTitle = LangString(IDS_CREATE_FOLDER, 0x03020230);
-
- upd.UpdateCallbackSpec->ProgressDialog.MainWindow = _mainWindow;
- upd.UpdateCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
- upd.UpdateCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
-
- upd.FolderOperations = folderOperations;
- upd.Name = newName;
-
- NWindows::CThread thread;
- if (thread.Create(CThreadCreateFolder::MyThreadFunction, &upd) != S_OK)
- throw 271824;
- upd.UpdateCallbackSpec->StartProgressDialog(progressTitle);
+ CThreadFolderOperations op(FOLDER_TYPE_CREATE_FOLDER);
+ op.FolderOperations = folderOperations;
+ op.Name = newName;
+ DoOperation(op, *this, LangString(IDS_CREATE_FOLDER, 0x03020230));
- HRESULT result = upd.Result;
-
- if (result != S_OK)
- {
- MessageBoxError(result, LangString(IDS_CREATE_FOLDER_ERROR, 0x03020233));
- return;
+ if (op.Result != S_OK)
+ {
+ MessageBoxError(op.Result, LangString(IDS_CREATE_FOLDER_ERROR, 0x03020233));
+ return;
+ }
}
int pos = newName.Find(L'\\');
if (pos >= 0)
@@ -356,7 +369,6 @@ void CPanel::CreateFolder()
state.SelectedNames.Clear();
state.FocusedName = newName;
state.SelectFocused = true;
- }
RefreshTitleAlways();
RefreshListCtrl(state);
}
@@ -366,7 +378,7 @@ void CPanel::CreateFile()
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
@@ -416,11 +428,11 @@ void CPanel::ChangeComment()
CMyComPtr<IFolderOperations> folderOperations;
if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
{
- MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
- UString comment;
+ UString comment;
{
NCOM::CPropVariant propVariant;
if (_folder->GetProperty(realIndex, kpidComment, &propVariant) != S_OK)
diff --git a/CPP/7zip/UI/FileManager/PanelSelect.cpp b/CPP/7zip/UI/FileManager/PanelSelect.cpp
index 4b726b1e..bbd4a187 100755
--- a/CPP/7zip/UI/FileManager/PanelSelect.cpp
+++ b/CPP/7zip/UI/FileManager/PanelSelect.cpp
@@ -97,7 +97,7 @@ void CPanel::OnInsert()
int nextIndex = focusedItem + 1;
if (nextIndex < _listView.GetItemCount())
{
- _listView.SetItemState(nextIndex, LVIS_FOCUSED | LVIS_SELECTED,
+ _listView.SetItemState(nextIndex, LVIS_FOCUSED | LVIS_SELECTED,
LVIS_FOCUSED | LVIS_SELECTED);
_listView.EnsureVisible(nextIndex, false);
}
@@ -151,7 +151,7 @@ void CPanel::UpdateSelection()
void CPanel::SelectSpec(bool selectMode)
{
CComboDialog comboDialog;
- comboDialog.Title = selectMode ?
+ comboDialog.Title = selectMode ?
LangString(IDS_SELECT, 0x03020250):
LangString(IDS_DESELECT, 0x03020251);
comboDialog.Static = LangString(IDS_SELECT_MASK, 0x03020252);
@@ -279,7 +279,7 @@ void CPanel::OnLeftClick(LPNMITEMACTIVATE itemActivate)
}
}
}
- else
+ else
{
_startGroupSelect = indexInList;
if ((itemActivate->uKeyFlags & LVKF_CONTROL) != 0)
diff --git a/CPP/7zip/UI/FileManager/PanelSort.cpp b/CPP/7zip/UI/FileManager/PanelSort.cpp
index c5fddcd6..7eabc9ef 100755
--- a/CPP/7zip/UI/FileManager/PanelSort.cpp
+++ b/CPP/7zip/UI/FileManager/PanelSort.cpp
@@ -20,7 +20,7 @@ static UString GetExtension(const UString &name)
int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
- if(lpData == NULL)
+ if (lpData == NULL)
return 0;
CPanel *panel = (CPanel*)lpData;
@@ -55,7 +55,7 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
/*
if (panel->_sortIndex == 1)
return MyCompare(file1.Size, file2.Size);
- return ::CompareFileTime(&file1.LastWriteTime, &file2.LastWriteTime);
+ return ::CompareFileTime(&file1.MTime, &file2.MTime);
*/
// PROPID propID = panel->_properties[panel->_sortIndex].ID;
@@ -65,7 +65,7 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
// Name must be first property
panel->_folder->GetProperty((UINT32)lParam1, propID, &propVariant1);
panel->_folder->GetProperty((UINT32)lParam2, propID, &propVariant2);
- if(propVariant1.vt != propVariant2.vt)
+ if (propVariant1.vt != propVariant2.vt)
return 0; // It means some BUG
if (propVariant1.vt == VT_BSTR)
{
@@ -77,22 +77,17 @@ int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
- if(lpData == NULL)
- return 0;
- if (lParam1 == kParentIndex)
- return -1;
- if (lParam2 == kParentIndex)
- return 1;
+ if (lpData == NULL) return 0;
+ if (lParam1 == kParentIndex) return -1;
+ if (lParam2 == kParentIndex) return 1;
CPanel *panel = (CPanel*)lpData;
- bool isDirectory1 = panel->IsItemFolder((int)lParam1);
- bool isDirectory2 = panel->IsItemFolder((int)lParam2);
+ bool isDir1 = panel->IsItemFolder((int)lParam1);
+ bool isDir2 = panel->IsItemFolder((int)lParam2);
- if(isDirectory1 && (!isDirectory2))
- return -1;
- if((!isDirectory1) && isDirectory2)
- return 1;
+ if (isDir1 && !isDir2) return -1;
+ if (isDir2 && !isDir1) return 1;
int result = CompareItems2(lParam1, lParam2, lpData);
return panel->_ascending ? result: (-result);
@@ -102,7 +97,7 @@ int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
/*
void CPanel::SortItems(int index)
{
- if(index == _sortIndex)
+ if (index == _sortIndex)
_ascending = !_ascending;
else
{
@@ -112,9 +107,9 @@ void CPanel::SortItems(int index)
{
case kpidSize:
case kpidPackedSize:
- case kpidCreationTime:
- case kpidLastAccessTime:
- case kpidLastWriteTime:
+ case kpidCTime:
+ case kpidATime:
+ case kpidMTime:
_ascending = false;
break;
}
@@ -131,7 +126,7 @@ void CPanel::SortItemsWithPropID(PROPID propID)
*/
void CPanel::SortItemsWithPropID(PROPID propID)
{
- if(propID == _sortID)
+ if (propID == _sortID)
_ascending = !_ascending;
else
{
@@ -140,11 +135,11 @@ void CPanel::SortItemsWithPropID(PROPID propID)
switch (propID)
{
case kpidSize:
- case kpidPackedSize:
- case kpidCreationTime:
- case kpidLastAccessTime:
- case kpidLastWriteTime:
- _ascending = false;
+ case kpidPackSize:
+ case kpidCTime:
+ case kpidATime:
+ case kpidMTime:
+ _ascending = false;
break;
}
}
diff --git a/CPP/7zip/UI/FileManager/PanelSplitFile.cpp b/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
index cbfc6c25..36146d7a 100755
--- a/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
+++ b/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
@@ -4,8 +4,8 @@
#include "resource.h"
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
}
@@ -48,7 +48,7 @@ public:
struct CVolSeqName
{
UString UnchangedPart;
- UString ChangedPart;
+ UString ChangedPart;
CVolSeqName(): ChangedPart(L"000") {};
bool ParseName(const UString &name)
@@ -69,7 +69,7 @@ struct CVolSeqName
UString GetNextName()
{
- UString newName;
+ UString newName;
int i;
int numLetters = ChangedPart.Length();
for (i = numLetters - 1; i >= 0; i--)
@@ -172,18 +172,18 @@ struct CThreadSplit
return;
}
}
- DWORD Process()
+ void Process()
{
try { Process2(); }
catch(const wchar_t *s) { Error = s; }
catch(...) { Error = L"Error"; }
ProgressDialog->MyClose();
- return 0;
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
- return ((CThreadSplit *)param)->Process();
+ ((CThreadSplit *)param)->Process();
+ return 0;
}
};
@@ -193,7 +193,7 @@ void CApp::Split()
CPanel &srcPanel = Panels[srcPanelIndex];
if (!srcPanel.IsFSFolder())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
CRecordVector<UInt32> indices;
@@ -202,13 +202,13 @@ void CApp::Split()
return;
if (indices.Size() != 1)
{
- srcPanel.MessageBox(L"Select one file");
+ srcPanel.MessageBoxErrorLang(IDS_SELECT_ONE_FILE, 0x03020A02);
return;
}
int index = indices[0];
if (srcPanel.IsItemFolder(index))
{
- srcPanel.MessageBox(L"Select one file");
+ srcPanel.MessageBoxErrorLang(IDS_SELECT_ONE_FILE, 0x03020A02);
return;
}
const UString itemName = srcPanel.GetItemName(index);
@@ -234,7 +234,7 @@ void CApp::Split()
}
if (fileInfo.Size <= splitDialog.VolumeSizes.Front())
{
- srcPanel.MessageBoxMyError(LangString(IDS_SPLIT_VOL_MUST_BE_SMALLER, 0x03020522));
+ srcPanel.MessageBoxErrorLang(IDS_SPLIT_VOL_MUST_BE_SMALLER, 0x03020522);
return;
}
const UInt64 numVolumes = GetNumberOfVolumes(fileInfo.Size, splitDialog.VolumeSizes);
@@ -242,8 +242,8 @@ void CApp::Split()
{
wchar_t s[32];
ConvertUInt64ToString(numVolumes, s);
- if (::MessageBoxW(srcPanel, MyFormatNew(IDS_SPLIT_CONFIRM_MESSAGE, 0x03020521, s),
- LangString(IDS_SPLIT_CONFIRM_TITLE, 0x03020520),
+ if (::MessageBoxW(srcPanel, MyFormatNew(IDS_SPLIT_CONFIRM_MESSAGE, 0x03020521, s),
+ LangString(IDS_SPLIT_CONFIRM_TITLE, 0x03020520),
MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL) != IDYES)
return;
}
@@ -301,117 +301,91 @@ void CApp::Split()
struct CThreadCombine
{
CProgressDialog *ProgressDialog;
+
UString InputDirPrefix;
- UString FirstVolumeName;
- UString OutputDirPrefix;
+ UStringVector Names;
+ UString OutputPath;
+ UInt64 TotalSize;
+
UString Error;
+ HRESULT Res;
void Process2()
{
- // NCOM::CComInitializer comInitializer;
- ProgressDialog->WaitCreating();
-
- CVolSeqName volSeqName;
- if (!volSeqName.ParseName(FirstVolumeName))
- throw L"Can not detect file as splitted file";
-
- UString nextName = InputDirPrefix + FirstVolumeName;
- UInt64 totalSize = 0;
- for (;;)
+ NFile::NIO::COutFile outFile;
+ if (!outFile.Create(OutputPath, false))
{
- NFile::NFind::CFileInfoW fileInfo;
- if (!NFile::NFind::FindFile(nextName, fileInfo))
- break;
- if (fileInfo.IsDirectory())
- break;
- totalSize += fileInfo.Size;
- nextName = InputDirPrefix + volSeqName.GetNextName();
+ Error = L"Can create open output file:\n" + OutputPath;
+ return;
}
- if (totalSize == 0)
- throw L"no data";
- ProgressDialog->ProgressSynch.SetProgress(totalSize, 0);
-
- if (!volSeqName.ParseName(FirstVolumeName))
- throw L"Can not detect file as splitted file";
- UString outName = volSeqName.UnchangedPart;
- while(!outName.IsEmpty())
- {
- int lastIndex = outName.Length() - 1;
- if (outName[lastIndex] != L'.')
- break;
- outName.Delete(lastIndex);
- }
- if (outName.IsEmpty())
- outName = L"file";
- NFile::NIO::COutFile outFile;
- if (!outFile.Create(OutputDirPrefix + outName, false))
- throw L"Can create open output file";
+ ProgressDialog->ProgressSynch.SetProgress(TotalSize, 0);
- NFile::NIO::CInFile inFile;
CMyBuffer bufferObject;
if (!bufferObject.Allocate(kBufSize))
throw L"Can not allocate buffer";
Byte *buffer = (Byte *)(void *)bufferObject;
UInt64 pos = 0;
- nextName = InputDirPrefix + FirstVolumeName;
- bool needOpen = true;
- for (;;)
+ for (int i = 0; i < Names.Size(); i++)
{
- if (needOpen)
+ NFile::NIO::CInFile inFile;
+ const UString nextName = InputDirPrefix + Names[i];
+ if (!inFile.Open(nextName))
{
- NFile::NFind::CFileInfoW fileInfo;
- if (!NFile::NFind::FindFile(nextName, fileInfo))
- break;
- if (fileInfo.IsDirectory())
- break;
- if (!inFile.Open(nextName))
- throw L"Can not open file";
- ProgressDialog->ProgressSynch.SetCurrentFileName(fileInfo.Name);
- nextName = InputDirPrefix + volSeqName.GetNextName();
- needOpen = false;
+ Error = L"Can not open input file:\n" + nextName;
+ return;
}
- UInt32 processedSize;
- if (!inFile.Read(buffer, kBufSize, processedSize))
- throw L"Can not read input file";
- if (processedSize == 0)
+ ProgressDialog->ProgressSynch.SetCurrentFileName(nextName);
+ for (;;)
{
- needOpen = true;
- continue;
+ UInt32 processedSize;
+ if (!inFile.Read(buffer, kBufSize, processedSize))
+ throw L"Can not read input file";
+ if (processedSize == 0)
+ break;
+ UInt32 needSize = processedSize;
+ if (!outFile.Write(buffer, needSize, processedSize) || needSize != processedSize)
+ throw L"Can not write output file";
+ pos += processedSize;
+ Res = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(pos);
+ if (Res != S_OK)
+ return;
}
- UInt32 needSize = processedSize;
- if (!outFile.Write(buffer, needSize, processedSize))
- throw L"Can not write output file";
- if (needSize != processedSize)
- throw L"Can not write output file";
- pos += processedSize;
- HRESULT res = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(pos);
- if (res != S_OK)
- return;
}
}
- DWORD Process()
+
+ void Process()
{
+ Res = S_OK;
+ ProgressDialog->WaitCreating();
try { Process2(); }
catch(const wchar_t *s) { Error = s; }
catch(...) { Error = L"Error";}
ProgressDialog->MyClose();
- return 0;
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
- return ((CThreadCombine *)param)->Process();
+ ((CThreadCombine *)param)->Process();
+ return 0;
}
};
+extern void AddValuePair2(UINT resourceID, UInt32 langID, UInt64 num, UInt64 size, UString &s);
+
+static void AddInfoFileName(const UString &name, UString &dest)
+{
+ dest += L"\n ";
+ dest += name;
+}
+
void CApp::Combine()
{
int srcPanelIndex = GetFocusedPanelIndex();
CPanel &srcPanel = Panels[srcPanelIndex];
if (!srcPanel.IsFSFolder())
{
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
+ srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
return;
}
CRecordVector<UInt32> indices;
@@ -421,7 +395,7 @@ void CApp::Combine()
int index = indices[0];
if (indices.Size() != 1 || srcPanel.IsItemFolder(index))
{
- srcPanel.MessageBox(LangString(IDS_COMBINE_SELECT_ONE_FILE, 0x03020620));
+ srcPanel.MessageBoxErrorLang(IDS_COMBINE_SELECT_ONE_FILE, 0x03020620);
return;
}
const UString itemName = srcPanel.GetItemName(index);
@@ -433,49 +407,115 @@ void CApp::Combine()
if (NumPanels > 1)
if (destPanel.IsFSFolder())
path = destPanel._currentFolderPrefix;
- CCopyDialog copyDialog;
- copyDialog.Value = path;
- copyDialog.Title = LangString(IDS_COMBINE, 0x03020600);
- copyDialog.Title += ' ';
- copyDialog.Title += srcPanel.GetItemRelPath(index);
-
- copyDialog.Static = LangString(IDS_COMBINE_TO, 0x03020601);;
- if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
- return;
+ CVolSeqName volSeqName;
+ if (!volSeqName.ParseName(itemName))
+ {
+ srcPanel.MessageBoxErrorLang(IDS_COMBINE_CANT_DETECT_SPLIT_FILE, 0x03020621);
+ return;
+ }
+
CThreadCombine combiner;
- // combiner.Panel = this;
-
+
+ UString nextName = itemName;
+ combiner.TotalSize = 0;
+ for (;;)
{
- CProgressDialog progressDialog;
- combiner.ProgressDialog = &progressDialog;
-
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
- UString title = LangString(IDS_COMBINING, 0x03020610);
-
- progressDialog.MainWindow = _window;
- progressDialog.MainTitle = progressWindowTitle;
- progressDialog.MainAddTitle = title + UString(L" ");
+ NFile::NFind::CFileInfoW fileInfo;
+ if (!NFile::NFind::FindFile(srcPath + nextName, fileInfo) || fileInfo.IsDir())
+ break;
+ combiner.Names.Add(nextName);
+ combiner.TotalSize += fileInfo.Size;
+ nextName = volSeqName.GetNextName();
+ }
+ if (combiner.Names.Size() == 1)
+ {
+ srcPanel.MessageBoxErrorLang(IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART, 0x03020622);
+ return;
+ }
+
+ if (combiner.TotalSize == 0)
+ {
+ srcPanel.MessageBoxMyError(L"No data");
+ return;
+ }
+
+ UString info;
+ AddValuePair2(IDS_FILES_COLON, 0x02000320, combiner.Names.Size(), combiner.TotalSize, info);
+
+ info += L"\n";
+ info += srcPath;
+
+ int i;
+ for (i = 0; i < combiner.Names.Size() && i < 2; i++)
+ AddInfoFileName(combiner.Names[i], info);
+ if (i != combiner.Names.Size())
+ {
+ if (i + 1 != combiner.Names.Size())
+ AddInfoFileName(L"...", info);
+ AddInfoFileName(combiner.Names.Back(), info);
+ }
+
+ {
+ CCopyDialog copyDialog;
+ copyDialog.Value = path;
+ copyDialog.Title = LangString(IDS_COMBINE, 0x03020600);
+ copyDialog.Title += ' ';
+ copyDialog.Title += srcPanel.GetItemRelPath(index);
+ copyDialog.Static = LangString(IDS_COMBINE_TO, 0x03020601);
+ copyDialog.Info = info;
+ if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
+ return;
+ path = copyDialog.Value;
+ }
- path = copyDialog.Value;
NFile::NName::NormalizeDirPathPrefix(path);
if (!NFile::NDirectory::CreateComplexDirectory(path))
{
srcPanel.MessageBoxMyError(MyFormatNew(IDS_CANNOT_CREATE_FOLDER, 0x02000603, path));
return;
}
-
- combiner.InputDirPrefix = srcPath;
- combiner.FirstVolumeName = itemName;
- combiner.OutputDirPrefix = path;
-
- // CPanel::CDisableTimerProcessing disableTimerProcessing1(srcPanel);
- // CPanel::CDisableTimerProcessing disableTimerProcessing2(destPanel);
-
- NWindows::CThread thread;
- if (thread.Create(CThreadCombine::MyThreadFunction, &combiner) != S_OK)
- throw 271824;
- progressDialog.Create(title, _window);
+
+ UString outName = volSeqName.UnchangedPart;
+ while (!outName.IsEmpty())
+ {
+ int lastIndex = outName.Length() - 1;
+ if (outName[lastIndex] != L'.')
+ break;
+ outName.Delete(lastIndex);
+ }
+ if (outName.IsEmpty())
+ outName = L"file";
+
+ NFile::NFind::CFileInfoW fileInfo;
+ UString destFilePath = path + outName;
+ combiner.OutputPath = destFilePath;
+ if (NFile::NFind::FindFile(destFilePath, fileInfo))
+ {
+ srcPanel.MessageBoxMyError(MyFormatNew(IDS_FILE_EXIST, 0x03020A04, destFilePath));
+ return;
+ }
+
+ {
+ CProgressDialog progressDialog;
+ combiner.ProgressDialog = &progressDialog;
+
+ UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
+ UString title = LangString(IDS_COMBINING, 0x03020610);
+
+ progressDialog.MainWindow = _window;
+ progressDialog.MainTitle = progressWindowTitle;
+ progressDialog.MainAddTitle = title + UString(L" ");
+
+ combiner.InputDirPrefix = srcPath;
+
+ // CPanel::CDisableTimerProcessing disableTimerProcessing1(srcPanel);
+ // CPanel::CDisableTimerProcessing disableTimerProcessing2(destPanel);
+
+ NWindows::CThread thread;
+ if (thread.Create(CThreadCombine::MyThreadFunction, &combiner) != S_OK)
+ throw 271824;
+ progressDialog.Create(title, _window);
}
RefreshTitleAlways();
diff --git a/CPP/7zip/UI/FileManager/PasswordDialog.cpp b/CPP/7zip/UI/FileManager/PasswordDialog.cpp
index a366a61e..94e8219d 100755
--- a/CPP/7zip/UI/FileManager/PasswordDialog.cpp
+++ b/CPP/7zip/UI/FileManager/PasswordDialog.cpp
@@ -3,12 +3,12 @@
#include "StdAfx.h"
#include "PasswordDialog.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_PASSWORD_HEADER, 0x02000B01 },
{ IDC_CHECK_PASSWORD_SHOW, 0x02000B02 },
@@ -17,9 +17,9 @@ static CIDLangPair kIDLangPairs[] =
#endif
-bool CPasswordDialog::OnInit()
+bool CPasswordDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x02000B00);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp b/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp
index d611e096..eb6674b3 100755
--- a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp
+++ b/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp
@@ -2,8 +2,8 @@
#include "StdAfx.h"
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
}
@@ -18,7 +18,7 @@ using namespace NWindows;
static const UInt32 kBufferSize = (4 << 20);
-static STATPROPSTG kProperties[] =
+static STATPROPSTG kProperties[] =
{
{ NULL, kpidName, VT_BSTR},
{ NULL, kpidSize, VT_UI8}
@@ -56,22 +56,16 @@ STDMETHODIMP CPhysDriveFolder::GetNumberOfItems(UInt32 *numItems)
STDMETHODIMP CPhysDriveFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (itemIndex >= 1)
return E_INVALIDARG;
switch(propID)
{
- case kpidIsFolder:
- propVariant = false;
- break;
- case kpidName:
- propVariant = _name;
- break;
- case kpidSize:
- propVariant = _length;
- break;
+ case kpidIsDir: prop = false; break;
+ case kpidName: prop = _name; break;
+ case kpidSize: prop = _length; break;
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
@@ -93,7 +87,7 @@ STDMETHODIMP CPhysDriveFolder::GetNumberOfProperties(UInt32 *numProperties)
return S_OK;
}
-STDMETHODIMP CPhysDriveFolder::GetPropertyInfo(UInt32 index,
+STDMETHODIMP CPhysDriveFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -136,13 +130,13 @@ STDMETHODIMP CPhysDriveFolder::Clone(IFolderFolder **resultFolder)
STDMETHODIMP CPhysDriveFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress * /* progress */)
{
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
if (index >= 1)
return E_INVALIDARG;
UInt64 size = 0;
HRESULT result = GetLength(size);
- propVariant = size;
- propVariant.Detach(value);
+ prop = size;
+ prop.Detach(value);
return result;
}
@@ -235,7 +229,7 @@ HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64
return S_OK;
}
-STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numItems,
+STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
if (numItems == 0)
@@ -260,7 +254,7 @@ STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numIt
Int32 writeAskResult;
CMyComBSTR destPathResult;
- RINOK(callback->AskWrite(GetFullPath(), BoolToInt(false), NULL, &fileSize,
+ RINOK(callback->AskWrite(GetFullPath(), BoolToInt(false), NULL, &fileSize,
destPath, &destPathResult, &writeAskResult));
if (!IntToBool(writeAskResult))
return S_OK;
@@ -275,8 +269,8 @@ STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numIt
// Move Operations
STDMETHODIMP CPhysDriveFolder::MoveTo(
- const UInt32 * /* indices */,
- UInt32 /* numItems */,
+ const UInt32 * /* indices */,
+ UInt32 /* numItems */,
const wchar_t * /* path */,
IFolderOperationsExtractCallback * /* callback */)
{
diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.h b/CPP/7zip/UI/FileManager/PhysDriveFolder.h
index 996dda13..1f327966 100755
--- a/CPP/7zip/UI/FileManager/PhysDriveFolder.h
+++ b/CPP/7zip/UI/FileManager/PhysDriveFolder.h
@@ -1,14 +1,14 @@
// PhysDriveFolder.h
-#ifndef __PHYSDRIVEFOLDER_H
-#define __PHYSDRIVEFOLDER_H
+#ifndef __PHYSDRIVEFOLDER_H
+#define __PHYSDRIVEFOLDER_H
#include "Common/MyString.h"
#include "Common/MyCom.h"
#include "IFolder.h"
-class CPhysDriveFolder:
+class CPhysDriveFolder:
public IFolderFolder,
public IFolderWasChanged,
public IFolderOperations,
diff --git a/CPP/7zip/UI/FileManager/PluginInterface.h b/CPP/7zip/UI/FileManager/PluginInterface.h
index 7bef6950..905aff9a 100755
--- a/CPP/7zip/UI/FileManager/PluginInterface.h
+++ b/CPP/7zip/UI/FileManager/PluginInterface.h
@@ -6,36 +6,36 @@
#include "Common/MyString.h"
// {23170F69-40C1-278D-0000-000100010000}
-DEFINE_GUID(IID_IInitContextMenu,
+DEFINE_GUID(IID_IInitContextMenu,
0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278D-0000-000100010000")
IInitContextMenu: public IUnknown
{
public:
- STDMETHOD(InitContextMenu)(const wchar_t *aFolder, const wchar_t **aNames, UINT32 aNumFiles) PURE;
+ STDMETHOD(InitContextMenu)(const wchar_t *aFolder, const wchar_t **aNames, UINT32 aNumFiles) PURE;
};
// {23170F69-40C1-278D-0000-000100020100}
-DEFINE_GUID(IID_IPluginOptionsCallback,
+DEFINE_GUID(IID_IPluginOptionsCallback,
0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278D-0000-000100020000")
IPluginOptionsCallback: public IUnknown
{
public:
- STDMETHOD(GetProgramFolderPath)(BSTR *value) PURE;
- STDMETHOD(GetProgramPath)(BSTR *value) PURE;
- STDMETHOD(GetRegistryCUPath)(BSTR *value) PURE;
+ STDMETHOD(GetProgramFolderPath)(BSTR *value) PURE;
+ STDMETHOD(GetProgramPath)(BSTR *value) PURE;
+ STDMETHOD(GetRegistryCUPath)(BSTR *value) PURE;
};
// {23170F69-40C1-278D-0000-000100020000}
-DEFINE_GUID(IID_IPluginOptions,
+DEFINE_GUID(IID_IPluginOptions,
0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278D-0000-000100020000")
IPluginOptions: public IUnknown
{
public:
- STDMETHOD(PluginOptions)(HWND hWnd, IPluginOptionsCallback *callback) PURE;
+ STDMETHOD(PluginOptions)(HWND hWnd, IPluginOptionsCallback *callback) PURE;
// STDMETHOD(GetFileExtensions)(BSTR *extensions) PURE;
};
diff --git a/CPP/7zip/UI/FileManager/PluginLoader.h b/CPP/7zip/UI/FileManager/PluginLoader.h
index 598a874b..f48c9e97 100755
--- a/CPP/7zip/UI/FileManager/PluginLoader.h
+++ b/CPP/7zip/UI/FileManager/PluginLoader.h
@@ -6,11 +6,11 @@
#include "Windows/DLL.h"
typedef UINT32 (WINAPI * CreateObjectPointer)(
- const GUID *clsID,
- const GUID *interfaceID,
+ const GUID *clsID,
+ const GUID *interfaceID,
void **outObject);
-class CPluginLibrary: public NWindows::NDLL::CLibrary
+class CPluginLibrary: public NWindows::NDLL::CLibrary
{
public:
HRESULT CreateManager(REFGUID clsID, IFolderManager **manager)
diff --git a/CPP/7zip/UI/FileManager/PluginsPage.cpp b/CPP/7zip/UI/FileManager/PluginsPage.cpp
index 3be15b18..3b205ce3 100755
--- a/CPP/7zip/UI/FileManager/PluginsPage.cpp
+++ b/CPP/7zip/UI/FileManager/PluginsPage.cpp
@@ -19,7 +19,7 @@
#include "PluginInterface.h"
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_PLUGINS_STATIC_PLUGINS, 0x03010101},
{ IDC_PLUGINS_BUTTON_OPTIONS, 0x03010110}
@@ -36,14 +36,7 @@ bool CPluginsPage::OnInit()
UINT32 newFlags = /*LVS_EX_CHECKBOXES | */ LVS_EX_FULLROWSELECT;
_listView.SetExtendedListViewStyle(newFlags, newFlags);
- UString title = L"Plugins";
- LVCOLUMNW column;
- column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
- column.cx = 160;
- column.fmt = LVCFMT_LEFT;
- column.pszText = (LPWSTR)(LPCWSTR)title;
- column.iSubItem = 0;
- _listView.InsertColumn(0, &column);
+ _listView.InsertColumn(0, L"Plugins", 160);
ReadFileFolderPluginInfoList(_plugins);
@@ -104,7 +97,7 @@ bool CPluginsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
return true;
}
-class CPluginOptionsCallback:
+class CPluginOptionsCallback:
public IPluginOptionsCallback,
public CMyUnknownImp
{
@@ -112,9 +105,9 @@ class CPluginOptionsCallback:
public:
MY_UNKNOWN_IMP
- STDMETHOD(GetProgramFolderPath)(BSTR *value);
- STDMETHOD(GetProgramPath)(BSTR *Value);
- STDMETHOD(GetRegistryCUPath)(BSTR *Value);
+ STDMETHOD(GetProgramFolderPath)(BSTR *value);
+ STDMETHOD(GetProgramPath)(BSTR *Value);
+ STDMETHOD(GetRegistryCUPath)(BSTR *Value);
void Init(const UString &pluginName)
{ _pluginName = pluginName; }
};
@@ -192,8 +185,8 @@ void CPluginsPage::OnButtonOptions()
pluginOptions->PluginOptions(HWND(*this), callback);
}
-bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
-{
+bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
+{
if (lParam->hwndFrom == HWND(_listView) && lParam->code == LVN_ITEMCHANGED)
{
const NMLISTVIEW *aNMListView = (const NMLISTVIEW *)lParam;
@@ -206,7 +199,7 @@ bool CPluginsPage::OnNotify(UINT controlID, LPNMHDR lParam)
}
return true;
}
- return CPropertyPage::OnNotify(controlID, lParam);
+ return CPropertyPage::OnNotify(controlID, lParam);
}
/*
diff --git a/CPP/7zip/UI/FileManager/PluginsPage.rc b/CPP/7zip/UI/FileManager/PluginsPage.rc
index 5a1f48ec..b4868aa3 100755
--- a/CPP/7zip/UI/FileManager/PluginsPage.rc
+++ b/CPP/7zip/UI/FileManager/PluginsPage.rc
@@ -12,8 +12,8 @@ CAPTION "Plugins"
MY_FONT
BEGIN
LTEXT "&Plugins:", IDC_PLUGINS_STATIC_PLUGINS, marg, marg, xSize2, 8
- CONTROL "List1", IDC_PLUGINS_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
- LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
+ CONTROL "List1", IDC_PLUGINS_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS |
+ LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
marg, 20, xSize2 - bXSize - 12, ySize2 - 12
PUSHBUTTON "Options...", IDC_PLUGINS_BUTTON_OPTIONS, (xSize - marg - bXSize), 20, bXSize, bYSize
END
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog.cpp b/CPP/7zip/UI/FileManager/ProgressDialog.cpp
index b185868b..5be77a8f 100755
--- a/CPP/7zip/UI/FileManager/ProgressDialog.cpp
+++ b/CPP/7zip/UI/FileManager/ProgressDialog.cpp
@@ -11,17 +11,30 @@ using namespace NWindows;
static const UINT_PTR kTimerID = 3;
static const UINT kTimerElapse = 50;
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDCANCEL, 0x02000711 }
};
#endif
+HRESULT CProgressSynch::ProcessStopAndPause()
+{
+ for (;;)
+ {
+ if (GetStopped())
+ return E_ABORT;
+ if (!GetPaused())
+ break;
+ ::Sleep(100);
+ }
+ return S_OK;
+}
+
#ifndef _SFX
CProgressDialog::~CProgressDialog()
{
@@ -36,12 +49,12 @@ void CProgressDialog::AddToTitle(LPCWSTR s)
-bool CProgressDialog::OnInit()
+bool CProgressDialog::OnInit()
{
_range = UINT64(-1);
_prevPercentValue = -1;
- #ifdef LANG
+ #ifdef LANG
// LangSetWindowText(HWND(*this), 0x02000C00);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
@@ -53,7 +66,7 @@ bool CProgressDialog::OnInit()
return CModalDialog::OnInit();
}
-void CProgressDialog::OnCancel()
+void CProgressDialog::OnCancel()
{
ProgressSynch.SetStopped(true);
}
@@ -96,7 +109,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
total = 1;
int percentValue = (int)(completed * 100 / total);
- if (percentValue != _prevPercentValue)
+ if (percentValue != _prevPercentValue)
{
wchar_t s[64];
ConvertUInt64ToString(percentValue, s);
@@ -154,16 +167,16 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return CModalDialog::OnMessage(message, wParam, lParam);
}
-bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
switch(buttonID)
{
case IDCANCEL:
{
bool paused = ProgressSynch.GetPaused();;
ProgressSynch.SetPaused(true);
- int res = ::MessageBoxW(HWND(*this),
- L"Are you sure you want to cancel?",
+ int res = ::MessageBoxW(HWND(*this),
+ L"Are you sure you want to cancel?",
_title, MB_YESNOCANCEL);
ProgressSynch.SetPaused(paused);
if (res == IDCANCEL || res == IDNO)
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog.h b/CPP/7zip/UI/FileManager/ProgressDialog.h
index 0ef2dc99..201aead7 100755
--- a/CPP/7zip/UI/FileManager/ProgressDialog.h
+++ b/CPP/7zip/UI/FileManager/ProgressDialog.h
@@ -19,6 +19,7 @@ class CProgressSynch
public:
CProgressSynch(): _stopped(false), _paused(false), _total(1), _completed(0) {}
+ HRESULT ProcessStopAndPause();
bool GetStopped()
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
@@ -103,7 +104,7 @@ public:
CProgressDialog(): _timer(0)
#ifndef _SFX
- ,MainWindow(0)
+ ,MainWindow(0)
#endif
{
if (_dialogCreatedEvent.Create() != S_OK)
@@ -114,9 +115,9 @@ public:
INT_PTR Create(const UString &title, HWND wndParent = 0)
- {
+ {
_title = title;
- return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
+ return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
}
static const UINT kCloseMessage;
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
index ae4752ef..0e24f187 100755
--- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
+++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
@@ -10,12 +10,12 @@ using namespace NWindows;
static const UINT_PTR kTimerID = 3;
static const UINT kTimerElapse = 100;
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDCANCEL, 0x02000C00 },
{ IDC_PROGRESS_ELAPSED, 0x02000C01 },
@@ -33,16 +33,22 @@ static CIDLangPair kIDLangPairs[] =
};
#endif
-HRESULT CProgressSynch::SetPosAndCheckPaused(UInt64 completed)
+HRESULT CProgressSynch::ProcessStopAndPause()
{
for (;;)
{
- if(GetStopped())
+ if (GetStopped())
return E_ABORT;
- if(!GetPaused())
+ if (!GetPaused())
break;
::Sleep(100);
}
+ return S_OK;
+}
+
+HRESULT CProgressSynch::SetPosAndCheckPaused(UInt64 completed)
+{
+ RINOK(ProcessStopAndPause());
SetPos(completed);
return S_OK;
}
@@ -62,7 +68,7 @@ void CProgressDialog::AddToTitle(LPCWSTR s)
}
static const int kTitleFileNameSizeLimit = 36;
-static const int kCurrentFileNameSizeLimit = 68;
+static const int kCurrentFileNameSizeLimit = 70;
static void ReduceString(UString &s, int size)
{
@@ -71,7 +77,7 @@ static void ReduceString(UString &s, int size)
}
#endif
-bool CProgressDialog::OnInit()
+bool CProgressDialog::OnInit()
{
_range = (UInt64)(Int64)(-1);
_prevPercentValue = UInt32(-1);
@@ -83,7 +89,7 @@ bool CProgressDialog::OnInit()
_elapsedTime = 0;
_foreground = true;
- #ifdef LANG
+ #ifdef LANG
// LangSetWindowText(HWND(*this), 0x02000C00);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
@@ -110,7 +116,7 @@ bool CProgressDialog::OnInit()
return CModalDialog::OnInit();
}
-void CProgressDialog::OnCancel()
+void CProgressDialog::OnCancel()
{
ProgressSynch.SetStopped(true);
}
@@ -161,9 +167,9 @@ void CProgressDialog::SetPos(UInt64 pos)
static void GetTimeString(UInt64 timeValue, TCHAR *s)
{
- wsprintf(s, TEXT("%02d:%02d:%02d"),
+ wsprintf(s, TEXT("%02d:%02d:%02d"),
UInt32(timeValue / 3600),
- UInt32((timeValue / 60) % 60),
+ UInt32((timeValue / 60) % 60),
UInt32(timeValue % 60));
}
@@ -235,7 +241,8 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
}
// if (elapsedChanged)
{
- UInt64 speedB = (completed * 1000) / _elapsedTime;
+ UInt32 elapsedTime = (_elapsedTime == 0) ? 1 : _elapsedTime;
+ UInt64 speedB = (completed * 1000) / elapsedTime;
UInt64 speedKB = speedB / 1024;
UInt64 speedMB = speedKB / 1024;
const UInt32 kLimit1 = 10;
@@ -263,7 +270,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
needRedraw = true;
}
}
- else
+ else
{
if (_prevMode != kSpeedBytes || speedB != _prevSpeed)
{
@@ -284,7 +291,7 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
UInt32 percentValue = (UInt32)(completed * 100 / total);
UString titleName;
ProgressSynch.GetTitleFileName(titleName);
- if (percentValue != _prevPercentValue || _prevTitleName != titleName)
+ if (percentValue != _prevPercentValue || _prevTitleName != titleName)
{
_prevPercentValue = percentValue;
SetTitleText();
@@ -329,8 +336,19 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
ProgressSynch.GetCurrentFileName(fileName);
if (_prevFileName != fileName)
{
- ReduceString(fileName, kCurrentFileNameSizeLimit);
- SetItemText(IDC_PROGRESS_FILE_NAME, fileName);
+ int slashPos = fileName.ReverseFind(L'\\');
+ UString s1, s2;
+ if (slashPos >= 0)
+ {
+ s1 = fileName.Left(slashPos + 1);
+ s2 = fileName.Mid(slashPos + 1);
+ }
+ else
+ s2 = fileName;
+ ReduceString(s1, kCurrentFileNameSizeLimit);
+ ReduceString(s2, kCurrentFileNameSizeLimit);
+ UString s = s1 + L"\n" + s2;
+ SetItemText(IDC_PROGRESS_FILE_NAME, s);
_prevFileName == fileName;
}
@@ -418,7 +436,7 @@ void CProgressDialog::SetTitleText()
void CProgressDialog::SetPauseText()
{
- SetItemText(IDC_BUTTON_PAUSE, ProgressSynch.GetPaused() ?
+ SetItemText(IDC_BUTTON_PAUSE, ProgressSynch.GetPaused() ?
continueString : pauseString);
SetTitleText();
}
@@ -436,8 +454,8 @@ void CProgressDialog::OnPauseButton()
void CProgressDialog::SetPriorityText()
{
- SetItemText(IDC_BUTTON_PROGRESS_PRIORITY, _foreground ?
- backgroundString :
+ SetItemText(IDC_BUTTON_PROGRESS_PRIORITY, _foreground ?
+ backgroundString :
foregroundString);
SetTitleText();
}
@@ -450,8 +468,8 @@ void CProgressDialog::OnPriorityButton()
SetPriorityText();
}
-bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
switch(buttonID)
{
case IDCANCEL:
@@ -460,8 +478,8 @@ bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
// ProgressSynch.SetPaused(true);
if (!paused)
OnPauseButton();
- int res = ::MessageBoxW(HWND(*this),
- LangString(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
+ int res = ::MessageBoxW(HWND(*this),
+ LangString(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
_title, MB_YESNOCANCEL);
// ProgressSynch.SetPaused(paused);
if (!paused)
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.h b/CPP/7zip/UI/FileManager/ProgressDialog2.h
index 9acaf9de..e838ae25 100755
--- a/CPP/7zip/UI/FileManager/ProgressDialog2.h
+++ b/CPP/7zip/UI/FileManager/ProgressDialog2.h
@@ -25,11 +25,11 @@ class CProgressSynch
UString TitleFileName;
UString CurrentFileName;
public:
- CProgressSynch():
- _stopped(false), _paused(false),
- _total((UInt64)(Int64)-1),
+ CProgressSynch():
+ _stopped(false), _paused(false),
+ _total((UInt64)(Int64)-1),
_completed(0),
- _totalFiles((UInt64)(Int64)-1),
+ _totalFiles((UInt64)(Int64)-1),
_completedFiles(0),
_inSize((UInt64)(Int64)-1),
_outSize((UInt64)(Int64)-1)
@@ -84,9 +84,10 @@ public:
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
_completedFiles = value;
}
+ HRESULT ProcessStopAndPause();
HRESULT SetPosAndCheckPaused(UInt64 completed);
- void GetProgress(UInt64 &total, UInt64 &completed,
- UInt64 &totalFiles, UInt64 &completedFiles,
+ void GetProgress(UInt64 &total, UInt64 &completed,
+ UInt64 &totalFiles, UInt64 &completedFiles,
UInt64 &inSize, UInt64 &outSize)
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
@@ -211,9 +212,9 @@ public:
INT_PTR Create(const UString &title, HWND wndParent = 0)
- {
+ {
_title = title;
- return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
+ return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
}
static const UINT kCloseMessage;
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.rc b/CPP/7zip/UI/FileManager/ProgressDialog2.rc
index 58cdec36..92b970f6 100755
--- a/CPP/7zip/UI/FileManager/ProgressDialog2.rc
+++ b/CPP/7zip/UI/FileManager/ProgressDialog2.rc
@@ -2,7 +2,7 @@
#include "../../GuiCommon.rc"
#define xSize2 320
-#define ySize2 98
+#define ySize2 110
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
@@ -36,7 +36,7 @@
#define y3 (y2 + 11)
-IDD_DIALOG_PROGRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
+IDD_DIALOG_PROGRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
CAPTION "Progress"
MY_FONT
BEGIN
@@ -63,12 +63,12 @@ BEGIN
RTEXT "", IDC_PROGRESS_UNPACKED_VALUE, x3, y2, x3Size, 8
RTEXT "", IDC_PROGRESS_PACKED_VALUE, x3, y3, x3Size, 8
- LTEXT "", IDC_PROGRESS_FILE_NAME, marg, bYPos - 30, xSize2, 8, SS_NOPREFIX
+ LTEXT "", IDC_PROGRESS_FILE_NAME, marg, bYPos - 42, xSize2, 21, SS_NOPREFIX | SS_LEFTNOWORDWRAP
CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER, marg, bYPos - 20, xSize2, 13
END
-STRINGTABLE DISCARDABLE
+STRINGTABLE DISCARDABLE
BEGIN
IDS_PROGRESS_PAUSED "Paused"
IDS_PROGRESS_FOREGROUND "&Foreground"
diff --git a/CPP/7zip/UI/FileManager/PropertyName.cpp b/CPP/7zip/UI/FileManager/PropertyName.cpp
index fb8f707e..cb4edfc2 100755
--- a/CPP/7zip/UI/FileManager/PropertyName.cpp
+++ b/CPP/7zip/UI/FileManager/PropertyName.cpp
@@ -2,32 +2,35 @@
#include "StdAfx.h"
-#include "../../PropID.h"
+#include "Common/IntToString.h"
#include "Windows/ResourceString.h"
+
+#include "../../PropID.h"
+
#include "resource.h"
-#include "PropertyName.h"
#include "PropertyNameRes.h"
#include "LangUtils.h"
+#include "PropertyName.h"
struct CPropertyIDNamePair
{
PROPID PropID;
UINT ResourceID;
- UINT LangID;
+ UInt32 LangID;
};
-static CPropertyIDNamePair kPropertyIDNamePairs[] =
+static CPropertyIDNamePair kPropertyIDNamePairs[] =
{
{ kpidPath, IDS_PROPERTY_PATH, 0x02000203 },
{ kpidName, IDS_PROPERTY_NAME, 0x02000204 },
- // { kpidExtension, L"Extension" },
- { kpidIsFolder, IDS_PROPERTY_IS_FOLDER, 0x02000206},
+ { kpidExtension, IDS_PROPERTY_EXTENSION, 0x02000205 },
+ { kpidIsDir, IDS_PROPERTY_IS_FOLDER, 0x02000206},
{ kpidSize, IDS_PROPERTY_SIZE, 0x02000207},
- { kpidPackedSize, IDS_PROPERTY_PACKED_SIZE, 0x02000208 },
- { kpidAttributes, IDS_PROPERTY_ATTRIBUTES, 0x02000209 },
- { kpidCreationTime, IDS_PROPERTY_CREATION_TIME, 0x0200020A },
- { kpidLastAccessTime, IDS_PROPERTY_LAST_ACCESS_TIME, 0x0200020B },
- { kpidLastWriteTime, IDS_PROPERTY_LAST_WRITE_TIME, 0x0200020C },
+ { kpidPackSize, IDS_PROPERTY_PACKED_SIZE, 0x02000208 },
+ { kpidAttrib, IDS_PROPERTY_ATTRIBUTES, 0x02000209 },
+ { kpidCTime, IDS_PROPERTY_CTIME, 0x0200020A },
+ { kpidATime, IDS_PROPERTY_ATIME, 0x0200020B },
+ { kpidMTime, IDS_PROPERTY_MTIME, 0x0200020C },
{ kpidSolid, IDS_PROPERTY_SOLID, 0x0200020D },
{ kpidCommented, IDS_PROPERTY_C0MMENTED, 0x0200020E },
{ kpidEncrypted, IDS_PROPERTY_ENCRYPTED, 0x0200020F },
@@ -46,7 +49,7 @@ static CPropertyIDNamePair kPropertyIDNamePairs[] =
{ kpidComment, IDS_PROPERTY_COMMENT, 0x0200021C },
{ kpidPosition, IDS_PROPERTY_POSITION, 0x0200021D },
{ kpidPrefix, IDS_PROPERTY_PREFIX, 0x0200021E },
- { kpidNumSubFolders, IDS_PROPERTY_FOLDERS, 0x0200021F },
+ { kpidNumSubDirs, IDS_PROPERTY_FOLDERS, 0x0200021F },
{ kpidNumSubFiles, IDS_PROPERTY_FILES, 0x02000220 },
{ kpidUnpackVer, IDS_PROPERTY_VERSION, 0x02000221},
{ kpidVolume, IDS_PROPERTY_VOLUME, 0x02000222},
@@ -56,8 +59,17 @@ static CPropertyIDNamePair kPropertyIDNamePairs[] =
{ kpidNumBlocks, IDS_PROPERTY_NUM_BLOCKS, 0x02000226},
{ kpidNumVolumes, IDS_PROPERTY_NUM_VOLUMES, 0x02000227},
+ { kpidBit64, IDS_PROPERTY_BIT64, 0x02000229},
+ { kpidBigEndian, IDS_PROPERTY_BIG_ENDIAN, 0x0200022A},
+ { kpidCpu, IDS_PROPERTY_CPU, 0x0200022B},
+ { kpidPhySize, IDS_PROPERTY_PHY_SIZE, 0x0200022C},
+ { kpidHeadersSize, IDS_PROPERTY_HEADERS_SIZE, 0x0200022D},
+ { kpidChecksum, IDS_PROPERTY_CHECKSUM, 0x0200022E},
+ { kpidCharacts, IDS_PROPERTY_CHARACTS, 0x0200022F},
+ { kpidVa, IDS_PROPERTY_VA, 0x02000230},
+
{ kpidTotalSize, IDS_PROPERTY_TOTAL_SIZE, 0x03031100 },
- { kpidFreeSpace, IDS_PROPERTY_FREE_SPACE, 0x03031101 },
+ { kpidFreeSpace, IDS_PROPERTY_FREE_SPACE, 0x03031101 },
{ kpidClusterSize, IDS_PROPERTY_CLUSTER_SIZE, 0x03031102},
{ kpidVolumeName, IDS_PROPERTY_VOLUME_NAME, 0x03031103 },
@@ -68,16 +80,22 @@ static CPropertyIDNamePair kPropertyIDNamePairs[] =
int FindProperty(PROPID propID)
{
for (int i = 0; i < sizeof(kPropertyIDNamePairs) / sizeof(kPropertyIDNamePairs[0]); i++)
- if(kPropertyIDNamePairs[i].PropID == propID)
+ if (kPropertyIDNamePairs[i].PropID == propID)
return i;
return -1;
}
-UString GetNameOfProperty(PROPID propID)
+UString GetNameOfProperty(PROPID propID, const wchar_t *name)
{
int index = FindProperty(propID);
if (index < 0)
- return UString();
+ {
+ if (name)
+ return name;
+ wchar_t s[32];
+ ConvertUInt64ToString(propID, s);
+ return s;
+ }
const CPropertyIDNamePair &pair = kPropertyIDNamePairs[index];
return LangString(pair.ResourceID, pair.LangID);
}
diff --git a/CPP/7zip/UI/FileManager/PropertyName.h b/CPP/7zip/UI/FileManager/PropertyName.h
index 413d2343..95e9dc9b 100755
--- a/CPP/7zip/UI/FileManager/PropertyName.h
+++ b/CPP/7zip/UI/FileManager/PropertyName.h
@@ -5,6 +5,6 @@
#include "Common/MyString.h"
-UString GetNameOfProperty(PROPID propID);
+UString GetNameOfProperty(PROPID propID, const wchar_t *name);
#endif
diff --git a/CPP/7zip/UI/FileManager/PropertyName.rc b/CPP/7zip/UI/FileManager/PropertyName.rc
index 94171ee3..ad8a9012 100755
--- a/CPP/7zip/UI/FileManager/PropertyName.rc
+++ b/CPP/7zip/UI/FileManager/PropertyName.rc
@@ -11,9 +11,9 @@ BEGIN
IDS_PROPERTY_SIZE "Size"
IDS_PROPERTY_PACKED_SIZE "Packed Size"
IDS_PROPERTY_ATTRIBUTES "Attributes"
- IDS_PROPERTY_CREATION_TIME "Created"
- IDS_PROPERTY_LAST_ACCESS_TIME "Accessed"
- IDS_PROPERTY_LAST_WRITE_TIME "Modified"
+ IDS_PROPERTY_CTIME "Created"
+ IDS_PROPERTY_ATIME "Accessed"
+ IDS_PROPERTY_MTIME "Modified"
IDS_PROPERTY_SOLID "Solid"
IDS_PROPERTY_C0MMENTED "Commented"
IDS_PROPERTY_ENCRYPTED "Encrypted"
@@ -42,4 +42,12 @@ BEGIN
IDS_PROPERTY_NUM_BLOCKS "Blocks"
IDS_PROPERTY_NUM_VOLUMES "Volumes"
+ IDS_PROPERTY_BIT64 "64-bit"
+ IDS_PROPERTY_BIG_ENDIAN "Big-endian"
+ IDS_PROPERTY_CPU "CPU"
+ IDS_PROPERTY_PHY_SIZE "Physical Size"
+ IDS_PROPERTY_HEADERS_SIZE "Headers Size"
+ IDS_PROPERTY_CHECKSUM "Checksum"
+ IDS_PROPERTY_CHARACTS "Characteristics"
+ IDS_PROPERTY_VA "Va"
END
diff --git a/CPP/7zip/UI/FileManager/PropertyNameRes.h b/CPP/7zip/UI/FileManager/PropertyNameRes.h
index 80c9637f..74d535ac 100755
--- a/CPP/7zip/UI/FileManager/PropertyNameRes.h
+++ b/CPP/7zip/UI/FileManager/PropertyNameRes.h
@@ -5,9 +5,9 @@
#define IDS_PROPERTY_SIZE 7
#define IDS_PROPERTY_PACKED_SIZE 8
#define IDS_PROPERTY_ATTRIBUTES 9
-#define IDS_PROPERTY_CREATION_TIME 10
-#define IDS_PROPERTY_LAST_ACCESS_TIME 11
-#define IDS_PROPERTY_LAST_WRITE_TIME 12
+#define IDS_PROPERTY_CTIME 10
+#define IDS_PROPERTY_ATIME 11
+#define IDS_PROPERTY_MTIME 12
#define IDS_PROPERTY_SOLID 13
#define IDS_PROPERTY_C0MMENTED 14
#define IDS_PROPERTY_ENCRYPTED 15
@@ -35,3 +35,12 @@
#define IDS_PROPERTY_LINKS 37
#define IDS_PROPERTY_NUM_BLOCKS 38
#define IDS_PROPERTY_NUM_VOLUMES 39
+
+#define IDS_PROPERTY_BIT64 41
+#define IDS_PROPERTY_BIG_ENDIAN 42
+#define IDS_PROPERTY_CPU 43
+#define IDS_PROPERTY_PHY_SIZE 44
+#define IDS_PROPERTY_HEADERS_SIZE 45
+#define IDS_PROPERTY_CHECKSUM 46
+#define IDS_PROPERTY_CHARACTS 47
+#define IDS_PROPERTY_VA 48
diff --git a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
index a03762ef..72153f9d 100755
--- a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
+++ b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
@@ -37,7 +37,7 @@ bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo)
{
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey key;
- if(key.Open(HKEY_CURRENT_USER, GetAssociationsPath() + CSysString('\\') +
+ if(key.Open(HKEY_CURRENT_USER, GetAssociationsPath() + CSysString('\\') +
CSysString(GetSystemString(ext)), KEY_READ) != ERROR_SUCCESS)
return false;
UString pluginsString;
@@ -94,7 +94,7 @@ void WriteInternalAssociations(const CObjectVector<CExtInfo> &items)
}
///////////////////////////////////
-// External
+// External
static const TCHAR *kShellNewKeyName = TEXT("ShellNew");
static const TCHAR *kShellNewDataValueName = TEXT("Data");
@@ -187,8 +187,8 @@ void DeleteShellExtensionInfo(const CSysString &extension)
}
void AddShellExtensionInfo(const CSysString &extension,
- const UString &programTitle,
- const UString &programOpenCommand,
+ const UString &programTitle,
+ const UString &programOpenCommand,
const UString &iconPath, int iconIndex,
const void *shellNewData, int shellNewDataSize)
{
@@ -243,7 +243,7 @@ void AddShellExtensionInfo(const CSysString &extension,
/*
static const TCHAR *kContextMenuKeyName = TEXT("\\shellex\\ContextMenuHandlers\\7-ZIP");
-static const TCHAR *kContextMenuHandlerCLASSIDValue =
+static const TCHAR *kContextMenuHandlerCLASSIDValue =
TEXT("{23170F69-40C1-278A-1000-000100020000}");
static const TCHAR *kRootKeyNameForFile = TEXT("*");
static const TCHAR *kRootKeyNameForFolder = TEXT("Folder");
@@ -265,7 +265,7 @@ static bool CheckContextMenuHandlerCommon(const CSysString &aKeyName)
}
bool CheckContextMenuHandler()
-{
+{
return CheckContextMenuHandlerCommon(kRootKeyNameForFile) &&
CheckContextMenuHandlerCommon(kRootKeyNameForFolder);
}
@@ -279,8 +279,8 @@ static void DeleteContextMenuHandlerCommon(const CSysString &aKeyName)
}
void DeleteContextMenuHandler()
-{
- DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
+{
+ DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
DeleteContextMenuHandlerCommon(kRootKeyNameForFolder);
}
@@ -294,8 +294,8 @@ static void AddContextMenuHandlerCommon(const CSysString &aKeyName)
}
void AddContextMenuHandler()
-{
- AddContextMenuHandlerCommon(kRootKeyNameForFile);
+{
+ AddContextMenuHandlerCommon(kRootKeyNameForFile);
AddContextMenuHandlerCommon(kRootKeyNameForFolder);
}
*/
diff --git a/CPP/7zip/UI/FileManager/RegistryAssociations.h b/CPP/7zip/UI/FileManager/RegistryAssociations.h
index c1a64c96..2516fd2b 100755
--- a/CPP/7zip/UI/FileManager/RegistryAssociations.h
+++ b/CPP/7zip/UI/FileManager/RegistryAssociations.h
@@ -19,12 +19,12 @@ namespace NRegistryAssociations {
bool CheckShellExtensionInfo(const CSysString &extension, UString &iconPath, int &iconIndex);
- // void ReadCompressionInfo(NZipSettings::NCompression::CInfo &anInfo,
+ // void ReadCompressionInfo(NZipSettings::NCompression::CInfo &anInfo,
void DeleteShellExtensionInfo(const CSysString &extension);
void AddShellExtensionInfo(const CSysString &extension,
- const UString &programTitle,
- const UString &programOpenCommand,
+ const UString &programTitle,
+ const UString &programOpenCommand,
const UString &iconPath, int iconIndex,
const void *shellNewData, int shellNewDataSize);
diff --git a/CPP/7zip/UI/FileManager/RegistryPlugins.cpp b/CPP/7zip/UI/FileManager/RegistryPlugins.cpp
index 771166ca..a0bfec05 100755
--- a/CPP/7zip/UI/FileManager/RegistryPlugins.cpp
+++ b/CPP/7zip/UI/FileManager/RegistryPlugins.cpp
@@ -28,7 +28,7 @@ static const TCHAR *kPluginsTypeValue = TEXT("Type");
static CSysString GetFileFolderPluginsKeyName()
{
- return CSysString(kLMBasePath) + CSysString(TEXT('\\')) +
+ return CSysString(kLMBasePath) + CSysString(TEXT('\\')) +
CSysString(kPluginsKeyName);
}
@@ -115,7 +115,7 @@ void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
{
- if (fileInfo.IsDirectory())
+ if (fileInfo.IsDir())
continue;
CPluginInfo pluginInfo;
pluginInfo.FilePath = folderPath + fileInfo.Name;
diff --git a/CPP/7zip/UI/FileManager/RegistryPlugins.h b/CPP/7zip/UI/FileManager/RegistryPlugins.h
index 90bab7b5..77055ac7 100755
--- a/CPP/7zip/UI/FileManager/RegistryPlugins.h
+++ b/CPP/7zip/UI/FileManager/RegistryPlugins.h
@@ -5,7 +5,7 @@
#include "Common/MyString.h"
-enum EPluginType
+enum EPluginType
{
kPluginTypeFF = 0
};
diff --git a/CPP/7zip/UI/FileManager/RootFolder.cpp b/CPP/7zip/UI/FileManager/RootFolder.cpp
index 5c8e0e28..3f3c67ef 100755
--- a/CPP/7zip/UI/FileManager/RootFolder.cpp
+++ b/CPP/7zip/UI/FileManager/RootFolder.cpp
@@ -20,7 +20,7 @@
using namespace NWindows;
-static const STATPROPSTG kProperties[] =
+static const STATPROPSTG kProperties[] =
{
{ NULL, kpidName, VT_BSTR}
};
@@ -28,10 +28,33 @@ static const STATPROPSTG kProperties[] =
// static const wchar_t *kMyComputerTitle = L"Computer";
// static const wchar_t *kMyNetworkTitle = L"Network";
-void CRootFolder::Init()
+UString RootFolder_GetName_Computer(int &iconIndex)
{
- _computerName = LangString(IDS_COMPUTER, 0x03020300);
- _networkName = LangString(IDS_NETWORK, 0x03020301);
+ iconIndex = GetIconIndexForCSIDL(CSIDL_DRIVES);
+ return LangString(IDS_COMPUTER, 0x03020300);
+}
+
+UString RootFolder_GetName_Network(int &iconIndex)
+{
+ iconIndex = GetIconIndexForCSIDL(CSIDL_NETWORK);
+ return LangString(IDS_NETWORK, 0x03020301);
+}
+
+UString RootFolder_GetName_Documents(int &iconIndex)
+{
+ iconIndex = GetIconIndexForCSIDL(CSIDL_PERSONAL);
+ return LangString(IDS_DOCUMENTS, 0x03020302); ;
+}
+
+const int ROOT_INDEX_COMPUTER = 0;
+const int ROOT_INDEX_DOCUMENTS = 1;
+const int ROOT_INDEX_NETWORK = 2;
+
+void CRootFolder::Init()
+{
+ _names[ROOT_INDEX_COMPUTER] = RootFolder_GetName_Computer(_iconIndices[ROOT_INDEX_COMPUTER]);
+ _names[ROOT_INDEX_DOCUMENTS] = RootFolder_GetName_Documents(_iconIndices[ROOT_INDEX_DOCUMENTS]);
+ _names[ROOT_INDEX_NETWORK] = RootFolder_GetName_Network(_iconIndices[ROOT_INDEX_NETWORK]);
};
STDMETHODIMP CRootFolder::LoadItems()
@@ -42,50 +65,78 @@ STDMETHODIMP CRootFolder::LoadItems()
STDMETHODIMP CRootFolder::GetNumberOfItems(UInt32 *numItems)
{
- *numItems = 2;
+ *numItems = kNumRootFolderItems;
return S_OK;
}
STDMETHODIMP CRootFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
- NCOM::CPropVariant propVariant;
+ NCOM::CPropVariant prop;
switch(propID)
{
- case kpidIsFolder:
- propVariant = true;
- break;
- case kpidName:
- if (itemIndex == 0)
- propVariant = _computerName;
- else if (itemIndex == 1)
- propVariant = _networkName;
- break;
+ case kpidIsDir: prop = true; break;
+ case kpidName: prop = _names[itemIndex]; break;
}
- propVariant.Detach(value);
+ prop.Detach(value);
return S_OK;
}
+UString GetMyDocsPath()
+{
+ UString us;
+ WCHAR s[MAX_PATH + 1];
+ if (SHGetSpecialFolderPathW(0, s, CSIDL_PERSONAL, FALSE))
+ us = s;
+ #ifndef _UNICODE
+ else
+ {
+ CHAR s2[MAX_PATH + 1];
+ if (SHGetSpecialFolderPathA(0, s2, CSIDL_PERSONAL, FALSE))
+ us = GetUnicodeString(s2);
+ }
+ #endif
+ if (us.Length() > 0 && us[us.Length() - 1] != L'\\')
+ us += L'\\';
+ return us;
+}
+
STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
{
- if (index == 0)
+ if (index == ROOT_INDEX_COMPUTER)
{
CFSDrives *fsDrivesSpec = new CFSDrives;
CMyComPtr<IFolderFolder> subFolder = fsDrivesSpec;
fsDrivesSpec->Init();
*resultFolder = subFolder.Detach();
}
- else if (index == 1)
+ else if (index == ROOT_INDEX_NETWORK)
{
CNetFolder *netFolderSpec = new CNetFolder;
CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
- netFolderSpec->Init(0, 0, _networkName + L'\\');
+ netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + L'\\');
*resultFolder = subFolder.Detach();
}
+ else if (index == ROOT_INDEX_DOCUMENTS)
+ {
+ UString s = GetMyDocsPath();
+ if (!s.IsEmpty())
+ {
+ NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
+ CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
+ RINOK(fsFolderSpec->Init(s, NULL));
+ *resultFolder = subFolder.Detach();
+ }
+ }
else
return E_INVALIDARG;
return S_OK;
}
+static bool AreEqualNames(const UString &name1, const UString &name2)
+{
+ return (name1 == name2 || name1 == (name2 + UString(L'\\')));
+}
+
STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
{
*resultFolder = 0;
@@ -99,12 +150,15 @@ STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resu
*resultFolder = rootFolder.Detach();
return S_OK;
}
- if (name2 == _computerName ||
- name2 == (_computerName + UString(L'\\')))
- return BindToFolder(UInt32(0), resultFolder);
- if (name2 == _networkName ||
- name2 == (_networkName + UString(L'\\')))
- return BindToFolder(UInt32(1), resultFolder);
+ for (int i = 0; i < kNumRootFolderItems; i++)
+ if (AreEqualNames(name2, _names[i]))
+ return BindToFolder((UInt32)i, resultFolder);
+ if (AreEqualNames(name2, L"My Documents") ||
+ AreEqualNames(name2, L"Documents"))
+ return BindToFolder((UInt32)ROOT_INDEX_DOCUMENTS, resultFolder);
+ if (AreEqualNames(name2, L"My Computer") ||
+ AreEqualNames(name2, L"Computer"))
+ return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder);
if (name2 == UString(L'\\'))
{
CMyComPtr<IFolderFolder> subFolder = this;
@@ -157,7 +211,7 @@ STDMETHODIMP CRootFolder::GetNumberOfProperties(UInt32 *numProperties)
return S_OK;
}
-STDMETHODIMP CRootFolder::GetPropertyInfo(UInt32 index,
+STDMETHODIMP CRootFolder::GetPropertyInfo(UInt32 index,
BSTR *name, PROPID *propID, VARTYPE *varType)
{
if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
@@ -183,12 +237,7 @@ STDMETHODIMP CRootFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
{
- int aCSIDL;
- if (index == 0)
- aCSIDL = CSIDL_DRIVES;
- else
- aCSIDL = CSIDL_NETWORK;
- *iconIndex = GetIconIndexForCSIDL(aCSIDL);
+ *iconIndex = _iconIndices[index];
return S_OK;
}
diff --git a/CPP/7zip/UI/FileManager/RootFolder.h b/CPP/7zip/UI/FileManager/RootFolder.h
index 7dad969d..f17a0783 100755
--- a/CPP/7zip/UI/FileManager/RootFolder.h
+++ b/CPP/7zip/UI/FileManager/RootFolder.h
@@ -9,7 +9,9 @@
#include "FSFolder.h"
-class CRootFolder:
+const int kNumRootFolderItems = 3;
+
+class CRootFolder:
public IFolderFolder,
public IFolderGetSystemIconIndex,
public CMyUnknownImp
@@ -25,8 +27,8 @@ public:
void Init();
private:
- UString _computerName;
- UString _networkName;
+ UString _names[kNumRootFolderItems];
+ int _iconIndices[kNumRootFolderItems];
};
#endif
diff --git a/CPP/7zip/UI/FileManager/SettingsPage.cpp b/CPP/7zip/UI/FileManager/SettingsPage.cpp
index 4ce2919d..8b2eb836 100755
--- a/CPP/7zip/UI/FileManager/SettingsPage.cpp
+++ b/CPP/7zip/UI/FileManager/SettingsPage.cpp
@@ -16,7 +16,7 @@
using namespace NWindows;
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_SETTINGS_SHOW_DOTS, 0x03010401},
{ IDC_SETTINGS_SHOW_REAL_FILE_ICONS, 0x03010402},
@@ -91,7 +91,7 @@ void CSettingsPage::OnNotifyHelp()
}
bool CSettingsPage::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+{
switch(buttonID)
{
/*
diff --git a/CPP/7zip/UI/FileManager/SettingsPage.rc b/CPP/7zip/UI/FileManager/SettingsPage.rc
index ddd0911b..1d0e709b 100755
--- a/CPP/7zip/UI/FileManager/SettingsPage.rc
+++ b/CPP/7zip/UI/FileManager/SettingsPage.rc
@@ -13,23 +13,23 @@ MY_FONT
BEGIN
CONTROL "Show "".."" item", IDC_SETTINGS_SHOW_DOTS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, marg, xSize2, 10
- CONTROL "Show real file &icons", IDC_SETTINGS_SHOW_REAL_FILE_ICONS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Show real file &icons", IDC_SETTINGS_SHOW_REAL_FILE_ICONS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 21, xSize2, 10
- CONTROL "Show system &menu", IDC_SETTINGS_SHOW_SYSTEM_MENU, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Show system &menu", IDC_SETTINGS_SHOW_SYSTEM_MENU, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 35, xSize2, 10
- CONTROL "&Full row select", IDC_SETTINGS_FULL_ROW, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "&Full row select", IDC_SETTINGS_FULL_ROW, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 63, xSize2, 10
- CONTROL "Show &grid lines", IDC_SETTINGS_SHOW_GRID, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Show &grid lines", IDC_SETTINGS_SHOW_GRID, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 77, xSize2, 10
- CONTROL "&Single-click to open an item", IDC_SETTINGS_SINGLE_CLICK, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,
+ CONTROL "&Single-click to open an item", IDC_SETTINGS_SINGLE_CLICK, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,
marg, 91, xSize2, 10
- CONTROL "&Underline current name", IDC_SETTINGS_UNDERLINE, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,
+ CONTROL "&Underline current name", IDC_SETTINGS_UNDERLINE, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,
marg + 12, 105, xSize2 - 12, 10
- CONTROL "&Alternative selection mode", IDC_SETTINGS_ALTERNATIVE_SELECTION, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "&Alternative selection mode", IDC_SETTINGS_ALTERNATIVE_SELECTION, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 122, xSize2, 10
- CONTROL "Use &large memory pages", IDC_SETTINGS_LARGE_PAGES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Use &large memory pages", IDC_SETTINGS_LARGE_PAGES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
marg, 142, xSize2, 10
END
diff --git a/CPP/7zip/UI/FileManager/SplitDialog.cpp b/CPP/7zip/UI/FileManager/SplitDialog.cpp
index 1a3770ee..bab319d1 100755
--- a/CPP/7zip/UI/FileManager/SplitDialog.cpp
+++ b/CPP/7zip/UI/FileManager/SplitDialog.cpp
@@ -8,7 +8,7 @@
#include "Windows/FileName.h"
#include "SplitUtils.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
@@ -16,8 +16,8 @@
using namespace NWindows;
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_SPLIT_PATH, 0x03020501 },
{ IDC_STATIC_SPLIT_VOLUME, 0x02000D40 },
@@ -25,9 +25,9 @@ static CIDLangPair kIDLangPairs[] =
#endif
-bool CSplitDialog::OnInit()
+bool CSplitDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x03020500);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
@@ -59,7 +59,7 @@ bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
-void CSplitDialog::OnButtonSetPath()
+void CSplitDialog::OnButtonSetPath()
{
UString currentPath;
_pathCombo.GetText(currentPath);
@@ -82,7 +82,7 @@ void CSplitDialog::OnOK()
volumeString.Trim();
if (!ParseVolumeSizes(volumeString, VolumeSizes) || VolumeSizes.Size() == 0)
{
- ::MessageBoxW(*this, LangString(IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41), L"7-Zip", 0);
+ ::MessageBoxW(*this, LangString(IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41), L"7-Zip", 0);
return;
}
CModalDialog::OnOK();
diff --git a/CPP/7zip/UI/FileManager/StringUtils.cpp b/CPP/7zip/UI/FileManager/StringUtils.cpp
index 63eebdba..bddaa971 100755
--- a/CPP/7zip/UI/FileManager/StringUtils.cpp
+++ b/CPP/7zip/UI/FileManager/StringUtils.cpp
@@ -23,7 +23,7 @@ void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2)
break;
}
}
- else
+ else
dest1 += c;
}
dest2 = src.Mid(i);
diff --git a/CPP/7zip/UI/FileManager/SysIconUtils.cpp b/CPP/7zip/UI/FileManager/SysIconUtils.cpp
index 0d337550..5af6f850 100755
--- a/CPP/7zip/UI/FileManager/SysIconUtils.cpp
+++ b/CPP/7zip/UI/FileManager/SysIconUtils.cpp
@@ -11,21 +11,21 @@
extern bool g_IsNT;
#endif
-int GetIconIndexForCSIDL(int aCSIDL)
+int GetIconIndexForCSIDL(int csidl)
{
- LPITEMIDLIST pidlMyComputer = 0;
- SHGetSpecialFolderLocation(NULL, aCSIDL, &pidlMyComputer);
- if (pidlMyComputer)
+ LPITEMIDLIST pidl = 0;
+ SHGetSpecialFolderLocation(NULL, csidl, &pidl);
+ if (pidl)
{
SHFILEINFO shellInfo;
- SHGetFileInfo(LPCTSTR(pidlMyComputer), FILE_ATTRIBUTE_NORMAL,
- &shellInfo, sizeof(shellInfo),
+ SHGetFileInfo(LPCTSTR(pidl), FILE_ATTRIBUTE_NORMAL,
+ &shellInfo, sizeof(shellInfo),
SHGFI_PIDL | SHGFI_SYSICONINDEX);
IMalloc *pMalloc;
SHGetMalloc(&pMalloc);
if(pMalloc)
{
- pMalloc->Free(pidlMyComputer);
+ pMalloc->Free(pidl);
pMalloc->Release();
}
return shellInfo.iIcon;
@@ -33,10 +33,10 @@ int GetIconIndexForCSIDL(int aCSIDL)
return 0;
}
-DWORD_PTR GetRealIconIndex(LPCTSTR path, UINT32 attributes, int &iconIndex)
+DWORD_PTR GetRealIconIndex(LPCTSTR path, DWORD attributes, int &iconIndex)
{
SHFILEINFO shellInfo;
- DWORD_PTR res = ::SHGetFileInfo(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
+ DWORD_PTR res = ::SHGetFileInfo(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
iconIndex = shellInfo.iIcon;
return res;
@@ -70,13 +70,13 @@ DWORD_PTR MySHGetFileInfoW(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW
}
#ifndef _UNICODE
-// static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
+// static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
+DWORD_PTR GetRealIconIndex(LPCWSTR path, DWORD attributes, int &iconIndex)
{
if(g_IsNT)
{
SHFILEINFOW shellInfo;
- DWORD_PTR res = ::MySHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
+ DWORD_PTR res = ::MySHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
iconIndex = shellInfo.iIcon;
return res;
@@ -86,7 +86,7 @@ DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
}
#endif
-DWORD_PTR GetRealIconIndex(const UString &fileName, UINT32 attributes,
+DWORD_PTR GetRealIconIndex(const UString &fileName, DWORD attributes,
int &iconIndex, UString &typeName)
{
#ifndef _UNICODE
@@ -94,8 +94,8 @@ DWORD_PTR GetRealIconIndex(const UString &fileName, UINT32 attributes,
{
SHFILEINFO shellInfo;
shellInfo.szTypeName[0] = 0;
- DWORD_PTR res = ::SHGetFileInfoA(GetSystemString(fileName), FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
- sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
+ DWORD_PTR res = ::SHGetFileInfoA(GetSystemString(fileName), FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
+ sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
| SHGFI_TYPENAME);
typeName = GetUnicodeString(shellInfo.szTypeName);
iconIndex = shellInfo.iIcon;
@@ -106,8 +106,8 @@ DWORD_PTR GetRealIconIndex(const UString &fileName, UINT32 attributes,
{
SHFILEINFOW shellInfo;
shellInfo.szTypeName[0] = 0;
- DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
- sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
+ DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
+ sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
| SHGFI_TYPENAME);
typeName = shellInfo.szTypeName;
iconIndex = shellInfo.iIcon;
diff --git a/CPP/7zip/UI/FileManager/SysIconUtils.h b/CPP/7zip/UI/FileManager/SysIconUtils.h
index 3b6c6c2e..a90d28bc 100755
--- a/CPP/7zip/UI/FileManager/SysIconUtils.h
+++ b/CPP/7zip/UI/FileManager/SysIconUtils.h
@@ -32,7 +32,7 @@ class CExtToIconMap
CObjectVector<CExtIconPair> _map;
public:
CExtToIconMap(): _dirIconIndex(-1), _noExtIconIndex(-1) {}
- void Clear()
+ void Clear()
{
_dirIconIndex = -1;
_noExtIconIndex = -1;
@@ -42,10 +42,10 @@ public:
int GetIconIndex(UINT32 attributes, const UString &fileName);
};
-DWORD_PTR GetRealIconIndex(LPCTSTR path, UINT32 attributes, int &iconIndex);
+DWORD_PTR GetRealIconIndex(LPCTSTR path, DWORD attributes, int &iconIndex);
#ifndef _UNICODE
-DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex);
+DWORD_PTR GetRealIconIndex(LPCWSTR path, DWORD attributes, int &iconIndex);
#endif
-int GetIconIndexForCSIDL(int aCSIDL);
+int GetIconIndexForCSIDL(int csidl);
#endif
diff --git a/CPP/7zip/UI/FileManager/SystemPage.cpp b/CPP/7zip/UI/FileManager/SystemPage.cpp
index 40da5cb3..f8605ea8 100755
--- a/CPP/7zip/UI/FileManager/SystemPage.cpp
+++ b/CPP/7zip/UI/FileManager/SystemPage.cpp
@@ -26,7 +26,7 @@ using namespace NRegistryAssociations;
const int kRefreshpluginsListMessage = WM_USER + 1;
const int kUpdateDatabase = kRefreshpluginsListMessage + 1;
-static CIDLangPair kIDLangPairs[] =
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_SYSTEM_STATIC_ASSOCIATE, 0x03010302},
{ IDC_SYSTEM_SELECT_ALL, 0x03000330}
@@ -44,7 +44,7 @@ bool CSystemPage::OnInit()
_listViewPlugins.Attach(GetItem(IDC_SYSTEM_LIST_PLUGINS));
/*
- CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
+ CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU,
NRegistryAssociations::CheckContextMenuHandler());
*/
@@ -52,26 +52,11 @@ bool CSystemPage::OnInit()
_listViewExt.SetExtendedListViewStyle(newFlags, newFlags);
_listViewPlugins.SetExtendedListViewStyle(newFlags, newFlags);
- UString s = LangString(IDS_PROPERTY_EXTENSION, 0x02000205);
- LVCOLUMNW column;
- column.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
- column.cx = 70;
- column.fmt = LVCFMT_LEFT;
- column.pszText = (LPWSTR)(LPCWSTR)s;
- column.iSubItem = 0;
- _listViewExt.InsertColumn(0, &column);
-
- s = LangString(IDS_PLUGIN, 0x03010310);
- column.cx = 70;
- column.pszText = (LPWSTR)(LPCWSTR)s;
- column.iSubItem = 1;
- _listViewExt.InsertColumn(1, &column);
-
- s = LangString(IDS_PLUGIN, 0x03010310);
- column.cx = 70;
- column.pszText = (LPWSTR)(LPCWSTR)s;
- column.iSubItem = 0;
- _listViewPlugins.InsertColumn(0, &column);
+ _listViewExt.InsertColumn(0, LangString(IDS_PROPERTY_EXTENSION, 0x02000205), 70);
+ const UString s = LangString(IDS_PLUGIN, 0x03010310);
+ _listViewExt.InsertColumn(1, s, 70);
+
+ _listViewPlugins.InsertColumn(0, s, 70);
_extDatabase.Read();
@@ -79,13 +64,7 @@ bool CSystemPage::OnInit()
{
CExtInfoBig &extInfo = _extDatabase.ExtBigItems[i];
- LVITEMW item;
- item.iItem = i;
- item.mask = LVIF_TEXT | LVIF_PARAM;
- item.lParam = i;
- item.pszText = (LPWSTR)(LPCWSTR)extInfo.Ext;
- item.iSubItem = 0;
- int itemIndex = _listViewExt.InsertItem(&item);
+ int itemIndex = _listViewExt.InsertItem(i, (LPCWSTR)extInfo.Ext);
UString iconPath;
int iconIndex;
@@ -111,13 +90,7 @@ bool CSystemPage::OnInit()
void CSystemPage::SetMainPluginText(int itemIndex, int indexInDatabase)
{
- LVITEMW item;
- item.iItem = itemIndex;
- item.mask = LVIF_TEXT;
- UString mainPlugin = _extDatabase.GetMainPluginNameForExtItem(indexInDatabase);
- item.pszText = (WCHAR *)(const WCHAR *)mainPlugin;
- item.iSubItem = 1;
- _listViewExt.SetItem(&item);
+ _listViewExt.SetSubItem(itemIndex, 1, _extDatabase.GetMainPluginNameForExtItem(indexInDatabase));
}
static UString GetProgramCommand()
@@ -181,7 +154,7 @@ LONG CSystemPage::OnApply()
const CPluginInfo &plugin = _extDatabase.Plugins[extInfo.PluginsPairs[0].Index];
iconPath = GetIconPath(plugin.FilePath, plugin.ClassID, extInfo.Ext, iconIndex);
}
- NRegistryAssociations::AddShellExtensionInfo(GetSystemString(extInfo.Ext),
+ NRegistryAssociations::AddShellExtensionInfo(GetSystemString(extInfo.Ext),
title, command, iconPath, iconIndex, NULL, 0);
}
else
@@ -203,7 +176,7 @@ void CSystemPage::OnNotifyHelp()
}
void CSystemPage::SelectAll()
-{
+{
int count = _listViewExt.GetItemCount();
for (int i = 0; i < count; i++)
_listViewExt.SetCheckState(i, true);
@@ -211,7 +184,7 @@ void CSystemPage::SelectAll()
}
bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+{
switch(buttonID)
{
case IDC_SYSTEM_SELECT_ALL:
@@ -224,8 +197,8 @@ bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND)
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
}
-bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
-{
+bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
+{
if (lParam->hwndFrom == HWND(_listViewExt))
{
switch(lParam->code)
@@ -241,7 +214,7 @@ bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
PostMessage(kUpdateDatabase, 0);
break;
}
- }
+ }
else if (lParam->hwndFrom == HWND(_listViewPlugins))
{
switch(lParam->code)
@@ -268,7 +241,7 @@ bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
}
}
}
- return CPropertyPage::OnNotify(controlID, lParam);
+ return CPropertyPage::OnNotify(controlID, lParam);
}
bool CSystemPage::OnPluginsKeyDown(LPNMLVKEYDOWN keyDownInfo)
@@ -394,14 +367,7 @@ void CSystemPage::RefreshPluginsList(int selectIndex)
for (int i = 0; i < extInfo.PluginsPairs.Size(); i++)
{
CPluginEnabledPair pluginPair = extInfo.PluginsPairs[i];
- UString pluginName = _extDatabase.Plugins[pluginPair.Index].Name;
- LVITEMW item;
- item.iItem = i;
- item.mask = LVIF_TEXT | LVIF_PARAM;
- item.lParam = i;
- item.pszText = (LPWSTR)(LPCWSTR)pluginName;
- item.iSubItem = 0;
- int itemIndex = _listViewPlugins.InsertItem(&item);
+ int itemIndex = _listViewPlugins.InsertItem(i, _extDatabase.Plugins[pluginPair.Index].Name);
_listViewPlugins.SetCheckState(itemIndex, pluginPair.Enabled);
}
if(_listViewPlugins.GetItemCount() > 0)
diff --git a/CPP/7zip/UI/FileManager/SystemPage.rc b/CPP/7zip/UI/FileManager/SystemPage.rc
index f881f612..1cf9405f 100755
--- a/CPP/7zip/UI/FileManager/SystemPage.rc
+++ b/CPP/7zip/UI/FileManager/SystemPage.rc
@@ -15,7 +15,7 @@ CAPTION "System"
MY_FONT
BEGIN
LTEXT "Associate 7-Zip with:", IDC_SYSTEM_STATIC_ASSOCIATE, marg, marg, xSize2, 8
- CONTROL "List1", IDC_SYSTEM_LIST_ASSOCIATE, "SysListView32",
+ CONTROL "List1", IDC_SYSTEM_LIST_ASSOCIATE, "SysListView32",
LVS_LIST | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
marg, 20, g0Size, gYSize
PUSHBUTTON "Select all", IDC_SYSTEM_SELECT_ALL, marg, (ySize - marg - bYSize), 90, bYSize
diff --git a/CPP/7zip/UI/FileManager/TextPairs.cpp b/CPP/7zip/UI/FileManager/TextPairs.cpp
index a149fe37..74df1c62 100755
--- a/CPP/7zip/UI/FileManager/TextPairs.cpp
+++ b/CPP/7zip/UI/FileManager/TextPairs.cpp
@@ -38,8 +38,8 @@ static UString GetIDString(const wchar_t *srcString, int &finishPos)
break;
finishPos++;
bool isSeparatorChar = IsSeparatorChar(c);
- if (c == kNewLineChar || (isSeparatorChar && !quotes)
- || (c == kQuoteChar && quotes))
+ if (c == kNewLineChar || (isSeparatorChar && !quotes)
+ || (c == kQuoteChar && quotes))
break;
else if (c == kQuoteChar)
quotes = true;
@@ -60,7 +60,7 @@ static UString GetValueString(const wchar_t *srcString, int &finishPos)
if (c == kEndOfLine)
break;
finishPos++;
- if (c == kNewLineChar)
+ if (c == kNewLineChar)
break;
result += c;
}
@@ -131,7 +131,7 @@ void CPairsStorage::Sort()
int CPairsStorage::FindID(const UString &id, int &insertPos)
{
- int left = 0, right = Pairs.Size();
+ int left = 0, right = Pairs.Size();
while (left != right)
{
UINT32 mid = (left + right) / 2;
diff --git a/CPP/7zip/UI/FileManager/UpdateCallback100.cpp b/CPP/7zip/UI/FileManager/UpdateCallback100.cpp
index 927d3cd5..376e7647 100755
--- a/CPP/7zip/UI/FileManager/UpdateCallback100.cpp
+++ b/CPP/7zip/UI/FileManager/UpdateCallback100.cpp
@@ -42,14 +42,7 @@ STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
{
- for (;;)
- {
- if(ProgressDialog.ProgressSynch.GetStopped())
- return E_ABORT;
- if(!ProgressDialog.ProgressSynch.GetPaused())
- break;
- ::Sleep(100);
- }
+ RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
if (completeValue != NULL)
ProgressDialog.ProgressSynch.SetPos(*completeValue);
return S_OK;
@@ -104,3 +97,23 @@ STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefi
*password = tempName.Detach();
return S_OK;
}
+
+STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
+{
+ return S_OK;
+}
+
+STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
+{
+ return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+}
+
+STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
+{
+ if (!_passwordIsDefined)
+ return S_FALSE;
+ CMyComBSTR tempName = _password;
+ *password = tempName.Detach();
+ return S_OK;
+}
+
diff --git a/CPP/7zip/UI/FileManager/UpdateCallback100.h b/CPP/7zip/UI/FileManager/UpdateCallback100.h
index fd75bf2f..5ae194a2 100755
--- a/CPP/7zip/UI/FileManager/UpdateCallback100.h
+++ b/CPP/7zip/UI/FileManager/UpdateCallback100.h
@@ -10,35 +10,33 @@
#include "ProgressDialog2.h"
#include "../../IPassword.h"
-#ifdef LANG
+#ifdef LANG
#include "LangUtils.h"
#endif
-class CUpdateCallback100Imp:
+class CUpdateCallback100Imp:
public IFolderArchiveUpdateCallback,
public ICryptoGetTextPassword2,
+ public ICryptoGetTextPassword,
+ public IArchiveOpenCallback,
public ICompressProgressInfo,
public CMyUnknownImp
{
public:
- MY_UNKNOWN_IMP3(
- IFolderArchiveUpdateCallback,
+ MY_UNKNOWN_IMP5(
+ IFolderArchiveUpdateCallback,
ICryptoGetTextPassword2,
+ ICryptoGetTextPassword,
+ IArchiveOpenCallback,
ICompressProgressInfo)
- // IProgress
+ INTERFACE_IProgress(;)
+ INTERFACE_IArchiveOpenCallback(;)
+ INTERFACE_IFolderArchiveUpdateCallback(;)
- STDMETHOD(SetTotal)(UInt64 size);
- STDMETHOD(SetCompleted)(const UInt64 *completeValue);
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
- // IUpdateCallBack
- STDMETHOD(CompressOperation)(const wchar_t *name);
- STDMETHOD(DeleteOperation)(const wchar_t *name);
- STDMETHOD(OperationResult)(Int32 operationResult);
- STDMETHOD(UpdateErrorMessage)(const wchar_t *message);
- STDMETHOD(SetNumFiles)(UInt64 numFiles);
-
+ STDMETHOD(CryptoGetTextPassword)(BSTR *password);
STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
private:
bool _passwordIsDefined;
@@ -56,7 +54,7 @@ public:
UInt64 NumFolders;
UInt64 NumFiles;
- void Init(HWND parentWindow,
+ void Init(HWND parentWindow,
bool passwordIsDefined, const UString &password)
{
_passwordIsDefined = passwordIsDefined;
diff --git a/CPP/7zip/UI/FileManager/ViewSettings.cpp b/CPP/7zip/UI/FileManager/ViewSettings.cpp
index 9102cc4e..34d01229 100755
--- a/CPP/7zip/UI/FileManager/ViewSettings.cpp
+++ b/CPP/7zip/UI/FileManager/ViewSettings.cpp
@@ -416,7 +416,7 @@ void SaveCopyHistory(const UStringVector &folders)
void ReadCopyHistory(UStringVector &folders)
{ ReadStringList(kCopyHistoryValueName, folders); }
-void AddUniqueStringToHeadOfList(UStringVector &list,
+void AddUniqueStringToHeadOfList(UStringVector &list,
const UString &string)
{
for(int i = 0; i < list.Size();)
diff --git a/CPP/7zip/UI/FileManager/ViewSettings.h b/CPP/7zip/UI/FileManager/ViewSettings.h
index 4af0b991..2500ce7b 100755
--- a/CPP/7zip/UI/FileManager/ViewSettings.h
+++ b/CPP/7zip/UI/FileManager/ViewSettings.h
@@ -13,13 +13,13 @@ struct CColumnInfo
};
inline bool operator==(const CColumnInfo &a1, const CColumnInfo &a2)
-{
- return (a1.PropID == a2.PropID) &&
- (a1.IsVisible == a2.IsVisible) && (a1.Width == a2.Width);
+{
+ return (a1.PropID == a2.PropID) &&
+ (a1.IsVisible == a2.IsVisible) && (a1.Width == a2.Width);
}
inline bool operator!=(const CColumnInfo &a1, const CColumnInfo &a2)
-{
+{
return !(a1 == a2);
}
@@ -44,11 +44,11 @@ struct CListViewInfo
return -1;
}
- bool IsEqual(const CListViewInfo &aNewInfo) const
+ bool IsEqual(const CListViewInfo &aNewInfo) const
{
if (Columns.Size() != aNewInfo.Columns.Size() ||
- // SortIndex != aNewInfo.SortIndex ||
- SortID != aNewInfo.SortID ||
+ // SortIndex != aNewInfo.SortIndex ||
+ SortID != aNewInfo.SortID ||
Ascending != aNewInfo.Ascending)
return false;
for (int i = 0; i < Columns.Size(); i++)
@@ -92,7 +92,7 @@ void ReadFastFolders(UStringVector &folders);
void SaveCopyHistory(const UStringVector &folders);
void ReadCopyHistory(UStringVector &folders);
-void AddUniqueStringToHeadOfList(UStringVector &list,
+void AddUniqueStringToHeadOfList(UStringVector &list,
const UString &string);
#endif
diff --git a/CPP/7zip/UI/FileManager/makefile b/CPP/7zip/UI/FileManager/makefile
index 0b815ad9..78921b90 100755
--- a/CPP/7zip/UI/FileManager/makefile
+++ b/CPP/7zip/UI/FileManager/makefile
@@ -102,6 +102,7 @@ WIN_OBJS = \
$O\Security.obj \
$O\Shell.obj \
$O\Synchronization.obj \
+ $O\Time.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
diff --git a/CPP/7zip/UI/FileManager/resource.h b/CPP/7zip/UI/FileManager/resource.h
index 864c066b..edd351b6 100755
--- a/CPP/7zip/UI/FileManager/resource.h
+++ b/CPP/7zip/UI/FileManager/resource.h
@@ -42,7 +42,7 @@
#define IDM_OPEN_PARENT_FOLDER 431
#define IDM_FOLDERS_HISTORY 432
#define IDM_VIEW_REFRESH 440
-#define IDM_VIEW_FLAT_VIEW 449
+#define IDM_VIEW_FLAT_VIEW 449
#define IDM_VIEW_TWO_PANELS 450
#define IDM_VIEW_TOOLBARS 451
#define IDM_VIEW_STANDARD_TOOLBAR 460
@@ -86,6 +86,7 @@
#define IDS_WANT_TO_DELETE_ITEMS 2215
#define IDS_DELETING 2216
#define IDS_ERROR_DELETING 2217
+#define IDS_ERROR_LONG_PATH_TO_RECYCLE 2218
#define IDS_RENAMING 2220
#define IDS_ERROR_RENAMING 2221
@@ -116,8 +117,10 @@
#define IDS_CANNOT_UPDATE_FILE 2281
#define IDS_CANNOT_START_EDITOR 2282
#define IDS_OPENNING 2283
+#define IDS_VIRUS 2284
#define IDS_COMPUTER 2300
#define IDS_NETWORK 2301
+#define IDS_DOCUMENTS 2302
#define IDS_ADD 2400
#define IDS_EXTRACT 2401
#define IDS_TEST 2402
@@ -145,6 +148,8 @@
#define IDS_COMBINE_TO 4031
#define IDS_COMBINING 4032
#define IDS_COMBINE_SELECT_ONE_FILE 4033
+#define IDS_COMBINE_CANT_DETECT_SPLIT_FILE 4034
+#define IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART 4035
#define IDS_CHECKSUM_CALCULATING 4040
#define IDS_CHECKSUM_INFORMATION 4041
@@ -157,3 +162,7 @@
#define IDS_PROGRESS_TESTING 4100
#define IDS_MESSAGE_NO_ERRORS 4200
+#define IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER 4301
+#define IDS_SELECT_ONE_FILE 4302
+#define IDS_SELECT_FILES 4303
+#define IDS_FILE_EXIST 4304
diff --git a/CPP/7zip/UI/FileManager/resource.rc b/CPP/7zip/UI/FileManager/resource.rc
index b8664cbe..3ec3bb32 100755
--- a/CPP/7zip/UI/FileManager/resource.rc
+++ b/CPP/7zip/UI/FileManager/resource.rc
@@ -5,7 +5,7 @@
MY_VERSION_INFO_APP("7-Zip File Manager", "7zFM")
-IDR_ACCELERATOR1 ACCELERATORS
+IDR_ACCELERATOR1 ACCELERATORS
BEGIN
"N", IDM_CREATE_FILE, VIRTKEY, CONTROL, NOINVERT
VK_F1, IDM_HELP_CONTENTS, VIRTKEY, NOINVERT
@@ -42,10 +42,10 @@ BEGIN
END
POPUP "&Edit"
BEGIN
- MENUITEM "Cu&t\tCtrl+X", IDM_EDIT_CUT, GRAYED
- MENUITEM "&Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED
- MENUITEM "&Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED
- MENUITEM SEPARATOR
+ // MENUITEM "Cu&t\tCtrl+X", IDM_EDIT_CUT, GRAYED
+ // MENUITEM "&Copy\tCtrl+C", IDM_EDIT_COPY, GRAYED
+ // MENUITEM "&Paste\tCtrl+V", IDM_EDIT_PASTE, GRAYED
+ // MENUITEM SEPARATOR
MENUITEM "Select &All\tShift+[Grey +]", IDM_SELECT_ALL
MENUITEM "Deselect All\tShift+[Grey -]", IDM_DESELECT_ALL
MENUITEM "&Invert Selection\tGrey *", IDM_INVERT_SELECTION
@@ -126,7 +126,7 @@ IDB_DELETE2 BITMAP "Delete2.bmp"
IDB_INFO2 BITMAP "Info2.bmp"
-STRINGTABLE
+STRINGTABLE
BEGIN
IDS_APP_TITLE "7-Zip File Manager"
IDS_COPY "Copy"
@@ -144,7 +144,9 @@ BEGIN
IDS_COMBINE "Combine Files"
IDS_COMBINE_TO "&Combine to:"
IDS_COMBINING "Combining..."
- IDS_COMBINE_SELECT_ONE_FILE "Select only first file"
+ IDS_COMBINE_SELECT_ONE_FILE "Select only first part of split file"
+ IDS_COMBINE_CANT_DETECT_SPLIT_FILE "Can not detect file as split file"
+ IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART "Can not find more than one part of split file"
IDS_CHECKSUM_CALCULATING "Checksum calculating..."
IDS_CHECKSUM_INFORMATION "Checksum information"
@@ -165,6 +167,7 @@ BEGIN
IDS_WANT_TO_DELETE_ITEMS "Are you sure you want to delete these {0} items?"
IDS_DELETING "Deleting..."
IDS_ERROR_DELETING "Error Deleting File or Folder"
+ IDS_ERROR_LONG_PATH_TO_RECYCLE "The system cannot move a file with long path to the Recycle Bin"
IDS_RENAMING "Renaming..."
IDS_ERROR_RENAMING "Error Renaming File or Folder"
IDS_CONFIRM_FILE_COPY "Confirm File Copy"
@@ -202,6 +205,7 @@ BEGIN
IDS_CANNOT_UPDATE_FILE "Can not update file\n'{0}'"
IDS_CANNOT_START_EDITOR "Cannot start editor."
IDS_OPENNING "Opening..."
+ IDS_VIRUS "The file looks like a virus (the file name contains long spaces in name)."
IDS_ADD "Add"
IDS_EXTRACT "Extract"
IDS_TEST "Test"
@@ -212,9 +216,14 @@ BEGIN
IDS_BOOKMARK "Bookmark"
IDS_COMPUTER "Computer"
IDS_NETWORK "Network"
+ IDS_DOCUMENTS "Documents"
IDS_PROGRESS_TESTING "Testing"
IDS_MESSAGE_NO_ERRORS "There are no errors"
+ IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER "The operation cannot be called from a folder that has a long path."
+ IDS_SELECT_ONE_FILE "You must select one file"
+ IDS_SELECT_FILES "You must select one or more files"
+ IDS_FILE_EXIST "File {0} is already exist"
END
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
index 3177bb06..c7a1cc5b 100755
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
@@ -21,14 +21,14 @@ static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
static const UINT_PTR kTimerID = 4;
static const UINT kTimerElapse = 1000;
-#ifdef LANG
+#ifdef LANG
#include "../FileManager/LangUtils.h"
#endif
using namespace NWindows;
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_BENCHMARK_DICTIONARY, 0x02000D0C },
{ IDC_BENCHMARK_MEMORY, 0x03080001 },
@@ -69,16 +69,16 @@ const LPCTSTR kKBs = TEXT(" KB/s");
static const int kMinDicLogSize = 21;
static const UInt32 kMinDicSize = (1 << kMinDicLogSize);
-static const UInt32 kMaxDicSize =
+static const UInt32 kMaxDicSize =
#ifdef _WIN64
(1 << 30);
#else
(1 << 27);
#endif
-bool CBenchmarkDialog::OnInit()
+bool CBenchmarkDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x03080000);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
@@ -177,7 +177,7 @@ UInt32 CBenchmarkDialog::OnChangeDictionary()
return dictionary;
}
-static const UInt32 g_IDs[] =
+static const UInt32 g_IDs[] =
{
IDC_BENCHMARK_COMPRESSING_USAGE,
IDC_BENCHMARK_COMPRESSING_USAGE2,
@@ -231,12 +231,12 @@ void CBenchmarkDialog::OnStopButton()
_syncInfo.Pause();
}
-void CBenchmarkDialog::OnHelp()
+void CBenchmarkDialog::OnHelp()
{
ShowHelpWindow(NULL, kHelpTopic);
}
-void CBenchmarkDialog::OnCancel()
+void CBenchmarkDialog::OnCancel()
{
_syncInfo.Stop();
KillTimer(_timer);
@@ -245,9 +245,9 @@ void CBenchmarkDialog::OnCancel()
static void GetTimeString(UInt64 timeValue, TCHAR *s)
{
- wsprintf(s, TEXT("%02d:%02d:%02d"),
+ wsprintf(s, TEXT("%02d:%02d:%02d"),
UInt32(timeValue / 3600),
- UInt32((timeValue / 60) % 60),
+ UInt32((timeValue / 60) % 60),
UInt32(timeValue % 60));
}
@@ -281,7 +281,7 @@ void CBenchmarkDialog::PrintUsage(UInt64 usage, UINT controlID)
void CBenchmarkDialog::PrintResults(
UInt32 dictionarySize,
- const CBenchInfo2 &info,
+ const CBenchInfo2 &info,
UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
bool decompressMode)
{
@@ -327,8 +327,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20);
- dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
- PrintResults(dicSizeTemp,
+ dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
+ PrintResults(dicSizeTemp,
_syncInfo.CompressingInfoTemp,
IDC_BENCHMARK_COMPRESSING_USAGE,
IDC_BENCHMARK_COMPRESSING_SPEED,
@@ -338,7 +338,7 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
PrintResults(
- _syncInfo.DictionarySize,
+ _syncInfo.DictionarySize,
_syncInfo.CompressingInfo,
IDC_BENCHMARK_COMPRESSING_USAGE2,
IDC_BENCHMARK_COMPRESSING_SPEED2,
@@ -348,7 +348,7 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
PrintResults(
- _syncInfo.DictionarySize,
+ _syncInfo.DictionarySize,
_syncInfo.DecompressingInfoTemp,
IDC_BENCHMARK_DECOMPRESSING_USAGE,
IDC_BENCHMARK_DECOMPRESSING_SPEED,
@@ -358,8 +358,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
}
{
PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.DecompressingInfo,
+ _syncInfo.DictionarySize,
+ _syncInfo.DecompressingInfo,
IDC_BENCHMARK_DECOMPRESSING_USAGE2,
IDC_BENCHMARK_DECOMPRESSING_SPEED2,
IDC_BENCHMARK_DECOMPRESSING_RPU2,
@@ -368,14 +368,14 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
if (_syncInfo.DecompressingInfo.GlobalTime > 0 &&
_syncInfo.CompressingInfo.GlobalTime > 0)
{
- UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize,
+ UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize,
_syncInfo.CompressingInfo.GlobalTime, _syncInfo.CompressingInfo.GlobalFreq, _syncInfo.CompressingInfo.UnpackSize);
- UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime,
- _syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize,
+ UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime,
+ _syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize,
_syncInfo.DecompressingInfo.PackSize, 1);
PrintRating((comprRating + decomprRating) / 2, IDC_BENCHMARK_TOTAL_RATING_VALUE);
PrintRating((
- GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) +
+ GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) +
GetRatingPerUsage(_syncInfo.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
PrintUsage((GetUsage(_syncInfo.CompressingInfo) + GetUsage(_syncInfo.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
}
@@ -385,8 +385,8 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
{
- if (code == CBN_SELCHANGE &&
- (itemID == IDC_BENCHMARK_COMBO_DICTIONARY ||
+ if (code == CBN_SELCHANGE &&
+ (itemID == IDC_BENCHMARK_COMBO_DICTIONARY ||
itemID == IDC_BENCHMARK_COMBO_NUM_THREADS))
{
OnChangeSettings();
@@ -395,8 +395,8 @@ bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
return CModalDialog::OnCommand(code, itemID, lParam);
}
-bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
+bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
switch(buttonID)
{
case IDC_BUTTON_RESTART:
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.h b/CPP/7zip/UI/GUI/BenchmarkDialog.h
index 2ba4a9a5..a57cdb39 100755
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.h
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.h
@@ -87,7 +87,7 @@ public:
void WaitCreating() { _startEvent.Lock(); }
};
-class CBenchmarkDialog:
+class CBenchmarkDialog:
public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox m_Dictionary;
@@ -109,7 +109,7 @@ class CBenchmarkDialog:
void PrintUsage(UInt64 usage, UINT controlID);
void PrintResults(
UINT32 dictionarySize,
- const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
+ const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
bool decompressMode = false);
UInt32 GetNumberOfThreads();
@@ -122,7 +122,7 @@ public:
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
};
-HRESULT Benchmark(
+HRESULT Benchmark(
#ifdef EXTERNAL_LZMA
CCodecs *codecs,
#endif
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index 51d215bc..9634ba02 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -26,7 +26,7 @@
extern bool g_IsNT;
#endif
-#ifdef LANG
+#ifdef LANG
#include "../FileManager/LangUtils.h"
#endif
@@ -34,8 +34,8 @@ extern bool g_IsNT;
#define MY_SIZE_OF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_COMPRESS_ARCHIVE, 0x02000D01 },
{ IDC_STATIC_COMPRESS_FORMAT, 0x02000D03 },
@@ -94,7 +94,7 @@ enum ELevel
kUltra = 9
};
-static const CLevelInfo g_Levels[] =
+static const CLevelInfo g_Levels[] =
{
{ IDS_METHOD_STORE, 0x02000D81 },
{ IDS_METHOD_FASTEST, 0x02000D85 },
@@ -118,7 +118,7 @@ enum EMethodID
kDeflate64
};
-static const LPCWSTR kMethodsNames[] =
+static const LPCWSTR kMethodsNames[] =
{
L"Copy",
L"LZMA",
@@ -128,33 +128,33 @@ static const LPCWSTR kMethodsNames[] =
L"Deflate64"
};
-static const EMethodID g_7zMethods[] =
+static const EMethodID g_7zMethods[] =
{
kLZMA,
kPPMd,
kBZip2
};
-static const EMethodID g_7zSfxMethods[] =
+static const EMethodID g_7zSfxMethods[] =
{
kCopy,
kLZMA,
kPPMd
};
-static EMethodID g_ZipMethods[] =
+static EMethodID g_ZipMethods[] =
{
kDeflate,
kDeflate64,
kBZip2
};
-static EMethodID g_GZipMethods[] =
+static EMethodID g_GZipMethods[] =
{
kDeflate
};
-static EMethodID g_BZip2Methods[] =
+static EMethodID g_BZip2Methods[] =
{
kBZip2
};
@@ -173,42 +173,42 @@ struct CFormatInfo
bool EncryptFileNames;
};
-static const CFormatInfo g_Formats[] =
+static const CFormatInfo g_Formats[] =
{
- {
- L"",
- (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
+ {
+ L"",
+ (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
0, 0,
false, false, false, false, false, false
},
- {
- k7zFormat,
- (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
+ {
+ k7zFormat,
+ (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
g_7zMethods, MY_SIZE_OF_ARRAY(g_7zMethods),
true, true, true, true, true, true
},
- {
- L"Zip",
- (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
+ {
+ L"Zip",
+ (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
g_ZipMethods, MY_SIZE_OF_ARRAY(g_ZipMethods) ,
false, false, true, false, true, false
},
- {
- L"GZip",
- (1 << 1) | (1 << 5) | (1 << 7) | (1 << 9),
+ {
+ L"GZip",
+ (1 << 1) | (1 << 5) | (1 << 7) | (1 << 9),
g_GZipMethods, MY_SIZE_OF_ARRAY(g_GZipMethods),
false, false, false, false, false, false
},
- {
- L"BZip2",
+ {
+ L"BZip2",
(1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
- g_BZip2Methods,
+ g_BZip2Methods,
MY_SIZE_OF_ARRAY(g_BZip2Methods),
false, false, true, false, false
},
- {
- L"Tar",
- (1 << 0),
+ {
+ L"Tar",
+ (1 << 0),
0, 0,
false, false, false, false, false, false
}
@@ -236,9 +236,9 @@ static UInt64 GetMaxRamSizeForProgram()
return physSize;
}
-bool CCompressDialog::OnInit()
+bool CCompressDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x02000D00);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, MY_SIZE_OF_ARRAY(kIDLangPairs) );
#endif
@@ -410,7 +410,7 @@ void CCompressDialog::CheckControlsEnable()
EnableItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, fi.Encrypt);
EnableItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
- ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
+ ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames ? SW_SHOW : SW_HIDE);
}
bool CCompressDialog::IsSFX()
@@ -454,7 +454,7 @@ void CCompressDialog::OnButtonSFX()
CheckVolumeEnable();
}
-void CCompressDialog::OnButtonSetArchive()
+void CCompressDialog::OnButtonSetArchive()
{
UString fileName;
m_ArchivePath.GetText(fileName);
@@ -489,14 +489,14 @@ static bool IsAsciiString(const UString &s)
return true;
}
-void CCompressDialog::OnOK()
+void CCompressDialog::OnOK()
{
_password1Control.GetText(Info.Password);
if (IsZipFormat())
{
if (!IsAsciiString(Info.Password))
{
- MyMessageBoxResource(*this, IDS_PASSWORD_USE_ASCII, 0x02000B11);
+ ShowErrorMessageHwndRes(*this, IDS_PASSWORD_USE_ASCII, 0x02000B11);
return;
}
UString method = GetEncryptionMethodSpec();
@@ -505,7 +505,7 @@ void CCompressDialog::OnOK()
{
if (Info.Password.Length() > 99)
{
- MyMessageBoxResource(*this, IDS_PASSWORD_IS_TOO_LONG, 0x02000B12);
+ ShowErrorMessageHwndRes(*this, IDS_PASSWORD_IS_TOO_LONG, 0x02000B12);
return;
}
}
@@ -516,7 +516,7 @@ void CCompressDialog::OnOK()
_password2Control.GetText(password2);
if (password2 != Info.Password)
{
- MyMessageBoxResource(*this, IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, 0x02000B10);
+ ShowErrorMessageHwndRes(*this, IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, 0x02000B10);
return;
}
}
@@ -558,7 +558,7 @@ void CCompressDialog::OnOK()
{
if (!ParseVolumeSizes(volumeString, Info.VolumeSizes))
{
- MyMessageBoxResource(*this, IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41);
+ ShowErrorMessageHwndRes(*this, IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41);
return;
}
if (!Info.VolumeSizes.IsEmpty())
@@ -568,7 +568,7 @@ void CCompressDialog::OnOK()
{
wchar_t s[32];
ConvertUInt64ToString(volumeSize, s);
- if (::MessageBoxW(*this, MyFormatNew(IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, 0x02000D42, s),
+ if (::MessageBoxW(*this, MyFormatNew(IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, 0x02000D42, s),
L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL) != IDYES)
return;
}
@@ -595,7 +595,7 @@ void CCompressDialog::OnOK()
static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/add.htm";
-void CCompressDialog::OnHelp()
+void CCompressDialog::OnHelp()
{
ShowHelpWindow(NULL, kHelpTopic);
}
@@ -660,7 +660,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
return CModalDialog::OnCommand(code, itemID, lParam);
}
-void CCompressDialog::CheckSFXNameChange()
+void CCompressDialog::CheckSFXNameChange()
{
bool isSFX = IsSFX();
CheckSFXControlsEnable();
@@ -668,7 +668,7 @@ void CCompressDialog::CheckSFXNameChange()
SetArchiveName2(isSFX);
}
-void CCompressDialog::SetArchiveName2(bool prevWasSFX)
+void CCompressDialog::SetArchiveName2(bool prevWasSFX)
{
UString fileName;
m_ArchivePath.GetText(fileName);
@@ -797,7 +797,7 @@ void CCompressDialog::SetLevel()
SetMethod();
}
-void CCompressDialog::SetMethod()
+void CCompressDialog::SetMethod()
{
m_Method.ResetContent();
UInt32 level = GetLevel();
@@ -814,7 +814,7 @@ void CCompressDialog::SetMethod()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- defaultMethod = fo.Method;
+ defaultMethod = fo.Method;
}
bool isSfx = IsSFX();
for(int m = 0; m < fi.NumMethods; m++)
@@ -838,7 +838,7 @@ bool CCompressDialog::IsZipFormat()
return (ai.Name.CompareNoCase(L"zip") == 0);
}
-void CCompressDialog::SetEncryptionMethod()
+void CCompressDialog::SetEncryptionMethod()
{
_encryptionMethod.ResetContent();
const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
@@ -854,7 +854,7 @@ void CCompressDialog::SetEncryptionMethod()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- encryptionMethod = fo.EncryptionMethod;
+ encryptionMethod = fo.EncryptionMethod;
}
_encryptionMethod.AddString(TEXT("ZipCrypto"));
_encryptionMethod.AddString(TEXT("AES-256"));
@@ -1365,7 +1365,7 @@ void CCompressDialog::PrintMemUsage(UINT res, UInt64 value)
void CCompressDialog::SetMemoryUsage()
{
- UInt64 decompressMem;
+ UInt64 decompressMem;
UInt64 memUsage = GetMemoryUsage(decompressMem);
PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_VALUE, memUsage);
PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, decompressMem);
diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h
index 0b9e38c2..a88d472c 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.h
+++ b/CPP/7zip/UI/GUI/CompressDialog.h
@@ -58,9 +58,9 @@ namespace NCompressDialog
bool EncryptHeadersIsAllowed;
bool EncryptHeaders;
- void Init()
- {
- Level = Dictionary = Order = UInt32(-1);
+ void Init()
+ {
+ Level = Dictionary = Order = UInt32(-1);
OrderMode = false;
Method.Empty();
Options.Empty();
diff --git a/CPP/7zip/UI/GUI/CompressDialog.rc b/CPP/7zip/UI/GUI/CompressDialog.rc
index d2a14104..397a2756 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.rc
+++ b/CPP/7zip/UI/GUI/CompressDialog.rc
@@ -97,9 +97,9 @@ BEGIN
COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4XPos, 51, g4XSize, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4XPos, OptYPos, g4XSize, 48
- CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g4XPos2, OptYPos + 14, g4XSize2, 10
- CONTROL "Compress shared files",IDC_COMPRESS_SHARED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ CONTROL "Compress shared files",IDC_COMPRESS_SHARED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
g4XPos2, OptYPos + 30, g4XSize2, 10
GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4XPos, PswYPos, g4XSize, 127
diff --git a/CPP/7zip/UI/GUI/Extract.rc b/CPP/7zip/UI/GUI/Extract.rc
index 4f2a520c..0c655ce4 100755
--- a/CPP/7zip/UI/GUI/Extract.rc
+++ b/CPP/7zip/UI/GUI/Extract.rc
@@ -2,8 +2,9 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-STRINGTABLE DISCARDABLE
+STRINGTABLE DISCARDABLE
BEGIN
+ IDS_UPDATE_NOT_SUPPORTED "Update operations are not supported for this archive."
IDS_CANNOT_CREATE_FOLDER "Cannot create folder '{0}'"
IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE "File is not supported archive."
IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC "CRC failed in '{0}'. File is broken."
@@ -16,4 +17,7 @@ BEGIN
IDS_PROGRESS_EXTRACTING "Extracting"
IDS_CANT_OPEN_ARCHIVE "Can not open file '{0}' as archive"
IDS_CANT_OPEN_ENCRYPTED_ARCHIVE "Can not open encrypted archive '{0}'. Wrong password?"
+ IDS_MEM_ERROR "The system cannot allocate the required amount of memory"
+ IDS_UNKNOWN_ERROR "Unknown Error"
+ IDS_UNSUPPORTED_ARCHIVE_TYPE "Unsupported archive type"
END
diff --git a/CPP/7zip/UI/GUI/ExtractDialog.cpp b/CPP/7zip/UI/GUI/ExtractDialog.cpp
index 876fbbba..6b388700 100755
--- a/CPP/7zip/UI/GUI/ExtractDialog.cpp
+++ b/CPP/7zip/UI/GUI/ExtractDialog.cpp
@@ -94,7 +94,7 @@ void CExtractDialog::SetPathMode()
for (int i = 0; i < kNumPathnamesButtons; i++)
if(PathMode == kPathModeButtonsVals[i])
{
- CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1],
+ CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1],
kPathModeButtons[i]);
return;
}
@@ -121,7 +121,7 @@ void CExtractDialog::SetOverwriteMode()
for (int i = 0; i < kNumOverwriteButtons; i++)
if(OverwriteMode == kOverwriteButtonsVals[i])
{
- CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
+ CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
kOverwriteButtons[i]);
return;
}
@@ -142,8 +142,8 @@ int CExtractDialog::GetFilesMode() const
#endif
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 },
{ IDC_EXTRACT_PATH_MODE, 0x02000810 },
@@ -174,9 +174,9 @@ static CIDLangPair kIDLangPairs[] =
static const int kHistorySize = 8;
#endif
-bool CExtractDialog::OnInit()
+bool CExtractDialog::OnInit()
{
- #ifdef LANG
+ #ifdef LANG
LangSetWindowText(HWND(*this), 0x02000800);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
@@ -210,7 +210,7 @@ bool CExtractDialog::OnInit()
#endif
/*
- if(extractionInfo.Paths.Size() > 0)
+ if(extractionInfo.Paths.Size() > 0)
_path.SetCurSel(0);
else
_path.SetCurSel(-1);
@@ -223,7 +223,7 @@ bool CExtractDialog::OnInit()
SetOverwriteMode();
/*
- CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
+ CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
kFilesButtons[_filesMode]);
*/
@@ -278,7 +278,7 @@ bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
-void CExtractDialog::OnButtonSetPath()
+void CExtractDialog::OnButtonSetPath()
{
UString currentPath;
_path.GetText(currentPath);
@@ -300,7 +300,7 @@ void AddUniqueString(UStringVector &list, const UString &s)
list.Add(s);
}
-void CExtractDialog::OnOK()
+void CExtractDialog::OnOK()
{
#ifndef _SFX
GetPathMode();
@@ -365,7 +365,7 @@ void CExtractDialog::UpdateWildCardState()
#ifndef NO_REGISTRY
static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm";
-void CExtractDialog::OnHelp()
+void CExtractDialog::OnHelp()
{
ShowHelpWindow(NULL, kHelpTopic);
CModalDialog::OnHelp();
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp
index 7936fa86..a03bd77a 100755
--- a/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp
@@ -21,7 +21,6 @@
#include "resource.h"
#include "ExtractRes.h"
-#include "OpenCallbackGUI.h"
#include "ExtractDialog.h"
using namespace NWindows;
@@ -32,11 +31,12 @@ struct CThreadExtracting
{
CCodecs *codecs;
CExtractCallbackImp *ExtractCallbackSpec;
+ CIntVector FormatIndices;
+
UStringVector *ArchivePaths;
UStringVector *ArchivePathsFull;
const NWildcard::CCensorNode *WildcardCensor;
const CExtractOptions *Options;
- COpenCallbackGUI *OpenCallback;
CMyComPtr<IExtractCallbackUI> ExtractCallback;
CDecompressStat Stat;
UString ErrorMessage;
@@ -48,20 +48,20 @@ struct CThreadExtracting
try
{
Result = DecompressArchives(
- codecs,
+ codecs, FormatIndices,
*ArchivePaths, *ArchivePathsFull,
- *WildcardCensor, *Options, OpenCallback, ExtractCallback, ErrorMessage, Stat);
+ *WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback, ErrorMessage, Stat);
}
catch(const UString &s)
{
ErrorMessage = s;
Result = E_FAIL;
- }
+ }
catch(const wchar_t *s)
{
ErrorMessage = s;
Result = E_FAIL;
- }
+ }
catch(const char *s)
{
ErrorMessage = GetUnicodeString(s);
@@ -110,16 +110,17 @@ static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s
HRESULT ExtractGUI(
CCodecs *codecs,
- UStringVector &archivePaths,
+ const CIntVector &formatIndices,
+ UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
bool showDialog,
- COpenCallbackGUI *openCallback,
CExtractCallbackImp *extractCallback)
{
CThreadExtracting extracter;
extracter.codecs = codecs;
+ extracter.FormatIndices = formatIndices;
if (!options.TestMode)
{
@@ -131,7 +132,7 @@ HRESULT ExtractGUI(
CExtractDialog dialog;
if (!NFile::NDirectory::MyGetFullPathName(outputDir, dialog.DirectoryPath))
{
- MyMessageBox(kIncorrectOutDir);
+ ShowErrorMessage(kIncorrectOutDir);
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(dialog.DirectoryPath);
@@ -145,13 +146,13 @@ HRESULT ExtractGUI(
options.OverwriteMode = dialog.OverwriteMode;
options.PathMode = dialog.PathMode;
#ifndef _SFX
- openCallback->Password = dialog.Password;
- openCallback->PasswordIsDefined = !dialog.Password.IsEmpty();
+ extractCallback->Password = dialog.Password;
+ extractCallback->PasswordIsDefined = !dialog.Password.IsEmpty();
#endif
}
if (!NFile::NDirectory::MyGetFullPathName(outputDir, options.OutputDir))
{
- MyMessageBox(kIncorrectOutDir);
+ ShowErrorMessage(kIncorrectOutDir);
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
@@ -160,10 +161,10 @@ HRESULT ExtractGUI(
if(!NFile::NDirectory::CreateComplexDirectory(options.OutputDir))
{
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
- UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
- #ifdef LANG
- 0x02000603,
- #endif
+ UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
+ #ifdef LANG
+ 0x02000603,
+ #endif
options.OutputDir);
MyMessageBox(s2 + UString(L"\n") + s);
return E_FAIL;
@@ -171,7 +172,7 @@ HRESULT ExtractGUI(
*/
}
- UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
+ UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
options.TestMode ? 0x02000F90: 0x02000890);
extracter.ExtractCallbackSpec = extractCallback;
@@ -182,12 +183,11 @@ HRESULT ExtractGUI(
extracter.ArchivePathsFull = &archivePathsFull;
extracter.WildcardCensor = &wildcardCensor;
extracter.Options = &options;
- extracter.OpenCallback = openCallback;
NWindows::CThread thread;
RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &extracter));
extracter.ExtractCallbackSpec->StartProgressDialog(title);
- if (extracter.Result == S_OK && options.TestMode &&
+ if (extracter.Result == S_OK && options.TestMode &&
extracter.ExtractCallbackSpec->Messages.IsEmpty() &&
extracter.ExtractCallbackSpec->NumArchiveErrors == 0)
{
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.h b/CPP/7zip/UI/GUI/ExtractGUI.h
index dfc59945..ffefabfe 100755
--- a/CPP/7zip/UI/GUI/ExtractGUI.h
+++ b/CPP/7zip/UI/GUI/ExtractGUI.h
@@ -4,18 +4,17 @@
#define __EXTRACT_GUI_H
#include "../Common/Extract.h"
-#include "OpenCallbackGUI.h"
#include "../FileManager/ExtractCallback.h"
HRESULT ExtractGUI(
CCodecs *codecs,
- UStringVector &archivePaths,
+ const CIntVector &formatIndices,
+ UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
bool showDialog,
- COpenCallbackGUI *openCallback,
CExtractCallbackImp *extractCallback);
#endif
diff --git a/CPP/7zip/UI/GUI/ExtractRes.h b/CPP/7zip/UI/GUI/ExtractRes.h
index 917c0a34..084181ea 100755
--- a/CPP/7zip/UI/GUI/ExtractRes.h
+++ b/CPP/7zip/UI/GUI/ExtractRes.h
@@ -1,3 +1,4 @@
+#define IDS_UPDATE_NOT_SUPPORTED 199
#define IDS_CANNOT_CREATE_FOLDER 200
#define IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE 201
@@ -13,3 +14,6 @@
#define IDS_CANT_OPEN_ARCHIVE 103
#define IDS_CANT_OPEN_ENCRYPTED_ARCHIVE 104
+#define IDS_MEM_ERROR 105
+#define IDS_UNKNOWN_ERROR 106
+#define IDS_UNSUPPORTED_ARCHIVE_TYPE 107
diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp
index 65b7fafa..e1117188 100755
--- a/CPP/7zip/UI/GUI/GUI.cpp
+++ b/CPP/7zip/UI/GUI/GUI.cpp
@@ -4,8 +4,8 @@
#include <initguid.h>
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
}
@@ -14,26 +14,17 @@ extern "C"
#include "Common/CommandLineParser.h"
#include "Common/MyException.h"
-#include "Windows/COM.h"
-#include "Windows/FileMapping.h"
-#include "Windows/FileDir.h"
-#include "Windows/Synchronization.h"
#include "Windows/Error.h"
-#include "Windows/FileName.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
-#include "../../IStream.h"
-#include "../../IPassword.h"
-
#include "../FileManager/StringUtils.h"
#include "../Common/ExitCode.h"
#include "../Common/ArchiveCommandLine.h"
#include "ExtractRes.h"
-#include "../Explorer/MyMessages.h"
#include "ExtractGUI.h"
#include "UpdateGUI.h"
@@ -46,31 +37,37 @@ HINSTANCE g_hInstance;
bool g_IsNT = false;
#endif
-// static const wchar_t *kExceptionErrorMessage = L"Error:";
-// static const wchar_t *kUserBreak = L"Break signaled";
+static void ErrorMessage(LPCWSTR message)
+{
+ MessageBoxW(NULL, message, L"7-Zip", MB_ICONERROR | MB_OK);
+}
+
+static void ErrorLangMessage(UINT resourceID, UInt32 langID)
+{
+ ErrorMessage(LangString(resourceID, langID));
+}
-static const wchar_t *kMemoryExceptionMessage = L"ERROR: Can't allocate required memory!";
-static const wchar_t *kUnknownExceptionMessage = L"Unknown Error";
-// static const wchar_t *kInternalExceptionMessage = L"Internal Error #";
-// static const wchar_t *kIncorrectCommandMessage = L"Incorrect command";
+static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
-static void ErrorMessage(const wchar_t *message)
+static int ShowMemErrorMessage()
{
- MessageBoxW(0, message, L"7-Zip GUI", MB_ICONERROR);
+ ErrorLangMessage(IDS_MEM_ERROR, 0x0200060B);
+ return NExitCode::kMemoryError;
}
-int Main2()
+static int ShowSysErrorMessage(DWORD errorCode)
{
- /*
- TCHAR t[512];
- GetCurrentDirectory(512, t);
- ErrorMessage(t);
- return 0;
- */
+ if (errorCode == E_OUTOFMEMORY)
+ return ShowMemErrorMessage();
+ ErrorMessage(NError::MyFormatMessageW(errorCode));
+ return NExitCode::kFatalError;
+}
+static int Main2()
+{
UStringVector commandStrings;
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
- if(commandStrings.Size() <= 1)
+ if (commandStrings.Size() <= 1)
{
MessageBoxW(0, L"Specify command", L"7-Zip", 0);
return 0;
@@ -95,6 +92,17 @@ int Main2()
throw CSystemException(result);
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
+ if (codecs->Formats.Size() == 0 &&
+ (isExtractGroupCommand ||
+ options.Command.IsFromUpdateGroup()))
+ throw kNoFormats;
+
+ CIntVector formatIndices;
+ if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices))
+ {
+ ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE, 0x0200060D);
+ return NExitCode::kFatalError;
+ }
if (options.Command.CommandType == NCommandType::kBenchmark)
{
@@ -115,10 +123,6 @@ int Main2()
ecs->Password = options.Password;
ecs->Init();
- COpenCallbackGUI openCallback;
- openCallback.PasswordIsDefined = options.PasswordEnabled;
- openCallback.Password = options.Password;
-
CExtractOptions eo;
eo.StdOutMode = options.StdOutMode;
eo.OutputDir = options.OutputDir;
@@ -130,25 +134,21 @@ int Main2()
eo.Properties = options.ExtractProperties;
#endif
- HRESULT result = ExtractGUI(codecs,
- options.ArchivePathsSorted,
+ HRESULT result = ExtractGUI(codecs, formatIndices,
+ options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
- eo, options.ShowDialog, &openCallback, ecs);
+ options.WildcardCensor.Pairs.Front().Head,
+ eo, options.ShowDialog, ecs);
if (result != S_OK)
throw CSystemException(result);
if (ecs->Messages.Size() > 0 || ecs->NumArchiveErrors != 0)
- return NExitCode::kFatalError;
+ return NExitCode::kFatalError;
}
else if (options.Command.IsFromUpdateGroup())
{
- bool passwordIsDefined =
+ bool passwordIsDefined =
options.PasswordEnabled && !options.Password.IsEmpty();
- COpenCallbackGUI openCallback;
- openCallback.PasswordIsDefined = passwordIsDefined;
- openCallback.Password = options.Password;
-
CUpdateCallbackGUI callback;
// callback.EnablePercents = options.EnablePercents;
callback.PasswordIsDefined = passwordIsDefined;
@@ -159,27 +159,33 @@ int Main2()
CUpdateErrorInfo errorInfo;
- if (!options.UpdateOptions.Init(codecs, options.ArchiveName, options.ArcType))
- throw "Unsupported archive type";
+ if (!options.UpdateOptions.Init(codecs, formatIndices, options.ArchiveName))
+ {
+ ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED, 0x02000601);
+ return NExitCode::kFatalError;
+ }
HRESULT result = UpdateGUI(
codecs,
- options.WildcardCensor, options.UpdateOptions,
+ options.WildcardCensor, options.UpdateOptions,
options.ShowDialog,
- errorInfo, &openCallback, &callback);
+ errorInfo, &callback);
if (result != S_OK)
{
if (!errorInfo.Message.IsEmpty())
+ {
ErrorMessage(errorInfo.Message);
+ if (result == E_FAIL)
+ return NExitCode::kFatalError;
+ }
throw CSystemException(result);
}
if (callback.FailedFiles.Size() > 0)
- return NExitCode::kWarning;
+ return NExitCode::kWarning;
}
else
{
- ErrorMessage(L"Use correct command");
- return 0;
+ throw "Unsupported command";
}
return 0;
}
@@ -188,7 +194,7 @@ static bool inline IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
+ if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
@@ -199,7 +205,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
#ifdef _UNICODE
if (!IsItWindowsNT())
{
- MyMessageBox(L"This program requires Windows NT/2000/XP/2003");
+ ErrorMessage(L"This program requires Windows NT/2000/2003/2008/XP/Vista");
return NExitCode::kFatalError;
}
#else
@@ -221,64 +227,43 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
}
catch(const CNewException &)
{
- MyMessageBox(kMemoryExceptionMessage);
- return (NExitCode::kMemoryError);
+ return ShowMemErrorMessage();
}
catch(const CArchiveCommandLineException &e)
{
- MyMessageBox(GetUnicodeString(e));
- return (NExitCode::kUserError);
+ ErrorMessage(GetUnicodeString(e));
+ return NExitCode::kUserError;
}
catch(const CSystemException &systemError)
{
- if (systemError.ErrorCode == E_OUTOFMEMORY)
- {
- MyMessageBox(kMemoryExceptionMessage);
- return (NExitCode::kMemoryError);
- }
if (systemError.ErrorCode == E_ABORT)
- {
- // MyMessageBox(kUserBreak);
- return (NExitCode::kUserBreak);
- }
- UString message;
- NError::MyFormatMessage(systemError.ErrorCode, message);
- MyMessageBox(message);
- return (NExitCode::kFatalError);
- }
- /*
- catch(NExitCode::EEnum &exitCode)
- {
- g_StdErr << kInternalExceptionMessage << exitCode << endl;
- return (exitCode);
+ return NExitCode::kUserBreak;
+ return ShowSysErrorMessage(systemError.ErrorCode);
}
- */
catch(const UString &s)
{
- MyMessageBox(s);
- return (NExitCode::kFatalError);
+ ErrorMessage(s);
+ return NExitCode::kFatalError;
}
catch(const AString &s)
{
- MyMessageBox(GetUnicodeString(s));
- return (NExitCode::kFatalError);
+ ErrorMessage(GetUnicodeString(s));
+ return NExitCode::kFatalError;
}
- catch(const char *s)
+ catch(const wchar_t *s)
{
- MyMessageBox(GetUnicodeString(s));
- return (NExitCode::kFatalError);
+ ErrorMessage(s);
+ return NExitCode::kFatalError;
}
- /*
- catch(int t)
+ catch(const char *s)
{
- g_StdErr << kInternalExceptionMessage << t << endl;
- return (NExitCode::kFatalError);
+ ErrorMessage(GetUnicodeString(s));
+ return NExitCode::kFatalError;
}
- */
catch(...)
{
- MyMessageBox(kUnknownExceptionMessage);
- return (NExitCode::kFatalError);
+ ErrorLangMessage(IDS_UNKNOWN_ERROR, 0x0200060C);
+ return NExitCode::kFatalError;
}
}
diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp
index b61ef92f..1de7ac97 100755
--- a/CPP/7zip/UI/GUI/GUI.dsp
+++ b/CPP/7zip/UI/GUI/GUI.dsp
@@ -561,14 +561,6 @@ SOURCE=.\GUI.cpp
# End Source File
# Begin Source File
-SOURCE=.\OpenCallbackGUI.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\OpenCallbackGUI.h
-# End Source File
-# Begin Source File
-
SOURCE=.\UpdateCallbackGUI.cpp
# End Source File
# Begin Source File
@@ -959,6 +951,10 @@ SOURCE=..\..\..\Windows\System.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Windows\Time.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Windows\Window.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/GUI/OpenCallbackGUI.cpp b/CPP/7zip/UI/GUI/OpenCallbackGUI.cpp
deleted file mode 100755
index 7717de99..00000000
--- a/CPP/7zip/UI/GUI/OpenCallbackGUI.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// OpenCallbackGUI.cpp
-
-#include "StdAfx.h"
-
-#include "OpenCallbackGUI.h"
-
-#ifndef _NO_CRYPTO
-#include "../FileManager/PasswordDialog.h"
-#endif
-
-HRESULT COpenCallbackGUI::CheckBreak()
-{
- return S_OK;
-}
-
-HRESULT COpenCallbackGUI::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
- return S_OK;
-}
-
-HRESULT COpenCallbackGUI::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
- return S_OK;
-}
-
-#ifndef _NO_CRYPTO
-HRESULT COpenCallbackGUI::CryptoGetTextPassword(BSTR *password)
-{
- PasswordWasAsked = true;
- if (!PasswordIsDefined)
- {
- CPasswordDialog dialog;
- if (dialog.Create(ParentWindow) == IDCANCEL)
- return E_ABORT;
- Password = dialog.Password;
- PasswordIsDefined = true;
- }
- CMyComBSTR tempName(Password);
- *password = tempName.Detach();
- return S_OK;
-}
-
-HRESULT COpenCallbackGUI::GetPasswordIfAny(UString &password)
-{
- if (PasswordIsDefined)
- password = Password;
- return S_OK;
-}
-
-bool COpenCallbackGUI::WasPasswordAsked()
-{
- return PasswordWasAsked;
-}
-
-void COpenCallbackGUI::ClearPasswordWasAskedFlag()
-{
- PasswordWasAsked = false;
-}
-
-#endif
-
diff --git a/CPP/7zip/UI/GUI/OpenCallbackGUI.h b/CPP/7zip/UI/GUI/OpenCallbackGUI.h
deleted file mode 100755
index 6b531d3c..00000000
--- a/CPP/7zip/UI/GUI/OpenCallbackGUI.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// OpenCallbackGUI.h
-
-#ifndef __OPEN_CALLBACK_GUI_H
-#define __OPEN_CALLBACK_GUI_H
-
-#include "../Common/ArchiveOpenCallback.h"
-
-class COpenCallbackGUI: public IOpenCallbackUI
-{
-public:
- HRESULT CheckBreak();
- HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes);
- HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes);
- #ifndef _NO_CRYPTO
- HRESULT CryptoGetTextPassword(BSTR *password);
- HRESULT GetPasswordIfAny(UString &password);
- bool WasPasswordAsked();
- void ClearPasswordWasAskedFlag();
-
- bool PasswordIsDefined;
- UString Password;
- bool PasswordWasAsked;
- #endif
-
- HWND ParentWindow;
-
- COpenCallbackGUI():
- #ifndef _NO_CRYPTO
- PasswordIsDefined(false),
- PasswordWasAsked(false),
- #endif
- ParentWindow(0) {}
-};
-
-#endif
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
index a17f0cac..7cd5df95 100755
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
@@ -41,9 +41,9 @@ void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message)
void CUpdateCallbackGUI::AddErrorMessage(const wchar_t *name, DWORD systemError)
{
AddErrorMessage(
- UString(L"WARNING: ") +
- NError::MyFormatMessageW(systemError) +
- UString(L": ") +
+ UString(L"WARNING: ") +
+ NError::MyFormatMessageW(systemError) +
+ UString(L": ") +
UString(name));
}
@@ -87,15 +87,14 @@ HRESULT CUpdateCallbackGUI::FinishArchive()
HRESULT CUpdateCallbackGUI::CheckBreak()
{
- for (;;)
- {
- if(ProgressDialog.ProgressSynch.GetStopped())
- return E_ABORT;
- if(!ProgressDialog.ProgressSynch.GetPaused())
- break;
- ::Sleep(100);
- }
- return S_OK;
+ return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+}
+
+HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, const wchar_t *path)
+{
+ ProgressDialog.ProgressSynch.SetCurrentFileName(path);
+ ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
+ return ProgressDialog.ProgressSynch.ProcessStopAndPause();
}
HRESULT CUpdateCallbackGUI::Finilize()
@@ -151,17 +150,17 @@ HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
{
NumFiles++;
ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
- return S_OK;
+ return S_OK;
}
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
- if (!PasswordIsDefined)
+ if (!PasswordIsDefined)
{
if (AskPassword)
{
CPasswordDialog dialog;
- if (dialog.Create(ParentWindow) == IDCANCEL)
+ if (dialog.Create(ProgressDialog) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
@@ -175,9 +174,63 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST
/*
It doesn't work, since main stream waits Dialog
-HRESULT CUpdateCallbackGUI::CloseProgress()
-{
- ProgressDialog.MyClose();
+HRESULT CUpdateCallbackGUI::CloseProgress()
+{
+ ProgressDialog.MyClose();
return S_OK;
};
-*/ \ No newline at end of file
+*/
+
+
+HRESULT CUpdateCallbackGUI::Open_CheckBreak()
+{
+ return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+}
+
+HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
+{
+ // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
+{
+ return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+}
+
+#ifndef _NO_CRYPTO
+
+HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
+{
+ PasswordWasAsked = true;
+ if (!PasswordIsDefined)
+ {
+ CPasswordDialog dialog;
+ if (dialog.Create(ProgressDialog) == IDCANCEL)
+ return E_ABORT;
+ Password = dialog.Password;
+ PasswordIsDefined = true;
+ }
+ CMyComBSTR tempName(Password);
+ *password = tempName.Detach();
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password)
+{
+ if (PasswordIsDefined)
+ password = Password;
+ return S_OK;
+}
+
+bool CUpdateCallbackGUI::Open_WasPasswordAsked()
+{
+ return PasswordWasAsked;
+}
+
+void CUpdateCallbackGUI::Open_ClearPasswordWasAskedFlag()
+{
+ PasswordWasAsked = false;
+}
+
+#endif
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
index dc370638..1f8b70e0 100755
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
@@ -4,19 +4,24 @@
#define __UPDATE_CALLBACK_GUI_H
#include "../Common/Update.h"
+#include "../Common/ArchiveOpenCallback.h"
#include "../FileManager/ProgressDialog2.h"
-class CUpdateCallbackGUI: public IUpdateCallbackUI2
+class CUpdateCallbackGUI:
+ public IOpenCallbackUI,
+ public IUpdateCallbackUI2
{
public:
// bool StdOutMode;
bool PasswordIsDefined;
UString Password;
bool AskPassword;
+ bool PasswordWasAsked;
UInt64 NumFiles;
- CUpdateCallbackGUI():
+ CUpdateCallbackGUI():
PasswordIsDefined(false),
+ PasswordWasAsked(false),
AskPassword(false),
// StdOutMode(false)
ParentWindow(0)
@@ -26,6 +31,7 @@ public:
void Init();
INTERFACE_IUpdateCallbackUI2(;)
+ INTERFACE_IOpenCallbackUI(;)
// HRESULT CloseProgress();
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp
index ca89c7c9..16edc718 100755
--- a/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp
@@ -23,7 +23,6 @@
#include "../Explorer/MyMessages.h"
#include "ExtractRes.h"
-#include "OpenCallbackGUI.h"
#include "CompressDialog.h"
#include "UpdateGUI.h"
@@ -41,7 +40,6 @@ struct CThreadUpdating
CUpdateCallbackGUI *UpdateCallbackGUI;
const NWildcard::CCensor *WildcardCensor;
CUpdateOptions *Options;
- COpenCallbackGUI *OpenCallback;
CUpdateErrorInfo *ErrorInfo;
HRESULT Result;
@@ -51,19 +49,19 @@ struct CThreadUpdating
UpdateCallbackGUI->ProgressDialog.WaitCreating();
try
{
- Result = UpdateArchive(codecs, *WildcardCensor, *Options,
- *ErrorInfo, OpenCallback, UpdateCallbackGUI);
+ Result = UpdateArchive(codecs, *WildcardCensor, *Options,
+ *ErrorInfo, UpdateCallbackGUI, UpdateCallbackGUI);
}
catch(const UString &s)
{
ErrorInfo->Message = s;
Result = E_FAIL;
- }
+ }
catch(const wchar_t *s)
{
ErrorInfo->Message = s;
Result = E_FAIL;
- }
+ }
catch(const char *s)
{
ErrorInfo->Message = GetUnicodeString(s);
@@ -126,7 +124,7 @@ static bool IsThereMethodOverride(bool is7z, const UString &propertiesString)
return false;
}
-static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
+static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
const UString &propertiesString)
{
UStringVector strings;
@@ -160,14 +158,14 @@ static UString GetNumInBytesString(UInt64 v)
static void SetOutProperties(
CObjectVector<CProperty> &properties,
bool is7z,
- UInt32 level,
+ UInt32 level,
bool setMethod,
const UString &method,
UInt32 dictionary,
bool orderMode,
UInt32 order,
- bool solidIsSpecified, UInt64 solidBlockSize,
- bool multiThreadIsAllowed, UInt32 numThreads,
+ bool solidIsSpecified, UInt64 solidBlockSize,
+ bool multiThreadIsAllowed, UInt32 numThreads,
const UString &encryptionMethod,
bool encryptHeadersIsAllowed, bool encryptHeaders,
bool /* sfxMode */)
@@ -247,7 +245,7 @@ static HRESULT ShowDialog(
if (NFind::FindFile(name, fileInfo))
{
if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
- oneFile = !fileInfo.IsDirectory();
+ oneFile = !fileInfo.IsDir();
}
}
}
@@ -263,7 +261,7 @@ static HRESULT ShowDialog(
}
if(dialog.m_ArchiverInfoList.Size() == 0)
{
- MyMessageBox(L"No Update Engines");
+ ShowErrorMessage(L"No Update Engines");
return E_FAIL;
}
@@ -324,13 +322,13 @@ static HRESULT ShowDialog(
SetOutProperties(
options.MethodMode.Properties,
is7z,
- di.Level,
+ di.Level,
!methodOverride,
- di.Method,
- di.Dictionary,
+ di.Method,
+ di.Dictionary,
di.OrderMode, di.Order,
- di.SolidIsSpecified, di.SolidBlockSize,
- di.MultiThreadIsAllowed, di.NumThreads,
+ di.SolidIsSpecified, di.SolidBlockSize,
+ di.MultiThreadIsAllowed, di.NumThreads,
di.EncryptionMethod,
di.EncryptHeadersIsAllowed, di.EncryptHeaders,
di.SFXMode);
@@ -364,11 +362,10 @@ static HRESULT ShowDialog(
HRESULT UpdateGUI(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
CUpdateErrorInfo &errorInfo,
- COpenCallbackGUI *openCallback,
CUpdateCallbackGUI *callback)
{
if (showDialog)
@@ -387,7 +384,6 @@ HRESULT UpdateGUI(
tu.WildcardCensor = &censor;
tu.Options = &options;
- tu.OpenCallback = openCallback;
tu.ErrorInfo = &errorInfo;
NWindows::CThread thread;
@@ -395,5 +391,3 @@ HRESULT UpdateGUI(
tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0));
return tu.Result;
}
-
-
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.h b/CPP/7zip/UI/GUI/UpdateGUI.h
index db58877b..112eff0f 100755
--- a/CPP/7zip/UI/GUI/UpdateGUI.h
+++ b/CPP/7zip/UI/GUI/UpdateGUI.h
@@ -4,18 +4,16 @@
#define __UPDATE_GUI_H
#include "../Common/Update.h"
-#include "OpenCallbackGUI.h"
#include "UpdateCallbackGUI.h"
#include "../FileManager/UpdateCallback100.h"
HRESULT UpdateGUI(
CCodecs *codecs,
- const NWildcard::CCensor &censor,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
CUpdateErrorInfo &errorInfo,
- COpenCallbackGUI *openCallback,
CUpdateCallbackGUI *callback);
#endif
diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile
index e37ce7d5..e2caf8ee 100755
--- a/CPP/7zip/UI/GUI/makefile
+++ b/CPP/7zip/UI/GUI/makefile
@@ -15,7 +15,6 @@ GUI_OBJS = \
$O\ExtractDialog.obj \
$O\ExtractGUI.obj \
$O\GUI.obj \
- $O\OpenCallbackGUI.obj \
$O\UpdateCallbackGUI.obj \
$O\UpdateGUI.obj \
@@ -50,6 +49,7 @@ WIN_OBJS = \
$O\Shell.obj \
$O\Synchronization.obj \
$O\System.obj \
+ $O\Time.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
diff --git a/CPP/7zip/UI/GUI/resource.h b/CPP/7zip/UI/GUI/resource.h
index 08517dec..e154e035 100755
--- a/CPP/7zip/UI/GUI/resource.h
+++ b/CPP/7zip/UI/GUI/resource.h
@@ -1,13 +1,13 @@
-#define IDS_CONTEXT_EXTRACT 42
-#define IDS_CONTEXT_EXTRACT_HELP 43
-#define IDS_CONTEXT_COMPRESS 44
-#define IDS_CONTEXT_COMPRESS_HELP 45
-#define IDS_CONTEXT_OPEN 46
-#define IDS_CONTEXT_OPEN_HELP 47
-#define IDS_CONTEXT_TEST 48
-#define IDS_CONTEXT_TEST_HELP 49
-#define IDS_CONTEXT_CAPTION_HELP 50
-#define IDS_CONTEXT_POPUP_CAPTION 51
+#define IDS_CONTEXT_EXTRACT 142
+#define IDS_CONTEXT_EXTRACT_HELP 143
+#define IDS_CONTEXT_COMPRESS 144
+#define IDS_CONTEXT_COMPRESS_HELP 145
+#define IDS_CONTEXT_OPEN 146
+#define IDS_CONTEXT_OPEN_HELP 147
+#define IDS_CONTEXT_TEST 148
+#define IDS_CONTEXT_TEST_HELP 149
+#define IDS_CONTEXT_CAPTION_HELP 150
+#define IDS_CONTEXT_POPUP_CAPTION 151
#define IDS_OPEN_TYPE_ALL_FILES 80
#define IDS_METHOD_STORE 81
@@ -39,7 +39,7 @@
#define IDS_PASSWORD_USE_ASCII 110
#define IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH 111
-#define IDS_PASSWORD_IS_TOO_LONG 112
+#define IDS_PASSWORD_IS_TOO_LONG 112
#define IDS_FILES_COLON 2274
#define IDS_FOLDERS_COLON 2275
@@ -47,7 +47,3 @@
#define IDS_COMPRESSED_COLON 2277
#define IDS_ARCHIVES_COLON 2278
-#define IDB_DELETE 149
-#define IDC_LIST1 1067
-#define IDC_COLUMN_EDIT_WIDTH 1068
-