mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
@ -273,26 +273,27 @@ SOURCES += \
|
||||
|
||||
core_debug {
|
||||
SOURCES += \
|
||||
../Enums/RecordType.cpp \
|
||||
../PPTFormatLib.cpp \
|
||||
../Reader/ReadStructures.cpp \
|
||||
../Reader/RoundTripExtractor.cpp \
|
||||
../Reader/PPTDocumentInfoOneUser.cpp \
|
||||
../Reader/Records.cpp \
|
||||
../Reader/PPTFileReader.cpp \
|
||||
../Reader/SlidePersist.cpp \
|
||||
../Records/Drawing/ArtBlip.cpp \
|
||||
../Records/Drawing/ShapeContainer.cpp \
|
||||
../PPTXWriter/Converter.cpp \
|
||||
../PPTXWriter/ShapeWriter.cpp
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
../Enums/RecordType.cpp \
|
||||
../PPTFormatLib.cpp \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/Elements.cpp \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/TextAttributesEx.cpp \
|
||||
../../../Common/3dParty/pole/pole.cpp \
|
||||
../PPTXWriter/ShapeWriter.cpp \
|
||||
../PPTXWriter/Animation.cpp \
|
||||
../PPTXWriter/TableWriter.cpp \
|
||||
../PPTXWriter/TxBodyConverter.cpp \
|
||||
../Reader/RoundTripExtractor.cpp \
|
||||
../Records/Drawing/ArtBlip.cpp \
|
||||
../Records/Drawing/ShapeContainer.cpp \
|
||||
../Records/Animations/TimeVariant.cpp \
|
||||
../Records/BlipEntityAtom.cpp
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/Elements.cpp \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/TextAttributesEx.cpp \
|
||||
../../../Common/3dParty/pole/pole.cpp
|
||||
|
||||
|
||||
@ -30,13 +30,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../Enums/RecordType.cpp"
|
||||
#include "../PPTFormatLib.cpp"
|
||||
#include "../Reader/ReadStructures.cpp"
|
||||
#include "../Reader/RoundTripExtractor.cpp"
|
||||
#include "../Reader/PPTDocumentInfoOneUser.cpp"
|
||||
#include "../Reader/PPTFileReader.cpp"
|
||||
#include "../Reader/Records.cpp"
|
||||
#include "../Reader/PPTFileReader.cpp"
|
||||
#include "../Reader/SlidePersist.cpp"
|
||||
//#include "../Records/Animations/AnimationTypes.cpp"
|
||||
#include "../Records/Drawing/ArtBlip.cpp"
|
||||
#include "../Records/Drawing/ShapeContainer.cpp"
|
||||
#include "../PPTXWriter/Converter.cpp"
|
||||
#include "../PPTXWriter/ShapeWriter.cpp"
|
||||
#include "../PPTXWriter/Animation.cpp"
|
||||
#include "../PPTXWriter/TableWriter.cpp"
|
||||
#include "../PPTXWriter/TxBodyConverter.cpp"
|
||||
#include "../Records/Drawing/ArtBlip.cpp"
|
||||
#include "../Records/Drawing/ShapeContainer.cpp"
|
||||
#include "../Records/Animations/TimeVariant.cpp"
|
||||
#include "../Records/BlipEntityAtom.cpp"
|
||||
|
||||
@ -507,6 +507,7 @@
|
||||
<ClCompile Include="..\Reader\RoundTripExtractor.cpp" />
|
||||
<ClCompile Include="..\Reader\SlidePersist.cpp" />
|
||||
<ClCompile Include="..\Records\Animations\TimeVariant.cpp" />
|
||||
<ClCompile Include="..\Records\BlipEntityAtom.cpp" />
|
||||
<ClCompile Include="..\Records\Drawing\ArtBlip.cpp" />
|
||||
<ClCompile Include="..\Records\Drawing\ShapeContainer.cpp" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -856,5 +856,8 @@
|
||||
<ClCompile Include="..\Reader\RoundTripExtractor.cpp">
|
||||
<Filter>Reader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Records\BlipEntityAtom.cpp">
|
||||
<Filter>Records</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -71,8 +71,9 @@ public:
|
||||
bool isDocFormatFile (POLE::Storage *storage);
|
||||
bool isXlsFormatFile (POLE::Storage *storage);
|
||||
bool isPptFormatFile (POLE::Storage *storage);
|
||||
bool isMS_OFFCRYPTOFormatFile (POLE::Storage * storage, std::wstring & documentID);
|
||||
bool isMS_OFFCRYPTOFormatFile (const std::wstring & fileName, std::wstring & documentID);
|
||||
bool isMS_OFFICECRYPTOFormatFile(POLE::Storage * storage, std::wstring & documentID);
|
||||
bool isMS_MITCRYPTOFormatFile(POLE::Storage * storage, std::wstring & documentID);
|
||||
bool isMS_OFFCRYPTOFormatFile (const std::wstring & fileName, std::wstring & documentID);
|
||||
|
||||
std::wstring getDocumentID (const std::wstring & fileName);
|
||||
|
||||
|
||||
@ -274,10 +274,14 @@ std::wstring COfficeFileFormatChecker::getDocumentID (const std::wstring & _file
|
||||
POLE::Storage storage(fileName.c_str());
|
||||
if (storage.open())
|
||||
{
|
||||
if ( isMS_OFFCRYPTOFormatFile(&storage, documentID) )
|
||||
if ( isMS_OFFICECRYPTOFormatFile(&storage, documentID) )
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO;
|
||||
}
|
||||
else if (isMS_MITCRYPTOFormatFile(&storage, documentID))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_MITCRYPTO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -316,37 +320,36 @@ bool COfficeFileFormatChecker::isMS_OFFCRYPTOFormatFile (const std::wstring & _f
|
||||
POLE::Storage storage(fileName.c_str());
|
||||
if (storage.open())
|
||||
{
|
||||
if ( isMS_OFFCRYPTOFormatFile(&storage, documentID) )
|
||||
if (isMS_OFFICECRYPTOFormatFile(&storage, documentID) )
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO;
|
||||
return true;
|
||||
}
|
||||
if (isMS_MITCRYPTOFormatFile(&storage, documentID))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_MITCRYPTO;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isMS_OFFCRYPTOFormatFile (POLE::Storage * storage, std::wstring & documentID)
|
||||
bool COfficeFileFormatChecker::isMS_OFFICECRYPTOFormatFile(POLE::Storage * storage, std::wstring & documentID)
|
||||
{
|
||||
if (storage == NULL) return false;
|
||||
if (storage == NULL) return false;
|
||||
|
||||
documentID.clear();
|
||||
|
||||
bool result = false;
|
||||
std::list<std::wstring> entries = storage->entries(L"DataSpaces");
|
||||
if (entries.size() > 0)
|
||||
std::list<std::wstring> entries = storage->entries(L"DataSpaces");
|
||||
if (/*false == entries.empty() && */storage->exists(L"EncryptionInfo"))
|
||||
{
|
||||
result = true;
|
||||
result = true;
|
||||
}
|
||||
|
||||
if ( storage->exists(L"EncryptionInfo") &&
|
||||
storage->exists(L"EncryptedPackage"))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
POLE::Stream stream(storage, L"DocumentID");
|
||||
|
||||
POLE::Stream stream(storage, L"DocumentID");
|
||||
|
||||
std::string sData;
|
||||
sData.resize(stream.size());
|
||||
if (stream.read((BYTE*)sData.c_str(), stream.size()) > 0)
|
||||
@ -357,6 +360,22 @@ bool COfficeFileFormatChecker::isMS_OFFCRYPTOFormatFile (POLE::Storage * storage
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isMS_MITCRYPTOFormatFile (POLE::Storage * storage, std::wstring & documentID)
|
||||
{
|
||||
if (storage == NULL) return false;
|
||||
|
||||
documentID.clear();
|
||||
|
||||
bool result = false;
|
||||
std::list<std::wstring> entries = storage->entries(L"DataSpaces");
|
||||
if (false == entries.empty() && false == storage->exists(L"EncryptionInfo") && storage->exists(L"EncryptedPackage"))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
|
||||
@ -396,11 +415,16 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT;
|
||||
return true;
|
||||
}
|
||||
else if ( isMS_OFFCRYPTOFormatFile(&storage, sDocumentID) )
|
||||
else if ( isMS_OFFICECRYPTOFormatFile(&storage, sDocumentID) )
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO;
|
||||
return true;
|
||||
}
|
||||
else if (isMS_MITCRYPTOFormatFile(&storage, sDocumentID))
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_MITCRYPTO;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
|
||||
@ -119,6 +119,7 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_JSON AVS_OFFICESTUDIO_FILE_OTHER + 0x0008 // Для mail-merge
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_ZIP AVS_OFFICESTUDIO_FILE_OTHER + 0x0009
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_ODF AVS_OFFICESTUDIO_FILE_OTHER + 0x000a
|
||||
#define AVS_OFFICESTUDIO_FILE_OTHER_MS_MITCRYPTO AVS_OFFICESTUDIO_FILE_OTHER + 0x000b
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB 0x1000
|
||||
#define AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001
|
||||
|
||||
@ -946,6 +946,12 @@ bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
|
||||
if (pStream)
|
||||
{
|
||||
if (pStream->fail())
|
||||
{
|
||||
delete pStream;
|
||||
delete pStorage;
|
||||
return false;
|
||||
}
|
||||
_UINT16 VersionInfoMajor = 0, VersionInfoMinor = 0;
|
||||
|
||||
pStream->read((unsigned char*)&VersionInfoMajor, 2);
|
||||
@ -963,6 +969,7 @@ bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
return false;
|
||||
}
|
||||
nEncryptionInfoSize = pStream->read(byteEncryptionInfo, nEncryptionInfoSize);
|
||||
|
||||
delete pStream;
|
||||
|
||||
if (VersionInfoMajor == 0x0004 && VersionInfoMinor == 0x0004)
|
||||
|
||||
Reference in New Issue
Block a user