This commit is contained in:
Igor Pavlov
2015-06-15 00:00:00 +00:00
committed by Kornel Lesiński
parent 0713a3ab80
commit 54490d51d5
591 changed files with 34932 additions and 16390 deletions

View File

@@ -2,6 +2,10 @@
#include "StdAfx.h"
#ifndef _7ZIP_ST
#include "../../../Windows/Synchronization.h"
#endif
#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
@@ -13,13 +17,26 @@
using namespace NWindows;
using namespace NFar;
#ifndef _7ZIP_ST
static NSynchronization::CCriticalSection g_CriticalSection;
#define MT_LOCK NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
#else
#define MT_LOCK
#endif
static HRESULT CheckBreak2()
{
return WasEscPressed() ? E_ABORT : S_OK;
}
extern void PrintMessage(const char *message);
CExtractCallBackImp::~CExtractCallBackImp()
CExtractCallbackImp::~CExtractCallbackImp()
{
}
void CExtractCallBackImp::Init(
void CExtractCallbackImp::Init(
UINT codePage,
CProgressBox *progressBox,
bool passwordIsDefined,
@@ -28,35 +45,41 @@ void CExtractCallBackImp::Init(
m_PasswordIsDefined = passwordIsDefined;
m_Password = password;
m_CodePage = codePage;
m_ProgressBox = progressBox;
_percent = progressBox;
}
STDMETHODIMP CExtractCallBackImp::SetTotal(UInt64 size)
STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 size)
{
_total = size;
_totalIsDefined = true;
return S_OK;
MT_LOCK
if (_percent)
{
_percent->Total = size;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CExtractCallBackImp::SetCompleted(const UInt64 *completeValue)
STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *completeValue)
{
if (WasEscPressed())
return E_ABORT;
_processedIsDefined = (completeValue != NULL);
if (_processedIsDefined)
_processed = *completeValue;
if (m_ProgressBox != 0)
m_ProgressBox->Progress(
_totalIsDefined ? &_total: NULL,
_processedIsDefined ? &_processed: NULL, AString());
return S_OK;
MT_LOCK
if (_percent)
{
if (completeValue)
_percent->Completed = *completeValue;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CExtractCallBackImp::AskOverwrite(
STDMETHODIMP CExtractCallbackImp::AskOverwrite(
const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
Int32 *answer)
{
MT_LOCK
NOverwriteDialog::CFileInfo oldFileInfo, newFileInfo;
oldFileInfo.TimeIsDefined = (existTime != 0);
if (oldFileInfo.TimeIsDefined)
@@ -101,44 +124,62 @@ STDMETHODIMP CExtractCallBackImp::AskOverwrite(
default:
return E_FAIL;
}
return S_OK;
return CheckBreak2();
}
STDMETHODIMP CExtractCallBackImp::PrepareOperation(const wchar_t *name, bool /* isFolder */, Int32 /* askExtractMode */, const UInt64 * /* position */)
static const char *kTestString = "Testing";
static const char *kExtractString = "Extracting";
static const char *kSkipString = "Skipping";
STDMETHODIMP CExtractCallbackImp::PrepareOperation(const wchar_t *name, Int32 /* isFolder */, Int32 askExtractMode, const UInt64 * /* position */)
{
if (WasEscPressed())
return E_ABORT;
MT_LOCK
m_CurrentFilePath = name;
return S_OK;
}
const char *s;
STDMETHODIMP CExtractCallBackImp::MessageError(const wchar_t *message)
{
AString s = UnicodeStringToMultiByte(message, CP_OEMCP);
if (g_StartupInfo.ShowMessage((const char *)s) == -1)
return E_ABORT;
return S_OK;
}
static void ReduceString(UString &s, unsigned size)
{
if (s.Len() > size)
switch (askExtractMode)
{
s.Delete(size / 2, s.Len() - size);
s.Insert(size / 2, L" ... ");
case NArchive::NExtract::NAskMode::kExtract: s = kExtractString; break;
case NArchive::NExtract::NAskMode::kTest: s = kTestString; break;
case NArchive::NExtract::NAskMode::kSkip: s = kSkipString; break;
default: s = "???"; // return E_FAIL;
};
if (_percent)
{
_percent->Command = s;
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CExtractCallBackImp::SetOperationResult(Int32 operationResult, bool encrypted)
STDMETHODIMP CExtractCallbackImp::MessageError(const wchar_t *message)
{
switch (operationResult)
MT_LOCK
AString s = UnicodeStringToMultiByte(message, CP_OEMCP);
if (g_StartupInfo.ShowErrorMessage((const char *)s) == -1)
return E_ABORT;
return CheckBreak2();
}
void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, AString &s)
{
s.Empty();
switch (opRes)
{
case NArchive::NExtract::NOperationResult::kOK:
break;
return;
default:
{
UINT messageID = 0;
switch (operationResult)
switch (opRes)
{
case NArchive::NExtract::NOperationResult::kUnsupportedMethod:
messageID = NMessageID::kExtractUnsupportedMethod;
@@ -154,44 +195,78 @@ STDMETHODIMP CExtractCallBackImp::SetOperationResult(Int32 operationResult, bool
NMessageID::kExtractDataError;
break;
}
UString name = m_CurrentFilePath;
ReduceString(name, 70);
AString s;
if (messageID != 0)
{
s = g_StartupInfo.GetMsgString(messageID);
s.Replace(" '%s'", "");
}
else if (operationResult == NArchive::NExtract::NOperationResult::kUnavailable)
else if (opRes == NArchive::NExtract::NOperationResult::kUnavailable)
s = "Unavailable data";
else if (operationResult == NArchive::NExtract::NOperationResult::kUnexpectedEnd)
else if (opRes == NArchive::NExtract::NOperationResult::kUnexpectedEnd)
s = "Unexpected end of data";
else if (operationResult == NArchive::NExtract::NOperationResult::kDataAfterEnd)
else if (opRes == NArchive::NExtract::NOperationResult::kDataAfterEnd)
s = "There are some data after the end of the payload data";
else if (operationResult == NArchive::NExtract::NOperationResult::kIsNotArc)
else if (opRes == NArchive::NExtract::NOperationResult::kIsNotArc)
s = "Is not archive";
else if (operationResult == NArchive::NExtract::NOperationResult::kHeadersError)
else if (opRes == NArchive::NExtract::NOperationResult::kHeadersError)
s = "kHeaders Error";
else
{
char temp[16];
ConvertUInt32ToString(operationResult, temp);
ConvertUInt32ToString(opRes, temp);
s = "Error #";
s += temp;
}
s += "\n";
s += UnicodeStringToMultiByte(name, m_CodePage);
if (g_StartupInfo.ShowMessageLines(s) == -1)
return E_ABORT;
}
}
return S_OK;
}
STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 opRes, Int32 encrypted)
{
MT_LOCK
if (opRes == NArchive::NExtract::NOperationResult::kOK)
{
if (_percent)
{
_percent->Command.Empty();
_percent->FileName.Empty();
_percent->Files++;
}
}
else
{
AString s;
SetExtractErrorMessage(opRes, encrypted, s);
if (PrintErrorMessage(s, m_CurrentFilePath) == -1)
return E_ABORT;
}
return CheckBreak2();
}
STDMETHODIMP CExtractCallbackImp::ReportExtractResult(Int32 opRes, Int32 encrypted, const wchar_t *name)
{
MT_LOCK
if (opRes != NArchive::NExtract::NOperationResult::kOK)
{
AString s;
SetExtractErrorMessage(opRes, encrypted, s);
if (PrintErrorMessage(s, name) == -1)
return E_ABORT;
}
return CheckBreak2();
}
extern HRESULT GetPassword(UString &password);
STDMETHODIMP CExtractCallBackImp::CryptoGetTextPassword(BSTR *password)
STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
{
MT_LOCK
if (!m_PasswordIsDefined)
{
RINOK(GetPassword(m_Password));

View File

@@ -11,40 +11,29 @@
#include "ProgressBox.h"
class CExtractCallBackImp:
class CExtractCallbackImp:
public IFolderArchiveExtractCallback,
public IFolderArchiveExtractCallback2,
public ICryptoGetTextPassword,
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
MY_UNKNOWN_IMP2(ICryptoGetTextPassword, IFolderArchiveExtractCallback2)
// IProgress
STDMETHOD(SetTotal)(UInt64 size);
STDMETHOD(SetCompleted)(const UInt64 *completeValue);
// IExtractCallBack
STDMETHOD(AskOverwrite)(
const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
Int32 *result);
STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
INTERFACE_IFolderArchiveExtractCallback(;)
INTERFACE_IFolderArchiveExtractCallback2(;)
STDMETHOD(MessageError)(const wchar_t *message);
STDMETHOD(SetOperationResult)(Int32 resultEOperationResult, bool encrypted);
// ICryptoGetTextPassword
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
private:
UInt64 _total;
UInt64 _processed;
bool _totalIsDefined;
bool _processedIsDefined;
UString m_CurrentFilePath;
CProgressBox *m_ProgressBox;
CProgressBox *_percent;
UINT m_CodePage;
bool m_PasswordIsDefined;
@@ -58,8 +47,8 @@ private:
*/
void AddErrorMessage(LPCTSTR message);
public:
CExtractCallBackImp(): _totalIsDefined(false), _processedIsDefined(false) {}
~CExtractCallBackImp();
// CExtractCallbackImp() {}
~CExtractCallbackImp();
void Init(UINT codePage,
CProgressBox *progressBox,
bool passwordIsDefined, const UString &password);

View File

@@ -1,3 +1,4 @@
// Far.cpp
// Test Align for updating !!!!!!!!!!!!!!!!!!
#include "StdAfx.h"
@@ -11,8 +12,6 @@
#include "../../Common/FileStreams.h"
#include "../Agent/Agent.h"
#include "Messages.h"
#include "Plugin.h"
#include "ProgressBox.h"
@@ -22,6 +21,8 @@ using namespace NFile;
using namespace NDir;
using namespace NFar;
static const DWORD kShowProgressTime_ms = 100;
static const char *kCommandPrefix = "7-zip";
static const TCHAR *kRegisrtryMainKeyName = TEXT("");
static const TCHAR *kRegisrtryValueNameEnabled = TEXT("UsedByDefault3");
@@ -30,6 +31,12 @@ static bool kPluginEnabledDefault = true;
HINSTANCE g_hInstance;
namespace NFar {
const char *g_PluginName_for_Error = "7-Zip";
}
#define NT_CHECK_FAIL_ACTION return FALSE;
BOOL WINAPI DllMain(
@@ -42,9 +49,14 @@ BOOL WINAPI DllMain(
{
if (dwReason == DLL_PROCESS_ATTACH)
{
// OutputDebugStringA("7-Zip FAR DLL_PROCESS_ATTACH");
g_hInstance = (HINSTANCE)hInstance;
NT_CHECK
}
if (dwReason == DLL_PROCESS_DETACH)
{
// OutputDebugStringA("7-Zip FAR DLL_PROCESS_DETACH");
}
return TRUE;
}
@@ -55,6 +67,18 @@ static struct COptions
static const TCHAR *kPliginNameForRegestry = TEXT("7-ZIP");
EXTERN_C void WINAPI ExitFAR()
{
/* WIN32:
it's not allowed to call FreeLibrary() from FreeLibrary().
So we try to free all DLLs before destructors */
// OutputDebugStringA("-- ExitFAR --- START");
FreeGlobalCodecs();
// OutputDebugStringA("-- ExitFAR --- END");
}
EXTERN_C void WINAPI SetStartupInfo(const PluginStartupInfo *info)
{
MY_TRY_BEGIN;
@@ -62,6 +86,10 @@ EXTERN_C void WINAPI SetStartupInfo(const PluginStartupInfo *info)
g_Options.Enabled = g_StartupInfo.QueryRegKeyValue(
HKEY_CURRENT_USER, kRegisrtryMainKeyName,
kRegisrtryValueNameEnabled, kPluginEnabledDefault);
// OutputDebugStringA("SetStartupInfo");
// LoadGlobalCodecs();
MY_TRY_END1("SetStartupInfo");
}
@@ -77,17 +105,8 @@ class COpenArchiveCallback:
CProgressBox _progressBox;
UInt64 _numFilesTotal;
UInt64 _numFilesCur;
UInt64 _numBytesTotal;
UInt64 _numBytesCur;
bool _numFilesTotalDefined;
bool _numFilesCurDefined;
bool _numBytesTotalDefined;
bool _numBytesCurDefined;
DWORD m_PrevTickCount;
NFind::CFileInfo _fileInfo;
public:
@@ -123,12 +142,13 @@ public:
PasswordIsDefined = false;
_numFilesTotalDefined = false;
_numFilesCurDefined = false;
_numBytesTotalDefined = false;
_numBytesCurDefined = false;
m_MessageBoxIsShown = false;
m_PrevTickCount = GetTickCount();
_progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kReading));
}
void ShowMessage();
@@ -140,113 +160,60 @@ public:
}
};
static HRESULT CheckBreak2()
{
return WasEscPressed() ? E_ABORT : S_OK;
}
void COpenArchiveCallback::ShowMessage()
{
DWORD currentTime = GetTickCount();
if (!m_MessageBoxIsShown)
{
if (currentTime - m_PrevTickCount < 100)
DWORD currentTime = GetTickCount();
if (currentTime - _progressBox.StartTick < kShowProgressTime_ms)
return;
_progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kReading), 48);
m_MessageBoxIsShown = true;
}
else
{
if (currentTime - m_PrevTickCount < 200)
return;
}
m_PrevTickCount = currentTime;
UInt64 total = 0, cur = 0;
bool curIsDefined = false, totalIsDefined = false;
char message[256];
message[0] = 0;
if (_numFilesCurDefined)
ConvertUInt64ToStringAligned(_numFilesCur, message, 5);
if (_numFilesTotalDefined)
{
strcat(message, " / ");
ConvertUInt64ToStringAligned(_numFilesTotal, message + strlen(message), 5);
total = _numFilesTotal;
totalIsDefined = true;
if (_numFilesCurDefined)
{
cur = _numFilesCur;
curIsDefined = true;
}
}
else if (_numBytesTotalDefined)
{
total = _numBytesTotal;
totalIsDefined = true;
if (_numBytesCurDefined)
{
cur = _numBytesCur;
curIsDefined = true;
}
}
_progressBox.Progress(
totalIsDefined ? &total: NULL,
curIsDefined ? &cur: NULL,
message);
_progressBox.UseBytesForPercents = !_numFilesTotalDefined;
_progressBox.Print();
}
STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64 *numBytes)
{
if (WasEscPressed())
return E_ABORT;
_numFilesTotalDefined = (numFiles != NULL);
if (_numFilesTotalDefined)
_numFilesTotal = *numFiles;
_progressBox.FilesTotal = *numFiles;
_numBytesTotalDefined = (numBytes != NULL);
if (_numBytesTotalDefined)
_numBytesTotal = *numBytes;
_progressBox.Total = *numBytes;
return S_OK;
return CheckBreak2();
}
STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *numFiles, const UInt64 *numBytes)
{
if (WasEscPressed())
return E_ABORT;
if (numFiles)
_progressBox.Files = *numFiles;
_numFilesCurDefined = (numFiles != NULL);
if (_numFilesCurDefined)
_numFilesCur = *numFiles;
if (numBytes)
_progressBox.Completed = *numBytes;
_numBytesCurDefined = (numBytes != NULL);
if (_numBytesCurDefined)
_numBytesCur = *numBytes;
// if (*numFiles % 100 != 0)
// return S_OK;
ShowMessage();
return S_OK;
return CheckBreak2();
}
STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 /* total */)
{
if (WasEscPressed())
return E_ABORT;
return S_OK;
return CheckBreak2();
}
STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *completed)
STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 * /* completed */)
{
if (WasEscPressed())
return E_ABORT;
if (completed == NULL)
return S_OK;
ShowMessage();
return S_OK;
return CheckBreak2();
}
STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, IInStream **inStream)
@@ -303,7 +270,7 @@ HRESULT GetPassword(UString &password)
// sprintf(DialogItems[1].Data,GetMsg(MGetPasswordForFile),FileName);
if (g_StartupInfo.ShowDialog(76, 6, NULL, dialogItems, kNumItems) < 0)
return (E_ABORT);
return E_ABORT;
AString oemPassword = dialogItems[2].Data;
password = MultiByteToUnicodeString(oemPassword, CP_OEMCP);
@@ -383,26 +350,28 @@ static HANDLE MyOpenFilePluginW(const wchar_t *name)
{
if (result == E_ABORT)
return (HANDLE)-2;
ShowSysErrorMessage(result);
return INVALID_HANDLE_VALUE;
}
UString errorMessage = agent->GetErrorMessage();
if (!errorMessage.IsEmpty())
PrintErrorMessage("7-Zip", UnicodeStringToMultiByte(errorMessage, CP_OEMCP));
g_StartupInfo.ShowErrorMessage(UnicodeStringToMultiByte(errorMessage, CP_OEMCP));
// ::OutputDebugStringA("after OpenArchive\n");
CPlugin *plugin = new CPlugin(
fullName,
// defaultName,
archiveHandler,
agent,
(const wchar_t *)archiveType
);
if (plugin == NULL)
return(INVALID_HANDLE_VALUE);
if (!plugin)
return INVALID_HANDLE_VALUE;
plugin->PasswordIsDefined = openArchiveCallbackSpec->PasswordIsDefined;
plugin->Password = openArchiveCallbackSpec->Password;
// OutputDebugStringA("--- OpenFilePlugin ---- END");
return (HANDLE)(plugin);
}
@@ -420,6 +389,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
EXTERN_C HANDLE WINAPI OpenFilePlugin(char *name, const unsigned char * /* data */, int /* dataSize */)
{
MY_TRY_BEGIN;
// OutputDebugStringA("--- OpenFilePlugin");
if (name == NULL || (!g_Options.Enabled))
{
// if (!Opt.ProcessShiftF1)
@@ -474,9 +444,14 @@ EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, INT_PTR item)
case 1:
{
CObjectVector<PluginPanelItem> pluginPanelItem;
if(!g_StartupInfo.ControlGetActivePanelSelectedOrCurrentItems(pluginPanelItem))
if (!g_StartupInfo.ControlGetActivePanelSelectedOrCurrentItems(pluginPanelItem))
throw 142134;
if (CompressFiles(pluginPanelItem) == S_OK)
HRESULT res = CompressFiles(pluginPanelItem);
if (res != S_OK && res != E_ABORT)
{
ShowSysErrorMessage(res);
}
// if (res == S_OK)
{
/* int t = */ g_StartupInfo.ControlClearPanelSelection();
g_StartupInfo.ControlRequestActivePanel(FCTL_UPDATEPANEL, NULL);
@@ -496,8 +471,10 @@ EXTERN_C HANDLE WINAPI OpenPlugin(int openFrom, INT_PTR item)
EXTERN_C void WINAPI ClosePlugin(HANDLE plugin)
{
// OutputDebugStringA("-- ClosePlugin --- START");
MY_TRY_BEGIN;
delete (CPlugin *)plugin;
// OutputDebugStringA("-- ClosePlugin --- END");
MY_TRY_END1("ClosePlugin");
}
@@ -599,14 +576,14 @@ EXTERN_C void WINAPI GetOpenPluginInfo(HANDLE plugin,struct OpenPluginInfo *info
EXTERN_C int WINAPI PutFiles(HANDLE plugin, struct PluginPanelItem *panelItems, int itemsNumber, int move, int opMode)
{
MY_TRY_BEGIN;
return(((CPlugin *)plugin)->PutFiles(panelItems, itemsNumber, move, opMode));
return (((CPlugin *)plugin)->PutFiles(panelItems, itemsNumber, move, opMode));
MY_TRY_END2("PutFiles", NFileOperationReturnCode::kError);
}
EXTERN_C int WINAPI DeleteFiles(HANDLE plugin, PluginPanelItem *panelItems, int itemsNumber, int opMode)
{
MY_TRY_BEGIN;
return(((CPlugin *)plugin)->DeleteFiles(panelItems, itemsNumber, opMode));
return (((CPlugin *)plugin)->DeleteFiles(panelItems, itemsNumber, opMode));
MY_TRY_END2("DeleteFiles", FALSE);
}

View File

@@ -3,6 +3,7 @@
LIBRARY "7-ZipFar"
EXPORTS
ExitFAR
SetStartupInfo
OpenPlugin
OpenFilePlugin

View File

@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /YX /FD /c
# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /Gz /MTd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MTd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /D "EXTERNAL_CODECS" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
@@ -342,6 +342,14 @@ SOURCE=..\..\..\Windows\Registry.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\ResourceString.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\ResourceString.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Synchronization.cpp
# End Source File
# Begin Source File
@@ -526,6 +534,18 @@ SOURCE=..\Agent\AgentProxy.h
# End Source File
# Begin Source File
SOURCE=..\Agent\ArchiveFolder.cpp
# End Source File
# Begin Source File
SOURCE=..\Agent\ArchiveFolderOpen.cpp
# End Source File
# Begin Source File
SOURCE=..\Agent\ArchiveFolderOut.cpp
# End Source File
# Begin Source File
SOURCE=..\Agent\IFolderArchive.h
# End Source File
# Begin Source File
@@ -554,6 +574,14 @@ SOURCE=..\..\Compress\CopyCoder.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Common\CreateCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\CreateCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\FilePathAutoRename.cpp
# End Source File
# Begin Source File
@@ -570,6 +598,14 @@ SOURCE=..\..\Common\FileStreams.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\FilterCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\FilterCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\LimitedStreams.cpp
# End Source File
# Begin Source File

View File

@@ -104,18 +104,27 @@ typedef int (WINAPI *FARAPIDIALOG)(
);
enum {
FMSG_WARNING=1,
FMSG_ERRORTYPE=2,
FMSG_KEEPBACKGROUND=4,
FMSG_DOWN=8,
FMSG_LEFTALIGN=16
FMSG_WARNING = 0x00000001,
FMSG_ERRORTYPE = 0x00000002,
FMSG_KEEPBACKGROUND = 0x00000004,
FMSG_DOWN = 0x00000008,
FMSG_LEFTALIGN = 0x00000010,
FMSG_ALLINONE = 0x00000020,
FMSG_MB_OK = 0x00010000,
FMSG_MB_OKCANCEL = 0x00020000,
FMSG_MB_ABORTRETRYIGNORE = 0x00030000,
FMSG_MB_YESNO = 0x00040000,
FMSG_MB_YESNOCANCEL = 0x00050000,
FMSG_MB_RETRYCANCEL = 0x00060000
};
typedef int (WINAPI *FARAPIMESSAGE)(
INT_PTR PluginNumber,
unsigned int Flags,
char *HelpTopic,
char **Items,
const char *HelpTopic,
const char * const *Items,
int ItemsNumber,
int ButtonsNumber
);
@@ -424,21 +433,22 @@ struct OpenPluginInfo
{
int StructSize;
DWORD Flags;
char *HostFile;
char *CurDir;
char *Format;
char *PanelTitle;
struct InfoPanelLine *InfoLines;
const char *HostFile;
const char *CurDir;
const char *Format;
const char *PanelTitle;
const struct InfoPanelLine *InfoLines;
int InfoLinesNumber;
char **DescrFiles;
const char * const *DescrFiles;
int DescrFilesNumber;
struct PanelMode *PanelModesArray;
const struct PanelMode *PanelModesArray;
int PanelModesNumber;
int StartPanelMode;
int StartSortMode;
int StartSortOrder;
struct KeyBarTitles *KeyBar;
char *ShortcutData;
const struct KeyBarTitles *KeyBar;
const char *ShortcutData;
// long Reserverd;
};
enum {

View File

@@ -2,6 +2,7 @@
#include "StdAfx.h"
#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
#ifndef UNDER_CE
@@ -35,8 +36,8 @@ const char *CStartupInfo::GetMsgString(int messageId)
int CStartupInfo::ShowMessage(unsigned int flags,
const char *helpTopic, const char **items, int numItems, int numButtons)
{
return m_Data.Message(m_Data.ModuleNumber, flags, (char *)helpTopic,
(char **)items, numItems, numButtons);
return m_Data.Message(m_Data.ModuleNumber, flags, helpTopic,
items, numItems, numButtons);
}
namespace NMessageID
@@ -50,12 +51,40 @@ namespace NMessageID
};
}
int CStartupInfo::ShowMessage(const char *message)
int CStartupInfo::ShowWarningWithOk(const char **items, int numItems)
{
const char *items[]= { GetMsgString(NMessageID::kError), message, GetMsgString(NMessageID::kOk) };
return ShowMessage(FMSG_WARNING, NULL, items, ARRAY_SIZE(items), 1);
return ShowMessage(FMSG_WARNING | FMSG_MB_OK, NULL, items, numItems, 0);
}
extern const char *g_PluginName_for_Error;
void CStartupInfo::SetErrorTitle(AString &s)
{
if (g_PluginName_for_Error)
{
s += g_PluginName_for_Error;
s += ": ";
}
s += GetMsgString(NMessageID::kError);
}
int CStartupInfo::ShowErrorMessage(const char *message)
{
AString s;
SetErrorTitle(s);
const char *items[]= { s, message };
return ShowWarningWithOk(items, ARRAY_SIZE(items));
}
int CStartupInfo::ShowErrorMessage2(const char *m1, const char *m2)
{
AString s;
SetErrorTitle(s);
const char *items[]= { s, m1, m2 };
return ShowWarningWithOk(items, ARRAY_SIZE(items));
}
/*
static void SplitString(const AString &srcString, AStringVector &destStrings)
{
destStrings.Clear();
@@ -80,7 +109,9 @@ static void SplitString(const AString &srcString, AStringVector &destStrings)
if (!string.IsEmpty())
destStrings.Add(string);
}
*/
/*
int CStartupInfo::ShowMessageLines(const char *message)
{
AStringVector strings;
@@ -94,10 +125,22 @@ int CStartupInfo::ShowMessageLines(const char *message)
return ShowMessage(FMSG_WARNING, NULL, items, pos, 1);
}
*/
/*
int CStartupInfo::ShowMessageLines(const char *message)
{
AString s = GetMsgString(NMessageID::kError);
s.Add_LF();
s += message;
return ShowMessage(FMSG_WARNING | FMSG_MB_OK | FMSG_ALLINONE, NULL,
(const char **)(const char *)s, 1, 0);
}
*/
int CStartupInfo::ShowMessage(int messageId)
{
return ShowMessage(GetMsgString(messageId));
return ShowErrorMessage(GetMsgString(messageId));
}
int CStartupInfo::ShowDialog(int X1, int Y1, int X2, int Y2,
@@ -129,14 +172,14 @@ void CStartupInfo::InitDialogItems(const CInitDialogItem *srcItems,
destItem.X2 = srcItem.X2;
destItem.Y2 = srcItem.Y2;
destItem.Focus = GetBOOLValue(srcItem.Focus);
if(srcItem.HistoryName != NULL)
if (srcItem.HistoryName != NULL)
destItem.History = srcItem.HistoryName;
else
destItem.Selected = GetBOOLValue(srcItem.Selected);
destItem.Flags = srcItem.Flags;
destItem.DefaultButton = GetBOOLValue(srcItem.DefaultButton);
if(srcItem.DataMessageId < 0)
if (srcItem.DataMessageId < 0)
MyStringCopy(destItem.Data, srcItem.DataString);
else
MyStringCopy(destItem.Data, GetMsgString(srcItem.DataMessageId));
@@ -220,7 +263,7 @@ CSysString CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyN
return valueDefault;
CSysString value;
if(regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
if (regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
return valueDefault;
return value;
@@ -234,7 +277,7 @@ UInt32 CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyName,
return valueDefault;
UInt32 value;
if(regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
if (regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
return valueDefault;
return value;
@@ -248,7 +291,7 @@ bool CStartupInfo::QueryRegKeyValue(HKEY parentKey, const CSysString &keyName,
return valueDefault;
bool value;
if(regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
if (regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
return valueDefault;
return value;
@@ -278,9 +321,9 @@ bool CStartupInfo::ControlGetActivePanelCurrentItemInfo(
PluginPanelItem &pluginPanelItem)
{
PanelInfo panelInfo;
if(!ControlGetActivePanelInfo(panelInfo))
if (!ControlGetActivePanelInfo(panelInfo))
return false;
if(panelInfo.ItemsNumber <= 0)
if (panelInfo.ItemsNumber <= 0)
throw "There are no items";
pluginPanelItem = panelInfo.PanelItems[panelInfo.CurrentItem];
return true;
@@ -291,9 +334,9 @@ bool CStartupInfo::ControlGetActivePanelSelectedOrCurrentItems(
{
pluginPanelItems.Clear();
PanelInfo panelInfo;
if(!ControlGetActivePanelInfo(panelInfo))
if (!ControlGetActivePanelInfo(panelInfo))
return false;
if(panelInfo.ItemsNumber <= 0)
if (panelInfo.ItemsNumber <= 0)
throw "There are no items";
if (panelInfo.SelectedItemsNumber == 0)
pluginPanelItems.Add(panelInfo.PanelItems[panelInfo.CurrentItem]);
@@ -306,7 +349,7 @@ bool CStartupInfo::ControlGetActivePanelSelectedOrCurrentItems(
bool CStartupInfo::ControlClearPanelSelection()
{
PanelInfo panelInfo;
if(!ControlGetActivePanelInfo(panelInfo))
if (!ControlGetActivePanelInfo(panelInfo))
return false;
for (int i = 0; i < panelInfo.ItemsNumber; i++)
panelInfo.PanelItems[i].Flags &= ~PPIF_SELECTED;
@@ -375,7 +418,7 @@ CScreenRestorer::~CScreenRestorer()
}
void CScreenRestorer::Save()
{
if(m_Saved)
if (m_Saved)
return;
m_HANDLE = g_StartupInfo.SaveScreen();
m_Saved = true;
@@ -383,41 +426,67 @@ void CScreenRestorer::Save()
void CScreenRestorer::Restore()
{
if(m_Saved)
if (m_Saved)
{
g_StartupInfo.RestoreScreen(m_HANDLE);
m_Saved = false;
}
};
static AString DWORDToString(DWORD number)
int PrintErrorMessage(const char *message, unsigned code)
{
char buffer[32];
_ultoa(number, buffer, 10);
return buffer;
AString s = message;
s += " #";
char temp[16];
ConvertUInt32ToString((UInt32)code, temp);
s += temp;
return g_StartupInfo.ShowErrorMessage(s);
}
void PrintErrorMessage(const char *message, int code)
int PrintErrorMessage(const char *message, const char *text)
{
AString tmp = message;
tmp += " #";
tmp += DWORDToString(code);
g_StartupInfo.ShowMessage(tmp);
return g_StartupInfo.ShowErrorMessage2(message, text);
}
void PrintErrorMessage(const char *message, const char *text)
static void ReduceString(UString &s, unsigned size)
{
AString tmp = message;
tmp += ":\n";
tmp += text;
g_StartupInfo.ShowMessageLines(tmp);
if (s.Len() > size)
{
if (size > 5)
size -= 5;
s.Delete(size / 2, s.Len() - size);
s.Insert(size / 2, L" ... ");
}
}
void PrintErrorMessage(const char *message, const wchar_t *text)
int PrintErrorMessage(const char *message, const wchar_t *name, unsigned maxLen)
{
PrintErrorMessage(message, UnicodeStringToMultiByte(text, CP_OEMCP));
UString s = name;
ReduceString(s, maxLen);
return PrintErrorMessage(message, UnicodeStringToMultiByte(s, CP_OEMCP));
}
int ShowSysErrorMessage(DWORD errorCode)
{
UString message = NError::MyFormatMessage(errorCode);
return g_StartupInfo.ShowErrorMessage(UnicodeStringToMultiByte(message, CP_OEMCP));
}
int ShowLastErrorMessage()
{
return ShowSysErrorMessage(::GetLastError());
}
int ShowSysErrorMessage(DWORD errorCode, const wchar_t *name)
{
UString s = NError::MyFormatMessage(errorCode);
AString s1 = UnicodeStringToMultiByte(s, CP_OEMCP);
AString s2 = UnicodeStringToMultiByte(name, CP_OEMCP);
return g_StartupInfo.ShowErrorMessage2(s1, s2);
}
bool WasEscPressed()
{
#ifdef UNDER_CE
@@ -425,19 +494,19 @@ bool WasEscPressed()
#else
NConsole::CIn inConsole;
HANDLE handle = ::GetStdHandle(STD_INPUT_HANDLE);
if(handle == INVALID_HANDLE_VALUE)
if (handle == INVALID_HANDLE_VALUE)
return true;
inConsole.Attach(handle);
for (;;)
{
DWORD numEvents;
if(!inConsole.GetNumberOfEvents(numEvents))
if (!inConsole.GetNumberOfEvents(numEvents))
return true;
if(numEvents == 0)
if (numEvents == 0)
return false;
INPUT_RECORD event;
if(!inConsole.ReadEvent(event, numEvents))
if (!inConsole.ReadEvent(event, numEvents))
return true;
if (event.EventType == KEY_EVENT &&
event.Event.KeyEvent.bKeyDown &&
@@ -447,17 +516,4 @@ bool WasEscPressed()
#endif
}
void ShowErrorMessage(DWORD errorCode)
{
UString message = NError::MyFormatMessage(errorCode);
message.RemoveChar(L'\x0D');
message.Replace(L'\x0A', L' ');
g_StartupInfo.ShowMessage(UnicodeStringToMultiByte(message, CP_OEMCP));
}
void ShowLastErrorMessage()
{
ShowErrorMessage(::GetLastError());
}
}

View File

@@ -59,10 +59,15 @@ public:
void Init(const PluginStartupInfo &pluginStartupInfo,
const CSysString &pluginNameForRegestry);
const char *GetMsgString(int messageId);
int ShowMessage(unsigned int flags, const char *helpTopic,
const char **items, int numItems, int numButtons);
int ShowMessage(const char *message);
int ShowMessageLines(const char *message);
int ShowWarningWithOk(const char **items, int numItems);
void SetErrorTitle(AString &s);
int ShowErrorMessage(const char *message);
int ShowErrorMessage2(const char *m1, const char *m2);
// int ShowMessageLines(const char *messageLines);
int ShowMessage(int messageId);
int ShowDialog(int X1, int Y1, int X2, int Y2,
@@ -158,30 +163,32 @@ public:
extern CStartupInfo g_StartupInfo;
void PrintErrorMessage(const char *message, int code);
void PrintErrorMessage(const char *message, const char *text);
void PrintErrorMessage(const char *message, const wchar_t *text);
#define MY_TRY_BEGIN try\
{
int PrintErrorMessage(const char *message, unsigned code);
int PrintErrorMessage(const char *message, const char *text);
int PrintErrorMessage(const char *message, const wchar_t *name, unsigned maxLen = 70);
#define MY_TRY_END1(x) }\
catch(int n) { PrintErrorMessage(x, n); return; }\
#define MY_TRY_BEGIN try {
#define MY_TRY_END1(x) }\
catch(unsigned n) { PrintErrorMessage(x, n); return; }\
catch(const CSysString &s) { PrintErrorMessage(x, s); return; }\
catch(const char *s) { PrintErrorMessage(x, s); return; }\
catch(...) { g_StartupInfo.ShowMessage(x); return; }
catch(...) { g_StartupInfo.ShowErrorMessage(x); return; }
#define MY_TRY_END2(x, y) }\
catch(int n) { PrintErrorMessage(x, n); return y; }\
#define MY_TRY_END2(x, y) }\
catch(unsigned n) { PrintErrorMessage(x, n); return y; }\
catch(const AString &s) { PrintErrorMessage(x, s); return y; }\
catch(const char *s) { PrintErrorMessage(x, s); return y; }\
catch(const UString &s) { PrintErrorMessage(x, s); return y; }\
catch(const wchar_t *s) { PrintErrorMessage(x, s); return y; }\
catch(...) { g_StartupInfo.ShowMessage(x); return y; }
catch(...) { g_StartupInfo.ShowErrorMessage(x); return y; }
int ShowSysErrorMessage(DWORD errorCode);
int ShowSysErrorMessage(DWORD errorCode, const wchar_t *name);
int ShowLastErrorMessage();
bool WasEscPressed();
void ShowErrorMessage(DWORD errorCode);
void ShowLastErrorMessage();
}

View File

@@ -27,14 +27,15 @@ int CompareFileNames_ForFolderList(const wchar_t *s1, const wchar_t *s2)
}
CPlugin::CPlugin(const FString &fileName, IInFolderArchive *archiveHandler, UString archiveTypeName):
m_ArchiveHandler(archiveHandler),
CPlugin::CPlugin(const FString &fileName, CAgent *agent, UString archiveTypeName):
_agent(agent),
m_FileName(fileName),
_archiveTypeName(archiveTypeName)
{
m_ArchiveHandler = agent;
if (!m_FileInfo.Find(m_FileName))
throw "error";
archiveHandler->BindToRootFolder(&_folder);
m_ArchiveHandler->BindToRootFolder(&_folder);
}
CPlugin::~CPlugin() {}
@@ -194,7 +195,7 @@ void CPlugin::EnterToDirectory(const UString &dirName)
if (dirName == kDotsReplaceStringU)
s = L"..";
_folder->BindToFolder(s, &newFolder);
if (newFolder == NULL)
if (!newFolder)
if (dirName.IsEmpty())
return;
else
@@ -214,7 +215,7 @@ int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
{
CMyComPtr<IFolderFolder> newFolder;
_folder->BindToParentFolder(&newFolder);
if (newFolder == NULL)
if (!newFolder)
throw 40312;
_folder = newFolder;
}
@@ -245,7 +246,7 @@ void CPlugin::GetPathParts(UStringVector &pathParts)
{
CMyComPtr<IFolderFolder> newFolder;
folderItem->BindToParentFolder(&newFolder);
if (newFolder == NULL)
if (!newFolder)
break;
NCOM::CPropVariant prop;
if (folderItem->GetFolderProperty(kpidName, &prop) == S_OK)
@@ -258,16 +259,29 @@ void CPlugin::GetPathParts(UStringVector &pathParts)
void CPlugin::SetCurrentDirVar()
{
m_CurrentDir.Empty();
/*
// kpidPath path has tail slash, but we don't need it for compatibility with default FAR style
NCOM::CPropVariant prop;
if (_folder->GetFolderProperty(kpidPath, &prop) == S_OK)
if (prop.vt == VT_BSTR)
{
m_CurrentDir = (wchar_t *)prop.bstrVal;
// if (!m_CurrentDir.IsEmpty())
}
m_CurrentDir.InsertAtFront(WCHAR_PATH_SEPARATOR);
*/
UStringVector pathParts;
GetPathParts(pathParts);
FOR_VECTOR (i, pathParts)
{
m_CurrentDir += WCHAR_PATH_SEPARATOR;
m_CurrentDir.Add_PathSepar();
m_CurrentDir += pathParts[i];
}
}
static char *kPluginFormatName = "7-ZIP";
static const char *kPluginFormatName = "7-ZIP";
static int FindPropNameID(PROPID propID)
@@ -290,19 +304,19 @@ static CPropertyIDInfo kPropertyIDInfos[] =
{
{ kpidName, "N", 0},
{ kpidSize, "S", 8},
{ kpidPackedSize, "P", 8},
{ kpidPackSize, "P", 8},
{ kpidAttrib, "A", 0},
{ kpidCTime, "DC", 14},
{ kpidATime, "DA", 14},
{ kpidMTime, "DM", 14},
{ kpidSolid, NULL, 0, 'S'},
{ kpidEncrypted, NULL, 0, 'P'}
{ kpidEncrypted, NULL, 0, 'P'},
{ kpidDictionarySize, IDS_PROPERTY_DICTIONARY_SIZE },
{ kpidSplitBefore, NULL, 'B'},
{ kpidSplitAfter, NULL, 'A'},
{ kpidComment, , NULL, 'C'},
{ kpidComment, NULL, 'C'},
{ kpidCRC, IDS_PROPERTY_CRC }
// { kpidType, L"Type" }
};
@@ -394,17 +408,20 @@ static AString ConvertSizeToString(UInt64 value)
static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID)
{
AString s;
if (prop.vt == VT_BSTR)
s = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
else if (prop.vt == VT_BOOL)
{
AString s = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
s.Replace((char)0xA, ' ');
s.Replace((char)0xD, ' ');
return s;
}
if (prop.vt == VT_BOOL)
{
int messageID = VARIANT_BOOLToBool(prop.boolVal) ?
NMessageID::kYes : NMessageID::kNo;
return g_StartupInfo.GetMsgString(messageID);
}
else if (prop.vt != VT_EMPTY)
if (prop.vt != VT_EMPTY)
{
if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && (
propID == kpidSize ||
@@ -420,18 +437,15 @@ static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID)
{
UInt64 v = 0;
ConvertPropVariantToUInt64(prop, v);
s = ConvertSizeToString(v);
return ConvertSizeToString(v);
}
else
{
UString temp;
ConvertPropertyToString(temp, prop, propID);
s = UnicodeStringToMultiByte(temp, CP_OEMCP);
char sz[64];
ConvertPropertyToShortString(sz, prop, propID);
return sz;
}
}
s.Replace((char)0xA, ' ');
s.Replace((char)0xD, ' ');
return s;
return AString();
}
static AString PropToString2(const NCOM::CPropVariant &prop, PROPID propID)
@@ -489,12 +503,11 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
name = fs2us(fileName);
}
m_PannelTitle =
UString(L' ') +
_archiveTypeName +
UString(L':') +
name +
UString(L' ');
m_PannelTitle = L' ';
m_PannelTitle += _archiveTypeName;
m_PannelTitle += L':';
m_PannelTitle += name;
m_PannelTitle.Add_Space();
if (!m_CurrentDir.IsEmpty())
{
// m_PannelTitle += '\\';
@@ -629,25 +642,25 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
/*
AddColumn(kpidName);
AddColumn(kpidSize);
AddColumn(kpidPackedSize);
AddColumn(kpidPackSize);
AddColumn(kpidMTime);
AddColumn(kpidCTime);
AddColumn(kpidATime);
AddColumn(kpidAttrib);
PanelMode.ColumnTypes = (char *)(const char *)PanelModeColumnTypes;
PanelMode.ColumnWidths = (char *)(const char *)PanelModeColumnWidths;
PanelMode.ColumnTitles = NULL;
PanelMode.FullScreen = TRUE;
PanelMode.DetailedStatus = FALSE;
PanelMode.AlignExtensions = FALSE;
PanelMode.CaseConversion = FALSE;
PanelMode.StatusColumnTypes = "N";
PanelMode.StatusColumnWidths = "0";
PanelMode.Reserved[0] = 0;
PanelMode.Reserved[1] = 0;
_PanelMode.ColumnTypes = (char *)(const char *)PanelModeColumnTypes;
_PanelMode.ColumnWidths = (char *)(const char *)PanelModeColumnWidths;
_PanelMode.ColumnTitles = NULL;
_PanelMode.FullScreen = TRUE;
_PanelMode.DetailedStatus = FALSE;
_PanelMode.AlignExtensions = FALSE;
_PanelMode.CaseConversion = FALSE;
_PanelMode.StatusColumnTypes = "N";
_PanelMode.StatusColumnWidths = "0";
_PanelMode.Reserved[0] = 0;
_PanelMode.Reserved[1] = 0;
info->PanelModesArray = &PanelMode;
info->PanelModesArray = &_PanelMode;
info->PanelModesNumber = 1;
*/
@@ -667,6 +680,11 @@ struct CArchiveItemProperty
VARTYPE Type;
};
static inline char GetHex(Byte value)
{
return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
}
HRESULT CPlugin::ShowAttributesWindow()
{
PluginPanelItem pluginPanelItem;
@@ -691,7 +709,7 @@ HRESULT CPlugin::ShowAttributesWindow()
prop.Type = vt;
prop.ID = propID;
if (prop.ID == kpidPath)
prop.ID = kpidName;
prop.ID = kpidName;
prop.Name = GetNameOfProp(propID, name);
properties.Add(prop);
}
@@ -705,12 +723,16 @@ HRESULT CPlugin::ShowAttributesWindow()
initDialogItems.Add(idi);
AStringVector values;
const int kStartY = 3;
for (i = 0; i < properties.Size(); i++)
{
const CArchiveItemProperty &property = properties[i];
int startY = kStartY + values.Size();
CInitDialogItem idi =
{ DI_TEXT, 5, 3 + i, 0, 0, false, false, 0, false, 0, NULL, NULL };
{ DI_TEXT, 5, startY, 0, 0, false, false, 0, false, 0, NULL, NULL };
idi.DataMessageId = FindPropNameID(property.ID);
if (idi.DataMessageId < 0)
idi.DataString = property.Name;
@@ -723,11 +745,91 @@ HRESULT CPlugin::ShowAttributesWindow()
{
CInitDialogItem idi =
{ DI_TEXT, 30, 3 + i, 0, 0, false, false, 0, false, -1, NULL, NULL };
{ DI_TEXT, 30, startY, 0, 0, false, false, 0, false, -1, NULL, NULL };
initDialogItems.Add(idi);
}
}
CMyComPtr<IArchiveGetRawProps> _folderRawProps;
_folder.QueryInterface(IID_IArchiveGetRawProps, &_folderRawProps);
CObjectVector<CArchiveItemProperty> properties2;
if (_folderRawProps)
{
_folderRawProps->GetNumRawProps(&numProps);
for (i = 0; i < numProps; i++)
{
CMyComBSTR name;
PROPID propID;
if (_folderRawProps->GetRawPropInfo(i, &name, &propID) != S_OK)
continue;
CArchiveItemProperty prop;
prop.Type = VT_EMPTY;
prop.ID = propID;
if (prop.ID == kpidPath)
prop.ID = kpidName;
prop.Name = GetNameOfProp(propID, name);
properties2.Add(prop);
}
for (unsigned i = 0; i < properties2.Size(); i++)
{
const CArchiveItemProperty &property = properties2[i];
CMyComBSTR name;
const void *data;
UInt32 dataSize;
UInt32 propType;
if (_folderRawProps->GetRawProp(itemIndex, property.ID, &data, &dataSize, &propType) != S_OK)
continue;
if (dataSize != 0)
{
AString s;
if (property.ID == kpidNtSecure)
ConvertNtSecureToString((const Byte *)data, dataSize, s);
else
{
const UInt32 kMaxDataSize = 64;
if (dataSize > kMaxDataSize)
{
char temp[64];
s += "data:";
ConvertUInt32ToString(dataSize, temp);
s += temp;
}
else
{
for (UInt32 i = 0; i < dataSize; i++)
{
Byte b = ((const Byte *)data)[i];
s += GetHex((Byte)((b >> 4) & 0xF));
s += GetHex((Byte)(b & 0xF));
}
}
}
int startY = kStartY + values.Size();
CInitDialogItem idi =
{ DI_TEXT, 5, startY, 0, 0, false, false, 0, false, 0, NULL, NULL };
idi.DataMessageId = FindPropNameID(property.ID);
if (idi.DataMessageId < 0)
idi.DataString = property.Name;
initDialogItems.Add(idi);
values.Add(s);
{
CInitDialogItem idi =
{ DI_TEXT, 30, startY, 0, 0, false, false, 0, false, -1, NULL, NULL };
initDialogItems.Add(idi);
}
}
}
}
unsigned numLines = values.Size();
for (i = 0; i < numLines; i++)
{
@@ -741,6 +843,7 @@ HRESULT CPlugin::ShowAttributesWindow()
g_StartupInfo.InitDialogItems(&initDialogItems.Front(), dialogItems, numDialogItems);
unsigned maxLen = 0;
for (i = 0; i < numLines; i++)
{
FarDialogItem &dialogItem = dialogItems[1 + i * 2];
@@ -748,8 +851,10 @@ HRESULT CPlugin::ShowAttributesWindow()
if (len > maxLen)
maxLen = len;
}
unsigned maxLen2 = 0;
const unsigned kSpace = 10;
for (i = 0; i < numLines; i++)
{
FarDialogItem &dialogItem = dialogItems[1 + i * 2 + 1];
@@ -758,6 +863,7 @@ HRESULT CPlugin::ShowAttributesWindow()
maxLen2 = len;
dialogItem.X1 = maxLen + kSpace;
}
size = numLines + 6;
xSize = maxLen + kSpace + maxLen2 + 5;
FarDialogItem &firstDialogItem = dialogItems[0];
@@ -770,6 +876,12 @@ HRESULT CPlugin::ShowAttributesWindow()
int CPlugin::ProcessKey(int key, unsigned int controlState)
{
if (key == VK_F7 && controlState == 0)
{
CreateFolder();
return TRUE;
}
if (controlState == PKF_CONTROL && key == 'A')
{
HRESULT result = ShowAttributesWindow();
@@ -779,6 +891,7 @@ int CPlugin::ProcessKey(int key, unsigned int controlState)
return FALSE;
throw "Error";
}
if ((controlState & PKF_ALT) != 0 && key == VK_F6)
{
FString folderPath;

View File

@@ -5,13 +5,13 @@
#include "../../../Common/MyCom.h"
#include "../../../Windows/COM.h"
// #include "../../../Windows/COM.h"
#include "../../../Windows/FileFind.h"
#include "../../../Windows/PropVariant.h"
#include "../Common/WorkDir.h"
#include "../Agent/IFolderArchive.h"
#include "../Agent/Agent.h"
#include "FarUtils.h"
@@ -19,10 +19,18 @@ const UInt32 kNumInfoLinesMax = 64;
class CPlugin
{
NWindows::NCOM::CComInitializer m_ComInitializer;
CAgent *_agent;
CMyComPtr<IInFolderArchive> m_ArchiveHandler;
CMyComPtr<IFolderFolder> _folder;
// NWindows::NCOM::CComInitializer m_ComInitializer;
UString m_CurrentDir;
UString m_PannelTitle;
FString m_FileName;
NWindows::NFile::NFind::CFileInfo m_FileInfo;
UString _archiveTypeName;
InfoPanelLine m_InfoLines[kNumInfoLinesMax];
@@ -32,26 +40,20 @@ class CPlugin
AString PanelModeColumnTypes;
AString PanelModeColumnWidths;
PanelMode PanelMode;
// PanelMode _PanelMode;
void AddColumn(PROPID aPropID);
void EnterToDirectory(const UString &dirName);
void GetPathParts(UStringVector &pathParts);
void SetCurrentDirVar();
HRESULT AfterUpdate(CWorkDirTempFile &tempFile, const UStringVector &pathVector);
public:
FString m_FileName;
NWindows::NFile::NFind::CFileInfo m_FileInfo;
// HRESULT AfterUpdate(CWorkDirTempFile &tempFile, const UStringVector &pathVector);
CMyComPtr<IInFolderArchive> m_ArchiveHandler;
CMyComPtr<IFolderFolder> _folder;
UString _archiveTypeName;
public:
bool PasswordIsDefined;
UString Password;
CPlugin(const FString &fileName, IInFolderArchive *archiveHandler, UString archiveTypeName);
CPlugin(const FString &fileName, CAgent *agent, UString archiveTypeName);
~CPlugin();
void ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex);
@@ -80,6 +82,7 @@ public:
NFar::NFileOperationReturnCode::EEnum PutFiles(struct PluginPanelItem *panelItems, int itemsNumber,
int move, int opMode);
HRESULT CreateFolder();
HRESULT ShowAttributesWindow();

View File

@@ -14,13 +14,11 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
{
if (numItems == 0)
return FALSE;
/*
if (!m_ArchiverInfo.UpdateEnabled)
if (_agent->IsThereReadOnlyArc())
{
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return FALSE;
}
*/
if ((opMode & OPM_SILENT) == 0)
{
const char *msgItems[]=
@@ -55,21 +53,21 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
progressBoxPointer = &progressBox;
progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kDeleting), 48);
g_StartupInfo.GetMsgString(NMessageID::kDeleting));
}
/*
CWorkDirTempFile tempFile;
if (tempFile.CreateTempFile(m_FileName) != S_OK)
return FALSE;
*/
CObjArray<UInt32> indices(numItems);
int i;
for (i = 0; i < numItems; i++)
indices[i] = (UInt32)panelItems[i].UserData;
////////////////////////////
// Save _folder;
/*
UStringVector pathVector;
GetPathParts(pathVector);
@@ -80,13 +78,15 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return FALSE;
}
outArchive->SetFolder(_folder);
*/
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec);
updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer);
/*
outArchive->SetFolder(_folder);
result = outArchive->DeleteItems(tempFile.OutStream, indices, numItems, updateCallback);
updateCallback.Release();
outArchive.Release();
@@ -95,11 +95,24 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
{
result = AfterUpdate(tempFile, pathVector);
}
*/
HRESULT result;
{
CMyComPtr<IFolderOperations> folderOperations;
result = _folder.QueryInterface(IID_IFolderOperations, &folderOperations);
if (folderOperations)
result = folderOperations->Delete(indices, numItems, updateCallback);
else if (result != S_OK)
result = E_FAIL;
}
if (result != S_OK)
{
ShowErrorMessage(result);
ShowSysErrorMessage(result);
return FALSE;
}
SetCurrentDirVar();
return TRUE;
}

View File

@@ -47,11 +47,11 @@ HRESULT CPlugin::ExtractFiles(
progressBoxPointer = &progressBox;
progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kExtracting), 48);
g_StartupInfo.GetMsgString(NMessageID::kExtracting));
}
CExtractCallBackImp *extractCallbackSpec = new CExtractCallBackImp;
CExtractCallbackImp *extractCallbackSpec = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback(extractCallbackSpec);
extractCallbackSpec->Init(
@@ -100,7 +100,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
NName::NormalizeDirPathPrefix(destPathU);
destPath = UnicodeStringToMultiByte(destPathU, CP_OEMCP);
bool extractSelectedFiles = true;
// bool extractSelectedFiles = true;
NExtract::CInfo extractionInfo;
extractionInfo.PathMode = NExtract::NPathMode::kCurPaths;
@@ -211,7 +211,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
if (destPathU.Back() == kDirDelimiter)
break;
}
g_StartupInfo.ShowMessage("You must specify directory path");
g_StartupInfo.ShowErrorMessage("You must specify directory path");
}
if (dialogItems[kPathModeRadioIndex].Selected)
@@ -246,9 +246,13 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
extractionInfo.Save();
if (dialogItems[kFilesModeIndex].Selected)
extractSelectedFiles = true;
{
// extractSelectedFiles = true;
}
else if (dialogItems[kFilesModeIndex + 1].Selected)
extractSelectedFiles = false;
{
// extractSelectedFiles = false;
}
else
throw 31806;
@@ -278,7 +282,7 @@ NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *pa
{
if (result == E_ABORT)
return NFileOperationReturnCode::kInterruptedByUser;
ShowErrorMessage(result);
ShowSysErrorMessage(result);
return NFileOperationReturnCode::kError;
}

View File

@@ -49,6 +49,7 @@ static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UInt32 method)
return S_OK;
}
/*
HRESULT CPlugin::AfterUpdate(CWorkDirTempFile &tempFile, const UStringVector &pathVector)
{
_folder.Release();
@@ -69,26 +70,28 @@ HRESULT CPlugin::AfterUpdate(CWorkDirTempFile &tempFile, const UStringVector &pa
}
return S_OK;
}
*/
NFileOperationReturnCode::EEnum CPlugin::PutFiles(
struct PluginPanelItem *panelItems, int numItems,
int moveMode, int opMode)
{
/*
if (moveMode != 0)
{
g_StartupInfo.ShowMessage(NMessageID::kMoveIsNotSupported);
return NFileOperationReturnCode::kError;
}
*/
if (numItems == 0)
return NFileOperationReturnCode::kError;
/*
if (!m_ArchiverInfo.UpdateEnabled)
if (_agent->IsThereReadOnlyArc())
{
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return NFileOperationReturnCode::kError;
}
*/
const int kYSize = 14;
const int kXMid = 38;
@@ -184,7 +187,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
progressBoxPointer = &progressBox;
progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kUpdating), 48);
g_StartupInfo.GetMsgString(NMessageID::kUpdating));
}
UStringVector pathVector;
@@ -205,12 +208,12 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return NFileOperationReturnCode::kError;
}
outArchive->SetFolder(_folder);
outArchive->SetFiles(L"", fileNamePointers, numItems);
/*
BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
actionSetByte[i] = (BYTE)actionSet->StateActions[i];
*/
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
@@ -220,6 +223,9 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK)
return NFileOperationReturnCode::kError;
/*
outArchive->SetFolder(_folder);
outArchive->SetFiles(L"", fileNamePointers, numItems);
// FStringVector requestedPaths;
// FStringVector processedPaths;
result = outArchive->DoOperation2(
@@ -233,28 +239,33 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
{
result = AfterUpdate(tempFile, pathVector);
}
*/
{
result = _agent->SetFiles(L"", fileNamePointers, numItems);
if (result == S_OK)
{
CAgentFolder *agentFolder = NULL;
{
CMyComPtr<IArchiveFolderInternal> afi;
_folder.QueryInterface(IID_IArchiveFolderInternal, &afi);
if (afi)
afi->GetAgentFolder(&agentFolder);
}
if (agentFolder)
result = agentFolder->CommonUpdateOperation(AGENT_OP_Uni,
(moveMode != 0), NULL, actionSet, NULL, 0, updateCallback);
else
result = E_FAIL;
}
}
if (result != S_OK)
{
ShowErrorMessage(result);
ShowSysErrorMessage(result);
return NFileOperationReturnCode::kError;
}
/*
if (moveMode != 0)
{
for (int i = 0; i < numItems; i++)
{
const PluginPanelItem &pluginPanelItem = panelItems[i];
bool result;
if (NFile::NFind::NAttributes::IsDir(pluginPanelItem.FindData.dwFileAttributes))
result = NFile::NDirectory::RemoveDirectoryWithSubItems(pluginPanelItem.FindData.cFileName);
else
result = NFile::NDirectory::DeleteFileAlways(pluginPanelItem.FindData.cFileName);
if (!result)
return NFileOperationReturnCode::kError;
}
}
*/
return NFileOperationReturnCode::kSuccess;
}
@@ -335,11 +346,18 @@ UString CParsedPath::MergePath() const
}
/*
// {23170F69-40C1-278A-1000-000100030000}
DEFINE_GUID(CLSID_CAgentArchiveHandler,
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00);
*/
static void SetArcName(UString &arcName, const CArcInfoEx &arcInfo)
{
if (!arcInfo.Flags_KeepName())
{
int dotPos = arcName.ReverseFind_Dot();
int slashPos = arcName.ReverseFind_PathSepar();
if (dotPos > slashPos + 1)
arcName.DeleteFrom(dotPos);
}
arcName += L'.';
arcName += arcInfo.GetMainExt();
}
HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
{
@@ -368,12 +386,20 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
NCompression::CInfo compressionInfo;
compressionInfo.Load();
int archiverIndex = 0;
int archiverIndex = -1;
/*
CCodecs *codecs = new CCodecs;
CMyComPtr<ICompressCodecsInfo> compressCodecsInfo = codecs;
if (codecs->Load() != S_OK)
throw "Can't load 7-Zip codecs";
*/
if (LoadGlobalCodecs() != S_OK)
throw "Can't load 7-Zip codecs";
CCodecs *codecs = g_CodecsObj;
{
FOR_VECTOR (i, codecs->Formats)
{
@@ -388,6 +414,8 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
}
}
if (archiverIndex < 0)
throw "there is no output handler";
UString resultPath;
{
@@ -407,26 +435,18 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
}
}
UString archiveNameSrc = resultPath;
UString archiveName = archiveNameSrc;
UString arcName = archiveNameSrc;
const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex];
int prevFormat = archiverIndex;
if (!arcInfo.Flags_KeepName())
{
int dotPos = archiveName.ReverseFind('.');
int slashPos = MyMax(archiveName.ReverseFind('\\'), archiveName.ReverseFind('/'));
if (dotPos > slashPos)
archiveName = archiveName.Left(dotPos);
}
archiveName += L'.';
archiveName += arcInfo.GetMainExt();
SetArcName(arcName, arcInfo);
const CActionSet *actionSet = &k_ActionSet_Add;
for (;;)
{
AString archiveNameA = UnicodeStringToMultiByte(archiveName, CP_OEMCP);
AString archiveNameA = UnicodeStringToMultiByte(arcName, CP_OEMCP);
const int kYSize = 16;
const int kXMid = 38;
@@ -458,7 +478,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
{ DI_TEXT, 5, 2, 0, 0, false, false, 0, false, -1, updateAddToArchiveString, NULL },
{ DI_EDIT, 5, 3, 70, 3, true, false, DIF_HISTORY, false, -1, archiveNameA, kArchiveHistoryKeyName},
// { DI_EDIT, 5, 3, 70, 3, true, false, 0, false, -1, archiveName, NULL},
// { DI_EDIT, 5, 3, 70, 3, true, false, 0, false, -1, arcName, NULL},
{ DI_SINGLEBOX, 4, 4, kXMid - 2, 4 + 7, false, false, 0, false, NMessageID::kUpdateMethod, NULL, NULL },
@@ -495,7 +515,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
archiveNameA = dialogItems[kArchiveNameIndex].Data;
archiveNameA.Trim();
archiveName = MultiByteToUnicodeString(archiveNameA, CP_OEMCP);
MultiByteToUnicodeString2(arcName, archiveNameA, CP_OEMCP);
compressionInfo.Level = g_MethodMap[0];
for (i = 0; i < ARRAY_SIZE(g_MethodMap); i++)
@@ -532,15 +552,14 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
{
const UString &prevExtension = prevArchiverInfo.GetMainExt();
const unsigned prevExtensionLen = prevExtension.Len();
if (archiveName.Len() >= prevExtensionLen &&
MyStringCompareNoCase(archiveName.RightPtr(prevExtensionLen), prevExtension) == 0)
if (arcName.Len() >= prevExtensionLen &&
MyStringCompareNoCase(arcName.RightPtr(prevExtensionLen), prevExtension) == 0)
{
int pos = archiveName.Len() - prevExtensionLen;
if (pos > 1)
int pos = arcName.Len() - prevExtensionLen;
if (pos > 2)
{
int dotPos = archiveName.ReverseFind('.');
if (dotPos == pos - 1)
archiveName = archiveName.Left(dotPos);
if (arcName[pos - 1] == '.')
arcName.DeleteFrom(pos - 1);
}
}
}
@@ -550,16 +569,8 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
prevFormat = archiverIndex;
if (arcInfo.Flags_KeepName())
archiveName = archiveNameSrc;
else
{
int dotPos = archiveName.ReverseFind('.');
int slashPos = MyMax(archiveName.ReverseFind('\\'), archiveName.ReverseFind('/'));
if (dotPos > slashPos)
archiveName = archiveName.Left(dotPos);
}
archiveName += L'.';
archiveName += arcInfo.GetMainExt();
arcName = archiveNameSrc;
SetArcName(arcName, arcInfo);
}
continue;
}
@@ -577,12 +588,12 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
NWorkDir::CInfo workDirInfo;
workDirInfo.Load();
FString fullArchiveName;
if (!MyGetFullPathName(us2fs(archiveName), fullArchiveName))
FString fullArcName;
if (!MyGetFullPathName(us2fs(arcName), fullArcName))
return E_FAIL;
CWorkDirTempFile tempFile;
RINOK(tempFile.CreateTempFile(fullArchiveName));
RINOK(tempFile.CreateTempFile(fullArcName));
CScreenRestorer screenRestorer;
CProgressBox progressBox;
@@ -593,7 +604,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
progressBoxPointer = &progressBox;
progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kUpdating), 48);
g_StartupInfo.GetMsgString(NMessageID::kUpdating));
NFind::CFileInfo fileInfo;
@@ -601,7 +612,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
CMyComPtr<IOutFolderArchive> outArchive;
CMyComPtr<IInFolderArchive> archiveHandler;
if (fileInfo.Find(fullArchiveName))
if (fileInfo.Find(fullArcName))
{
if (fileInfo.IsDir())
throw "There is Directory with such name";
@@ -611,7 +622,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
// CLSID realClassID;
CMyComBSTR archiveType;
RINOK(agentSpec->Open(NULL,
GetUnicodeString(fullArchiveName, CP_OEMCP), UString(),
GetUnicodeString(fullArcName, CP_OEMCP), UString(),
// &realClassID,
&archiveType,
NULL));
@@ -675,7 +686,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
if (result != S_OK)
{
ShowErrorMessage(result);
ShowSysErrorMessage(result);
return result;
}
@@ -687,8 +698,122 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
result = tempFile.MoveToOriginal(archiveHandler != NULL);
if (result != S_OK)
{
ShowErrorMessage(result);
ShowSysErrorMessage(result);
return result;
}
return S_OK;
}
static const char *k_CreateFolder_History = "NewFolder"; // we use default FAR folder name
HRESULT CPlugin::CreateFolder()
{
if (_agent->IsThereReadOnlyArc())
{
g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive);
return TRUE;
}
UString destPathU;
{
const int kXSize = 60;
const int kYSize = 8;
const int kPathIndex = 2;
AString destPath = "New Folder";
const struct CInitDialogItem initItems[]={
{ DI_DOUBLEBOX, 3, 1, kXSize - 4, kYSize - 2, false, false, 0, false,
-1, "Create Folder", NULL },
{ DI_TEXT, 5, 2, 0, 0, false, false, 0, false, -1, "Folder name:", NULL },
{ DI_EDIT, 5, 3, kXSize - 6, 3, true, false, DIF_HISTORY, false, -1, destPath, k_CreateFolder_History },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, true, NMessageID::kOk, NULL, NULL },
{ DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kCancel, NULL, NULL }
};
const int kNumDialogItems = ARRAY_SIZE(initItems);
const int kOkButtonIndex = kNumDialogItems - 2;
FarDialogItem dialogItems[kNumDialogItems];
g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems);
for (;;)
{
int askCode = g_StartupInfo.ShowDialog(kXSize, kYSize,
NULL, // kHelpTopic
dialogItems, kNumDialogItems);
if (askCode != kOkButtonIndex)
return E_ABORT;
destPath = dialogItems[kPathIndex].Data;
destPathU = GetUnicodeString(destPath, CP_OEMCP);
destPathU.Trim();
if (!destPathU.IsEmpty())
break;
g_StartupInfo.ShowErrorMessage("You must specify folder name");
}
}
CScreenRestorer screenRestorer;
CProgressBox progressBox;
CProgressBox *progressBoxPointer = NULL;
// if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0)
{
screenRestorer.Save();
progressBoxPointer = &progressBox;
progressBox.Init(
// g_StartupInfo.GetMsgString(NMessageID::kWaitTitle),
g_StartupInfo.GetMsgString(NMessageID::kDeleting));
}
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec);
updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer);
HRESULT result;
{
CMyComPtr<IFolderOperations> folderOperations;
result = _folder.QueryInterface(IID_IFolderOperations, &folderOperations);
if (folderOperations)
result = folderOperations->CreateFolder(destPathU, updateCallback);
else if (result != S_OK)
result = E_FAIL;
}
if (result != S_OK)
{
ShowSysErrorMessage(result);
return result;
}
g_StartupInfo.Control(this, FCTL_UPDATEPANEL, (void *)1);
g_StartupInfo.Control(this, FCTL_REDRAWPANEL, NULL);
PanelInfo panelInfo;
if (g_StartupInfo.ControlGetActivePanelInfo(panelInfo))
{
AString destPath = GetOemString(destPathU);
for (int i = 0; i < panelInfo.ItemsNumber; i++)
{
const PluginPanelItem &pi = panelInfo.PanelItems[i];
if (strcmp(destPath, pi.FindData.cFileName) == 0)
{
PanelRedrawInfo panelRedrawInfo;
panelRedrawInfo.CurrentItem = i;
panelRedrawInfo.TopPanelItem = 0;
g_StartupInfo.Control(this, FCTL_REDRAWPANEL, &panelRedrawInfo);
break;
}
}
}
SetCurrentDirVar();
return S_OK;
}

