6f37d34920
Aligns the zstd NSIS wrapper directory with the naming convention used by
all other bundle directories (versions/25.01-bundle, 26.00-bundle, etc.).
Changes:
- git mv versions/zstd -> versions/zstd-bundle (20 project-owned files)
- Fix UI/NSIS/StdAfx.h: use relative include ../../Bundles/Nsis7z/pluginapi.h
instead of absolute-style 7zip/Bundles/Nsis7z/pluginapi.h (portable across
both Linux and Windows builds without extra include path)
Build tool updates:
- tools/legacy/build_plugin_zstd_vs2026.py: updated project_dir path
- tools/linux/build_plugin_linux.py:
* VERSION_LAYOUT zstd: zstd -> zstd-bundle
* VERSION_EXTRA_FLAGS zstd: -Wno-sign-compare -Wno-cast-function-type
(fast-lzma2 C vendor code)
* VERSION_EXTRA_CXXFLAGS zstd: -Wno-unused-parameter (NSIS wrapper)
* EXTRA_SYS_OBJS: inject MyWindows.o for zstd (LocalFileTimeToFileTime2)
* Remove 'zip_version != zstd' exception; auto-recreate symlinks for all
bundle versions including zstd
- tools/linux/setup_bundle_symlinks.py: add VENDOR_DIR mapping so 'zstd'
points to versions/7-zip-zstd (not versions/zstd which no longer exists)
- tools/linux/overlay/makefile.gcc: add EXTRA_SYS_OBJS ?= variable so
callers can inject additional objects without modifying the file
Linux build status after this commit:
python3 build_plugin.py --7zip-version zstd -> Build completed (all 3 configs)
164 lines
3.5 KiB
C++
164 lines
3.5 KiB
C++
// ExtractCallbackConsole.h
|
|
|
|
#include "StdAfx.h"
|
|
|
|
#include "Common/Common.h"
|
|
#include "ExtractCallbackConsole.h"
|
|
#include "UserInputUtils2.h"
|
|
#include "NSISBreak.h"
|
|
|
|
#include "Common/Wildcard.h"
|
|
|
|
#include "Windows/FileDir.h"
|
|
#include "Windows/FileFind.h"
|
|
#include "Windows/TimeUtils.h"
|
|
#include "Windows/Defs.h"
|
|
#include "Windows/PropVariant.h"
|
|
#include "Windows/ErrorMsg.h"
|
|
#include "Windows/PropVariantConv.h"
|
|
|
|
#include "7zip/Common/FilePathAutoRename.h"
|
|
|
|
#include "7zip/UI/Common/ExtractingFilePath.h"
|
|
|
|
using namespace NWindows;
|
|
using namespace NFile;
|
|
using namespace NDir;
|
|
|
|
extern HWND g_hwndProgress;
|
|
|
|
void CExtractCallbackConsole::UpdateProgress()
|
|
{
|
|
// Prima controlla se c'è il callback con filename (nuova funzione)
|
|
if (ProgressWithFileHandler != NULL)
|
|
{
|
|
if (completedSize != -1 || totalSize > 0)
|
|
ProgressWithFileHandler(completedSize, totalSize, CurrentFileName.Ptr());
|
|
else
|
|
ProgressWithFileHandler(0, 0, CurrentFileName.Ptr());
|
|
}
|
|
// Altrimenti usa il callback originale (per compatibilità)
|
|
else if (ProgressHandler != NULL)
|
|
{
|
|
if (completedSize != -1 || totalSize > 0)
|
|
ProgressHandler(completedSize, totalSize);
|
|
else
|
|
ProgressHandler(0, 0);
|
|
}
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::SetTotal(UInt64 val)
|
|
{
|
|
totalSize = val;
|
|
UpdateProgress();
|
|
if (NNSISBreak::TestBreakSignal())
|
|
return E_ABORT;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::SetCompleted(const UInt64 *val)
|
|
{
|
|
completedSize = *val;
|
|
UpdateProgress();
|
|
if (NNSISBreak::TestBreakSignal())
|
|
return E_ABORT;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::AskOverwrite(
|
|
const wchar_t *existName, const FILETIME *, const UInt64 *,
|
|
const wchar_t *newName, const FILETIME *, const UInt64 *,
|
|
Int32 *answer)
|
|
{
|
|
*answer = NOverwriteAnswer::kYesToAll;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::PrepareOperation(const wchar_t *name, Int32 isFolder, Int32 askExtractMode, const UInt64 *position)
|
|
{
|
|
// Memorizza il nome del file corrente per passarlo al callback
|
|
CurrentFileName = name;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::MessageError(const wchar_t *message)
|
|
{
|
|
NumFileErrorsInCurrentArchive++;
|
|
NumFileErrors++;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::SetOperationResult(Int32 opRes, Int32 encrypted)
|
|
{
|
|
switch(opRes)
|
|
{
|
|
case NArchive::NExtract::NOperationResult::kOK:
|
|
break;
|
|
default:
|
|
{
|
|
NumFileErrorsInCurrentArchive++;
|
|
NumFileErrors++;
|
|
|
|
}
|
|
}
|
|
return S_OK;
|
|
}
|
|
|
|
#ifndef Z7_NO_CRYPTO
|
|
|
|
HRESULT CExtractCallbackConsole::SetPassword(const UString &password)
|
|
{
|
|
PasswordIsDefined = true;
|
|
Password = password;
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
|
|
{
|
|
if (!PasswordIsDefined)
|
|
{
|
|
Password = GetPassword(OutStream);
|
|
PasswordIsDefined = true;
|
|
}
|
|
return StringToBstr(Password, password);
|
|
}
|
|
|
|
#endif
|
|
|
|
HRESULT CExtractCallbackConsole::BeforeOpen(const wchar_t *name, bool testMode)
|
|
{
|
|
NumArchives++;
|
|
NumFileErrorsInCurrentArchive = 0;
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CExtractCallbackConsole::OpenResult(const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result)
|
|
{
|
|
if (result != S_OK)
|
|
{
|
|
NumArchiveErrors++;
|
|
}
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CExtractCallbackConsole::ThereAreNoFiles()
|
|
{
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT CExtractCallbackConsole::ExtractResult(HRESULT result)
|
|
{
|
|
if (result == S_OK)
|
|
{
|
|
if (NumFileErrorsInCurrentArchive != 0)
|
|
{
|
|
NumArchiveErrors++;
|
|
}
|
|
return result;
|
|
}
|
|
NumArchiveErrors++;
|
|
if (result == E_ABORT || result == ERROR_DISK_FULL)
|
|
return result;
|
|
return S_OK;
|
|
}
|