mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix bug #66864
This commit is contained in:
@ -109,6 +109,34 @@ bool CPPTDocumentInfo::ReadFromStream(CRecordCurrentUserAtom *pCurrentUser, POLE
|
||||
|
||||
return true;
|
||||
}
|
||||
std::wstring CPPTDocumentInfo::GetBinFromStg(const std::wstring& name, _UINT32 nRef)
|
||||
{
|
||||
for (size_t i = 0; i < m_arUsers.size(); ++i)
|
||||
{
|
||||
std::map<_UINT32, _UINT32>::iterator nIndexPsrRef = m_arUsers[i]->m_mapOffsetInPIDs.find(nRef);
|
||||
if (m_arUsers[i]->m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
std::wstring result;
|
||||
_UINT32 offset_stream = nIndexPsrRef->second;
|
||||
StreamUtils::StreamSeek(offset_stream, m_pStream);
|
||||
|
||||
SRecordHeader oHeader;
|
||||
oHeader.ReadFromStream(m_pStream);
|
||||
|
||||
CRecordExObjStg* pExObjStg = new CRecordExObjStg(name, m_pCommonInfo->tempPath);
|
||||
|
||||
if (pExObjStg)
|
||||
{
|
||||
pExObjStg->ReadFromStream(oHeader, m_pStream);
|
||||
result = pExObjStg->m_sFileName;
|
||||
|
||||
RELEASEOBJECT(pExObjStg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
bool CPPTDocumentInfo::LoadDocument()
|
||||
{
|
||||
@ -116,7 +144,7 @@ bool CPPTDocumentInfo::LoadDocument()
|
||||
|
||||
try
|
||||
{
|
||||
m_arUsers[0]->ReadExtenalObjects();
|
||||
m_arUsers[0]->ReadExtenalObjects(); // todooo ???? прочитать по всем (см 66864)
|
||||
m_arUsers[0]->FromDocument();
|
||||
}
|
||||
catch(int) //error code
|
||||
|
||||
@ -59,7 +59,8 @@ public:
|
||||
|
||||
bool ReadFromStream(CRecordCurrentUserAtom* pCurrentUser, POLE::Stream* pStream);
|
||||
bool LoadDocument();
|
||||
|
||||
|
||||
std::wstring GetBinFromStg(const std::wstring& name, _UINT32 nRef);
|
||||
private:
|
||||
POLE::Stream* m_pStream;
|
||||
};
|
||||
|
||||
@ -423,7 +423,7 @@ bool CPPTUserInfo::ReadDocumentPersists(POLE::Stream* pStream)
|
||||
{
|
||||
if (pVbaAtom->m_nHasMacros)
|
||||
{
|
||||
m_sVbaProjectFile = GetBinFromStg(L"vbaProject.bin", pVbaAtom->m_nObjStgDataRef);
|
||||
m_sVbaProjectFile = m_pDocumentInfo->GetBinFromStg(L"vbaProject.bin", pVbaAtom->m_nObjStgDataRef);
|
||||
|
||||
m_bMacros = (false == m_sVbaProjectFile.empty());
|
||||
}
|
||||
@ -431,39 +431,6 @@ bool CPPTUserInfo::ReadDocumentPersists(POLE::Stream* pStream)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
std::wstring CPPTUserInfo::GetBinFromStg(const std::wstring& name, _UINT32 nRef)
|
||||
{
|
||||
POLE::Stream* pStream = m_pDocumentInfo->m_pStream;
|
||||
|
||||
std::map<_UINT32, _UINT32>::iterator nIndexPsrRef = m_mapOffsetInPIDs.find(nRef);
|
||||
|
||||
std::wstring result;
|
||||
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
|
||||
{
|
||||
_UINT32 offset_stream = nIndexPsrRef->second;
|
||||
StreamUtils::StreamSeek(offset_stream, pStream);
|
||||
|
||||
POLE::Stream* pStreamTmp = pStream;
|
||||
if (m_pDecryptor)
|
||||
{
|
||||
DecryptStream(pStream, nRef);
|
||||
pStreamTmp = m_arStreamDecrypt.back()->stream_;
|
||||
}
|
||||
SRecordHeader oHeader;
|
||||
oHeader.ReadFromStream(pStreamTmp);
|
||||
|
||||
CRecordExObjStg *pExObjStg = new CRecordExObjStg(name, m_pDocumentInfo->m_pCommonInfo->tempPath);
|
||||
|
||||
if (pExObjStg)
|
||||
{
|
||||
pExObjStg->ReadFromStream(oHeader, pStreamTmp);
|
||||
result = pExObjStg->m_sFileName;
|
||||
|
||||
RELEASEOBJECT(pExObjStg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
void CPPTUserInfo::ReadExtenalObjects()
|
||||
{
|
||||
@ -2570,7 +2537,7 @@ void CPPTUserInfo::LoadExOleObject(CRecordsContainer* pExObject)
|
||||
if (oArrayCString.size() > 1)
|
||||
oInfo.m_progName = oArrayCString[1]->m_strText;
|
||||
|
||||
oInfo.m_strFilePath = GetBinFromStg(L"", oArrayExOleObj[0]->m_nPersistID); // ExOleObjStg || ExControlStg
|
||||
oInfo.m_strFilePath = m_pDocumentInfo->GetBinFromStg(L"", oArrayExOleObj[0]->m_nPersistID); // ExOleObjStg || ExControlStg
|
||||
|
||||
m_oExMedia.m_arOleObjects.push_back(oInfo);
|
||||
}
|
||||
|
||||
@ -132,8 +132,6 @@ public:
|
||||
bool ReadDocumentPersists(POLE::Stream* pStream);
|
||||
void ReadExtenalObjects();
|
||||
|
||||
std::wstring GetBinFromStg(const std::wstring& name, _UINT32 nRef);
|
||||
|
||||
void DecryptStream(POLE::Stream *pStream, int block);
|
||||
|
||||
void FromDocument();
|
||||
|
||||
Reference in New Issue
Block a user