From 47f491561151c4f4bb2a8d2757daca476476c526 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Tue, 5 Jul 2005 00:00:00 +0000 Subject: [PATCH] 4.24 beta --- 7zip/Archive/7z/StdAfx.h | 1 + 7zip/Archive/7z/resource.rc | 8 +- 7zip/Archive/Tar/StdAfx.h | 1 + 7zip/Archive/Tar/TarIn.cpp | 5 + 7zip/Archive/Tar/resource.rc | 8 +- 7zip/Bundles/Alone/StdAfx.h | 3 +- 7zip/Bundles/Alone/resource.rc | 8 +- 7zip/Bundles/SFXCon/Main.cpp | 4 +- 7zip/Bundles/SFXCon/StdAfx.h | 1 + 7zip/Bundles/SFXCon/resource.rc | 8 +- 7zip/Bundles/SFXSetup/StdAfx.h | 1 + 7zip/Bundles/SFXSetup/resource.rc | 8 +- 7zip/Bundles/SFXWin/Main.cpp | 2 +- 7zip/Bundles/SFXWin/StdAfx.h | 2 + 7zip/Bundles/SFXWin/resource.rc | 8 +- 7zip/FileManager/EnumFormatEtc.cpp | 2 +- 7zip/FileManager/FSFolder.cpp | 4 +- 7zip/FileManager/MyCom2.h | 6 + 7zip/FileManager/Panel.h | 2 +- 7zip/FileManager/PanelDrag.cpp | 4 - 7zip/FileManager/PanelItemOpen.cpp | 15 +- 7zip/FileManager/PanelItems.cpp | 6 +- 7zip/FileManager/PanelListNotify.cpp | 2 +- 7zip/FileManager/PanelMenu.cpp | 21 +- 7zip/FileManager/PanelSelect.cpp | 2 +- .../Resource/AboutDialog/resource.rc | 2 +- .../BenchmarkDialog/BenchmarkDialog.cpp | 2 +- 7zip/FileManager/StdAfx.h | 20 +- 7zip/FileManager/resource.rc | 8 +- 7zip/UI/Agent/Agent.h | 4 +- 7zip/UI/Agent/AgentOut.cpp | 34 ++- 7zip/UI/Agent/ArchiveFolderOpen.cpp | 2 +- 7zip/UI/Common/ArchiveCommandLine.cpp | 76 +++++- 7zip/UI/Common/EnumDirItems.cpp | 162 ++++++++++--- 7zip/UI/Common/EnumDirItems.h | 2 +- 7zip/UI/Console/Main.cpp | 2 +- 7zip/UI/Console/StdAfx.h | 1 + 7zip/UI/Console/resource.rc | 8 +- 7zip/UI/Explorer/ContextMenu.cpp | 86 +++++-- 7zip/UI/Explorer/ContextMenu.h | 27 +-- 7zip/UI/Explorer/DllExports.cpp | 224 +++++++++++++++--- 7zip/UI/Explorer/StdAfx.h | 11 +- 7zip/UI/Explorer/resource.rc | 8 +- 7zip/UI/Far/Far.dsp | 8 + 7zip/UI/Far/Far.rc | 8 +- 7zip/UI/Far/Main.cpp | 12 - 7zip/UI/Far/Plugin.h | 10 - 7zip/UI/Far/PluginCommon.cpp | 6 - 7zip/UI/Far/PluginWrite.cpp | 8 +- 7zip/UI/Far/StdAfx.h | 6 +- 7zip/UI/GUI/CompressDialog.cpp | 16 +- 7zip/UI/GUI/CompressDialog.h | 1 + 7zip/UI/GUI/StdAfx.h | 2 + 7zip/UI/GUI/UpdateGUI.cpp | 6 +- 7zip/UI/GUI/resource.rc | 8 +- Common/Alloc.cpp | 8 +- Common/Alloc.h | 8 +- Common/NewHandler.cpp | 16 +- Common/NewHandler.h | 6 + Common/Wildcard.cpp | 102 ++++---- Common/Wildcard.h | 29 ++- DOC/7zC.txt | 4 +- DOC/7zip.nsi | 37 ++- DOC/history.txt | 5 + DOC/lzma.txt | 4 +- DOC/readme.txt | 2 +- 66 files changed, 757 insertions(+), 366 deletions(-) diff --git a/7zip/Archive/7z/StdAfx.h b/7zip/Archive/7z/StdAfx.h index e7fb6986..2e4be10b 100755 --- a/7zip/Archive/7z/StdAfx.h +++ b/7zip/Archive/7z/StdAfx.h @@ -4,5 +4,6 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" #endif diff --git a/7zip/Archive/7z/resource.rc b/7zip/Archive/7z/resource.rc index 95e124a0..7adf8c51 100755 --- a/7zip/Archive/7z/resource.rc +++ b/7zip/Archive/7z/resource.rc @@ -75,8 +75,8 @@ IDI_ICON1 ICON DISCARDABLE "7z.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -94,14 +94,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7z Plugin for 7-Zip\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7z\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7z.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/Archive/Tar/StdAfx.h b/7zip/Archive/Tar/StdAfx.h index e7fb6986..2e4be10b 100755 --- a/7zip/Archive/Tar/StdAfx.h +++ b/7zip/Archive/Tar/StdAfx.h @@ -4,5 +4,6 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" #endif diff --git a/7zip/Archive/Tar/TarIn.cpp b/7zip/Archive/Tar/TarIn.cpp index 92045e80..f9bfacd6 100755 --- a/7zip/Archive/Tar/TarIn.cpp +++ b/7zip/Archive/Tar/TarIn.cpp @@ -206,6 +206,11 @@ HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) item.LongLinkSize = item.HeaderPosition - headerPosition; item.HeaderPosition = headerPosition; } + else if (item.LinkFlag == 'g' || item.LinkFlag == 'x') + { + // pax Extended Header + return S_OK; + } else if (item.LinkFlag > '7' || (item.LinkFlag < '0' && item.LinkFlag != 0)) return S_FALSE; return S_OK; diff --git a/7zip/Archive/Tar/resource.rc b/7zip/Archive/Tar/resource.rc index 33ef30b2..71059be7 100755 --- a/7zip/Archive/Tar/resource.rc +++ b/7zip/Archive/Tar/resource.rc @@ -75,8 +75,8 @@ IDI_ICON1 ICON DISCARDABLE "Tar.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,13,0,0 - PRODUCTVERSION 4,13,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -94,14 +94,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "Tar Plugin for 7-Zip\0" - VALUE "FileVersion", "4, 13, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "tar\0" VALUE "LegalCopyright", "Copyright (C) 1999-2004 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "tar.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 13, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/Bundles/Alone/StdAfx.h b/7zip/Bundles/Alone/StdAfx.h index 92239aeb..2e4be10b 100755 --- a/7zip/Bundles/Alone/StdAfx.h +++ b/7zip/Bundles/Alone/StdAfx.h @@ -4,5 +4,6 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" -#endif +#endif diff --git a/7zip/Bundles/Alone/resource.rc b/7zip/Bundles/Alone/resource.rc index 3e77b476..380b9739 100755 --- a/7zip/Bundles/Alone/resource.rc +++ b/7zip/Bundles/Alone/resource.rc @@ -66,8 +66,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -85,14 +85,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7-Zip Standalone Console version\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7za\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7za.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/Bundles/SFXCon/Main.cpp b/7zip/Bundles/SFXCon/Main.cpp index 20b775d6..c7a8a755 100755 --- a/7zip/Bundles/SFXCon/Main.cpp +++ b/7zip/Bundles/SFXCon/Main.cpp @@ -34,7 +34,7 @@ using namespace NCommandLineParser; extern CStdOutStream *g_StdStream; static const char *kCopyrightString = -"\n7-Zip SFX 4.23 Copyright (c) 1999-2005 Igor Pavlov 2005-06-29\n"; +"\n7-Zip SFX 4.24 beta Copyright (c) 1999-2005 Igor Pavlov 2005-07-06\n"; static const int kNumSwitches = 6; @@ -244,7 +244,7 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor, recursed = false; break; } - wildcardCensor.AddItem(name, include, recursed); + wildcardCensor.AddItem(include, name, recursed); return true; } diff --git a/7zip/Bundles/SFXCon/StdAfx.h b/7zip/Bundles/SFXCon/StdAfx.h index e7fb6986..2e4be10b 100755 --- a/7zip/Bundles/SFXCon/StdAfx.h +++ b/7zip/Bundles/SFXCon/StdAfx.h @@ -4,5 +4,6 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" #endif diff --git a/7zip/Bundles/SFXCon/resource.rc b/7zip/Bundles/SFXCon/resource.rc index 082ec718..472c350f 100755 --- a/7zip/Bundles/SFXCon/resource.rc +++ b/7zip/Bundles/SFXCon/resource.rc @@ -75,8 +75,8 @@ IDI_ICON1 ICON DISCARDABLE "7z.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -94,14 +94,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7z SFX (Console version)\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7zCon.sfx\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7zCon.sfx\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/Bundles/SFXSetup/StdAfx.h b/7zip/Bundles/SFXSetup/StdAfx.h index eb294d41..19ece34b 100755 --- a/7zip/Bundles/SFXSetup/StdAfx.h +++ b/7zip/Bundles/SFXSetup/StdAfx.h @@ -4,6 +4,7 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" #include #endif diff --git a/7zip/Bundles/SFXSetup/resource.rc b/7zip/Bundles/SFXSetup/resource.rc index 9f7bcf40..55746979 100755 --- a/7zip/Bundles/SFXSetup/resource.rc +++ b/7zip/Bundles/SFXSetup/resource.rc @@ -76,8 +76,8 @@ IDI_ICON3 ICON DISCARDABLE "setup.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -95,14 +95,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7z Self-Extract Setup\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7zS.sfx\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7zS.sfx\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/Bundles/SFXWin/Main.cpp b/7zip/Bundles/SFXWin/Main.cpp index ca6bb1b5..e037e10e 100755 --- a/7zip/Bundles/SFXWin/Main.cpp +++ b/7zip/Bundles/SFXWin/Main.cpp @@ -76,7 +76,7 @@ int APIENTRY WinMain( v1.Add(fullPath); v2.Add(fullPath); NWildcard::CCensorNode wildcardCensor; - wildcardCensor.AddItem(L"*", true, true, true, true); + wildcardCensor.AddItem(true, L"*", true, true, true); HRESULT result = ExtractGUI(v1, v2, wildcardCensor, eo, (assumeYes ? false: true), &openCallback, ecs); diff --git a/7zip/Bundles/SFXWin/StdAfx.h b/7zip/Bundles/SFXWin/StdAfx.h index 72988efa..c5f7231f 100755 --- a/7zip/Bundles/SFXWin/StdAfx.h +++ b/7zip/Bundles/SFXWin/StdAfx.h @@ -4,6 +4,8 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" + #include #include diff --git a/7zip/Bundles/SFXWin/resource.rc b/7zip/Bundles/SFXWin/resource.rc index 44a10fca..c87aea9b 100755 --- a/7zip/Bundles/SFXWin/resource.rc +++ b/7zip/Bundles/SFXWin/resource.rc @@ -80,8 +80,8 @@ IDI_ICON3 ICON DISCARDABLE "7z.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -99,14 +99,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7z SFX\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7zWin.sfx\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7zWin.sfx\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/FileManager/EnumFormatEtc.cpp b/7zip/FileManager/EnumFormatEtc.cpp index 3734b9ab..1fa46918 100755 --- a/7zip/FileManager/EnumFormatEtc.cpp +++ b/7zip/FileManager/EnumFormatEtc.cpp @@ -46,7 +46,7 @@ CEnumFormatEtc::CEnumFormatEtc(const FORMATETC *pFormatEtc, ULONG numFormats) if(m_Formats) { m_NumFormats = numFormats; - for(int i = 0; i < numFormats; i++) + for(ULONG i = 0; i < numFormats; i++) DeepCopyFormatEtc(&m_Formats[i], &pFormatEtc[i]); } } diff --git a/7zip/FileManager/FSFolder.cpp b/7zip/FileManager/FSFolder.cpp index 81963552..a6cf5701 100755 --- a/7zip/FileManager/FSFolder.cpp +++ b/7zip/FileManager/FSFolder.cpp @@ -133,12 +133,12 @@ bool CFSFolder::LoadComments() UInt64 length; if (!file.GetLength(length)) return false; - if (length >= 0xFFFFFFF) + if (length >= (1 << 28)) return false; AString s; char *p = s.GetBuffer((size_t)length + 1); UINT32 processedSize; - file.Read(p, length, processedSize); + file.Read(p, (UInt32)length, processedSize); p[length] = 0; s.ReleaseBuffer(); s.Replace("\r\n", "\n"); diff --git a/7zip/FileManager/MyCom2.h b/7zip/FileManager/MyCom2.h index 01b2a1f7..756a8169 100755 --- a/7zip/FileManager/MyCom2.h +++ b/7zip/FileManager/MyCom2.h @@ -38,5 +38,11 @@ STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); if ( MY_QUERYINTERFACE_ENTRY(i2) \ ) +#define MY_UNKNOWN_IMP3_MT(i1, i2, i3) MY_UNKNOWN_IMP_SPEC_MT2( \ + i1, \ + MY_QUERYINTERFACE_ENTRY(i1) \ + MY_QUERYINTERFACE_ENTRY(i2) \ + MY_QUERYINTERFACE_ENTRY(i3) \ + ) #endif diff --git a/7zip/FileManager/Panel.h b/7zip/FileManager/Panel.h index 27323ec3..e6d91838 100755 --- a/7zip/FileManager/Panel.h +++ b/7zip/FileManager/Panel.h @@ -321,7 +321,7 @@ public: CItemProperties _properties; CItemProperties _visibleProperties; - int _sortID; + PROPID _sortID; // int _sortIndex; bool _ascending; diff --git a/7zip/FileManager/PanelDrag.cpp b/7zip/FileManager/PanelDrag.cpp index fd48f5ba..2a563953 100755 --- a/7zip/FileManager/PanelDrag.cpp +++ b/7zip/FileManager/PanelDrag.cpp @@ -235,14 +235,10 @@ static bool CopyNamesToHGlobal(NMemory::CGlobal &hgDrop, const CSysStringVector { const CSysString &s = names[i]; int fullLength = s.Length() + 1; - if (fullLength > totalLength) - return false; // error: name was changed! lstrcpy(p, s); p += fullLength; totalLength -= fullLength; } - if (totalLength == 0) - return false; *p = 0; return true; } diff --git a/7zip/FileManager/PanelItemOpen.cpp b/7zip/FileManager/PanelItemOpen.cpp index fad0cb83..f913ec77 100755 --- a/7zip/FileManager/PanelItemOpen.cpp +++ b/7zip/FileManager/PanelItemOpen.cpp @@ -7,6 +7,7 @@ #include "Common/StringConvert.h" #include "Common/Random.h" #include "Common/StringConvert.h" +#include "Common/AutoPtr.h" #include "Windows/FileDir.h" #include "Windows/FileFind.h" @@ -315,8 +316,9 @@ public: static DWORD WINAPI MyThreadFunction(void *param) { - // CTmpProcessInfo *tmpProcessInfo = (CTmpProcessInfo *)param; - std::auto_ptr tmpProcessInfo((CTmpProcessInfo *)param); + CMyAutoPtr tmpProcessInfoPtr((CTmpProcessInfo *)param); + CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get(); + HANDLE hProcess = tmpProcessInfo->ProcessHandle; HANDLE events[2] = { g_ExitEventLauncher._exitEvent, hProcess}; DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE); @@ -337,7 +339,7 @@ static DWORD WINAPI MyThreadFunction(void *param) 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.get()) != 1) + if (SendMessage(tmpProcessInfo->Window, kOpenItemChanged, 0, (LONG_PTR)tmpProcessInfo) != 1) { ::MessageBoxW(g_HWND, MyFormatNew(IDS_CANNOT_UPDATE_FILE, 0x03020281, GetUnicodeString(tmpProcessInfo->FilePath)), L"7-Zip", MB_OK | MB_ICONSTOP); @@ -386,7 +388,8 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, UString tempFilePath = tempDirNorm + name; - std::auto_ptr tmpProcessInfo(new CTmpProcessInfo()); + CMyAutoPtr tmpProcessInfoPtr(new CTmpProcessInfo()); + CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get(); tmpProcessInfo->FolderPath = tempDir; tmpProcessInfo->FilePath = tempFilePath; if (!NFind::FindFile(tempFilePath, tmpProcessInfo->FileInfo)) @@ -422,10 +425,10 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, tmpProcessInfo->ProcessHandle = hProcess; CThread thread; - if (!thread.Create(MyThreadFunction, tmpProcessInfo.get())) + if (!thread.Create(MyThreadFunction, tmpProcessInfo)) throw 271824; tempDirectory.DisableDeleting(); - tmpProcessInfo.release(); + tmpProcessInfoPtr.release(); tmpProcessInfoRelease._needDelete = false; } diff --git a/7zip/FileManager/PanelItems.cpp b/7zip/FileManager/PanelItems.cpp index ee62da57..de52c3ec 100755 --- a/7zip/FileManager/PanelItems.cpp +++ b/7zip/FileManager/PanelItems.cpp @@ -98,8 +98,8 @@ void CPanel::InitColumns() UINT32 numProperties; enumProperties->GetNumberOfProperties(&numProperties); - UINT32 i; - for (i = 0; i < numProperties; i++) + int i; + for (i = 0; i < (int)numProperties; i++) { CMyComBSTR name; PROPID propID; @@ -360,7 +360,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, // OutputDebugStringA("S1\n"); - for(int i = 0; i < numItems; i++) + for(UInt32 i = 0; i < numItems; i++) { UString itemName = GetItemName(i); if (itemName.CompareNoCase(focusedName) == 0) diff --git a/7zip/FileManager/PanelListNotify.cpp b/7zip/FileManager/PanelListNotify.cpp index 0207ee90..53c51171 100755 --- a/7zip/FileManager/PanelListNotify.cpp +++ b/7zip/FileManager/PanelListNotify.cpp @@ -260,12 +260,12 @@ bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result) case NM_CUSTOMDRAW: return OnCustomDraw((LPNMLVCUSTOMDRAW)header, result); case LVN_BEGINDRAG: - case LVN_BEGINRDRAG: { OnDrag((LPNMLISTVIEW)header); RefreshStatusBar(); break; } + // case LVN_BEGINRDRAG: } return false; } diff --git a/7zip/FileManager/PanelMenu.cpp b/7zip/FileManager/PanelMenu.cpp index c7919188..d4336fdd 100755 --- a/7zip/FileManager/PanelMenu.cpp +++ b/7zip/FileManager/PanelMenu.cpp @@ -63,7 +63,7 @@ void CPanel::CreateShellContextMenu( CMyComPtr &systemContextMenu) { systemContextMenu.Release(); - UString folderPath = GetUnicodeString(_currentFolderPrefix); + UString folderPath = _currentFolderPrefix; CMyComPtr desktopFolder; ::SHGetDesktopFolder(&desktopFolder); @@ -255,18 +255,14 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec, // menu.CreatePopup(); bool sevenZipMenuCreated = false; - UString currentFolderUnicode; - UString folder = GetUnicodeString(_currentFolderPrefix); - CSysString currentFolderSys = GetSystemString(_currentFolderPrefix); CMyComPtr contextMenu; if (contextMenu.CoCreateInstance(CLSID_CZipContextMenu, IID_IContextMenu) == S_OK) { CMyComPtr initContextMenu; - if (contextMenu.QueryInterface(IID_IInitContextMenu, - &initContextMenu) != S_OK) + if (contextMenu.QueryInterface(IID_IInitContextMenu, &initContextMenu) != S_OK) return; - currentFolderUnicode = GetUnicodeString(_currentFolderPrefix);; + UString currentFolderUnicode = _currentFolderPrefix; UStringVector names; for(int i = 0; i < operatedIndices.Size(); i++) names.Add(currentFolderUnicode + GetItemName(operatedIndices[i])); @@ -274,13 +270,12 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec, for(i = 0; i < operatedIndices.Size(); i++) namePointers.Add(names[i]); - ::SetCurrentDirectory(::GetSystemString(_currentFolderPrefix)); - if (initContextMenu->InitContextMenu(folder, &namePointers.Front(), + // NFile::NDirectory::MySetCurrentDirectory(currentFolderUnicode); + if (initContextMenu->InitContextMenu(currentFolderUnicode, &namePointers.Front(), operatedIndices.Size()) == S_OK) { - HRESULT res = contextMenu->QueryContextMenu(menu, 0, - kSevenZipStartMenuID, - kSystemStartMenuID - 1, 0); + HRESULT res = contextMenu->QueryContextMenu(menu, 0, kSevenZipStartMenuID, + kSystemStartMenuID - 1, 0); sevenZipMenuCreated = (HRESULT_SEVERITY(res) == SEVERITY_SUCCESS); if (sevenZipMenuCreated) sevenZipContextMenu = contextMenu; @@ -341,7 +336,7 @@ bool CPanel::InvokePluginCommand(int id, commandInfo.lpTitle = ""; commandInfo.lpVerbW = LPCWSTR(offset); commandInfo.lpParameters = NULL; - UString currentFolderUnicode = GetUnicodeString(_currentFolderPrefix);; + UString currentFolderUnicode = _currentFolderPrefix; commandInfo.lpDirectoryW = currentFolderUnicode; commandInfo.lpTitleW = L""; // commandInfo.ptInvoke.x = xPos; diff --git a/7zip/FileManager/PanelSelect.cpp b/7zip/FileManager/PanelSelect.cpp index 5c7024e3..026520de 100755 --- a/7zip/FileManager/PanelSelect.cpp +++ b/7zip/FileManager/PanelSelect.cpp @@ -144,7 +144,7 @@ void CPanel::SelectByType(bool selectMode) UINT32 numItems; _folder->GetNumberOfItems(&numItems); - if (_selectedStatusVector.Size() != numItems) + if ((UInt32)_selectedStatusVector.Size() != numItems) throw 11111; if (isItemFolder) diff --git a/7zip/FileManager/Resource/AboutDialog/resource.rc b/7zip/FileManager/Resource/AboutDialog/resource.rc index ca3f50d4..fe8edf5a 100755 --- a/7zip/FileManager/Resource/AboutDialog/resource.rc +++ b/7zip/FileManager/Resource/AboutDialog/resource.rc @@ -83,7 +83,7 @@ BEGIN PUSHBUTTON "Support",IDC_ABOUT_BUTTON_EMAIL,136,30,94,14 PUSHBUTTON "Register",IDC_ABOUT_BUTTON_REGISTER,136,53,94,14 ICON IDI_LOGO,IDC_STATIC,7,7,20,20,SS_REALSIZEIMAGE - LTEXT "7-Zip 4.23",IDC_STATIC,7,54,119,9 + LTEXT "7-Zip 4.24 beta",IDC_STATIC,7,54,119,9 LTEXT "Copyright (c) 1999-2005 Igor Pavlov",IDC_STATIC,7,67, 119,17 LTEXT "7-Zip is free software. However, you can support development of 7-Zip by registering.", diff --git a/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp b/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp index 416f388d..cfb976ba 100755 --- a/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp +++ b/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp @@ -244,7 +244,7 @@ static UInt64 GetMemoryUsage(UInt32 dictionary) UInt32 CBenchmarkDialog::OnChangeDictionary() { - UInt64 dictionary = m_Dictionary.GetItemData(m_Dictionary.GetCurSel()); + UInt32 dictionary = (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel()); UInt64 memUsage = GetMemoryUsage(dictionary); memUsage = (memUsage + (1 << 20) - 1) >> 20; TCHAR s[40]; diff --git a/7zip/FileManager/StdAfx.h b/7zip/FileManager/StdAfx.h index 1adf6737..e0b5d6e5 100755 --- a/7zip/FileManager/StdAfx.h +++ b/7zip/FileManager/StdAfx.h @@ -16,26 +16,8 @@ #include #include -/* - // #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include - -extern CComModule _Module; - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -*/ -#include +#include "Common/NewHandler.h" #endif diff --git a/7zip/FileManager/resource.rc b/7zip/FileManager/resource.rc index cc6e7475..80467bb1 100755 --- a/7zip/FileManager/resource.rc +++ b/7zip/FileManager/resource.rc @@ -82,8 +82,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -101,14 +101,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7-Zip File Manager\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7zFM\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7zFM.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/UI/Agent/Agent.h b/7zip/UI/Agent/Agent.h index a2325daf..e631d2bb 100755 --- a/7zip/UI/Agent/Agent.h +++ b/7zip/UI/Agent/Agent.h @@ -3,8 +3,6 @@ #ifndef __AGENT_AGENT_H #define __AGENT_AGENT_H -#include - #include "Common/MyCom.h" #include "Windows/PropVariant.h" @@ -260,7 +258,7 @@ public: #ifndef EXTRACT_ONLY CObjectVector m_PropNames; - std::vector m_PropValues; + CObjectVector m_PropValues; #endif IInArchive *GetArchive() { return _archiveLink.GetArchive(); } diff --git a/7zip/UI/Agent/AgentOut.cpp b/7zip/UI/Agent/AgentOut.cpp index 08dc73e6..5d2b4bba 100755 --- a/7zip/UI/Agent/AgentOut.cpp +++ b/7zip/UI/Agent/AgentOut.cpp @@ -81,7 +81,7 @@ STDMETHODIMP CAgent::SetFiles(const wchar_t *folderPrefix, _folderPrefix = folderPrefix; _names.Clear(); _names.Reserve(numNames); - for (int i = 0; i < numNames; i++) + for (UINT32 i = 0; i < numNames; i++) _names.Add(names[i]); return S_OK; } @@ -249,12 +249,23 @@ STDMETHODIMP CAgent::DoOperation( for(i = 0; i < m_PropNames.Size(); i++) names.Add((const wchar_t *)m_PropNames[i]); - RINOK(setProperties->SetProperties(&names.Front(), - &m_PropValues.front(), names.Size())); + NWindows::NCOM::CPropVariant *propValues = new NWindows::NCOM::CPropVariant[m_PropValues.Size()]; + try + { + for (int i = 0; i < m_PropValues.Size(); i++) + propValues[i] = m_PropValues[i]; + RINOK(setProperties->SetProperties(&names.Front(), propValues, names.Size())); + } + catch(...) + { + delete []propValues; + throw; + } + delete []propValues; } } m_PropNames.Clear(); - m_PropValues.clear(); + m_PropValues.Clear(); if (sfxModule != NULL) { @@ -265,8 +276,7 @@ STDMETHODIMP CAgent::DoOperation( RINOK(CopyBlock(sfxStream, outStream)); } - return outArchive->UpdateItems(outStream, updatePairs2.Size(), - updateCallback); + return outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback); } @@ -340,9 +350,9 @@ STDMETHODIMP CAgent::DeleteItems( _archiveFolderItem->GetRealIndices(indices, numItems, realIndices); CObjectVector updatePairs; int curIndex = 0; - UINT32 numItemsInArchive; + UInt32 numItemsInArchive; RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive)); - for (int i = 0; i < numItemsInArchive; i++) + for (UInt32 i = 0; i < numItemsInArchive; i++) { if (curIndex < realIndices.Size()) if (realIndices[curIndex] == i) @@ -379,7 +389,7 @@ HRESULT CAgent::CreateFolder( CObjectVector updatePairs; UINT32 numItemsInArchive; RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive)); - for (int i = 0; i < numItemsInArchive; i++) + for (UInt32 i = 0; i < numItemsInArchive; i++) { CUpdatePair2 updatePair; updatePair.NewData = updatePair.NewProperties = false; @@ -450,7 +460,7 @@ HRESULT CAgent::RenameItem( int curIndex = 0; UINT32 numItemsInArchive; RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive)); - for (int i = 0; i < numItemsInArchive; i++) + for (UInt32 i = 0; i < numItemsInArchive; i++) { if (curIndex < realIndices.Size()) if (realIndices[curIndex] == i) @@ -495,11 +505,11 @@ STDMETHODIMP CAgent::SetProperties(const wchar_t **names, const PROPVARIANT *values, INT32 numProperties) { m_PropNames.Clear(); - m_PropValues.clear(); + m_PropValues.Clear(); for (int i = 0; i < numProperties; i++) { m_PropNames.Add(names[i]); - m_PropValues.push_back(values[i]); + m_PropValues.Add(values[i]); } return S_OK; } diff --git a/7zip/UI/Agent/ArchiveFolderOpen.cpp b/7zip/UI/Agent/ArchiveFolderOpen.cpp index 7a843c3f..0cc088cf 100755 --- a/7zip/UI/Agent/ArchiveFolderOpen.cpp +++ b/7zip/UI/Agent/ArchiveFolderOpen.cpp @@ -38,7 +38,7 @@ STDMETHODIMP CArchiveFolderManager::OpenFolderFile(const wchar_t *filePath, progressWrapper.QueryInterface(IID_IArchiveOpenCallback, &openArchiveCallback); } CAgent *agent = new CAgent(); - CComPtr archive = agent; + CMyComPtr archive = agent; RINOK(agent->Open(filePath, NULL, openArchiveCallback)); return agent->BindToRootFolder(resultFolder); } diff --git a/7zip/UI/Common/ArchiveCommandLine.cpp b/7zip/UI/Common/ArchiveCommandLine.cpp index 28b9e7ea..95ce1bc8 100755 --- a/7zip/UI/Common/ArchiveCommandLine.cpp +++ b/7zip/UI/Common/ArchiveCommandLine.cpp @@ -228,7 +228,7 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor, recursed = false; break; } - wildcardCensor.AddItem(name, include, recursed); + wildcardCensor.AddItem(include, name, recursed); return true; } @@ -374,6 +374,72 @@ static void AddSwitchWildCardsToCensor(NWildcard::CCensor &wildcardCensor, } } +#ifdef _WIN32 + +// This code converts all short file names to long file names. + +static void ConvertToLongName(const UString &prefix, UString &name) +{ + if (name.IsEmpty() || DoesNameContainWildCard(name)) + return; + NFind::CFileInfoW fileInfo; + if (NFind::FindFile(prefix + name, fileInfo)) + name = fileInfo.Name; +} + +static void ConvertToLongNames(const UString &prefix, CObjectVector &items) +{ + for (int i = 0; i < items.Size(); i++) + { + NWildcard::CItem &item = items[i]; + if (item.Recursive || item.PathParts.Size() != 1) + continue; + ConvertToLongName(prefix, item.PathParts.Front()); + } +} + +static void ConvertToLongNames(const UString &prefix, NWildcard::CCensorNode &node) +{ + ConvertToLongNames(prefix, node.IncludeItems); + ConvertToLongNames(prefix, node.ExcludeItems); + int i; + for (i = 0; i < node.SubNodes.Size(); i++) + ConvertToLongName(prefix, node.SubNodes[i].Name); + // mix folders with same name + for (i = 0; i < node.SubNodes.Size(); i++) + { + NWildcard::CCensorNode &nextNode1 = node.SubNodes[i]; + for (int j = i + 1; j < node.SubNodes.Size();) + { + const NWildcard::CCensorNode &nextNode2 = node.SubNodes[j]; + if (nextNode1.Name.CollateNoCase(nextNode2.Name) == 0) + { + nextNode1.IncludeItems += nextNode2.IncludeItems; + nextNode1.ExcludeItems += nextNode2.ExcludeItems; + node.SubNodes.Delete(j); + } + else + j++; + } + } + for (i = 0; i < node.SubNodes.Size(); i++) + { + NWildcard::CCensorNode &nextNode = node.SubNodes[i]; + ConvertToLongNames(prefix + nextNode.Name + wchar_t(NFile::NName::kDirDelimiter), nextNode); + } +} + +static void ConvertToLongNames(NWildcard::CCensor &censor) +{ + for (int i = 0; i < censor.Pairs.Size(); i++) + { + NWildcard::CPair &pair = censor.Pairs[i]; + ConvertToLongNames(pair.Prefix, pair.Head); + } +} + +#endif + static NUpdateArchive::NPairAction::EEnum GetUpdatePairActionType(int i) { switch(i) @@ -718,6 +784,10 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options) if (thereIsArchiveName) AddCommandLineWildCardToCensr(archiveWildcardCensor, options.ArchiveName, true, NRecursedType::kNonRecursed); + #ifdef _WIN32 + ConvertToLongNames(archiveWildcardCensor); + #endif + CObjectVector dirItems; UString errorPath; if (EnumerateItems(archiveWildcardCensor, dirItems, NULL, errorPath) != S_OK) @@ -826,6 +896,10 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options) throw kTerminalOutError; if(updateOptions.StdInMode) updateOptions.StdInFileName = parser[NKey::kStdIn].PostStrings.Front(); + + #ifdef _WIN32 + ConvertToLongNames(options.WildcardCensor); + #endif } else throw kUserErrorMessage; diff --git a/7zip/UI/Common/EnumDirItems.cpp b/7zip/UI/Common/EnumDirItems.cpp index c974647f..8b44b252 100755 --- a/7zip/UI/Common/EnumDirItems.cpp +++ b/7zip/UI/Common/EnumDirItems.cpp @@ -12,12 +12,10 @@ using namespace NWindows; using namespace NFile; using namespace NName; -// using namespace NUpdateArchive; - void AddDirFileInfo( - const UString &prefix, - const UString &fullPathName, - NFind::CFileInfoW &fileInfo, + const UString &prefix, // prefix for logical path + const UString &fullPathName, // path on disk: can be relative to some basePrefix + const NFind::CFileInfoW &fileInfo, CObjectVector &dirItems) { CDirItem item; @@ -32,9 +30,9 @@ void AddDirFileInfo( } static HRESULT EnumerateDirectory( - const UString &baseFolderPrefix, - const UString &directory, - const UString &prefix, + const UString &baseFolderPrefix, // base (disk) prefix for scanning + const UString &directory, // additional disk prefix starting from baseFolderPrefix + const UString &prefix, // logical prefix CObjectVector &dirItems, UString &errorPath) { @@ -51,8 +49,7 @@ static HRESULT EnumerateDirectory( } if (!found) break; - AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo, - dirItems); + AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo, dirItems); if (fileInfo.IsDirectory()) { RINOK(EnumerateDirectory(baseFolderPrefix, directory + fileInfo.Name + wchar_t(kDirDelimiter), @@ -63,8 +60,8 @@ static HRESULT EnumerateDirectory( } HRESULT EnumerateDirItems( - const UString &baseFolderPrefix, - const UStringVector &fileNames, + const UString &baseFolderPrefix, // base (disk) prefix for scanning + const UStringVector &fileNames, // names relative to baseFolderPrefix const UString &archiveNamePrefix, CObjectVector &dirItems, UString &errorPath) @@ -74,7 +71,11 @@ HRESULT EnumerateDirItems( const UString &fileName = fileNames[i]; NFind::CFileInfoW fileInfo; if (!NFind::FindFile(baseFolderPrefix + fileName, fileInfo)) - throw 1081736; + { + HRESULT error = ::GetLastError(); + errorPath = baseFolderPrefix + fileName; + return error; + } AddDirFileInfo(archiveNamePrefix, fileName, fileInfo, dirItems); if (fileInfo.IsDirectory()) { @@ -88,9 +89,9 @@ HRESULT EnumerateDirItems( static HRESULT EnumerateDirItems( const NWildcard::CCensorNode &curNode, - const UString &diskPrefix, - const UString &archivePrefix, - const UString &addArchivePrefix, + const UString &diskPrefix, // full disk path prefix + const UString &archivePrefix, // prefix from root + const UStringVector &addArchivePrefix, // prefix from curNode CObjectVector &dirItems, bool enterToSubFolders, IEnumDirItemCallback *callback, @@ -101,6 +102,107 @@ static HRESULT EnumerateDirItems( enterToSubFolders = true; if (callback) RINOK(callback->CheckBreak()); + + // try direct_names case at first + if (addArchivePrefix.IsEmpty() && !enterToSubFolders) + { + // check that all names are direct + int i; + for (i = 0; i < curNode.IncludeItems.Size(); i++) + { + const NWildcard::CItem &item = curNode.IncludeItems[i]; + if (item.Recursive || item.PathParts.Size() != 1) + break; + const UString &name = item.PathParts.Front(); + if (name.IsEmpty() || DoesNameContainWildCard(name)) + break; + } + if (i == curNode.IncludeItems.Size()) + { + // all names are direct (no wildcards) + // so we don't need file_system's dir enumerator + CRecordVector needEnterVector; + for (i = 0; i < curNode.IncludeItems.Size(); i++) + { + 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)) + { + HRESULT error = ::GetLastError(); + errorPath = fullPath; + return error; + } + bool isDir = fileInfo.IsDirectory(); + if (isDir && !item.ForDir || !isDir && !item.ForFile) + { + errorPath = fullPath; + return E_FAIL; + } + const UString realName = fileInfo.Name; + const UString realDiskPath = diskPrefix + realName; + { + UStringVector pathParts; + pathParts.Add(fileInfo.Name); + if (curNode.CheckPathToRoot(false, pathParts, !isDir)) + continue; + } + AddDirFileInfo(archivePrefix, realDiskPath, fileInfo, dirItems); + if (!isDir) + continue; + + UStringVector addArchivePrefixNew; + const NWildcard::CCensorNode *nextNode = 0; + int index = curNode.FindSubNode(name); + if (index >= 0) + { + for (int t = needEnterVector.Size(); t <= index; t++) + needEnterVector.Add(true); + needEnterVector[index] = false; + nextNode = &curNode.SubNodes[index]; + } + else + { + nextNode = &curNode; + addArchivePrefixNew.Add(name); // don't change it to realName. It's for shortnames support + } + RINOK(EnumerateDirItems(*nextNode, + realDiskPath + wchar_t(kDirDelimiter), + archivePrefix + realName + wchar_t(kDirDelimiter), + addArchivePrefixNew, dirItems, true, callback, errorPath)); + } + for (i = 0; i < curNode.SubNodes.Size(); i++) + { + if (i < needEnterVector.Size()) + 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)) + { + if (!nextNode.AreThereIncludeItems()) + continue; + HRESULT error = ::GetLastError(); + errorPath = fullPath; + return error; + } + if (!fileInfo.IsDirectory()) + { + errorPath = fullPath; + return E_FAIL; + } + RINOK(EnumerateDirItems(nextNode, + diskPrefix + fileInfo.Name + wchar_t(kDirDelimiter), + archivePrefix + fileInfo.Name + wchar_t(kDirDelimiter), + UStringVector(), dirItems, false, callback, errorPath)); + } + return S_OK; + } + } + + NFind::CEnumeratorW enumerator(diskPrefix + wchar_t(kAnyStringWildcard)); while (true) { @@ -117,13 +219,17 @@ static HRESULT EnumerateDirItems( if (callback) RINOK(callback->CheckBreak()); - UString name = fileInfo.Name; + const UString &name = fileInfo.Name; bool enterToSubFolders2 = enterToSubFolders; - if (curNode.CheckPathToRoot(addArchivePrefix + name, !fileInfo.IsDirectory())) + UStringVector addArchivePrefixNew = addArchivePrefix; + addArchivePrefixNew.Add(name); + if (curNode.CheckPathToRoot(false, UStringVector(addArchivePrefixNew), !fileInfo.IsDirectory())) + continue; + if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fileInfo.IsDirectory())) { - AddDirFileInfo(archivePrefix, diskPrefix + fileInfo.Name, fileInfo, dirItems); + AddDirFileInfo(archivePrefix, diskPrefix + name, fileInfo, dirItems); if (fileInfo.IsDirectory()) - enterToSubFolders2 = true;; + enterToSubFolders2 = true; } if (!fileInfo.IsDirectory()) continue; @@ -138,20 +244,16 @@ static HRESULT EnumerateDirItems( if (!enterToSubFolders2 && nextNode == 0) continue; - UString archivePrefixNew = archivePrefix; - UString addArchivePrefixNew = addArchivePrefix; + addArchivePrefixNew = addArchivePrefix; if (nextNode == 0) { nextNode = &curNode; - addArchivePrefixNew += name; - addArchivePrefixNew += wchar_t(kDirDelimiter); + addArchivePrefixNew.Add(name); } - archivePrefixNew += name; - archivePrefixNew += wchar_t(kDirDelimiter); RINOK(EnumerateDirItems(*nextNode, - diskPrefix + fileInfo.Name + wchar_t(kDirDelimiter), - archivePrefixNew, addArchivePrefixNew, - dirItems, enterToSubFolders2, callback, errorPath)); + diskPrefix + name + wchar_t(kDirDelimiter), + archivePrefix + name + wchar_t(kDirDelimiter), + addArchivePrefixNew, dirItems, enterToSubFolders2, callback, errorPath)); } return S_OK; } @@ -167,7 +269,7 @@ HRESULT EnumerateItems( if (callback) RINOK(callback->CheckBreak()); const NWildcard::CPair &pair = censor.Pairs[i]; - RINOK(EnumerateDirItems(pair.Head, pair.Prefix, L"", L"", dirItems, false, callback, errorPath)); + RINOK(EnumerateDirItems(pair.Head, pair.Prefix, L"", UStringVector(), dirItems, false, callback, errorPath)); } return S_OK; } diff --git a/7zip/UI/Common/EnumDirItems.h b/7zip/UI/Common/EnumDirItems.h index bb237149..ae0c95e5 100755 --- a/7zip/UI/Common/EnumDirItems.h +++ b/7zip/UI/Common/EnumDirItems.h @@ -11,7 +11,7 @@ void AddDirFileInfo( const UString &prefix, const UString &fullPathName, - NWindows::NFile::NFind::CFileInfoW &fileInfo, + const NWindows::NFile::NFind::CFileInfoW &fileInfo, CObjectVector &dirItems); diff --git a/7zip/UI/Console/Main.cpp b/7zip/UI/Console/Main.cpp index 383c6271..82e92b78 100755 --- a/7zip/UI/Console/Main.cpp +++ b/7zip/UI/Console/Main.cpp @@ -54,7 +54,7 @@ static const char *kCopyrightString = "\n7-Zip" " [NT]" #endif -" 4.23 Copyright (c) 1999-2005 Igor Pavlov 2005-06-29\n"; +" 4.24 beta Copyright (c) 1999-2005 Igor Pavlov 2005-07-06\n"; static const char *kHelpString = "\nUsage: 7z" diff --git a/7zip/UI/Console/StdAfx.h b/7zip/UI/Console/StdAfx.h index 92239aeb..8531cc9c 100755 --- a/7zip/UI/Console/StdAfx.h +++ b/7zip/UI/Console/StdAfx.h @@ -4,5 +4,6 @@ #define __STDAFX_H #include "../../../Common/MyWindows.h" +#include "../../../Common/NewHandler.h" #endif diff --git a/7zip/UI/Console/resource.rc b/7zip/UI/Console/resource.rc index eb64cda5..907a5559 100755 --- a/7zip/UI/Console/resource.rc +++ b/7zip/UI/Console/resource.rc @@ -66,8 +66,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -85,14 +85,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7-Zip Console version\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7z\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7z.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/UI/Explorer/ContextMenu.cpp b/7zip/UI/Explorer/ContextMenu.cpp index 46e76b7a..6c1b34bb 100755 --- a/7zip/UI/Explorer/ContextMenu.cpp +++ b/7zip/UI/Explorer/ContextMenu.cpp @@ -47,6 +47,11 @@ static LPCTSTR kFileClassIDString = TEXT("SevenZip"); /////////////////////////////// // IShellExtInit +extern LONG g_DllRefCount; + +CZipContextMenu::CZipContextMenu() { InterlockedIncrement(&g_DllRefCount); } +CZipContextMenu::~CZipContextMenu() { InterlockedDecrement(&g_DllRefCount); } + HRESULT CZipContextMenu::GetFileNames(LPDATAOBJECT dataObject, CSysStringVector &fileNames) { @@ -71,6 +76,22 @@ HRESULT CZipContextMenu::GetFileNames(LPDATAOBJECT dataObject, STDMETHODIMP CZipContextMenu::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT dataObject, HKEY hkeyProgID) { + // OutputDebugString(TEXT("::Initialize\r\n")); + _dropMode = false; + _dropPath.Empty(); + if (pidlFolder != 0) + { + CSysString path; + if (NShell::GetPathFromIDList(pidlFolder, path)) + { + _dropPath = GetUnicodeString(path); + // OutputDebugString(path); + // OutputDebugString(TEXT("\r\n")); + NFile::NName::NormalizeDirPathPrefix(_dropPath); + _dropMode = !_dropPath.IsEmpty(); + } + } + /* m_IsFolder = false; if (pidlFolder == 0) @@ -91,6 +112,7 @@ STDMETHODIMP CZipContextMenu::InitContextMenu(const wchar_t *folder, _fileNames.Clear(); for (UINT32 i = 0; i < numFiles; i++) _fileNames.Add(names[i]); + _dropMode = false; return S_OK; } @@ -288,7 +310,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, (flags & CMF_EXPLORE) == 0) return MAKE_HRESULT(SEVERITY_SUCCESS, 0, currentCommandID); - _commandMap.clear(); + _commandMap.Clear(); CMenu popupMenu; CMenuDestroyer menuDestroyer; @@ -305,7 +327,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, commandMapItem.CommandInternalID = kCommandNULL; commandMapItem.Verb = kMainVerb; commandMapItem.HelpString = LangLoadStringW(IDS_CONTEXT_CAPTION_HELP, 0x02000102); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); menuItem.wID = currentCommandID++; subIndex = 0; @@ -338,7 +360,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, CCommandMapItem commandMapItem; FillCommand(kOpen, mainString, commandMapItem); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(mainString)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } } } @@ -367,11 +389,13 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, { CCommandMapItem commandMapItem; FillCommand(kExtract, mainString, commandMapItem); - commandMapItem.Folder = folderPrefix + - GetSubFolderNameForExtract(fileInfo.Name) + - UString(L'\\'); + if (_dropMode) + commandMapItem.Folder = _dropPath; + else + commandMapItem.Folder = folderPrefix; + commandMapItem.Folder += GetSubFolderNameForExtract(fileInfo.Name) + UString(L'\\'); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(mainString)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } // Extract Here @@ -380,8 +404,11 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, CCommandMapItem commandMapItem; FillCommand(kExtractHere, mainString, commandMapItem); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(mainString)); - commandMapItem.Folder = folderPrefix; - _commandMap.push_back(commandMapItem); + if (_dropMode) + commandMapItem.Folder = _dropPath; + else + commandMapItem.Folder = folderPrefix; + _commandMap.Add(commandMapItem); } // Extract To @@ -396,10 +423,15 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, else folder = L'*'; folder += L'\\'; - commandMapItem.Folder = folderPrefix + folder; + + if (_dropMode) + commandMapItem.Folder = _dropPath; + else + commandMapItem.Folder = folderPrefix; + commandMapItem.Folder += folder; s = MyFormatNew(s, GetReducedString(folder)); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(s)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } // Test if ((contextMenuFlags & NContextMenuFlags::kTest) != 0) @@ -407,7 +439,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, CCommandMapItem commandMapItem; FillCommand(kTest, mainString, commandMapItem); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(mainString)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } } UString archiveName = CreateArchiveName(fileName, _fileNames.Size() > 1, false); @@ -419,11 +451,14 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, if ((contextMenuFlags & NContextMenuFlags::kCompress) != 0) { CCommandMapItem commandMapItem; - commandMapItem.Folder = archivePathPrefix; + if (_dropMode) + commandMapItem.Folder = _dropPath; + else + commandMapItem.Folder = archivePathPrefix; commandMapItem.Archive = archiveName; FillCommand(kCompress, mainString, commandMapItem); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(mainString)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } @@ -433,26 +468,29 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, CCommandMapItem commandMapItem; UString s; FillCommand2(kCompressTo, s, commandMapItem); - commandMapItem.Folder = archivePathPrefix; + if (_dropMode) + commandMapItem.Folder = _dropPath; + else + commandMapItem.Folder = archivePathPrefix; commandMapItem.Archive = archiveName7z; UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\""); s = MyFormatNew(s, t); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(s)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } // CompressEmail - if ((contextMenuFlags & NContextMenuFlags::kCompressEmail) != 0) + if ((contextMenuFlags & NContextMenuFlags::kCompressEmail) != 0 && !_dropMode) { CCommandMapItem commandMapItem; commandMapItem.Archive = archiveName; FillCommand(kCompressEmail, mainString, commandMapItem); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(mainString)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } // CompressToEmail - if ((contextMenuFlags & NContextMenuFlags::kCompressToEmail) != 0) + if ((contextMenuFlags & NContextMenuFlags::kCompressToEmail) != 0 && !_dropMode) { CCommandMapItem commandMapItem; UString s; @@ -461,7 +499,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\""); s = MyFormatNew(s, t); MyInsertMenu(popupMenu, subIndex++, currentCommandID++, GetSystemString(s)); - _commandMap.push_back(commandMapItem); + _commandMap.Add(commandMapItem); } } @@ -491,7 +529,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT CZipContextMenu::FindVerb(const UString &verb) { - for(int i = 0; i < _commandMap.size(); i++) + for(int i = 0; i < _commandMap.Size(); i++) if(_commandMap[i].Verb.Compare(verb) == 0) return i; return -1; @@ -622,7 +660,7 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo) #endif */ - if(commandOffset < 0 || commandOffset >= _commandMap.size()) + if(commandOffset < 0 || commandOffset >= _commandMap.Size()) return E_FAIL; const CCommandMapItem commandMapItem = _commandMap[commandOffset]; @@ -697,12 +735,12 @@ STDMETHODIMP CZipContextMenu::GetCommandString(UINT commandOffset, UINT uType, { case GCS_VALIDATEA: case GCS_VALIDATEW: - if(commandOffset < 0 || commandOffset >= (UINT)_commandMap.size()) + if(commandOffset < 0 || commandOffset >= (UINT)_commandMap.Size()) return S_FALSE; else return S_OK; } - if(commandOffset < 0 || commandOffset >= (UINT)_commandMap.size()) + if(commandOffset < 0 || commandOffset >= (UINT)_commandMap.Size()) return E_FAIL; if(uType == GCS_HELPTEXTA || uType == GCS_HELPTEXTW) { diff --git a/7zip/UI/Explorer/ContextMenu.h b/7zip/UI/Explorer/ContextMenu.h index 3ee94227..b9c3ba8b 100755 --- a/7zip/UI/Explorer/ContextMenu.h +++ b/7zip/UI/Explorer/ContextMenu.h @@ -7,20 +7,17 @@ DEFINE_GUID(CLSID_CZipContextMenu, 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00); -#include - #include "Common/String.h" #include "../../FileManager/PluginInterface.h" - +#include "../../FileManager/MyCom2.h" class CZipContextMenu: public IContextMenu, public IShellExtInit, public IInitContextMenu, - public CComObjectRoot, - public CComCoClass + public CMyUnknownImp { public: @@ -48,18 +45,7 @@ public: UString Archive; }; -BEGIN_COM_MAP(CZipContextMenu) - COM_INTERFACE_ENTRY(IContextMenu) - COM_INTERFACE_ENTRY(IShellExtInit) - COM_INTERFACE_ENTRY(IInitContextMenu) -END_COM_MAP() - -DECLARE_NOT_AGGREGATABLE(CZipContextMenu) - -DECLARE_REGISTRY(CZipContextMenu, - // _T("SevenZip.ContextMenu.1"), _T("SevenZip.ContextMenu"), - TEXT("SevenZip.1"), TEXT("SevenZip"), - UINT(0), THREADFLAGS_APARTMENT) + MY_UNKNOWN_IMP3_MT(IContextMenu, IShellExtInit, IInitContextMenu) /////////////////////////////// // IShellExtInit @@ -81,7 +67,9 @@ DECLARE_REGISTRY(CZipContextMenu, STDMETHOD(InitContextMenu)(const wchar_t *folder, const wchar_t **names, UINT32 numFiles); private: UStringVector _fileNames; - std::vector _commandMap; + bool _dropMode; + UString _dropPath; + CObjectVector _commandMap; HRESULT GetFileNames(LPDATAOBJECT dataObject, CSysStringVector &fileNames); UINT FindVerb(const UString &verb); @@ -89,6 +77,9 @@ private: CCommandMapItem &commandMapItem); void FillCommand2(ECommandInternalID id, UString &mainString, CCommandMapItem &commandMapItem); +public: + CZipContextMenu(); + ~CZipContextMenu(); }; #endif diff --git a/7zip/UI/Explorer/DllExports.cpp b/7zip/UI/Explorer/DllExports.cpp index ff481b9b..abb4680a 100755 --- a/7zip/UI/Explorer/DllExports.cpp +++ b/7zip/UI/Explorer/DllExports.cpp @@ -1,43 +1,90 @@ // DLLExports.cpp +// +// Notes: +// Win2000: +// If I register at HKCR\Folder\ShellEx then DLL is locked. +// otherwise it unloads after exlorer closing. +// but if I call menu for desktop items it's locked all the time #include "StdAfx.h" // #include #include -#include #include +#include +#include -#include "../../IPassword.h" -#include "../Agent/Agent.h" -#include "../../FileManager/LangUtils.h" #include "Common/ComTry.h" -#include "ContextMenu.h" +#include "../../IPassword.h" +#include "../../FileManager/LangUtils.h" +#include "../Agent/Agent.h" +#include "ContextMenu.h" #include "OptionsDialog.h" -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) - // OBJECT_ENTRY(CLSID_CAgentArchiveHandler, CAgent) - OBJECT_ENTRY(CLSID_CZipContextMenu, CZipContextMenu) - // OBJECT_ENTRY(CLSID_CSevenZipOptions, CSevenZipOptions) -END_OBJECT_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - HINSTANCE g_hInstance; +LONG g_DllRefCount = 0; // Reference count of this DLL. + +static LPCTSTR kShellExtName = TEXT("7-Zip Shell Extension"); +static LPCTSTR kClsidMask = TEXT("CLSID\\%s"); +static LPCTSTR kClsidInprocMask = TEXT("CLSID\\%s\\InprocServer32"); +static LPCTSTR kApprovedKeyPath = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"); + +// #define ODS(sz) OutputDebugString(L#sz) + +class CShellExtClassFactory: + public IClassFactory, + public CMyUnknownImp +{ +public: + CShellExtClassFactory() { InterlockedIncrement(&g_DllRefCount); } + ~CShellExtClassFactory() { InterlockedDecrement(&g_DllRefCount); } + + + MY_UNKNOWN_IMP1_MT(IClassFactory) + + STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, void**); + STDMETHODIMP LockServer(BOOL); +}; + +STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter, + REFIID riid, void **ppvObj) +{ + // ODS("CShellExtClassFactory::CreateInstance()\r\n"); + *ppvObj = NULL; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + CZipContextMenu *shellExt; + try + { + shellExt = new CZipContextMenu(); + } + catch(...) { return E_OUTOFMEMORY; } + if (shellExt == NULL) + return E_OUTOFMEMORY; + + HRESULT res = shellExt->QueryInterface(riid, ppvObj); + if (res != S_OK) + delete shellExt; + return res; +} + + +STDMETHODIMP CShellExtClassFactory::LockServer(BOOL fLock) +{ + return S_OK; // Check it +} static bool IsItWindowsNT() { - OSVERSIONINFO aVersionInfo; - aVersionInfo.dwOSVersionInfoSize = sizeof(aVersionInfo); - if (!::GetVersionEx(&aVersionInfo)) + OSVERSIONINFO versionInfo; + versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); + if (!::GetVersionEx(&versionInfo)) return false; - return (aVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); + return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); } extern "C" @@ -47,15 +94,16 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) if (dwReason == DLL_PROCESS_ATTACH) { g_hInstance = hInstance; + // ODS("In DLLMain, DLL_PROCESS_ATTACH\r\n"); #ifdef UNICODE if (!IsItWindowsNT()) return FALSE; #endif - _Module.Init(ObjectMap, hInstance); - //DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); + { + // ODS("In DLLMain, DLL_PROCESS_DETACH\r\n"); + } return TRUE; } @@ -64,28 +112,138 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) STDAPI DllCanUnloadNow(void) { - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; + // ODS("In DLLCanUnloadNow\r\n"); + return (g_DllRefCount == 0 ? S_OK : S_FALSE); } -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { - return _Module.GetClassObject(rclsid, riid, ppv); + // ODS("In DllGetClassObject\r\n"); + *ppv = NULL; + if (IsEqualIID(rclsid, CLSID_CZipContextMenu)) + { + CShellExtClassFactory *cf; + try + { + cf = new CShellExtClassFactory; + } + catch(...) { return E_OUTOFMEMORY; } + if (cf == 0) + return E_OUTOFMEMORY; + HRESULT res = cf->QueryInterface(riid, ppv); + if (res != S_OK) + delete cf; + return res; + } + return CLASS_E_CLASSNOTAVAILABLE; + // return _Module.GetClassObject(rclsid, riid, ppv); +} + +static BOOL GetStringFromIID(CLSID clsid, LPTSTR s, int size) +{ + LPWSTR pwsz; + if (StringFromIID(clsid, &pwsz) != S_OK) + return FALSE; + if(!pwsz) + return FALSE; + #ifdef UNICODE + lstrcpyn(s, pwsz, size); + #else + WideCharToMultiByte(CP_ACP, 0, pwsz, -1, s, size, NULL, NULL); + #endif + CoTaskMemFree(pwsz); + s[size - 1] = 0; + return TRUE; +} + +typedef struct +{ + HKEY hRootKey; + LPCTSTR SubKey; + LPCTSTR ValueName; + LPCTSTR Data; +} CRegItem; + +static BOOL RegisterServer(CLSID clsid, LPCTSTR title) +{ + TCHAR clsidString[MAX_PATH]; + if (!GetStringFromIID(clsid, clsidString, MAX_PATH)) + return FALSE; + + TCHAR modulePath[MAX_PATH + 1]; + if (GetModuleFileName(g_hInstance, modulePath, MAX_PATH) == 0) + return FALSE; + + CRegItem clsidEntries[] = + { + HKEY_CLASSES_ROOT, kClsidMask, NULL, title, + HKEY_CLASSES_ROOT, kClsidInprocMask, NULL, modulePath, + HKEY_CLASSES_ROOT, kClsidInprocMask, TEXT("ThreadingModel"), TEXT("Apartment"), + NULL, NULL, NULL, NULL + }; + + HKEY hKey; + DWORD dwDisp; + //register the CLSID entries + for(int i = 0; clsidEntries[i].hRootKey; i++) + { + TCHAR subKey[MAX_PATH]; + wsprintf(subKey, clsidEntries[i].SubKey, clsidString); + if (RegCreateKeyEx(clsidEntries[i].hRootKey, subKey, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisp) != NOERROR) + return FALSE; + const TCHAR *data = clsidEntries[i].Data; + RegSetValueEx(hKey, clsidEntries[i].ValueName, 0, REG_SZ, + (LPBYTE)data, (lstrlen(data) + 1) * sizeof(TCHAR)); + RegCloseKey(hKey); + } + + if(IsItWindowsNT()) + { + if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, kApprovedKeyPath, 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisp) == NOERROR) + { + RegSetValueEx(hKey, clsidString, 0, REG_SZ, + (LPBYTE)title,(lstrlen(title) + 1) * sizeof(TCHAR)); + RegCloseKey(hKey); + } + } + return TRUE; } STDAPI DllRegisterServer(void) { - return _Module.RegisterServer(FALSE); + return RegisterServer(CLSID_CZipContextMenu, kShellExtName) ? S_OK: SELFREG_E_CLASS; } -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry +static BOOL UnregisterServer(CLSID clsid) +{ + TCHAR clsidString[MAX_PATH]; + if (!GetStringFromIID(clsid, clsidString, MAX_PATH)) + return FALSE; + + TCHAR subKey[MAX_PATH]; + wsprintf(subKey, kClsidInprocMask, clsidString); + RegDeleteKey(HKEY_CLASSES_ROOT, subKey); + + wsprintf (subKey, kClsidMask, clsidString); + RegDeleteKey(HKEY_CLASSES_ROOT, subKey); + + if(IsItWindowsNT()) + { + HKEY hKey; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, kApprovedKeyPath, 0, KEY_SET_VALUE, &hKey) == NOERROR) + { + RegDeleteValue(hKey, clsidString); + RegCloseKey(hKey); + } + } + return TRUE; +} STDAPI DllUnregisterServer(void) { - return _Module.UnregisterServer(); + return UnregisterServer(CLSID_CZipContextMenu) ? S_OK: SELFREG_E_CLASS; } STDAPI CreateObject( diff --git a/7zip/UI/Explorer/StdAfx.h b/7zip/UI/Explorer/StdAfx.h index fc42ac61..b9c0ee3a 100755 --- a/7zip/UI/Explorer/StdAfx.h +++ b/7zip/UI/Explorer/StdAfx.h @@ -18,16 +18,9 @@ #include #include -#define _ATL_APARTMENT_THREADED - -#define _ATL_NO_UUIDOF - -#include - -extern CComModule _Module; - -#include #include #include +#include "Common/NewHandler.h" + #endif diff --git a/7zip/UI/Explorer/resource.rc b/7zip/UI/Explorer/resource.rc index 0e034bf8..28c500eb 100755 --- a/7zip/UI/Explorer/resource.rc +++ b/7zip/UI/Explorer/resource.rc @@ -68,8 +68,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -87,14 +87,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7-Zip Shell Extension\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7-zip\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7-zip.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/UI/Far/Far.dsp b/7zip/UI/Far/Far.dsp index 1ecda11d..47478718 100755 --- a/7zip/UI/Far/Far.dsp +++ b/7zip/UI/Far/Far.dsp @@ -134,6 +134,14 @@ SOURCE=..\..\..\Common\IntToString.h # End Source File # Begin Source File +SOURCE=..\..\..\Common\NewHandler.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\Common\NewHandler.h +# End Source File +# Begin Source File + SOURCE=..\..\..\Common\String.cpp # End Source File # Begin Source File diff --git a/7zip/UI/Far/Far.rc b/7zip/UI/Far/Far.rc index 4ade9baa..c30feefa 100755 --- a/7zip/UI/Far/Far.rc +++ b/7zip/UI/Far/Far.rc @@ -66,8 +66,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -85,14 +85,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7-Zip FAR Plugin\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7-ZipFar\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7-ZipFar.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/7zip/UI/Far/Main.cpp b/7zip/UI/Far/Main.cpp index d27cc059..3f13d882 100755 --- a/7zip/UI/Far/Main.cpp +++ b/7zip/UI/Far/Main.cpp @@ -406,18 +406,6 @@ static HANDLE MyOpenFilePlugin(const char *name) // ::OutputDebugString("after OpenArchive\n"); - /* - std::auto_ptr aProxyHandler(new CProxyHandler()); - - if(aProxyHandler->Init(archiveHandler, - fileInfo, - GetDefaultName(fullName, archiverInfoResult.Extension), - openArchiveCallbackSpec) != S_OK) - return INVALID_HANDLE_VALUE; - - // ::OutputDebugString("after Init\n"); - */ - CPlugin *plugin = new CPlugin( fullName, // defaultName, diff --git a/7zip/UI/Far/Plugin.h b/7zip/UI/Far/Plugin.h index 61b03f49..0b617cfb 100755 --- a/7zip/UI/Far/Plugin.h +++ b/7zip/UI/Far/Plugin.h @@ -42,7 +42,6 @@ public: // UString m_DefaultName; NWindows::NFile::NFind::CFileInfoW m_FileInfo; - // std::auto_ptr m_ProxyHandler; CMyComPtr m_ArchiveHandler; CMyComPtr _folder; @@ -71,15 +70,6 @@ public: int DeleteFiles(PluginPanelItem *aPanelItems, int itemsNumber, int opMode); - /* - void AddRealIndexOfFile(const CArchiveFolderItem &aFolder, int anIndexInVector, - std::vector &aRealIndexes); - void AddRealIndexes(const CArchiveFolderItem &anItem, - std::vector &aRealIndexes); - void GetRealIndexes(PluginPanelItem *aPanelItems, int itemsNumber, - std::vector &aRealIndexes); - */ - HRESULT ExtractFiles( bool decompressAllItems, const UINT32 *indices, diff --git a/7zip/UI/Far/PluginCommon.cpp b/7zip/UI/Far/PluginCommon.cpp index 767b2bcb..3e8e3cee 100755 --- a/7zip/UI/Far/PluginCommon.cpp +++ b/7zip/UI/Far/PluginCommon.cpp @@ -4,12 +4,6 @@ #include "Plugin.h" -/* -using namespace NWindows; -using namespace std; -using namespace NFar; -*/ - /* void CPlugin::AddRealIndexOfFile(const CArchiveFolderItem &aFolder, int anIndexInVector, vector &aRealIndexes) diff --git a/7zip/UI/Far/PluginWrite.cpp b/7zip/UI/Far/PluginWrite.cpp index b6b3b2f2..e9581c59 100755 --- a/7zip/UI/Far/PluginWrite.cpp +++ b/7zip/UI/Far/PluginWrite.cpp @@ -44,14 +44,11 @@ static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method) { UStringVector realNames; realNames.Add(UString(L"x")); - std::vector values; - values.push_back(NCOM::CPropVariant((UINT32)method)); - + NCOM::CPropVariant value = (UInt32)method; CRecordVector names; for(int i = 0; i < realNames.Size(); i++) names.Add(realNames[i]); - RINOK(setProperties->SetProperties(&names.Front(), - &values.front(), names.Size())); + RINOK(setProperties->SetProperties(&names.Front(), &value, names.Size())); } return S_OK; } @@ -595,7 +592,6 @@ HRESULT CompressFiles(const CObjectVector &pluginPanelItems) g_StartupInfo.GetMsgString(NMessageID::kUpdating), 1 << 16); - // std::auto_ptr proxyHandler; NFind::CFileInfoW fileInfo; CMyComPtr outArchive; diff --git a/7zip/UI/Far/StdAfx.h b/7zip/UI/Far/StdAfx.h index da08641d..0a7c347b 100755 --- a/7zip/UI/Far/StdAfx.h +++ b/7zip/UI/Far/StdAfx.h @@ -4,5 +4,9 @@ #define __STDAFX_H #include +#include + +#include "Common/NewHandler.h" + +#endif -#endif diff --git a/7zip/UI/GUI/CompressDialog.cpp b/7zip/UI/GUI/CompressDialog.cpp index 1991ddd7..1191be34 100755 --- a/7zip/UI/GUI/CompressDialog.cpp +++ b/7zip/UI/GUI/CompressDialog.cpp @@ -360,6 +360,14 @@ void CCompressDialog::CheckSFXControlsEnable() EnableItem(IDC_COMPRESS_SFX, enable); } +void CCompressDialog::CheckVolumeEnable() +{ + bool isSFX = IsSFX(); + m_Volume.Enable(!isSFX); + if (isSFX) + m_Volume.SetText(TEXT("")); +} + void CCompressDialog::CheckControlsEnable() { const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()]; @@ -371,7 +379,8 @@ void CCompressDialog::CheckControlsEnable() EnableItem(IDC_COMPRESS_SOLID, fi.Solid); EnableItem(IDC_COMPRESS_MULTI_THREAD, multiThreadEnable); CheckSFXControlsEnable(); - + CheckVolumeEnable(); + // EnableItem(IDC_STATIC_COMPRESS_VOLUME, enable); // EnableItem(IDC_COMPRESS_COMBO_VOLUME, enable); @@ -379,6 +388,7 @@ void CCompressDialog::CheckControlsEnable() EnableItem(IDC_COMPRESS_PASSWORD, fi.Encrypt); EnableItem(IDC_COMPRESS_EDIT_PASSWORD, fi.Encrypt); EnableItem(IDC_COMPRESS_CHECK_SHOW_PASSWORD, fi.Encrypt); + } bool CCompressDialog::IsSFX() @@ -419,9 +429,7 @@ void CCompressDialog::OnButtonSFX() SetArchiveName2(false); // it's for OnInit } - m_Volume.Enable(!isSFX); - if (isSFX) - m_Volume.SetText(TEXT("")); + CheckVolumeEnable(); } void CCompressDialog::OnButtonSetArchive() diff --git a/7zip/UI/GUI/CompressDialog.h b/7zip/UI/GUI/CompressDialog.h index 8afa423f..d73792a2 100755 --- a/7zip/UI/GUI/CompressDialog.h +++ b/7zip/UI/GUI/CompressDialog.h @@ -141,6 +141,7 @@ public: protected: void CheckSFXControlsEnable(); + void CheckVolumeEnable(); void CheckControlsEnable(); void OnButtonSetArchive(); diff --git a/7zip/UI/GUI/StdAfx.h b/7zip/UI/GUI/StdAfx.h index 7960a33d..46ea51cf 100755 --- a/7zip/UI/GUI/StdAfx.h +++ b/7zip/UI/GUI/StdAfx.h @@ -8,4 +8,6 @@ #include #include +#include "Common/NewHandler.h" + #endif diff --git a/7zip/UI/GUI/UpdateGUI.cpp b/7zip/UI/GUI/UpdateGUI.cpp index a8d181b9..5becefef 100755 --- a/7zip/UI/GUI/UpdateGUI.cpp +++ b/7zip/UI/GUI/UpdateGUI.cpp @@ -195,9 +195,9 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor, if (censor.Pairs.Size() > 0) { const NWildcard::CPair &pair = censor.Pairs[0]; - if (pair.Head.Items.Size() > 0) + if (pair.Head.IncludeItems.Size() > 0) { - const NWildcard::CItem &item = pair.Head.Items[0]; + const NWildcard::CItem &item = pair.Head.IncludeItems[0]; if (item.ForFile) { UString name = pair.Prefix; @@ -209,7 +209,7 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor, } if (NFind::FindFile(name, fileInfo)) { - if (censor.Pairs.Size() == 1 && pair.Head.Items.Size() == 1) + if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1) oneFile = !fileInfo.IsDirectory(); } } diff --git a/7zip/UI/GUI/resource.rc b/7zip/UI/GUI/resource.rc index 16b53582..30b2724d 100755 --- a/7zip/UI/GUI/resource.rc +++ b/7zip/UI/GUI/resource.rc @@ -74,8 +74,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,23,0,0 - PRODUCTVERSION 4,23,0,0 + FILEVERSION 4,24,0,0 + PRODUCTVERSION 4,24,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -93,14 +93,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Igor Pavlov\0" VALUE "FileDescription", "7-Zip GUI Module\0" - VALUE "FileVersion", "4, 23, 0, 0\0" + VALUE "FileVersion", "4, 24, 0, 0\0" VALUE "InternalName", "7zg\0" VALUE "LegalCopyright", "Copyright (C) 1999-2005 Igor Pavlov\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "7zg.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "7-Zip\0" - VALUE "ProductVersion", "4, 23, 0, 0\0" + VALUE "ProductVersion", "4, 24, 0, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/Common/Alloc.cpp b/Common/Alloc.cpp index e1c5f7bd..36338370 100755 --- a/Common/Alloc.cpp +++ b/Common/Alloc.cpp @@ -18,7 +18,7 @@ int g_allocCount = 0; int g_allocCountBig = 0; #endif -void *MyAlloc(size_t size) +void *MyAlloc(size_t size) throw() { #ifdef _SZ_ALLOC_DEBUG fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount++); @@ -27,7 +27,7 @@ void *MyAlloc(size_t size) return ::malloc(size); } -void MyFree(void *address) +void MyFree(void *address) throw() { #ifdef _SZ_ALLOC_DEBUG if (address != 0) @@ -37,7 +37,7 @@ void MyFree(void *address) ::free(address); } -void *BigAlloc(size_t size) +void *BigAlloc(size_t size) throw() { #ifdef _SZ_ALLOC_DEBUG fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++); @@ -50,7 +50,7 @@ void *BigAlloc(size_t size) #endif } -void BigFree(void *address) +void BigFree(void *address) throw() { #ifdef _SZ_ALLOC_DEBUG if (address != 0) diff --git a/Common/Alloc.h b/Common/Alloc.h index 881af966..1a1caa8e 100755 --- a/Common/Alloc.h +++ b/Common/Alloc.h @@ -5,10 +5,10 @@ #include -void *MyAlloc(size_t size); -void MyFree(void *address); -void *BigAlloc(size_t size); -void BigFree(void *address); +void *MyAlloc(size_t size) throw(); +void MyFree(void *address) throw(); +void *BigAlloc(size_t size) throw(); +void BigFree(void *address) throw(); // void *BigAllocE(size_t size); #endif diff --git a/Common/NewHandler.cpp b/Common/NewHandler.cpp index 3b036bdb..9994297c 100755 --- a/Common/NewHandler.cpp +++ b/Common/NewHandler.cpp @@ -2,15 +2,19 @@ #include "StdAfx.h" +#include + #include "NewHandler.h" // #define DEBUG_MEMORY_LEAK #ifndef DEBUG_MEMORY_LEAK -#include - -void * __cdecl operator new(size_t size) +void * +#ifdef _MSC_VER +__cdecl +#endif +operator new(size_t size) { // void *p = ::HeapAlloc(::GetProcessHeap(), 0, size); void *p = ::malloc(size); @@ -19,7 +23,11 @@ void * __cdecl operator new(size_t size) return p; } -void __cdecl operator delete(void *p) +void +#ifdef _MSC_VER +__cdecl +#endif +operator delete(void *p) throw() { /* if (p == 0) diff --git a/Common/NewHandler.h b/Common/NewHandler.h index 331f3043..91ad34c2 100755 --- a/Common/NewHandler.h +++ b/Common/NewHandler.h @@ -5,4 +5,10 @@ class CNewException {}; +void +#ifdef _MSC_VER +__cdecl +#endif +operator delete(void *p) throw(); + #endif diff --git a/Common/Wildcard.cpp b/Common/Wildcard.cpp index 6f7efc71..74ad97a6 100755 --- a/Common/Wildcard.cpp +++ b/Common/Wildcard.cpp @@ -207,72 +207,83 @@ int CCensorNode::FindSubNode(const UString &name) const return -1; } -void CCensorNode::AddItem(CItem &item) +void CCensorNode::AddItemSimple(bool include, CItem &item) +{ + if (include) + IncludeItems.Add(item); + else + ExcludeItems.Add(item); +} + +void CCensorNode::AddItem(bool include, CItem &item) { if (item.PathParts.Size() <= 1) { - Items.Add(item); + AddItemSimple(include, item); return; } const UString &front = item.PathParts.Front(); if (DoesNameContainWildCard(front)) { - Items.Add(item); + AddItemSimple(include, item); return; } int index = FindSubNode(front); if (index < 0) index = SubNodes.Add(CCensorNode(front, this)); item.PathParts.Delete(0); - SubNodes[index].AddItem(item); + SubNodes[index].AddItem(include, item); } -void CCensorNode::AddItem(const UString &path, bool include, bool recursive, bool forFile, bool forDir) +void CCensorNode::AddItem(bool include, const UString &path, bool recursive, bool forFile, bool forDir) { CItem item; SplitPathToParts(path, item.PathParts); - item.Include = include; item.Recursive = recursive; item.ForFile = forFile; item.ForDir = forDir; - AddItem(item); + AddItem(include, item); } bool CCensorNode::NeedCheckSubDirs() const { - for (int i = 0; i < Items.Size(); i++) + for (int i = 0; i < IncludeItems.Size(); i++) { - const CItem &item = Items[i]; - if (!item.Include) - continue; + const CItem &item = IncludeItems[i]; if (item.Recursive || item.PathParts.Size() > 1) return true; } return false; } -bool CCensorNode::CheckPathCurrent(const UStringVector &pathParts, bool isFile, bool &include) const +bool CCensorNode::AreThereIncludeItems() const { - bool finded = false; - for (int i = 0; i < Items.Size(); i++) - { - const CItem &item = Items[i]; - if (item.CheckPath(pathParts, isFile)) - { - finded = true; - include = item.Include; - if (!include) - return true; - } - } - return finded; + if (IncludeItems.Size() > 0) + return true; + for (int i = 0; i < SubNodes.Size(); i++) + if (SubNodes[i].AreThereIncludeItems()) + return true; + return false; +} + +bool CCensorNode::CheckPathCurrent(bool include, const UStringVector &pathParts, bool isFile) const +{ + const CObjectVector &items = include ? IncludeItems : ExcludeItems; + for (int i = 0; i < items.Size(); i++) + if (items[i].CheckPath(pathParts, isFile)) + return true; + return false; } bool CCensorNode::CheckPath(UStringVector &pathParts, bool isFile, bool &include) const { - bool finded = CheckPathCurrent(pathParts, isFile, include); - if (finded && !include) + if (CheckPathCurrent(false, pathParts, isFile)) + { + include = false; return true; + } + include = true; + bool finded = CheckPathCurrent(true, pathParts, isFile); if (pathParts.Size() == 1) return finded; int index = FindSubNode(pathParts.Front()); @@ -281,7 +292,7 @@ bool CCensorNode::CheckPath(UStringVector &pathParts, bool isFile, bool &include UStringVector pathParts2 = pathParts; pathParts2.Delete(0); if (SubNodes[index].CheckPath(pathParts2, isFile, include)) - finded = true; + return true; } return finded; } @@ -301,36 +312,26 @@ bool CCensorNode::CheckPath(const UString &path, bool isFile) const return false; } -bool CCensorNode::CheckPathToRoot(UStringVector &pathParts, bool isFile, bool &include) const +bool CCensorNode::CheckPathToRoot(bool include, UStringVector &pathParts, bool isFile) const { - bool finded = CheckPathCurrent(pathParts, isFile, include); - if (finded && !include) + if (CheckPathCurrent(include, pathParts, isFile)) return true; if (Parent == 0) - return finded; + return false; pathParts.Insert(0, Name); - if (Parent->CheckPathToRoot(pathParts, isFile, include)) - finded = true; - return finded; + return Parent->CheckPathToRoot(include, pathParts, isFile); } -bool CCensorNode::CheckPathToRoot(UStringVector &pathParts, bool isFile) const -{ - bool include; - if(CheckPathToRoot(pathParts, isFile, include)) - return include; - return false; -} - -bool CCensorNode::CheckPathToRoot(const UString &path, bool isFile) const +/* +bool CCensorNode::CheckPathToRoot(bool include, const UString &path, bool isFile) const { UStringVector pathParts; SplitPathToParts(path, pathParts); - return CheckPathToRoot(pathParts, isFile); + return CheckPathToRoot(include, pathParts, isFile); } +*/ - -void CCensorNode::AddItem2(const UString &path, bool include, bool recursive) +void CCensorNode::AddItem2(bool include, const UString &path, bool recursive) { if (path.IsEmpty()) return; @@ -342,7 +343,7 @@ void CCensorNode::AddItem2(const UString &path, bool include, bool recursive) path2.Delete(path.Length() - 1); forFile = false; } - AddItem(path2, include, recursive, forFile, forFolder); + AddItem(include, path2, recursive, forFile, forFolder); } int CCensor::FindPrefix(const UString &prefix) const @@ -353,7 +354,7 @@ int CCensor::FindPrefix(const UString &prefix) const return -1; } -void CCensor::AddItem(const UString &path, bool include, bool recursive) +void CCensor::AddItem(bool include, const UString &path, bool recursive) { UStringVector pathParts; SplitPathToParts(path, pathParts); @@ -405,9 +406,8 @@ void CCensor::AddItem(const UString &path, bool include, bool recursive) item.PathParts = pathParts; item.ForDir = true; item.ForFile = forFile; - item.Include = include; item.Recursive = recursive; - Pairs[index].Head.AddItem(item); + Pairs[index].Head.AddItem(include, item); } bool CCensor::CheckPath(const UString &path, bool isFile) const diff --git a/Common/Wildcard.h b/Common/Wildcard.h index 59c0a0e8..0dbe33b5 100755 --- a/Common/Wildcard.h +++ b/Common/Wildcard.h @@ -17,7 +17,6 @@ namespace NWildcard { struct CItem { UStringVector PathParts; - bool Include; bool Recursive; bool ForFile; bool ForDir; @@ -26,32 +25,32 @@ struct CItem class CCensorNode { - UString Name; CCensorNode *Parent; - bool CheckPathCurrent(const UStringVector &pathParts, bool isFile, bool &include) const; + bool CheckPathCurrent(bool include, const UStringVector &pathParts, bool isFile) const; + void AddItemSimple(bool include, CItem &item); + bool CheckPath(UStringVector &pathParts, bool isFile, bool &include) const; public: CCensorNode(): Parent(0) { }; - CCensorNode(const UString &name, CCensorNode *parent): - Name(name), Parent(parent) { }; + CCensorNode(const UString &name, CCensorNode *parent): Name(name), Parent(parent) { }; + UString Name; CObjectVector SubNodes; - CObjectVector Items; + CObjectVector IncludeItems; + CObjectVector ExcludeItems; int FindSubNode(const UString &path) const; - void AddItem(CItem &item); - void AddItem(const UString &path, bool include, bool recursive, bool forFile, bool forDir); - void AddItem2(const UString &path, bool include, bool recursive); + void AddItem(bool include, CItem &item); + void AddItem(bool include, const UString &path, bool recursive, bool forFile, bool forDir); + void AddItem2(bool include, const UString &path, bool recursive); bool NeedCheckSubDirs() const; + bool AreThereIncludeItems() const; - bool CheckPath(UStringVector &pathParts, bool isFile, bool &include) const; bool CheckPath(const UString &path, bool isFile, bool &include) const; bool CheckPath(const UString &path, bool isFile) const; - bool CheckPathToRoot(UStringVector &pathParts, bool isFile, bool &include) const; - bool CheckPathToRoot(UStringVector &pathParts, bool isFile) const; - bool CheckPathToRoot(const UString &path, bool isFile) const; - + bool CheckPathToRoot(bool include, UStringVector &pathParts, bool isFile) const; + // bool CheckPathToRoot(const UString &path, bool isFile, bool include) const; }; struct CPair @@ -68,7 +67,7 @@ public: CObjectVector Pairs; bool AllAreRelative() const { return (Pairs.Size() == 1 && Pairs.Front().Prefix.IsEmpty()); } - void AddItem(const UString &path, bool include, bool recursive); + void AddItem(bool include, const UString &path, bool recursive); bool CheckPath(const UString &path, bool isFile) const; }; diff --git a/DOC/7zC.txt b/DOC/7zC.txt index 843fa2e5..a5b547ea 100755 --- a/DOC/7zC.txt +++ b/DOC/7zC.txt @@ -1,7 +1,7 @@ -7z ANSI-C Decoder 4.22 +7z ANSI-C Decoder 4.23 ---------------------- -7z ANSI-C Decoder 4.22 Copyright (C) 1999-2005 Igor Pavlov +7z ANSI-C Decoder 4.23 Copyright (C) 1999-2005 Igor Pavlov 7z ANSI-C provides 7z/LZMA decoding. 7z ANSI-C version is simplified version ported from C++ code. diff --git a/DOC/7zip.nsi b/DOC/7zip.nsi index 87ed1423..15b7f652 100755 --- a/DOC/7zip.nsi +++ b/DOC/7zip.nsi @@ -2,10 +2,10 @@ ;Defines !define VERSION_MAJOR 4 -!define VERSION_MINOR 23 -!define VERSION_POSTFIX_FULL "" +!define VERSION_MINOR 24 +!define VERSION_POSTFIX_FULL " beta" !define NAME_FULL "7-Zip ${VERSION_MAJOR}.${VERSION_MINOR}${VERSION_POSTFIX_FULL}" -!define VERSION_POSTFIX "" +!define VERSION_POSTFIX "b" !define FM_LINK "7-Zip File Manager.lnk" !define HELP_LINK "7-Zip Help.lnk" @@ -33,13 +33,19 @@ ;Compressor !ifndef NO_COMPRESSION - SetCompressor lzma + SetCompressor /SOLID lzma SetCompressorDictSize 4 !else SetCompressor zlib SetCompress off !endif + +;-------------------------------- +;Variables + + Var "MyDllPath" + ;-------------------------------- ;Interface Settings @@ -212,12 +218,14 @@ Section StrCpy $0 0 System::Call "kernel32::GetVersion() i .r0" IntCmpU $0 0x80000000 0 regNT 0 - !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED 7-zip.dll $INSTDIR\7-zip.dll $INSTDIR + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED 7-zip.dll $INSTDIR\7-zip.dll $INSTDIR File 7-Zipn.dll + StrCpy "$MyDllPath" "7-zip.dll" Goto doneReg regNT: - !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED 7-zipn.dll $INSTDIR\7-zipn.dll $INSTDIR + !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED 7-zipn.dll $INSTDIR\7-zipn.dll $INSTDIR File 7-Zip.dll + StrCpy "$MyDllPath" "7-zipn.dll" doneReg: ClearErrors @@ -246,9 +254,19 @@ Section WriteRegStr HKCU "Software\7-Zip" "Path" $INSTDIR # write reg entries + WriteRegStr HKCR "CLSID\${CLSID_CONTEXT_MENU}" "" "7-Zip Shell Extension" + WriteRegStr HKCR "CLSID\${CLSID_CONTEXT_MENU}\InprocServer32" "" "$INSTDIR\$MyDllPath" + WriteRegStr HKCR "CLSID\${CLSID_CONTEXT_MENU}\InprocServer32" "ThreadingModel" "Apartment" + + WriteRegStr HKCR "*\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}" WriteRegStr HKCR "Directory\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}" - WriteRegStr HKCR "Folder\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}" +; WriteRegStr HKCR "Folder\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}" + + WriteRegStr HKCR "Directory\shellex\DragDropHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}" +; WriteRegStr HKCR "Folder\shellex\DragDropHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${CLSID_CONTEXT_MENU}" "7-Zip Shell Extension" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe" "" "$INSTDIR\7zFM.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe" "Path" "$INSTDIR" @@ -435,6 +453,11 @@ Section "Uninstall" DeleteRegKey HKCR "Directory\shellex\ContextMenuHandlers\7-Zip" DeleteRegKey HKCR "Folder\shellex\ContextMenuHandlers\7-Zip" + DeleteRegKey HKCR "Directory\shellex\DragDropHandlers\7-Zip" + DeleteRegKey HKCR "Folder\shellex\DragDropHandlers\7-Zip" + + DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${CLSID_CONTEXT_MENU}" + DeleteRegKey HKCR "7-Zip.001" DeleteRegKey HKCR "7-Zip.7z" DeleteRegKey HKCR "7-Zip.arj" diff --git a/DOC/history.txt b/DOC/history.txt index 1ae21e66..a422d8d5 100755 --- a/DOC/history.txt +++ b/DOC/history.txt @@ -1,6 +1,11 @@ Sources history of the 7-Zip ---------------------------- + Version 4.24 beta 2005-07-06 + -------------------------------------- + - Common\NewHandler.h: using throw() for code size optimization. + + Version 4.23 2005-06-29 -------------------------------------- - Bug was fixed: memory leak in Cab decoder. diff --git a/DOC/lzma.txt b/DOC/lzma.txt index a252f430..8e73fa36 100755 --- a/DOC/lzma.txt +++ b/DOC/lzma.txt @@ -1,7 +1,7 @@ -LZMA SDK 4.22 +LZMA SDK 4.23 ------------- -LZMA SDK 4.22 Copyright (C) 1999-2005 Igor Pavlov +LZMA SDK 4.23 Copyright (C) 1999-2005 Igor Pavlov LZMA SDK provides developers with documentation, source code, and sample code necessary to write software that uses LZMA compression. diff --git a/DOC/readme.txt b/DOC/readme.txt index c4445926..401b61ba 100755 --- a/DOC/readme.txt +++ b/DOC/readme.txt @@ -1,4 +1,4 @@ -7-Zip 4.23 Sources +7-Zip 4.24 Sources ------------------ 7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.