mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 09:15:00 -06:00
4.45 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
d9666cf046
commit
a145bfc7cf
@@ -1,110 +0,0 @@
|
||||
// DLLExports.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/MyInitGuid.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "../../ICoder.h"
|
||||
#include "NsisHandler.h"
|
||||
|
||||
// {23170F69-40C1-278A-1000-000110090000}
|
||||
DEFINE_GUID(CLSID_CNsisHandler,
|
||||
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x09, 0x00, 0x00);
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
bool g_IsNT = false;
|
||||
static bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
#ifndef _UNICODE
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STDAPI CreateObject(
|
||||
const GUID *classID,
|
||||
const GUID *interfaceID,
|
||||
void **outObject)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
*outObject = 0;
|
||||
if (*classID != CLSID_CNsisHandler)
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
int needIn = *interfaceID == IID_IInArchive;
|
||||
// int needOut = *interfaceID == IID_IOutArchive;
|
||||
if (needIn /*|| needOut */)
|
||||
{
|
||||
NArchive::NNsis::CHandler *temp = new NArchive::NNsis::CHandler;
|
||||
if (needIn)
|
||||
{
|
||||
CMyComPtr<IInArchive> inArchive = (IInArchive *)temp;
|
||||
*outObject = inArchive.Detach();
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp;
|
||||
*outObject = outArchive.Detach();
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
return E_NOINTERFACE;
|
||||
COM_TRY_END
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
NWindows::NCOM::CPropVariant propVariant;
|
||||
switch(propID)
|
||||
{
|
||||
case NArchive::kName:
|
||||
propVariant = L"Nsis";
|
||||
break;
|
||||
case NArchive::kClassID:
|
||||
{
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CNsisHandler, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
case NArchive::kExtension:
|
||||
propVariant = L"exe";
|
||||
break;
|
||||
case NArchive::kUpdate:
|
||||
propVariant = false;
|
||||
break;
|
||||
case NArchive::kStartSignature:
|
||||
{
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::NNsis::kSignature,
|
||||
NArchive::NNsis::kSignatureSize)) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
case NArchive::kAssociate:
|
||||
{
|
||||
propVariant = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
propVariant.Detach(value);
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,337 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="Nsis" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=Nsis - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Nsis.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Nsis.mak" CFG="Nsis - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Nsis - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "Nsis - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Nsis - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# 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 "TAR_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /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"
|
||||
# ADD RSC /l 0x419 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\nsis.dll" /opt:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "Nsis - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# 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 "TAR_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /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"
|
||||
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\nsis.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Nsis - Win32 Release"
|
||||
# Name "Nsis - Win32 Debug"
|
||||
# Begin Group "Spec"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Archive.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DllExports.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Nsis.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"StdAfx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Buffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Windows"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\DLL.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\DLL.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileFind.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\FileFind.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariant.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariant.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Compress\Copy\CopyCoder.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Engine"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NsisDecode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NsisDecode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NsisHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NsisHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NsisIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NsisIn.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Archive Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CodecsPath.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CodecsPath.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CoderLoader.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CoderLoader.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\ItemNameUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ItemNameUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "7zip Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\LimitedStreams.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\LimitedStreams.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\ProgressUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\ProgressUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamObjects.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamObjects.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "7z"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethodID.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethodID.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethods.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethods.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Nsis"=.\Nsis.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -6,23 +6,21 @@
|
||||
|
||||
#include "../../Common/StreamUtils.h"
|
||||
|
||||
#include "../7z/7zMethods.h"
|
||||
#include "../../Common/MethodId.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NNsis {
|
||||
|
||||
static const N7z::CMethodID k_Copy = { { 0x0 }, 1 };
|
||||
static const N7z::CMethodID k_Deflate = { { 0x4, 0x9, 0x1 }, 3 };
|
||||
static const N7z::CMethodID k_BZip2 = { { 0x4, 0x9, 0x2 }, 3 };
|
||||
static const N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 };
|
||||
static const N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 };
|
||||
static const CMethodId k_Copy = 0x0;
|
||||
static const CMethodId k_Deflate = 0x040901;
|
||||
static const CMethodId k_BZip2 = 0x040902;
|
||||
static const CMethodId k_LZMA = 0x030101;
|
||||
static const CMethodId k_BCJ_X86 = 0x03030103;
|
||||
|
||||
CDecoder::CDecoder()
|
||||
{
|
||||
N7z::LoadMethodMap();
|
||||
}
|
||||
|
||||
HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter)
|
||||
HRESULT CDecoder::Init(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter)
|
||||
{
|
||||
useFilter = false;
|
||||
CObjectVector< CMyComPtr<ISequentialInStream> > inStreams;
|
||||
@@ -33,29 +31,21 @@ HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool ther
|
||||
_method = method;
|
||||
if (!_codecInStream)
|
||||
{
|
||||
const NArchive::N7z::CMethodID *methodID = 0;
|
||||
CMethodId methodID;
|
||||
switch (method)
|
||||
{
|
||||
case NMethodType::kCopy:
|
||||
methodID = &k_Copy;
|
||||
break;
|
||||
case NMethodType::kDeflate:
|
||||
methodID = &k_Deflate;
|
||||
break;
|
||||
case NMethodType::kBZip2:
|
||||
methodID = &k_BZip2;
|
||||
break;
|
||||
case NMethodType::kLZMA:
|
||||
methodID = &k_LZMA;
|
||||
break;
|
||||
default:
|
||||
return E_NOTIMPL;
|
||||
case NMethodType::kCopy: methodID = k_Copy; break;
|
||||
case NMethodType::kDeflate: methodID = k_Deflate; break;
|
||||
case NMethodType::kBZip2: methodID = k_BZip2; break;
|
||||
case NMethodType::kLZMA: methodID = k_LZMA; break;
|
||||
default: return E_NOTIMPL;
|
||||
}
|
||||
N7z::CMethodInfo methodInfo;
|
||||
if (!N7z::GetMethodInfo(*methodID, methodInfo))
|
||||
return E_NOTIMPL;
|
||||
CMyComPtr<ICompressCoder> coder;
|
||||
RINOK(_libraries.CreateCoder(methodInfo.FilePath, methodInfo.Decoder, &coder));
|
||||
RINOK(CreateCoder(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
methodID, coder, false));
|
||||
if (!coder)
|
||||
return E_NOTIMPL;
|
||||
coder.QueryInterface(IID_ISequentialInStream, &_codecInStream);
|
||||
if (!_codecInStream)
|
||||
return E_NOTIMPL;
|
||||
@@ -77,11 +67,12 @@ HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool ther
|
||||
{
|
||||
if (!_filterInStream)
|
||||
{
|
||||
N7z::CMethodInfo methodInfo;
|
||||
if (!N7z::GetMethodInfo(k_BCJ_X86, methodInfo))
|
||||
return E_NOTIMPL;
|
||||
CMyComPtr<ICompressCoder> coder;
|
||||
RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath, methodInfo.Decoder, &coder));
|
||||
RINOK(CreateCoder(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
k_BCJ_X86, coder, false));
|
||||
if (!coder)
|
||||
return E_NOTIMPL;
|
||||
coder.QueryInterface(IID_ISequentialInStream, &_filterInStream);
|
||||
if (!_filterInStream)
|
||||
return E_NOTIMPL;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "../../IStream.h"
|
||||
|
||||
#include "../Common/CoderLoader.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NNsis {
|
||||
@@ -24,21 +24,21 @@ namespace NMethodType
|
||||
class CDecoder
|
||||
{
|
||||
NMethodType::EEnum _method;
|
||||
CCoderLibraries _libraries;
|
||||
|
||||
CMyComPtr<ISequentialInStream> _filterInStream;
|
||||
CMyComPtr<ISequentialInStream> _codecInStream;
|
||||
CMyComPtr<ISequentialInStream> _decoderInStream;
|
||||
|
||||
public:
|
||||
CDecoder();
|
||||
void Release()
|
||||
{
|
||||
_filterInStream.Release();
|
||||
_codecInStream.Release();
|
||||
_decoderInStream.Release();
|
||||
}
|
||||
HRESULT Init(IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter);
|
||||
HRESULT Init(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter);
|
||||
HRESULT Read(void *data, UInt32 size, UInt32 *processedSize);
|
||||
};
|
||||
|
||||
|
||||
@@ -77,12 +77,15 @@ STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */,
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 * maxCheckStartPosition, IArchiveOpenCallback * /* openArchiveCallback */)
|
||||
STDMETHODIMP CHandler::Open(
|
||||
IInStream *stream, const UInt64 * maxCheckStartPosition, IArchiveOpenCallback * /* openArchiveCallback */)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
Close();
|
||||
{
|
||||
if(_archive.Open(stream, maxCheckStartPosition) != S_OK)
|
||||
if(_archive.Open(
|
||||
EXTERNAL_CODECS_VARS
|
||||
stream, maxCheckStartPosition) != S_OK)
|
||||
return S_FALSE;
|
||||
_inStream = stream;
|
||||
}
|
||||
@@ -314,7 +317,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
{
|
||||
RINOK(_inStream->Seek(_archive.StreamOffset, STREAM_SEEK_SET, NULL));
|
||||
bool useFilter;
|
||||
RINOK(_archive.Decoder.Init(_inStream, _archive.Method, _archive.FilterFlag, useFilter));
|
||||
RINOK(_archive.Decoder.Init(
|
||||
EXTERNAL_CODECS_VARS
|
||||
_inStream, _archive.Method, _archive.FilterFlag, useFilter));
|
||||
}
|
||||
|
||||
bool dataError = false;
|
||||
@@ -404,7 +409,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
{
|
||||
needDecompress = true;
|
||||
bool useFilter;
|
||||
RINOK(_archive.Decoder.Init(_inStream, _archive.Method, _archive.FilterFlag, useFilter));
|
||||
RINOK(_archive.Decoder.Init(
|
||||
EXTERNAL_CODECS_VARS
|
||||
_inStream, _archive.Method, _archive.FilterFlag, useFilter));
|
||||
fullSize = GetUInt32FromMemLE(buffer);
|
||||
}
|
||||
else
|
||||
@@ -481,4 +488,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
IMPL_ISetCompressCodecsInfo
|
||||
|
||||
}}
|
||||
|
||||
@@ -8,21 +8,30 @@
|
||||
|
||||
#include "NsisIn.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NNsis {
|
||||
|
||||
class CHandler:
|
||||
public IInArchive,
|
||||
PUBLIC_ISetCompressCodecsInfo
|
||||
public CMyUnknownImp
|
||||
{
|
||||
CMyComPtr<IInStream> _inStream;
|
||||
CInArchive _archive;
|
||||
|
||||
DECL_EXTERNAL_CODECS_VARS
|
||||
|
||||
bool GetUncompressedSize(int index, UInt32 &size);
|
||||
bool GetCompressedSize(int index, UInt32 &size);
|
||||
|
||||
public:
|
||||
MY_UNKNOWN_IMP1(IInArchive)
|
||||
MY_QUERYINTERFACE_BEGIN
|
||||
MY_QUERYINTERFACE_ENTRY(IInArchive)
|
||||
QUERY_ENTRY_ISetCompressCodecsInfo
|
||||
MY_QUERYINTERFACE_END
|
||||
MY_ADDREF_RELEASE
|
||||
|
||||
STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback);
|
||||
STDMETHOD(Close)();
|
||||
@@ -34,6 +43,8 @@ public:
|
||||
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
|
||||
STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties);
|
||||
STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType);
|
||||
|
||||
DECL_ISetCompressCodecsInfo
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -995,7 +995,9 @@ static bool IsLZMA(const Byte *p, UInt32 &dictionary, bool &thereIsFlag)
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT CInArchive::Open2()
|
||||
HRESULT CInArchive::Open2(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS2
|
||||
)
|
||||
{
|
||||
RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &StreamOffset));
|
||||
|
||||
@@ -1053,7 +1055,9 @@ HRESULT CInArchive::Open2()
|
||||
{
|
||||
// unpackSize = (1 << 23);
|
||||
_data.SetCapacity(unpackSize);
|
||||
RINOK(Decoder.Init(_stream, Method, FilterFlag, UseFilter));
|
||||
RINOK(Decoder.Init(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
_stream, Method, FilterFlag, UseFilter));
|
||||
UInt32 processedSize;
|
||||
RINOK(Decoder.Read(_data, unpackSize, &processedSize));
|
||||
if (processedSize != unpackSize)
|
||||
@@ -1108,7 +1112,9 @@ FirstHeader
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPosition)
|
||||
HRESULT CInArchive::Open(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
IInStream *inStream, const UInt64 *maxCheckStartPosition)
|
||||
{
|
||||
Clear();
|
||||
UInt64 pos;
|
||||
@@ -1152,7 +1158,12 @@ HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPositio
|
||||
|
||||
_stream = inStream;
|
||||
HRESULT res = S_FALSE;
|
||||
try { res = Open2(); }
|
||||
try
|
||||
{
|
||||
res = Open2(
|
||||
EXTERNAL_CODECS_LOC_VARS2
|
||||
);
|
||||
}
|
||||
catch(...) { Clear(); res = S_FALSE; }
|
||||
_stream.Release();
|
||||
return res;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "NsisDecode.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
// #define NSIS_SCRIPT
|
||||
|
||||
namespace NArchive {
|
||||
@@ -99,7 +101,9 @@ class CInArchive
|
||||
|
||||
Byte ReadByte();
|
||||
UInt32 ReadUInt32();
|
||||
HRESULT Open2();
|
||||
HRESULT Open2(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS2
|
||||
);
|
||||
void ReadBlockHeader(CBlockHeader &bh);
|
||||
AString ReadString(UInt32 pos);
|
||||
AString ReadString2(UInt32 pos);
|
||||
@@ -117,7 +121,9 @@ class CInArchive
|
||||
bool _headerIsCompressed;
|
||||
UInt32 _nonSolidStartOffset;
|
||||
public:
|
||||
HRESULT Open(IInStream *inStream, const UInt64 *maxCheckStartPosition);
|
||||
HRESULT Open(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
IInStream *inStream, const UInt64 *maxCheckStartPosition);
|
||||
void Clear();
|
||||
|
||||
UInt64 StreamOffset;
|
||||
|
||||
14
CPP/7zip/Archive/Nsis/NsisRegister.cpp
Executable file
14
CPP/7zip/Archive/Nsis/NsisRegister.cpp
Executable file
@@ -0,0 +1,14 @@
|
||||
// NsisRegister.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../Common/RegisterArc.h"
|
||||
|
||||
#include "NsisHandler.h"
|
||||
static IInArchive *CreateArc() { return new NArchive::NNsis::CHandler; }
|
||||
|
||||
static CArcInfo g_ArcInfo =
|
||||
{ L"Nsis", 0, 0, 0x9, { 0xEF, 0xBE, 0xAD, 0xDE,
|
||||
0x4E, 0x75, 0x6C, 0x6C, 0x73, 0x6F, 0x66, 0x74, 0x49, 0x6E, 0x73, 0x74}, 16, false, CreateArc, 0 };
|
||||
|
||||
REGISTER_ARC(Nsis)
|
||||
@@ -1,67 +0,0 @@
|
||||
PROG = nsis.dll
|
||||
DEF_FILE = ../Archive.def
|
||||
CFLAGS = $(CFLAGS) -I ../../../
|
||||
LIBS = $(LIBS) oleaut32.lib user32.lib
|
||||
|
||||
TAR_OBJS = \
|
||||
$O\DllExports.obj \
|
||||
$O\NsisDecode.obj \
|
||||
$O\NsisHandler.obj \
|
||||
$O\NsisIn.obj \
|
||||
|
||||
COMMON_OBJS = \
|
||||
$O\Alloc.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\Vector.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\DLL.obj \
|
||||
$O\FileFind.obj \
|
||||
$O\PropVariant.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\LimitedStreams.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
AR_COMMON_OBJS = \
|
||||
$O\CodecsPath.obj \
|
||||
$O\CoderLoader.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\FilterCoder.obj \
|
||||
|
||||
7Z_OBJS = \
|
||||
$O\7zMethodID.obj \
|
||||
$O\7zMethods.obj \
|
||||
|
||||
OBJS = \
|
||||
$O\StdAfx.obj \
|
||||
$(TAR_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
$(WIN_OBJS) \
|
||||
$(7ZIP_COMMON_OBJS) \
|
||||
$(AR_COMMON_OBJS) \
|
||||
$(7Z_OBJS) \
|
||||
$(COMPRESS_TAR_OBJS) \
|
||||
$O\CopyCoder.obj \
|
||||
$O\resource.res
|
||||
|
||||
!include "../../../Build.mak"
|
||||
|
||||
$(TAR_OBJS): $(*B).cpp
|
||||
$(COMPL)
|
||||
$(COMMON_OBJS): ../../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_OBJS): ../../../Windows/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(AR_COMMON_OBJS): ../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7Z_OBJS): ../7z/$(*B).cpp
|
||||
$(COMPL)
|
||||
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
|
||||
$(COMPL)
|
||||
@@ -1,3 +0,0 @@
|
||||
#include "../../MyVersionInfo.rc"
|
||||
|
||||
MY_VERSION_INFO_DLL("Nsis Plugin", "nsis")
|
||||
Reference in New Issue
Block a user