View File

@@ -2,112 +2,305 @@
#include "StdAfx.h"
#include <stdio.h>
#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
#include "FarUtils.h"
#include "ProgressBox.h"
static void CopySpaces(char *dest, int numSpaces)
void CPercentPrinterState::ClearCurState()
{
int i;
for (i = 0; i < numSpaces; i++)
dest[i] = ' ';
dest[i] = '\0';
Completed = 0;
Total = ((UInt64)(Int64)-1);
Files = 0;
FilesTotal = 0;
Command.Empty();
FileName.Empty();
}
void ConvertUInt64ToStringAligned(UInt64 value, char *s, int alignSize)
{
char temp[32];
ConvertUInt64ToString(value, temp);
int len = (int)strlen(temp);
int numSpaces = 0;
if (len < alignSize)
{
numSpaces = alignSize - len;
CopySpaces(s, numSpaces);
}
strcpy(s + numSpaces, temp);
}
// ---------- CMessageBox ----------
static const int kMaxLen = 255;
void CMessageBox::Init(const AString &title, int width)
void CProgressBox::Init(const AString &title)
{
_title = title;
_width = MyMin(width, kMaxLen);
_wasPrinted = false;
StartTick = GetTickCount();
_prevTick = StartTick;
_prevElapsedSec = 0;
}
void CMessageBox::ShowMessages(const char *strings[], int numStrings)
static unsigned GetPower32(UInt32 val)
{
const int kNumStaticStrings = 1;
const int kNumStringsMax = 10;
if (numStrings > kNumStringsMax)
numStrings = kNumStringsMax;
const char *msgItems[kNumStaticStrings + kNumStringsMax];
msgItems[0] = _title;
char formattedMessages[kNumStringsMax][kMaxLen + 1];
for (int i = 0; i < numStrings; i++)
const unsigned kStart = 32;
UInt32 mask = ((UInt32)1 << (kStart - 1));
for (unsigned i = kStart;; i--)
{
char *formattedMessage = formattedMessages[i];
const char *s = strings[i];
int len = (int)strlen(s);
if (len < kMaxLen)
if (i == 0 || (val & mask) != 0)
return i;
mask >>= 1;
}
}
static unsigned GetPower64(UInt64 val)
{
UInt32 high = (UInt32)(val >> 32);
if (high == 0)
return GetPower32((UInt32)val);
return GetPower32(high) + 32;
}
static UInt64 MyMultAndDiv(UInt64 mult1, UInt64 mult2, UInt64 divider)
{
unsigned pow1 = GetPower64(mult1);
unsigned pow2 = GetPower64(mult2);
while (pow1 + pow2 > 64)
{
if (pow1 > pow2) { pow1--; mult1 >>= 1; }
else { pow2--; mult2 >>= 1; }
divider >>= 1;
}
UInt64 res = mult1 * mult2;
if (divider != 0)
res /= divider;
return res;
}
#define UINT_TO_STR_2(val) { s[0] = (char)('0' + (val) / 10); s[1] = (char)('0' + (val) % 10); s += 2; }
static void GetTimeString(UInt64 timeValue, char *s)
{
UInt64 hours = timeValue / 3600;
UInt32 seconds = (UInt32)(timeValue - hours * 3600);
UInt32 minutes = seconds / 60;
seconds %= 60;
if (hours > 99)
{
ConvertUInt64ToString(hours, s);
for (; *s != 0; s++);
}
else
{
UInt32 hours32 = (UInt32)hours;
UINT_TO_STR_2(hours32);
}
*s++ = ':'; UINT_TO_STR_2(minutes);
*s++ = ':'; UINT_TO_STR_2(seconds);
*s = 0;
}
void CProgressBox::ReduceString(const UString &src, AString &dest)
{
UnicodeStringToMultiByte2(dest, src, CP_OEMCP);
if (dest.Len() <= MaxLen)
return;
unsigned len = FileName.Len();
for (; len != 0;)
{
unsigned delta = len / 8;
if (delta == 0)
delta = 1;
len -= delta;
_tempU = FileName;
_tempU.Delete(len / 2, FileName.Len() - len);
_tempU.Insert(len / 2, L" . ");
UnicodeStringToMultiByte2(dest, _tempU, CP_OEMCP);
if (dest.Len() <= MaxLen)
return;
}
dest.Empty();
}
static void Print_UInt64_and_String(AString &s, UInt64 val, const char *name)
{
char temp[32];
ConvertUInt64ToString(val, temp);
s += temp;
s.Add_Space();
s += name;
}
static void PrintSize_bytes_Smart(AString &s, UInt64 val)
{
// Print_UInt64_and_String(s, val, "bytes");
{
char temp[32];
ConvertUInt64ToString(val, temp);
s += temp;
}
if (val == 0)
return;
unsigned numBits = 10;
char c = 'K';
char temp[4] = { 'K', 'i', 'B', 0 };
if (val >= ((UInt64)10 << 30)) { numBits = 30; c = 'G'; }
else if (val >= ((UInt64)10 << 20)) { numBits = 20; c = 'M'; }
temp[0] = c;
s += " (";
Print_UInt64_and_String(s, ((val + ((UInt64)1 << numBits) - 1) >> numBits), temp);
s += ')';
}
static const unsigned kPercentsSize = 4;
void CProgressBox::Print()
{
DWORD tick = GetTickCount();
DWORD elapsedTicks = tick - StartTick;
DWORD elapsedSec = elapsedTicks / 1000;
if (_wasPrinted)
{
if (elapsedSec == _prevElapsedSec)
{
int size = MyMax(_width, len);
int startPos = (size - len) / 2;
CopySpaces(formattedMessage, startPos);
strcpy(formattedMessage + startPos, s);
CopySpaces(formattedMessage + startPos + len, size - startPos - len);
if ((UInt32)(tick - _prevTick) < _tickStep)
return;
if (_printedState.IsEqualTo((const CPercentPrinterState &)*this))
return;
}
}
UInt64 cur = Completed;
UInt64 total = Total;
if (!UseBytesForPercents)
{
cur = Files;
total = FilesTotal;
}
{
_timeStr.Empty();
_timeStr = "Elapsed time: ";
char s[40];
GetTimeString(elapsedSec, s);
_timeStr += s;
if (cur != 0)
{
UInt64 remainingTime = 0;
if (cur < total)
remainingTime = MyMultAndDiv(elapsedTicks, total - cur, cur);
UInt64 remainingSec = remainingTime / 1000;
_timeStr += " Remaining time: ";
GetTimeString(remainingSec, s);
_timeStr += s;
}
}
{
_perc.Empty();
char s[32];
unsigned size;
{
UInt64 val = 0;
if (total != (UInt64)(Int64)-1 && total != 0)
val = cur * 100 / Total;
ConvertUInt64ToString(val, s);
size = (unsigned)strlen(s);
s[size++] = '%';
s[size] = 0;
}
unsigned len = size;
while (len < kPercentsSize)
len = kPercentsSize;
len++;
if (len < MaxLen)
{
unsigned numChars = MaxLen - len;
unsigned filled = 0;
if (total != (UInt64)(Int64)-1 && total != 0)
filled = (unsigned)(cur * numChars / total);
unsigned i = 0;
if (filled < numChars)
{
for (i = 0; i < filled; i++)
_perc += '=';
}
for (; i < numChars; i++)
_perc += '.';
}
_perc.Add_Space();
while (size < kPercentsSize)
{
_perc.Add_Space();
size++;
}
_perc += s;
}
_files.Empty();
if (Files != 0 || FilesTotal != 0)
{
_files += "Files: ";
char s[32];
// if (Files != 0)
{
ConvertUInt64ToString(Files, s);
_files += s;
}
if (FilesTotal != 0)
{
_files += " / ";
ConvertUInt64ToString(FilesTotal, s);
_files += s;
}
}
_sizesStr.Empty();
if (Total != 0)
{
_sizesStr += "Size: ";
PrintSize_bytes_Smart(_sizesStr, Completed);
if (Total != 0 && Total != (UInt64)(Int64)-1)
{
_sizesStr += " / ";
PrintSize_bytes_Smart(_sizesStr, Total);
}
}
_name1.Empty();
_name2.Empty();
if (!FileName.IsEmpty())
{
_name1U.Empty();
_name2U.Empty();
/*
if (_isDir)
s1 = _filePath;
else
*/
{
strncpy(formattedMessage, s, kMaxLen);
formattedMessage[kMaxLen] = 0;
int slashPos = FileName.ReverseFind_PathSepar();
if (slashPos >= 0)
{
_name1U.SetFrom(FileName, slashPos + 1);
_name2U = FileName.Ptr(slashPos + 1);
}
else
_name2U = FileName;
}
msgItems[kNumStaticStrings + i] = formattedMessage;
ReduceString(_name1U, _name1);
ReduceString(_name2U, _name2);
}
NFar::g_StartupInfo.ShowMessage(0, NULL, msgItems, kNumStaticStrings + numStrings, 0);
}
// ---------- CProgressBox ----------
void CProgressBox::Init(const AString &title, int width)
{
CMessageBox::Init(title, width);
_prevMessage.Empty();
_prevPercentMessage.Empty();
_wasShown = false;
}
void CProgressBox::Progress(const UInt64 *total, const UInt64 *completed, const AString &message)
{
AString percentMessage;
if (total != 0 && completed != 0)
{
UInt64 totalVal = *total;
if (totalVal == 0)
totalVal = 1;
char buf[32];
ConvertUInt64ToStringAligned(*completed * 100 / totalVal, buf, 3);
strcat(buf, "%");
percentMessage = buf;
}
if (message != _prevMessage || percentMessage != _prevPercentMessage || !_wasShown)
{
_prevMessage = message;
_prevPercentMessage = percentMessage;
const char *strings[] = { message, percentMessage };
ShowMessages(strings, ARRAY_SIZE(strings));
_wasShown = true;
const char *strings[] = { _title, _timeStr, _files, _sizesStr, Command, _name1, _name2, _perc };
NFar::g_StartupInfo.ShowMessage(FMSG_LEFTALIGN, NULL, strings, ARRAY_SIZE(strings), 0);
}
_wasPrinted = true;
_printedState = *this;
_prevTick = tick;
_prevElapsedSec = elapsedSec;
}

