4.24 beta

This commit is contained in:
Igor Pavlov
2005-07-05 00:00:00 +00:00
committed by Kornel Lesiński
parent ac2b563958
commit 47f4915611
66 changed files with 757 additions and 366 deletions

View File

@@ -4,5 +4,6 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#endif

View File

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

View File

@@ -4,5 +4,6 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#endif

View File

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

View File

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

View File

@@ -4,5 +4,6 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#endif
#endif

View File

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

View File

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

View File

@@ -4,5 +4,6 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#endif

View File

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

View File

@@ -4,6 +4,7 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#include <commctrl.h>
#endif

View File

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

View File

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

View File

@@ -4,6 +4,8 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#include <commctrl.h>
#include <ShlObj.h>

View File

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

View File

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

View File

@@ -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");

View File

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

View File

@@ -321,7 +321,7 @@ public:
CItemProperties _properties;
CItemProperties _visibleProperties;
int _sortID;
PROPID _sortID;
// int _sortIndex;
bool _ascending;

View File

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

View File

@@ -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<CTmpProcessInfo> tmpProcessInfo((CTmpProcessInfo *)param);
CMyAutoPtr<CTmpProcessInfo> 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<CTmpProcessInfo> tmpProcessInfo(new CTmpProcessInfo());
CMyAutoPtr<CTmpProcessInfo> 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;
}

View File

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

View File

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

View File

@@ -63,7 +63,7 @@ void CPanel::CreateShellContextMenu(
CMyComPtr<IContextMenu> &systemContextMenu)
{
systemContextMenu.Release();
UString folderPath = GetUnicodeString(_currentFolderPrefix);
UString folderPath = _currentFolderPrefix;
CMyComPtr<IShellFolder> 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<IContextMenu> contextMenu;
if (contextMenu.CoCreateInstance(CLSID_CZipContextMenu, IID_IContextMenu) == S_OK)
{
CMyComPtr<IInitContextMenu> 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;

View File

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

View File

@@ -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.",

View File

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

View File

@@ -16,26 +16,8 @@
#include <tchar.h>
#include <shlwapi.h>
/*
// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
#include <ComDef.h>
#include <stdio.h>
#include <windows.h>
#include <Commctrl.h>
#include <shellapi.h>
#include <mbstring.h>
#include <new.h>
#include <regstr.h>
*/
#include <memory>
#include "Common/NewHandler.h"
#endif

View File

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

View File

@@ -3,8 +3,6 @@
#ifndef __AGENT_AGENT_H
#define __AGENT_AGENT_H
#include <vector>
#include "Common/MyCom.h"
#include "Windows/PropVariant.h"
@@ -260,7 +258,7 @@ public:
#ifndef EXTRACT_ONLY
CObjectVector<UString> m_PropNames;
std::vector<NWindows::NCOM::CPropVariant> m_PropValues;
CObjectVector<NWindows::NCOM::CPropVariant> m_PropValues;
#endif
IInArchive *GetArchive() { return _archiveLink.GetArchive(); }

View File

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

View File

@@ -38,7 +38,7 @@ STDMETHODIMP CArchiveFolderManager::OpenFolderFile(const wchar_t *filePath,
progressWrapper.QueryInterface(IID_IArchiveOpenCallback, &openArchiveCallback);
}
CAgent *agent = new CAgent();
CComPtr<IInFolderArchive> archive = agent;
CMyComPtr<IInFolderArchive> archive = agent;
RINOK(agent->Open(filePath, NULL, openArchiveCallback));
return agent->BindToRootFolder(resultFolder);
}

View File

@@ -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<NWildcard::CItem> &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<CDirItem> 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;

View File

@@ -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<CDirItem> &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<CDirItem> &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<CDirItem> &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<CDirItem> &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<bool> 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;
}

View File

@@ -11,7 +11,7 @@
void AddDirFileInfo(
const UString &prefix,
const UString &fullPathName,
NWindows::NFile::NFind::CFileInfoW &fileInfo,
const NWindows::NFile::NFind::CFileInfoW &fileInfo,
CObjectVector<CDirItem> &dirItems);

View File

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

View File

@@ -4,5 +4,6 @@
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#endif

View File

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

View File

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

View File

