mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Update compressed_archive to support the latest version of 7zip 18.05
p7zip has been abandoned and the latest version available is 16.02.
This commit is contained in:
parent
9321d864db
commit
1903b6753f
@ -3,6 +3,16 @@
|
|||||||
|
|
||||||
//WIN includes
|
//WIN includes
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "lib7zip/C/Alloc.h"
|
||||||
|
#include "lib7zip/C/7zTypes.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "lib7zip/CPP/Common/Common.h"
|
||||||
|
#include "lib7zip/CPP/Common/MyWindows.h"
|
||||||
|
|
||||||
|
|
||||||
#include "lib7zip/CPP/Common/StringConvert.h"
|
#include "lib7zip/CPP/Common/StringConvert.h"
|
||||||
#include "lib7zip/CPP/Common/MyInitGuid.h"
|
#include "lib7zip/CPP/Common/MyInitGuid.h"
|
||||||
#include "lib7zip/CPP/Common/MyCom.h"
|
#include "lib7zip/CPP/Common/MyCom.h"
|
||||||
@ -14,52 +24,56 @@
|
|||||||
#include "lib7zip/CPP/7zip/IPassword.h"
|
#include "lib7zip/CPP/7zip/IPassword.h"
|
||||||
#include "lib7zip/CPP/7zip/MyVersion.h"
|
#include "lib7zip/CPP/7zip/MyVersion.h"
|
||||||
|
|
||||||
#include "lib7zip/C/Types.h"
|
|
||||||
|
|
||||||
#include "lib7zip/CPP/Windows/PropVariant.h"
|
#include "lib7zip/CPP/Windows/PropVariant.h"
|
||||||
#include "lib7zip/CPP/Windows/PropVariantConversions.h"
|
#include "lib7zip/CPP/Windows/PropVariantConv.h"
|
||||||
|
|
||||||
#include "lib7zip/CPP/7zip/Common/StreamObjects.h"
|
#include "lib7zip/CPP/7zip/Common/StreamObjects.h"
|
||||||
#include "lib7zip/CPP/7zip/Common/StreamUtils.h"
|
#include "lib7zip/CPP/7zip/Common/StreamUtils.h"
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include "lib7zip/C/Alloc.h"
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
//POSIX includes
|
//POSIX includes
|
||||||
#include "libp7zip/CPP/myWindows/myPrivate.h"
|
|
||||||
#include "libp7zip/CPP/myWindows/config.h"
|
|
||||||
|
|
||||||
#include "libp7zip/CPP/Common/MyGuidDef.h"
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "libp7zip/C/Alloc.h"
|
||||||
|
#include "libp7zip/C/7zTypes.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "libp7zip/CPP/Windows/Defs.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "libp7zip/CPP/Common/Common.h"
|
||||||
|
#include "libp7zip/CPP/Common/MyCom.h"
|
||||||
|
|
||||||
|
//macos
|
||||||
|
//typedef int BOOL; ---> typedef signed char BOOL;
|
||||||
|
#include "libp7zip/CPP/include_windows/windows.h"
|
||||||
|
#include "libp7zip/CPP/include_windows/basetyps.h"
|
||||||
|
#include "libp7zip/CPP/include_windows/tchar.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/Common/MyWindows.h"
|
#include "libp7zip/CPP/Common/MyWindows.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/Common/StringConvert.h"
|
#include "libp7zip/CPP/Common/StringConvert.h"
|
||||||
#include "libp7zip/CPP/Common/MyInitGuid.h"
|
|
||||||
#include "libp7zip/CPP/Common/MyCom.h"
|
|
||||||
#include "libp7zip/CPP/7zip/Common/FileStreams.h"
|
|
||||||
#include "libp7zip/CPP/7zip/Archive/IArchive.h"
|
#include "libp7zip/CPP/7zip/Archive/IArchive.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/7zip/IStream.h"
|
#include "libp7zip/CPP/7zip/IStream.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/7zip/IPassword.h"
|
#include "libp7zip/CPP/7zip/IPassword.h"
|
||||||
|
#include "libp7zip/CPP/7zip/IProgress.h"
|
||||||
|
|
||||||
|
#include "libp7zip/CPP/7zip/Common/FileStreams.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/7zip/MyVersion.h"
|
#include "libp7zip/CPP/7zip/MyVersion.h"
|
||||||
|
|
||||||
#include "libp7zip/C/Types.h"
|
|
||||||
|
|
||||||
#include "libp7zip/CPP/Windows/Defs.h"
|
|
||||||
#include "libp7zip/CPP/Windows/PropVariant.h"
|
#include "libp7zip/CPP/Windows/PropVariant.h"
|
||||||
#include "libp7zip/CPP/Windows/PropVariantConversions.h"
|
#include "libp7zip/CPP/Windows/PropVariantConv.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/7zip/Common/StreamObjects.h"
|
#include "libp7zip/CPP/7zip/Common/StreamObjects.h"
|
||||||
#include "libp7zip/CPP/7zip/Common/StreamUtils.h"
|
#include "libp7zip/CPP/7zip/Common/StreamUtils.h"
|
||||||
|
|
||||||
#include "libp7zip/CPP/7zip/ICoder.h"
|
#include "libp7zip/CPP/7zip/ICoder.h"
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include "libp7zip/C/Alloc.h"
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _7Z_INCLUDES_H
|
#endif // _7Z_INCLUDES_H
|
||||||
|
@ -4,16 +4,6 @@ you need to download de source code of 7zip (Windows) or p7zip (Linux/MacOSX).
|
|||||||
Please extract it and rename the folder to lib7zip (Windows) or libp7zip (Linux/MacOSX),
|
Please extract it and rename the folder to lib7zip (Windows) or libp7zip (Linux/MacOSX),
|
||||||
then copy it to $YACREADER_SRC/compressed_archive/ (this folder).
|
then copy it to $YACREADER_SRC/compressed_archive/ (this folder).
|
||||||
|
|
||||||
YACReader is compiled using 7zip/p7zip 9.20.1 and will not work with newer versions.
|
YACReader is compiled using 7zip 18.05 and p7zip 16.02.
|
||||||
|
|
||||||
On Linux/Unix this means your YACReader installation will stop working if you
|
7zip is the recommended library to use is you want support for 7zip files and rar5.
|
||||||
update your installation of p7zip to a newer version. If you wish to keep using
|
|
||||||
p7zip with YACReader, you can copy 7z.so and Codecs/Rar29.so from p7zip 9.20.1
|
|
||||||
to "/usr/lib/yacreader/". YACReader will then detect these files and use
|
|
||||||
them instead of the system provided p7zip files which allows you to keep both
|
|
||||||
YACReader and an up to date p7zip installation.
|
|
||||||
|
|
||||||
Please keep in mind this is only a workaround that is provided for backwards
|
|
||||||
compatibility and not intended as a long time solution.
|
|
||||||
It is recommended that you switch to unarr as a decompression backend instead
|
|
||||||
(see README.txt in compressed_archive/unarr).
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
#include "libp7zip/CPP/Common/MyInitGuid.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "compressed_archive.h"
|
#include "compressed_archive.h"
|
||||||
#include "extract_delegate.h"
|
#include "extract_delegate.h"
|
||||||
|
|
||||||
@ -9,12 +13,28 @@
|
|||||||
#include "open_callbacks.h"
|
#include "open_callbacks.h"
|
||||||
#include "extract_callbacks.h"
|
#include "extract_callbacks.h"
|
||||||
|
|
||||||
|
#include "7z_includes.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#define _MY_WINAPI WINAPI
|
||||||
|
#else
|
||||||
|
#define _MY_WINAPI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef quint32 (_MY_WINAPI * CreateObjectFunc)(const GUID *clsID,const GUID *interfaceID,void **outObject);
|
||||||
|
typedef quint32 (_MY_WINAPI *GetMethodPropertyFunc)(quint32 index, PROPID propID, PROPVARIANT *value);
|
||||||
|
typedef quint32 (_MY_WINAPI *GetNumberOfMethodsFunc)(quint32 *numMethods);
|
||||||
|
typedef quint32 (_MY_WINAPI *GetNumberOfFormatsFunc)(quint32 *numFormats);
|
||||||
|
typedef quint32 (_MY_WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
|
||||||
|
typedef quint32 (_MY_WINAPI *GetHandlerPropertyFunc2)(quint32 index, PROPID propID, PROPVARIANT *value);
|
||||||
|
typedef quint32 (_MY_WINAPI *SetLargePageModeFunc)();
|
||||||
|
|
||||||
//DEFINE_GUID(CLSID_CFormat7z,0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
|
//DEFINE_GUID(CLSID_CFormat7z,0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
|
||||||
//DEFINE_GUID(IArchiveKK,0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00);
|
//DEFINE_GUID(IArchiveKK,0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00);
|
||||||
|
|
||||||
DEFINE_GUID(CLSID_CFormat7z, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
|
DEFINE_GUID(CLSID_CFormat7z, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
|
||||||
DEFINE_GUID(CLSID_CFormatRar, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x03, 0x00, 0x00);
|
DEFINE_GUID(CLSID_CFormatRar, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x03, 0x00, 0x00);
|
||||||
|
DEFINE_GUID(CLSID_CFormatRar5, 0X23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xCC, 0x00, 0x00);
|
||||||
DEFINE_GUID(CLSID_CFormatZip, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x01, 0x00, 0x00);
|
DEFINE_GUID(CLSID_CFormatZip, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x01, 0x00, 0x00);
|
||||||
DEFINE_GUID(CLSID_CFormatTar, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0xee, 0x00, 0x00);
|
DEFINE_GUID(CLSID_CFormatTar, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0xee, 0x00, 0x00);
|
||||||
DEFINE_GUID(CLSID_CFormatArj, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x04, 0x00, 0x00);
|
DEFINE_GUID(CLSID_CFormatArj, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x04, 0x00, 0x00);
|
||||||
@ -37,21 +57,21 @@ DEFINE_GUID(CLSID_CFormatWim, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00,
|
|||||||
DEFINE_GUID(CLSID_CFormatZ, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x05, 0x00, 0x00);*/
|
DEFINE_GUID(CLSID_CFormatZ, 0x23170f69, 0x40c1, 0x278a, 0x10, 0x00, 0x00, 0x01, 0x10, 0x05, 0x00, 0x00);*/
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
GUID _supportedFileFormats[] = {CLSID_CFormatRar,CLSID_CFormatZip,CLSID_CFormatTar,CLSID_CFormat7z,CLSID_CFormatArj};
|
GUID _supportedFileFormats[] = {CLSID_CFormatRar,CLSID_CFormatZip,CLSID_CFormatTar,CLSID_CFormat7z,CLSID_CFormatArj,CLSID_CFormatRar5};
|
||||||
#else
|
#else
|
||||||
GUID _supportedFileFormats[] = {CLSID_CFormatZip,CLSID_CFormatTar,CLSID_CFormat7z,CLSID_CFormatArj};
|
GUID _supportedFileFormats[] = {CLSID_CFormatZip,CLSID_CFormatTar,CLSID_CFormat7z,CLSID_CFormatArj};
|
||||||
#endif
|
#endif
|
||||||
std::vector<GUID> supportedFileFormats (_supportedFileFormats, _supportedFileFormats + sizeof(_supportedFileFormats) / sizeof(_supportedFileFormats[0]) );
|
std::vector<GUID> supportedFileFormats (_supportedFileFormats, _supportedFileFormats + sizeof(_supportedFileFormats) / sizeof(_supportedFileFormats[0]) );
|
||||||
|
|
||||||
DEFINE_GUID(IID_InArchive, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00);
|
DEFINE_GUID(IID_InArchive, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00);
|
||||||
DEFINE_GUID(IID_ISetCompressCodecsInfo, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x00);
|
DEFINE_GUID(IID_ISetCompressCodecsInfoX, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x00);
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
/*#ifdef Q_OS_UNIX
|
||||||
DEFINE_GUID(IID_IOutStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00);
|
DEFINE_GUID(IID_IOutStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00);
|
||||||
DEFINE_GUID(IID_IInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00);
|
DEFINE_GUID(IID_IInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00);
|
||||||
DEFINE_GUID(IID_IStreamGetSize, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00);
|
DEFINE_GUID(IID_IStreamGetSize, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00);
|
||||||
DEFINE_GUID(IID_ISequentialInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00);
|
DEFINE_GUID(IID_ISequentialInStream, 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00);
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
struct SevenZipInterface {
|
struct SevenZipInterface {
|
||||||
CreateObjectFunc createObjectFunc;
|
CreateObjectFunc createObjectFunc;
|
||||||
@ -101,7 +121,7 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent)
|
|||||||
CInFileStream *fileSpec = new CInFileStream;
|
CInFileStream *fileSpec = new CInFileStream;
|
||||||
CMyComPtr<IInStream> file = fileSpec;
|
CMyComPtr<IInStream> file = fileSpec;
|
||||||
|
|
||||||
CArchiveOpenCallback *openCallbackSpec = new CArchiveOpenCallback;
|
YCArchiveOpenCallback *openCallbackSpec = new YCArchiveOpenCallback;
|
||||||
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
|
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
|
||||||
openCallbackSpec->PasswordIsDefined = false;
|
openCallbackSpec->PasswordIsDefined = false;
|
||||||
// openCallbackSpec->PasswordIsDefined = true;
|
// openCallbackSpec->PasswordIsDefined = true;
|
||||||
@ -151,7 +171,7 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent)
|
|||||||
#else
|
#else
|
||||||
if (memcmp(magicNumber,rar,6) == 0)
|
if (memcmp(magicNumber,rar,6) == 0)
|
||||||
if (memcmp(magicNumber,rar5,7) == 0)
|
if (memcmp(magicNumber,rar5,7) == 0)
|
||||||
return;
|
i=5;
|
||||||
else
|
else
|
||||||
i=0;
|
i=0;
|
||||||
else if (memcmp(magicNumber,zip,2)==0)
|
else if (memcmp(magicNumber,zip,2)==0)
|
||||||
@ -218,11 +238,16 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (memcmp(magicNumber,rar5,7) == 0)
|
//RAR in macos and unix
|
||||||
return;//we don't support rar5
|
GUID clsidRar;
|
||||||
|
if (memcmp(magicNumber,rar5,7) == 0) {
|
||||||
|
clsidRar = CLSID_CFormatRar5;
|
||||||
|
} else {
|
||||||
|
clsidRar = CLSID_CFormatRar;
|
||||||
|
}
|
||||||
|
|
||||||
isRar=true; //tell the destructor we *tried* to open a rar file!
|
isRar=true; //tell the destructor we *tried* to open a rar file!
|
||||||
if (szInterface->createObjectFunc(&CLSID_CFormatRar, &IID_InArchive, (void **)&szInterface->archive) != S_OK)
|
if (szInterface->createObjectFunc(&clsidRar, &IID_InArchive, (void **)&szInterface->archive) != S_OK)
|
||||||
{
|
{
|
||||||
qDebug() << "Error creating rar archive :" + filePath;
|
qDebug() << "Error creating rar archive :" + filePath;
|
||||||
return;
|
return;
|
||||||
@ -230,7 +255,7 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent)
|
|||||||
|
|
||||||
CMyComPtr<ISetCompressCodecsInfo> codecsInfo;
|
CMyComPtr<ISetCompressCodecsInfo> codecsInfo;
|
||||||
|
|
||||||
if (szInterface->archive->QueryInterface(IID_ISetCompressCodecsInfo,(void **)&codecsInfo) != S_OK)
|
if (szInterface->archive->QueryInterface(IID_ISetCompressCodecsInfoX,(void **)&codecsInfo) != S_OK)
|
||||||
{
|
{
|
||||||
qDebug() << "Error getting rar codec :" + filePath;
|
qDebug() << "Error getting rar codec :" + filePath;
|
||||||
return;
|
return;
|
||||||
@ -296,22 +321,22 @@ bool CompressedArchive::loadFunctions()
|
|||||||
{
|
{
|
||||||
#if defined Q_OS_UNIX
|
#if defined Q_OS_UNIX
|
||||||
#if defined Q_OS_MAC
|
#if defined Q_OS_MAC
|
||||||
rarLib = new QLibrary(QCoreApplication::applicationDirPath()+"/utils/Codecs/Rar29");
|
rarLib = new QLibrary(QCoreApplication::applicationDirPath()+"/utils/Codecs/Rar");
|
||||||
#else
|
#else
|
||||||
//check if a yacreader specific version of p7zip exists on the system
|
//check if a yacreader specific version of p7zip exists on the system
|
||||||
QFileInfo rarCodec(QString(LIBDIR)+"/yacreader/Codecs/Rar29.so");
|
QFileInfo rarCodec(QString(LIBDIR)+"/yacreader/Codecs/Rar.so");
|
||||||
if (rarCodec.exists())
|
if (rarCodec.exists())
|
||||||
{
|
{
|
||||||
rarLib = new QLibrary(rarCodec.absoluteFilePath());
|
rarLib = new QLibrary(rarCodec.absoluteFilePath());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rarLib = new QLibrary(QString(LIBDIR)+"/p7zip/Codecs/Rar29.so");
|
rarLib = new QLibrary(QString(LIBDIR)+"/p7zip/Codecs/Rar.so");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(!rarLib->load())
|
if(!rarLib->load())
|
||||||
{
|
{
|
||||||
qDebug() << "Error Loading Rar29.so : " + rarLib->errorString() << endl;
|
qDebug() << "Error Loading Rar.so : " + rarLib->errorString() << endl;
|
||||||
QCoreApplication::exit(700); //TODO yacreader_global can't be used here, it is GUI dependant, YACReader::SevenZNotFound
|
QCoreApplication::exit(700); //TODO yacreader_global can't be used here, it is GUI dependant, YACReader::SevenZNotFound
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -387,7 +412,7 @@ void CompressedArchive::setupFilesNames()
|
|||||||
if(!isDir)
|
if(!isDir)
|
||||||
{
|
{
|
||||||
szInterface->archive->GetProperty(i, kpidPath, &prop);
|
szInterface->archive->GetProperty(i, kpidPath, &prop);
|
||||||
UString s = ConvertPropVariantToString(prop);
|
UString s = prop.bstrVal;
|
||||||
const wchar_t * chars = s.operator const wchar_t *();
|
const wchar_t * chars = s.operator const wchar_t *();
|
||||||
files.append(QString::fromWCharArray(chars));
|
files.append(QString::fromWCharArray(chars));
|
||||||
offsets.append(i);
|
offsets.append(i);
|
||||||
@ -440,7 +465,7 @@ int CompressedArchive::getNumEntries()
|
|||||||
|
|
||||||
QList<QByteArray> CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate)
|
QList<QByteArray> CompressedArchive::getAllData(const QVector<quint32> & indexes, ExtractDelegate * delegate)
|
||||||
{
|
{
|
||||||
CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback(indexesToPages, true, delegate);
|
YCArchiveExtractCallback *extractCallbackSpec = new YCArchiveExtractCallback(indexesToPages, true, delegate);
|
||||||
CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);
|
CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);
|
||||||
extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path
|
extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path
|
||||||
extractCallbackSpec->PasswordIsDefined = false;
|
extractCallbackSpec->PasswordIsDefined = false;
|
||||||
@ -464,7 +489,7 @@ QByteArray CompressedArchive::getRawDataAtIndex(int index)
|
|||||||
{
|
{
|
||||||
if(index>=0 && index < getNumFiles())
|
if(index>=0 && index < getNumFiles())
|
||||||
{
|
{
|
||||||
CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback(indexesToPages);
|
YCArchiveExtractCallback *extractCallbackSpec = new YCArchiveExtractCallback(indexesToPages);
|
||||||
CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);
|
CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);
|
||||||
extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path
|
extractCallbackSpec->Init(szInterface->archive, L""); // second parameter is output folder path
|
||||||
extractCallbackSpec->PasswordIsDefined = false;
|
extractCallbackSpec->PasswordIsDefined = false;
|
||||||
@ -489,7 +514,7 @@ QByteArray CompressedArchive::getRawDataAtIndex(int index)
|
|||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
|
|
||||||
STDMETHODIMP CompressedArchive::GetNumberOfMethods(UInt32 *numMethods)
|
STDMETHODIMP CompressedArchive::GetNumMethods(UInt32 *numMethods)
|
||||||
{
|
{
|
||||||
return szInterface->getNumberOfMethodsFuncRar(numMethods);
|
return szInterface->getNumberOfMethodsFuncRar(numMethods);
|
||||||
}
|
}
|
||||||
|
@ -8,23 +8,9 @@
|
|||||||
#include "libp7zip/CPP/Common/MyCom.h"
|
#include "libp7zip/CPP/Common/MyCom.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class ExtractDelegate;
|
class ExtractDelegate;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#include "7z_includes.h"
|
|
||||||
#define _MY_WINAPI WINAPI
|
|
||||||
#else
|
|
||||||
#define _MY_WINAPI
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef quint32 (_MY_WINAPI * CreateObjectFunc)(const GUID *clsID,const GUID *interfaceID,void **outObject);
|
|
||||||
typedef quint32 (_MY_WINAPI *GetMethodPropertyFunc)(quint32 index, PROPID propID, PROPVARIANT *value);
|
|
||||||
typedef quint32 (_MY_WINAPI *GetNumberOfMethodsFunc)(quint32 *numMethods);
|
|
||||||
typedef quint32 (_MY_WINAPI *GetNumberOfFormatsFunc)(quint32 *numFormats);
|
|
||||||
typedef quint32 (_MY_WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
|
|
||||||
typedef quint32 (_MY_WINAPI *GetHandlerPropertyFunc2)(quint32 index, PROPID propID, PROPVARIANT *value);
|
|
||||||
typedef quint32 (_MY_WINAPI *SetLargePageModeFunc)();
|
|
||||||
|
|
||||||
class QLibrary;
|
class QLibrary;
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@ -48,7 +34,7 @@ public:
|
|||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
|
|
||||||
STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods);
|
STDMETHOD(GetNumMethods)(UInt32 *numMethods);
|
||||||
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
||||||
STDMETHOD(CreateDecoder)(UInt32 index, const GUID *iid, void **coder);
|
STDMETHOD(CreateDecoder)(UInt32 index, const GUID *iid, void **coder);
|
||||||
STDMETHOD(CreateEncoder)(UInt32 index, const GUID *iid, void **coder);
|
STDMETHOD(CreateEncoder)(UInt32 index, const GUID *iid, void **coder);
|
||||||
|
@ -28,11 +28,11 @@ static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propI
|
|||||||
NCOM::CPropVariant prop;
|
NCOM::CPropVariant prop;
|
||||||
RINOK(archive->GetProperty(index, propID, &prop));
|
RINOK(archive->GetProperty(index, propID, &prop));
|
||||||
if (prop.vt == VT_BOOL)
|
if (prop.vt == VT_BOOL)
|
||||||
result = VARIANT_BOOLToBool(prop.boolVal);
|
result = VARIANT_BOOLToBool(prop.boolVal);
|
||||||
else if (prop.vt == VT_EMPTY)
|
else if (prop.vt == VT_EMPTY)
|
||||||
result = false;
|
result = false;
|
||||||
else
|
else
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
static HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
|
static HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
|
||||||
@ -40,7 +40,7 @@ static HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &resu
|
|||||||
return IsArchiveItemProp(archive, index, kpidIsDir, result);
|
return IsArchiveItemProp(archive, index, kpidIsDir, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CArchiveExtractCallback:
|
class YCArchiveExtractCallback:
|
||||||
public IArchiveExtractCallback,
|
public IArchiveExtractCallback,
|
||||||
public ICryptoGetTextPassword,
|
public ICryptoGetTextPassword,
|
||||||
public CMyUnknownImp
|
public CMyUnknownImp
|
||||||
@ -71,11 +71,11 @@ private:
|
|||||||
UInt32 _index;
|
UInt32 _index;
|
||||||
struct CProcessedFileInfo
|
struct CProcessedFileInfo
|
||||||
{
|
{
|
||||||
FILETIME MTime;
|
FILETIME MTime;
|
||||||
UInt32 Attrib;
|
UInt32 Attrib;
|
||||||
bool isDir;
|
bool isDir;
|
||||||
bool AttribDefined;
|
bool AttribDefined;
|
||||||
bool MTimeDefined;
|
bool MTimeDefined;
|
||||||
} _processedFileInfo;
|
} _processedFileInfo;
|
||||||
|
|
||||||
COutFileStream *_outFileStreamSpec;
|
COutFileStream *_outFileStreamSpec;
|
||||||
@ -92,29 +92,29 @@ public:
|
|||||||
UInt64 newFileSize;
|
UInt64 newFileSize;
|
||||||
QMap<qint32, qint32> indexesToPages;
|
QMap<qint32, qint32> indexesToPages;
|
||||||
|
|
||||||
CArchiveExtractCallback(const QMap<qint32, qint32> & indexesToPages ,bool c = false,ExtractDelegate * d = 0) : PasswordIsDefined(false),all(c),delegate(d),indexesToPages(indexesToPages) {}
|
YCArchiveExtractCallback(const QMap<qint32, qint32> & indexesToPages ,bool c = false,ExtractDelegate * d = 0) : PasswordIsDefined(false),all(c),delegate(d),indexesToPages(indexesToPages) {}
|
||||||
~CArchiveExtractCallback() {MidFree(data);}
|
~YCArchiveExtractCallback() {MidFree(data);}
|
||||||
};
|
};
|
||||||
|
|
||||||
void CArchiveExtractCallback::Init(IInArchive *archiveHandler, const UString &directoryPath)
|
void YCArchiveExtractCallback::Init(IInArchive *archiveHandler, const UString &directoryPath)
|
||||||
{
|
{
|
||||||
NumErrors = 0;
|
NumErrors = 0;
|
||||||
_archiveHandler = archiveHandler;
|
_archiveHandler = archiveHandler;
|
||||||
directoryPath;//unused
|
directoryPath;//unused
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 /* size */)
|
STDMETHODIMP YCArchiveExtractCallback::SetTotal(UInt64 /* size */)
|
||||||
{
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 * /* completeValue */)
|
STDMETHODIMP YCArchiveExtractCallback::SetCompleted(const UInt64 * /* completeValue */)
|
||||||
{
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
|
STDMETHODIMP YCArchiveExtractCallback::GetStream(UInt32 index,
|
||||||
ISequentialOutStream **outStream, Int32 askExtractMode)
|
ISequentialOutStream **outStream, Int32 askExtractMode)
|
||||||
{
|
{
|
||||||
*outStream = 0;
|
*outStream = 0;
|
||||||
_outFileStream.Release();
|
_outFileStream.Release();
|
||||||
@ -125,83 +125,83 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
|
|||||||
_index = indexesToPages.value(index);
|
_index = indexesToPages.value(index);
|
||||||
|
|
||||||
{
|
{
|
||||||
// Get Name
|
// Get Name
|
||||||
NCOM::CPropVariant prop;
|
NCOM::CPropVariant prop;
|
||||||
RINOK(_archiveHandler->GetProperty(index, kpidPath, &prop));
|
RINOK(_archiveHandler->GetProperty(index, kpidPath, &prop));
|
||||||
|
|
||||||
UString fullPath;
|
UString fullPath;
|
||||||
if (prop.vt == VT_EMPTY)
|
if (prop.vt == VT_EMPTY)
|
||||||
fullPath = kEmptyFileAlias;
|
fullPath = kEmptyFileAlias;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (prop.vt != VT_BSTR)
|
if (prop.vt != VT_BSTR)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
fullPath = prop.bstrVal;
|
fullPath = prop.bstrVal;
|
||||||
}
|
}
|
||||||
_filePath = fullPath;
|
_filePath = fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
askExtractMode;//unused
|
askExtractMode;//unused
|
||||||
//if (askExtractMode != NArchive::NExtract::NAskMode::kExtract)
|
//if (askExtractMode != NArchive::NExtract::NAskMode::kExtract)
|
||||||
//return S_OK;
|
//return S_OK;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Get Attrib
|
// Get Attrib
|
||||||
NCOM::CPropVariant prop;
|
NCOM::CPropVariant prop;
|
||||||
RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
|
RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
|
||||||
if (prop.vt == VT_EMPTY)
|
if (prop.vt == VT_EMPTY)
|
||||||
{
|
{
|
||||||
_processedFileInfo.Attrib = 0;
|
_processedFileInfo.Attrib = 0;
|
||||||
_processedFileInfo.AttribDefined = false;
|
_processedFileInfo.AttribDefined = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (prop.vt != VT_UI4)
|
if (prop.vt != VT_UI4)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
_processedFileInfo.Attrib = prop.ulVal;
|
_processedFileInfo.Attrib = prop.ulVal;
|
||||||
_processedFileInfo.AttribDefined = true;
|
_processedFileInfo.AttribDefined = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.isDir));
|
RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.isDir));
|
||||||
|
|
||||||
{
|
{
|
||||||
// Get Modified Time
|
// Get Modified Time
|
||||||
NCOM::CPropVariant prop;
|
NCOM::CPropVariant prop;
|
||||||
RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
|
RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
|
||||||
_processedFileInfo.MTimeDefined = false;
|
_processedFileInfo.MTimeDefined = false;
|
||||||
switch(prop.vt)
|
switch(prop.vt)
|
||||||
{
|
{
|
||||||
case VT_EMPTY:
|
case VT_EMPTY:
|
||||||
// _processedFileInfo.MTime = _utcMTimeDefault;
|
// _processedFileInfo.MTime = _utcMTimeDefault;
|
||||||
break;
|
break;
|
||||||
case VT_FILETIME:
|
case VT_FILETIME:
|
||||||
_processedFileInfo.MTime = prop.filetime;
|
_processedFileInfo.MTime = prop.filetime;
|
||||||
_processedFileInfo.MTimeDefined = true;
|
_processedFileInfo.MTimeDefined = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//se necesita conocer el tamaño del archivo para poder reservar suficiente memoria
|
//se necesita conocer el tama?o del archivo para poder reservar suficiente memoria
|
||||||
bool newFileSizeDefined;
|
bool newFileSizeDefined;
|
||||||
{
|
{
|
||||||
// Get Size
|
// Get Size
|
||||||
NCOM::CPropVariant prop;
|
NCOM::CPropVariant prop;
|
||||||
RINOK(_archiveHandler->GetProperty(index, kpidSize, &prop));
|
RINOK(_archiveHandler->GetProperty(index, kpidSize, &prop));
|
||||||
newFileSizeDefined = (prop.vt != VT_EMPTY);
|
newFileSizeDefined = (prop.vt != VT_EMPTY);
|
||||||
if (newFileSizeDefined)
|
if (newFileSizeDefined)
|
||||||
newFileSize = ConvertPropVariantToUInt64(prop);
|
ConvertPropVariantToUInt64(prop, newFileSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//No hay que crear ningún fichero, ni directorios intermedios
|
//No hay que crear ning?n fichero, ni directorios intermedios
|
||||||
/*{
|
/*{
|
||||||
// Create folders for file
|
// Create folders for file
|
||||||
int slashPos = _filePath.ReverseFind(WCHAR_PATH_SEPARATOR);
|
int slashPos = _filePath.ReverseFind(WCHAR_PATH_SEPARATOR);
|
||||||
if (slashPos >= 0)
|
if (slashPos >= 0)
|
||||||
NFile::NDirectory::CreateComplexDirectory(_directoryPath + _filePath.Left(slashPos));
|
NFile::NDirectory::CreateComplexDirectory(_directoryPath + _filePath.Left(slashPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
UString fullProcessedPath = _directoryPath + _filePath;
|
UString fullProcessedPath = _directoryPath + _filePath;
|
||||||
@ -209,123 +209,123 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
|
|||||||
*/
|
*/
|
||||||
if (_processedFileInfo.isDir)
|
if (_processedFileInfo.isDir)
|
||||||
{
|
{
|
||||||
//NFile::NDirectory::CreateComplexDirectory(fullProcessedPath);
|
//NFile::NDirectory::CreateComplexDirectory(fullProcessedPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*NFile::NFind::CFileInfoW fi;
|
/*NFile::NFind::CFileInfoW fi;
|
||||||
if (fi.Find(fullProcessedPath))
|
if (fi.Find(fullProcessedPath))
|
||||||
{
|
{
|
||||||
if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
|
if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
|
||||||
{
|
{
|
||||||
qDebug() <<(UString(kCantDeleteOutputFile) + fullProcessedPath);
|
qDebug() <<(UString(kCantDeleteOutputFile) + fullProcessedPath);
|
||||||
return E_ABORT;
|
return E_ABORT;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
if(newFileSizeDefined)
|
if(newFileSizeDefined)
|
||||||
{
|
{
|
||||||
CBufPtrSeqOutStream *outStreamSpec = new CBufPtrSeqOutStream;
|
CBufPtrSeqOutStream *outStreamSpec = new CBufPtrSeqOutStream;
|
||||||
CMyComPtr<CBufPtrSeqOutStream> outStreamLocal(outStreamSpec);
|
CMyComPtr<CBufPtrSeqOutStream> outStreamLocal(outStreamSpec);
|
||||||
data = (Byte *)MidAlloc(newFileSize);
|
data = (Byte *)MidAlloc(newFileSize);
|
||||||
outStreamSpec->Init(data, newFileSize);
|
outStreamSpec->Init(data, newFileSize);
|
||||||
*outStream = outStreamLocal.Detach();
|
*outStream = outStreamLocal.Detach();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
STDMETHODIMP YCArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
||||||
{
|
{
|
||||||
_extractMode = false;
|
_extractMode = false;
|
||||||
switch (askExtractMode)
|
switch (askExtractMode)
|
||||||
{
|
{
|
||||||
case NArchive::NExtract::NAskMode::kExtract: _extractMode = true; break;
|
case NArchive::NExtract::NAskMode::kExtract: _extractMode = true; break;
|
||||||
};
|
};
|
||||||
/* switch (askExtractMode)
|
/* switch (askExtractMode)
|
||||||
{
|
{
|
||||||
case NArchive::NExtract::NAskMode::kExtract: qDebug() << (kExtractingString); break;
|
case NArchive::NExtract::NAskMode::kExtract: qDebug() << (kExtractingString); break;
|
||||||
case NArchive::NExtract::NAskMode::kTest: qDebug() <<(kTestingString); break;
|
case NArchive::NExtract::NAskMode::kTest: qDebug() <<(kTestingString); break;
|
||||||
case NArchive::NExtract::NAskMode::kSkip: qDebug() <<(kSkippingString); break;
|
case NArchive::NExtract::NAskMode::kSkip: qDebug() <<(kSkippingString); break;
|
||||||
};*/
|
};*/
|
||||||
//qDebug() << _filePath;
|
//qDebug() << _filePath;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
STDMETHODIMP YCArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
||||||
{
|
{
|
||||||
switch(operationResult)
|
switch(operationResult)
|
||||||
{
|
{
|
||||||
case NArchive::NExtract::NOperationResult::kOK:
|
case NArchive::NExtract::NOperationResult::kOK:
|
||||||
if(all && !_processedFileInfo.isDir)
|
if(all && !_processedFileInfo.isDir)
|
||||||
{
|
{
|
||||||
QByteArray rawData((char *)data,newFileSize);
|
QByteArray rawData((char *)data,newFileSize);
|
||||||
MidFree(data);
|
MidFree(data);
|
||||||
data = 0;
|
data = 0;
|
||||||
if(delegate != 0)
|
if(delegate != 0)
|
||||||
delegate->fileExtracted(_index,rawData);
|
delegate->fileExtracted(_index,rawData);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
allFiles.append(rawData);
|
allFiles.append(rawData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
NumErrors++;
|
NumErrors++;
|
||||||
qDebug() << " ";
|
qDebug() << " ";
|
||||||
switch(operationResult)
|
switch(operationResult)
|
||||||
{
|
{
|
||||||
case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
|
case NArchive::NExtract::NOperationResult::kUnsupportedMethod:
|
||||||
if(delegate != 0)
|
if(delegate != 0)
|
||||||
delegate->unknownError(_index);
|
delegate->unknownError(_index);
|
||||||
qDebug() << kUnsupportedMethod;
|
qDebug() << kUnsupportedMethod;
|
||||||
break;
|
break;
|
||||||
case NArchive::NExtract::NOperationResult::kCRCError:
|
case NArchive::NExtract::NOperationResult::kCRCError:
|
||||||
if(delegate != 0)
|
if(delegate != 0)
|
||||||
delegate->crcError(_index);
|
delegate->crcError(_index);
|
||||||
qDebug() << kCRCFailed;
|
qDebug() << kCRCFailed;
|
||||||
break;
|
break;
|
||||||
case NArchive::NExtract::NOperationResult::kDataError:
|
case NArchive::NExtract::NOperationResult::kDataError:
|
||||||
if(delegate != 0)
|
if(delegate != 0)
|
||||||
delegate->unknownError(_index);
|
delegate->unknownError(_index);
|
||||||
qDebug() << kDataError;
|
qDebug() << kDataError;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(delegate != 0)
|
if(delegate != 0)
|
||||||
delegate->unknownError(_index);
|
delegate->unknownError(_index);
|
||||||
qDebug() << kUnknownError;
|
qDebug() << kUnknownError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (_outFileStream != NULL)
|
if (_outFileStream != NULL)
|
||||||
{
|
{
|
||||||
if (_processedFileInfo.MTimeDefined)
|
if (_processedFileInfo.MTimeDefined)
|
||||||
_outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
|
_outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
|
||||||
RINOK(_outFileStreamSpec->Close());
|
RINOK(_outFileStreamSpec->Close());
|
||||||
}
|
}
|
||||||
_outFileStream.Release();
|
_outFileStream.Release();
|
||||||
if (_extractMode && _processedFileInfo.AttribDefined)
|
if (_extractMode && _processedFileInfo.AttribDefined)
|
||||||
NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib);*/
|
NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib);*/
|
||||||
//qDebug() << endl;
|
//qDebug() << endl;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
|
STDMETHODIMP YCArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
|
||||||
{
|
{
|
||||||
if (!PasswordIsDefined)
|
if (!PasswordIsDefined)
|
||||||
{
|
{
|
||||||
// You can ask real password here from user
|
// You can ask real password here from user
|
||||||
// Password = GetPassword(OutStream);
|
// Password = GetPassword(OutStream);
|
||||||
// PasswordIsDefined = true;
|
// PasswordIsDefined = true;
|
||||||
qDebug() << "Password is not defined" << endl;
|
qDebug() << "Password is not defined" << endl;
|
||||||
return E_ABORT;
|
return E_ABORT;
|
||||||
}
|
}
|
||||||
return StringToBstr(Password, password);
|
return StringToBstr(Password, password);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
--- libp7zip/CPP/myWindows/StdAfx.h 2014-06-06 23:52:13.397311952 +0200
|
--- libp7zip/CPP/include_windows/windows.h 2018-09-18 17:17:26.000000000 +0200
|
||||||
+++ libp7zip/CPP/myWindows/StdAfx.h 2014-06-06 23:53:20.353981756 +0200
|
--- libp7zip/CPP/include_windows/windows.h 2018-09-18 17:17:24.000000000 +0200
|
||||||
@@ -114,7 +114,7 @@
|
@@ -36,7 +36,7 @@
|
||||||
|
#define WINAPI
|
||||||
|
|
||||||
#if defined( __x86_64__ )
|
#undef BOOL
|
||||||
|
-typedef int BOOL;
|
||||||
|
+typedef signed char BOOL;
|
||||||
|
|
||||||
-#define _WIN64 1
|
|
||||||
+//#define _WIN64 1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#define CREATE_NEW 1
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// Archive Open callback class
|
// Archive Open callback class
|
||||||
|
|
||||||
|
|
||||||
class CArchiveOpenCallback:
|
class YCArchiveOpenCallback:
|
||||||
public IArchiveOpenCallback,
|
public IArchiveOpenCallback,
|
||||||
public ICryptoGetTextPassword,
|
public ICryptoGetTextPassword,
|
||||||
public CMyUnknownImp
|
public CMyUnknownImp
|
||||||
@ -23,20 +23,20 @@ public:
|
|||||||
bool PasswordIsDefined;
|
bool PasswordIsDefined;
|
||||||
UString Password;
|
UString Password;
|
||||||
|
|
||||||
CArchiveOpenCallback() : PasswordIsDefined(false) {}
|
YCArchiveOpenCallback() : PasswordIsDefined(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
STDMETHODIMP CArchiveOpenCallback::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
|
STDMETHODIMP YCArchiveOpenCallback::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
|
||||||
{
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveOpenCallback::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
|
STDMETHODIMP YCArchiveOpenCallback::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
|
||||||
{
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
|
STDMETHODIMP YCArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
|
||||||
{
|
{
|
||||||
if (!PasswordIsDefined)
|
if (!PasswordIsDefined)
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@ win32 {
|
|||||||
unix {
|
unix {
|
||||||
exists (../compressed_archive/libp7zip) {
|
exists (../compressed_archive/libp7zip) {
|
||||||
message(Found p7zip source code...)
|
message(Found p7zip source code...)
|
||||||
|
#this is probably only needed in macos
|
||||||
system(patch -N -p0 -i libp7zip.patch)
|
system(patch -N -p0 -i libp7zip.patch)
|
||||||
} else {
|
} else {
|
||||||
error(You\'ll need 7zip source code to compile YACReader. \
|
error(You\'ll need 7zip source code to compile YACReader. \
|
||||||
@ -18,110 +19,82 @@ exists (../compressed_archive/libp7zip) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG += precompile_header
|
|
||||||
|
|
||||||
win32 {PRECOMPILED_HEADER = $$PWD/StdAfx.h}
|
|
||||||
!win32 {PRECOMPILED_HEADER = $$PWD/libp7zip/CPP/myWindows/StdAfx.h}
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
INCLUDEPATH += $$PWD/lib7zip/CPP/
|
INCLUDEPATH += \
|
||||||
|
$$PWD/lib7zip/myWindows \
|
||||||
|
$$PWD/lib7zip/CPP \
|
||||||
|
$$PWD/lib7zip/include_windows \
|
||||||
|
|
||||||
DEFINES += _UNICODE _WIN32
|
DEFINES += _UNICODE _WIN32
|
||||||
|
|
||||||
SOURCES += $$PWD/compressed_archive.cpp \
|
SOURCES += \
|
||||||
|
$$PWD/compressed_archive.cpp \
|
||||||
$$PWD/lib7zip/CPP/Windows/FileIO.cpp \
|
$$PWD/lib7zip/CPP/Windows/FileIO.cpp \
|
||||||
$$PWD/lib7zip/CPP/Windows/PropVariant.cpp \
|
$$PWD/lib7zip/CPP/Windows/PropVariant.cpp \
|
||||||
$$PWD/lib7zip/CPP/Windows/PropVariantConversions.cpp \
|
$$PWD/lib7zip/CPP/Windows/PropVariantConv.cpp \
|
||||||
$$PWD/lib7zip/CPP/Common/IntToString.cpp \
|
$$PWD/lib7zip/CPP/Common/IntToString.cpp \
|
||||||
$$PWD/lib7zip/CPP/Common/MyString.cpp \
|
$$PWD/lib7zip/CPP/Common/MyString.cpp \
|
||||||
$$PWD/lib7zip/CPP/Common/MyVector.cpp \
|
$$PWD/lib7zip/CPP/Common/MyVector.cpp \
|
||||||
$$PWD/lib7zip/CPP/Common/StringConvert.cpp \
|
$$PWD/lib7zip/CPP/Common/StringConvert.cpp \
|
||||||
$$PWD/lib7zip/CPP/Common/Wildcard.cpp \
|
$$PWD/lib7zip/CPP/Common/Wildcard.cpp \
|
||||||
$$PWD/lib7zip/CPP/7zip/Common/FileStreams.cpp \
|
$$PWD/lib7zip/CPP/7zip/Common/FileStreams.cpp \
|
||||||
$$PWD/lib7zip/CPP/7zip/Common/StreamUtils.cpp \
|
$$PWD/lib7zip/CPP/7zip/Common/StreamUtils.cpp \
|
||||||
$$PWD/lib7zip/C/Alloc.c \
|
$$PWD/lib7zip/C/Alloc.c \
|
||||||
$$PWD/lib7zip/CPP/7zip/Common/StreamObjects.cpp
|
$$PWD/lib7zip/CPP/7zip/Common/StreamObjects.cpp
|
||||||
|
|
||||||
HEADERS += $$PWD/compressed_archive.h \
|
HEADERS += \
|
||||||
|
$$PWD/lib7zip/CPP/Common/Common.h \
|
||||||
|
$$PWD/compressed_archive.h \
|
||||||
$$PWD/extract_delegate.h \
|
$$PWD/extract_delegate.h \
|
||||||
$$PWD/7z_includes.h \
|
$$PWD/7z_includes.h \
|
||||||
$$PWD/open_callbacks.h \
|
$$PWD/open_callbacks.h \
|
||||||
$$PWD/extract_callbacks.h\
|
$$PWD/extract_callbacks.h
|
||||||
$$PWD/lib7zip/CPP/Windows/FileIO.h \
|
}
|
||||||
$$PWD/lib7zip/CPP/Windows/PropVariant.h \
|
|
||||||
$$PWD/lib7zip/CPP/Windows/PropVariantConversions.h \
|
!win32 {
|
||||||
$$PWD/lib7zip/CPP/Common/IntToString.h \
|
CONFIG += precompile_header
|
||||||
$$PWD/lib7zip/CPP/Common/MyString.h \
|
PRECOMPILED_HEADER = $$PWD/7z_precompiled_header.h
|
||||||
$$PWD/lib7zip/CPP/Common/MyVector.h \
|
|
||||||
$$PWD/lib7zip/CPP/Common/StringConvert.h \
|
|
||||||
$$PWD/lib7zip/CPP/Common/Wildcard.h \
|
|
||||||
$$PWD/lib7zip/CPP/7zip/Common/FileStreams.h \
|
|
||||||
$$PWD/lib7zip/CPP/7zip/IStream.h \
|
|
||||||
$$PWD/lib7zip/CPP/7zip/Common/StreamUtils.h \
|
|
||||||
$$PWD/lib7zip/C/Alloc.h \
|
|
||||||
$$PWD/lib7zip/CPP/7zip/Common/StreamObjects.h
|
|
||||||
}
|
}
|
||||||
|
|
||||||
macx{
|
macx{
|
||||||
LIBS += -framework IOKit -framework CoreFoundation
|
LIBS += -framework IOKit -framework CoreFoundation
|
||||||
|
|
||||||
DEFINES += UNICODE _UNICODE _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \
|
DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \
|
||||||
NDEBUG _REENTRANT ENV_UNIX \
|
NDEBUG _REENTRANT ENV_UNIX \
|
||||||
_7ZIP_LARGE_PAGES ENV_MACOSX _TCHAR_DEFINED
|
_7ZIP_LARGE_PAGES ENV_MACOSX _TCHAR_DEFINED \
|
||||||
|
UNICODE _UNICODE UNIX_USE_WIN_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
unix:!macx{
|
unix:!macx{
|
||||||
DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \
|
DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \
|
||||||
NDEBUG _REENTRANT ENV_UNIX \
|
NDEBUG _REENTRANT ENV_UNIX \
|
||||||
_7ZIP_LARGE_PAGES
|
_7ZIP_LARGE_PAGES
|
||||||
}
|
}
|
||||||
|
|
||||||
!win32 {
|
!win32 {
|
||||||
INCLUDEPATH += $$PWD/libp7zip/CPP/ \
|
INCLUDEPATH += $$PWD/libp7zip/CPP/myWindows/ \
|
||||||
$$PWD/libp7zip/CPP/myWindows/ \
|
$$PWD/libp7zip/CPP/ \
|
||||||
$$PWD/libp7zip/CPP/include_windows/
|
$$PWD/libp7zip/CPP/include_windows/
|
||||||
|
|
||||||
SOURCES += $$PWD/compressed_archive.cpp \
|
SOURCES += \
|
||||||
|
$$PWD/compressed_archive.cpp \
|
||||||
|
$$PWD/libp7zip/CPP/Windows/PropVariant.cpp \
|
||||||
|
$$PWD/libp7zip/CPP/Windows/PropVariantConv.cpp \
|
||||||
$$PWD/libp7zip/CPP/Windows/FileIO.cpp \
|
$$PWD/libp7zip/CPP/Windows/FileIO.cpp \
|
||||||
$$PWD/libp7zip/CPP/Windows/FileFind.cpp \
|
$$PWD/libp7zip/CPP/Windows/FileFind.cpp \
|
||||||
$$PWD/libp7zip/CPP/Windows/PropVariant.cpp \
|
|
||||||
$$PWD/libp7zip/CPP/Windows/PropVariantConversions.cpp \
|
|
||||||
$$PWD/libp7zip/CPP/Common/IntToString.cpp \
|
$$PWD/libp7zip/CPP/Common/IntToString.cpp \
|
||||||
$$PWD/libp7zip/CPP/Common/MyString.cpp \
|
$$PWD/libp7zip/CPP/Common/MyString.cpp \
|
||||||
$$PWD/libp7zip/CPP/Common/MyVector.cpp \
|
$$PWD/libp7zip/CPP/Common/MyVector.cpp \
|
||||||
$$PWD/libp7zip/CPP/Common/StringConvert.cpp \
|
$$PWD/libp7zip/CPP/Common/StringConvert.cpp \
|
||||||
$$PWD/libp7zip/CPP/Common/Wildcard.cpp \
|
$$PWD/libp7zip/CPP/Common/Wildcard.cpp \
|
||||||
$$PWD/libp7zip/CPP/7zip/Common/FileStreams.cpp \
|
$$PWD/libp7zip/CPP/7zip/Common/FileStreams.cpp \
|
||||||
$$PWD/libp7zip/CPP/7zip/Common/StreamUtils.cpp \
|
$$PWD/libp7zip/CPP/7zip/Common/StreamUtils.cpp \
|
||||||
$$PWD/libp7zip/C/Alloc.c \
|
$$PWD/libp7zip/C/Alloc.c \
|
||||||
$$PWD/libp7zip/CPP/7zip/Common/StreamObjects.cpp \
|
$$PWD/libp7zip/CPP/7zip/Common/StreamObjects.cpp \
|
||||||
$$PWD/libp7zip/CPP/myWindows/wine_date_and_time.cpp \
|
$$PWD/libp7zip/CPP/myWindows/wine_date_and_time.cpp \
|
||||||
$$PWD/libp7zip/CPP/Common/MyWindows.cpp
|
$$PWD/libp7zip/CPP/Common/MyWindows.cpp
|
||||||
|
|
||||||
HEADERS += $$PWD/compressed_archive.h \
|
HEADERS += \
|
||||||
$$PWD/7z_includes.h \
|
$$PWD/compressed_archive.h \
|
||||||
$$PWD/open_callbacks.h \
|
$$PWD/7z_includes.h
|
||||||
$$PWD/extract_callbacks.h\
|
|
||||||
$$PWD/libp7zip/CPP/include_windows/windows.h \
|
|
||||||
$$PWD/libp7zip/CPP/include_windows/tchar.h \
|
|
||||||
$$PWD/libp7zip/CPP/include_windows/basetyps.h \
|
|
||||||
$$PWD/libp7zip/CPP/Windows/FileFind.h \
|
|
||||||
$$PWD/libp7zip/CPP/Windows/FileIO.h \
|
|
||||||
$$PWD/libp7zip/CPP/Windows/PropVariant.h \
|
|
||||||
$$PWD/libp7zip/CPP/Windows/PropVariantConversions.h \
|
|
||||||
$$PWD/libp7zip/CPP/Common/IntToString.h \
|
|
||||||
$$PWD/libp7zip/CPP/Common/MyString.h \
|
|
||||||
$$PWD/libp7zip/CPP/Common/MyVector.h \
|
|
||||||
$$PWD/libp7zip/CPP/Common/StringConvert.h \
|
|
||||||
$$PWD/libp7zip/CPP/Common/Wildcard.h \
|
|
||||||
$$PWD/libp7zip/CPP/7zip/Common/FileStreams.h \
|
|
||||||
$$PWD/libp7zip/CPP/7zip/IStream.h \
|
|
||||||
$$PWD/libp7zip/CPP/7zip/Common/StreamUtils.h \
|
|
||||||
$$PWD/libp7zip/C/Alloc.h \
|
|
||||||
$$PWD/libp7zip/CPP/7zip/Common/StreamObjects.h \
|
|
||||||
$$PWD/libp7zip/CPP/Common/MyWindows.h \
|
|
||||||
$$PWD/libp7zip/CPP/7zip/ICoder.h \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
10
config.pri
10
config.pri
@ -30,10 +30,18 @@ CONFIG(no_opengl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# default value for comic archive decompression backend
|
# default value for comic archive decompression backend
|
||||||
!CONFIG(unarr):!CONFIG(7zip) {
|
unix:!macx:!CONFIG(unarr):!CONFIG(7zip) {
|
||||||
CONFIG += unarr
|
CONFIG += unarr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win32:!CONFIG(unarr):!CONFIG(7zip) {
|
||||||
|
CONFIG += 7zip
|
||||||
|
}
|
||||||
|
|
||||||
|
macx:!CONFIG(unarr):!CONFIG(7zip) {
|
||||||
|
CONFIG += 7zip
|
||||||
|
}
|
||||||
|
|
||||||
# default values for pdf render backend
|
# default values for pdf render backend
|
||||||
win32:!CONFIG(poppler):!CONFIG(pdfium):!CONFIG(no_pdf) {
|
win32:!CONFIG(poppler):!CONFIG(pdfium):!CONFIG(no_pdf) {
|
||||||
CONFIG += pdfium
|
CONFIG += pdfium
|
||||||
|
Loading…
x
Reference in New Issue
Block a user