View File

@@ -6,25 +6,78 @@
#include "../../../Common/MyString.h"
#include "../../../Common/MyTypes.h"
void ConvertUInt64ToStringAligned(UInt64 value, char *s, int alignSize);
class CMessageBox
struct CPercentPrinterState
{
AString _title;
int _width;
public:
void Init(const AString &title, int width);
void ShowMessages(const char *strings[], int numStrings);
UInt64 Completed;
UInt64 Total;
UInt64 Files;
UInt64 FilesTotal;
AString Command;
UString FileName;
void ClearCurState();
bool IsEqualTo(const CPercentPrinterState &s) const
{
return
Completed == s.Completed
&& Total == s.Total
&& Files == s.Files
&& FilesTotal == s.FilesTotal
&& Command == s.Command
&& FileName == s.FileName;
}
CPercentPrinterState():
Completed(0),
Total((UInt64)(Int64)-1),
Files(0),
FilesTotal(0)
{}
};
class CProgressBox: public CMessageBox
class CProgressBox: public CPercentPrinterState
{
AString _prevMessage;
AString _prevPercentMessage;
bool _wasShown;
UInt32 _tickStep;
DWORD _prevTick;
DWORD _prevElapsedSec;
bool _wasPrinted;
UString _tempU;
UString _name1U;
UString _name2U;
CPercentPrinterState _printedState;
AString _title;
AString _timeStr;
AString _files;
AString _sizesStr;
AString _name1;
AString _name2;
AString _perc;
void ReduceString(const UString &src, AString &dest);
public:
void Init(const AString &title, int width);
void Progress(const UInt64 *total, const UInt64 *completed, const AString &message);
DWORD StartTick;
bool UseBytesForPercents;
unsigned MaxLen;
CProgressBox(UInt32 tickStep = 200):
_tickStep(tickStep),
_prevTick(0),
StartTick(0),
UseBytesForPercents(true),
MaxLen(60)
{}
void Init(const AString &title);
void Print();
};
#endif