@@ -7,20 +7,17 @@
DEFINE_GUID(CLSID_CZipContextMenu,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
#include <vector>
#include "Common/String.h"
#include "../../FileManager/PluginInterface.h"
#include "../../FileManager/MyCom2.h"
class CZipContextMenu:
public IContextMenu,
public IShellExtInit,
public IInitContextMenu,
public CComObjectRoot,
public CComCoClass<CZipContextMenu, &CLSID_CZipContextMenu>
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<CCommandMapItem> _commandMap;
bool _dropMode;
UString _dropPath;
CObjectVector<CCommandMapItem> _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

View File

@@ -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 <locale.h>
#include <initguid.h>
#include <ShlGuid.h>
#include <windows.h>
#include <ShlGuid.h>
#include <OleCtl.h>
#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(

View File

@@ -18,16 +18,9 @@
#include <mbstring.h>
#include <wchar.h>
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_UUIDOF
#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
#include <shlguid.h>
#include <regstr.h>
#include "Common/NewHandler.h"
#endif

View File

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

View File

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

View File

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

View File

@@ -406,18 +406,6 @@ static HANDLE MyOpenFilePlugin(const char *name)
// ::OutputDebugString("after OpenArchive\n");
/*
std::auto_ptr<CProxyHandler> 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,

View File

@@ -42,7 +42,6 @@ public:
// UString m_DefaultName;
NWindows::NFile::NFind::CFileInfoW m_FileInfo;
// std::auto_ptr<CProxyHandler> m_ProxyHandler;
CMyComPtr<IInFolderArchive> m_ArchiveHandler;
CMyComPtr<IFolderFolder> _folder;
@@ -71,15 +70,6 @@ public:
int DeleteFiles(PluginPanelItem *aPanelItems, int itemsNumber, int opMode);
/*
void AddRealIndexOfFile(const CArchiveFolderItem &aFolder, int anIndexInVector,
std::vector<int> &aRealIndexes);
void AddRealIndexes(const CArchiveFolderItem &anItem,
std::vector<int> &aRealIndexes);
void GetRealIndexes(PluginPanelItem *aPanelItems, int itemsNumber,
std::vector<int> &aRealIndexes);
*/
HRESULT ExtractFiles(
bool decompressAllItems,
const UINT32 *indices,

View File

@@ -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<int> &aRealIndexes)

View File

@@ -44,14 +44,11 @@ static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method)
{
UStringVector realNames;
realNames.Add(UString(L"x"));
std::vector<NCOM::CPropVariant> values;
values.push_back(NCOM::CPropVariant((UINT32)method));
NCOM::CPropVariant value = (UInt32)method;
CRecordVector<const wchar_t *> 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<PluginPanelItem> &pluginPanelItems)
g_StartupInfo.GetMsgString(NMessageID::kUpdating), 1 << 16);
// std::auto_ptr<CProxyHandler> proxyHandler;
NFind::CFileInfoW fileInfo;
CMyComPtr<IOutFolderArchive> outArchive;

View File

@@ -4,5 +4,9 @@
#define __STDAFX_H
#include <windows.h>
#include <stdio.h>
#include "Common/NewHandler.h"
#endif
#endif

View File

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

View File

@@ -141,6 +141,7 @@ public:
protected:
void CheckSFXControlsEnable();
void CheckVolumeEnable();
void CheckControlsEnable();
void OnButtonSetArchive();

View File

@@ -8,4 +8,6 @@
#include <shlobj.h>
#include <stdio.h>
#include "Common/NewHandler.h"
#endif

View File

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

View File

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

View File

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

View File

@@ -5,10 +5,10 @@
#include <stddef.h>
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

View File

@@ -2,15 +2,19 @@
#include "StdAfx.h"
#include <stdlib.h>
#include "NewHandler.h"
// #define DEBUG_MEMORY_LEAK
#ifndef DEBUG_MEMORY_LEAK
#include <stdlib.h>
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)

View File

@@ -5,4 +5,10 @@
class CNewException {};
void
#ifdef _MSC_VER
__cdecl
#endif
operator delete(void *p) throw();
#endif

View File

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

View File

@@ -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<CCensorNode> SubNodes;
CObjectVector<CItem> Items;
CObjectVector<CItem> IncludeItems;
CObjectVector<CItem> 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<CPair> 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;
};

View File

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

View File

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

View File

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

View File

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

View File

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