mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 02:11:40 -06:00
4.59 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
3901bf0ab8
commit
173c07e166
@@ -9,8 +9,8 @@
|
||||
#include "../AES/MyAES.h"
|
||||
#include "7zAES.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../../C/Sha256.h"
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ STDMETHODIMP CEncoder::ResetInitVector()
|
||||
}
|
||||
|
||||
STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
|
||||
{
|
||||
{
|
||||
// _key.Init();
|
||||
for (UInt32 i = _ivSize; i < sizeof(_iv); i++)
|
||||
_iv[i] = 0;
|
||||
@@ -149,7 +149,7 @@ STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
|
||||
// _key.NumCyclesPower = 0x3F;
|
||||
_key.NumCyclesPower = 19;
|
||||
|
||||
Byte firstByte = (Byte)(_key.NumCyclesPower |
|
||||
Byte firstByte = (Byte)(_key.NumCyclesPower |
|
||||
(((_key.SaltSize == 0) ? 0 : 1) << 7) |
|
||||
(((ivSize == 0) ? 0 : 1) << 6));
|
||||
RINOK(outStream->Write(&firstByte, 1, NULL));
|
||||
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
CBase();
|
||||
};
|
||||
|
||||
class CBaseCoder:
|
||||
class CBaseCoder:
|
||||
public ICompressFilter,
|
||||
public ICryptoSetPassword,
|
||||
public CMyUnknownImp,
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
|
||||
class CEncoder:
|
||||
class CEncoder:
|
||||
public CBaseCoder,
|
||||
public ICompressWriteCoderProperties,
|
||||
// public ICryptoResetSalt,
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
class CDecoder:
|
||||
class CDecoder:
|
||||
public CBaseCoder,
|
||||
public ICompressSetDecoderProperties2
|
||||
{
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
// DLLExports.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/MyInitGuid.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "7zAES.h"
|
||||
|
||||
/*
|
||||
// {23170F69-40C1-278B-0703-000000000000}
|
||||
DEFINE_GUID(CLSID_CCrypto_Hash_SHA256,
|
||||
0x23170F69, 0x40C1, 0x278B, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
|
||||
*/
|
||||
|
||||
// {23170F69-40C1-278B-06F1-070100000100}
|
||||
DEFINE_GUID(CLSID_CCrypto7zAESEncoder,
|
||||
0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00);
|
||||
|
||||
// {23170F69-40C1-278B-06F1-070100000000}
|
||||
DEFINE_GUID(CLSID_CCrypto7zAESDecoder,
|
||||
0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 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 *clsid, const GUID *iid, void **outObject)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
*outObject = 0;
|
||||
int correctInterface = (*iid == IID_ICompressFilter);
|
||||
CMyComPtr<ICompressFilter> filter;
|
||||
if (*clsid == CLSID_CCrypto7zAESDecoder)
|
||||
{
|
||||
if (!correctInterface)
|
||||
return E_NOINTERFACE;
|
||||
filter = (ICompressFilter *)new NCrypto::NSevenZ::CDecoder();
|
||||
}
|
||||
else if (*clsid == CLSID_CCrypto7zAESEncoder)
|
||||
{
|
||||
if (!correctInterface)
|
||||
return E_NOINTERFACE;
|
||||
filter = (ICompressFilter *)new NCrypto::NSevenZ::CEncoder();
|
||||
}
|
||||
else
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
*outObject = filter.Detach();
|
||||
COM_TRY_END
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI GetNumberOfMethods(UINT32 *numMethods)
|
||||
{
|
||||
*numMethods = 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
if (index != 0)
|
||||
return E_INVALIDARG;
|
||||
::VariantClear((tagVARIANT *)value);
|
||||
switch(propID)
|
||||
{
|
||||
case NMethodPropID::kID:
|
||||
{
|
||||
const char id[] = { 0x06, (char)(unsigned char)0xF1, 0x07, 0x01 };
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
case NMethodPropID::kName:
|
||||
if ((value->bstrVal = ::SysAllocString(L"7zAES")) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
case NMethodPropID::kDecoder:
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CCrypto7zAESDecoder, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
case NMethodPropID::kEncoder:
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CCrypto7zAESEncoder, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// StdAfx.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
Reference in New Issue
Block a user