View File

@@ -2,59 +2,206 @@
#include "StdAfx.h"
#ifndef _7ZIP_ST
#include "../../../Windows/Synchronization.h"
#endif
#include "../../../Common/StringConvert.h"
#include "FarUtils.h"
#include "UpdateCallbackFar.h"
using namespace NWindows;
using namespace NFar;
STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 /* numFiles */)
#ifndef _7ZIP_ST
static NSynchronization::CCriticalSection g_CriticalSection;
#define MT_LOCK NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
#else
#define MT_LOCK
#endif
static HRESULT CheckBreak2()
{
return S_OK;
return WasEscPressed() ? E_ABORT : S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::ScanProgress(UInt64 numFolders, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, Int32 /* isDir */)
{
MT_LOCK
if (_percent)
{
_percent->FilesTotal = numFolders + numFiles;
_percent->Total = totalSize;
_percent->Command = "Scanning";
_percent->FileName = path;
_percent->Print();
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::ScanError(const wchar_t *path, HRESULT errorCode)
{
if (ShowSysErrorMessage(errorCode, path) == -1)
return E_ABORT;
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 numFiles)
{
MT_LOCK
if (_percent)
{
_percent->FilesTotal = numFiles;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
{
_total = size;
return S_OK;
MT_LOCK
if (_percent)
{
_percent->Total = size;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
{
if (WasEscPressed())
return E_ABORT;
if (_progressBox != 0)
_progressBox->Progress(&_total, completeValue, AString());
return S_OK;
MT_LOCK
if (_percent)
{
if (completeValue)
_percent->Completed = *completeValue;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t* /* name */)
STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *name)
{
return S_OK;
MT_LOCK
if (_percent)
{
_percent->Command = "Adding";
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();;
}
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t* /* name */)
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t *name)
{
return S_OK;
MT_LOCK
if (_percent)
{
_percent->Command = "Deleting";
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();;
}
STDMETHODIMP CUpdateCallback100Imp::OperationResult(Int32 /* opRes */)
{
return S_OK;
MT_LOCK
if (_percent)
{
_percent->Files++;
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message)
{
if (g_StartupInfo.ShowMessage(UnicodeStringToMultiByte(message, CP_OEMCP)) == -1)
MT_LOCK
if (g_StartupInfo.ShowErrorMessage(UnicodeStringToMultiByte(message, CP_OEMCP)) == -1)
return E_ABORT;
return S_OK;
return CheckBreak2();
}
HRESULT CUpdateCallback100Imp::OpenFileError(const wchar_t *path, HRESULT errorCode)
{
if (ShowSysErrorMessage(errorCode, path) == -1)
return E_ABORT;
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::ReadingFileError(const wchar_t *path, HRESULT errorCode)
{
if (ShowSysErrorMessage(errorCode, path) == -1)
return E_ABORT;
return CheckBreak2();
}
void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, AString &s);
STDMETHODIMP CUpdateCallback100Imp::ReportExtractResult(Int32 opRes, Int32 isEncrypted, const wchar_t *name)
{
MT_LOCK
if (opRes != NArchive::NExtract::NOperationResult::kOK)
{
AString s;
SetExtractErrorMessage(opRes, isEncrypted, s);
if (PrintErrorMessage(s, name) == -1)
return E_ABORT;
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::ReportUpdateOperation(UInt32 op, const wchar_t *name, Int32 /* isDir */)
{
const char *s;
switch (op)
{
case NUpdateNotifyOp::kAdd: s = "Adding"; break;
case NUpdateNotifyOp::kUpdate: s = "Updating"; break;
case NUpdateNotifyOp::kAnalyze: s = "Analyzing"; break;
case NUpdateNotifyOp::kReplicate: s = "Replicating"; break;
case NUpdateNotifyOp::kRepack: s = "Repacking"; break;
case NUpdateNotifyOp::kSkip: s = "Skipping"; break;
case NUpdateNotifyOp::kHeader: s = "Header creating"; break;
case NUpdateNotifyOp::kDelete: s = "Deleting"; break;
default: s = "Unknown operation";
}
MT_LOCK
if (_percent)
{
_percent->Command = s;
_percent->FileName.Empty();
if (name)
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();;
}
extern HRESULT GetPassword(UString &password);
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
{
MT_LOCK
*password = NULL;
if (!m_PasswordIsDefined)
{

View File

@@ -13,31 +13,38 @@
class CUpdateCallback100Imp:
public IFolderArchiveUpdateCallback,
public IFolderArchiveUpdateCallback2,
public IFolderScanProgress,
public ICryptoGetTextPassword,
public CMyUnknownImp
{
// CMyComPtr<IInFolderArchive> _archiveHandler;
CProgressBox *_progressBox;
CProgressBox *_percent;
UInt64 _total;
bool m_PasswordIsDefined;
UString m_Password;
public:
MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
MY_UNKNOWN_IMP4(
IFolderArchiveUpdateCallback,
IFolderArchiveUpdateCallback2,
IFolderScanProgress,
ICryptoGetTextPassword)
INTERFACE_IProgress(;)
INTERFACE_IFolderArchiveUpdateCallback(;)
INTERFACE_IFolderArchiveUpdateCallback2(;)
INTERFACE_IFolderScanProgress(;)
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
CUpdateCallback100Imp(): _total(0) {}
void Init(/* IInFolderArchive *archiveHandler, */ CProgressBox *progressBox)
{
// _archiveHandler = archiveHandler;
_progressBox = progressBox;
_percent = progressBox;
m_PasswordIsDefined = false;
}
};
#endif

View File

@@ -1,7 +1,8 @@
PROG = 7-ZipFar.dll
DEF_FILE = Far.def
CFLAGS = $(CFLAGS) \
-DEXTERNAL_CODECS
-DEXTERNAL_CODECS \
-DNEW_FOLDER_INTERFACE
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH
@@ -40,12 +41,15 @@ WIN_OBJS = \
$O\PropVariant.obj \
$O\PropVariantConv.obj \
$O\Registry.obj \
$O\ResourceString.obj \
$O\Synchronization.obj \
$O\TimeUtils.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
@@ -78,6 +82,9 @@ AGENT_OBJS = \
$O\Agent.obj \
$O\AgentOut.obj \
$O\AgentProxy.obj \
$O\ArchiveFolder.obj \
$O\ArchiveFolderOpen.obj \
$O\ArchiveFolderOut.obj \
$O\UpdateCallbackAgent.obj \
COMPRESS_OBJS = \