mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Create CheckOwnerPassword
This commit is contained in:
@ -245,7 +245,12 @@ public:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CheckOwnerPassword(const std::wstring& sPassword)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->CheckOwnerPassword(sPassword);
|
||||
return true;
|
||||
}
|
||||
BYTE* GetInfo()
|
||||
{
|
||||
NSWasm::CData oRes;
|
||||
|
||||
@ -145,6 +145,10 @@ CFile.prototype["isNeedPassword"] = function()
|
||||
{
|
||||
return this._isNeedPassword;
|
||||
};
|
||||
CFile.prototype["CheckOwnerPassword"] = function(password)
|
||||
{
|
||||
return this._CheckOwnerPassword(password);
|
||||
};
|
||||
CFile.prototype["SplitPages"] = function(arrOriginIndex, arrayBufferChanges)
|
||||
{
|
||||
let ptr = this._SplitPages(arrOriginIndex, arrayBufferChanges);
|
||||
|
||||
@ -146,6 +146,13 @@ CFile.prototype._UndoRedact = function()
|
||||
return g_native_drawing_file["UndoRedact"]();
|
||||
};
|
||||
|
||||
CFile.prototype._CheckOwnerPassword = function(password)
|
||||
{
|
||||
if (!password)
|
||||
password = "";
|
||||
return g_native_drawing_file["CheckOwnerPassword"](password);
|
||||
}
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
{
|
||||
|
||||
@ -96,6 +96,13 @@ WASM_EXPORT int GetErrorCode(CDrawingFile* pFile)
|
||||
return -1;
|
||||
return pFile->GetErrorCode();
|
||||
}
|
||||
WASM_EXPORT int CheckOwnerPassword(CDrawingFile* pFile, const char* password)
|
||||
{
|
||||
std::wstring sPassword = L"";
|
||||
if (NULL != password)
|
||||
sPassword = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)password, strlen(password));
|
||||
return pFile->CheckOwnerPassword(sPassword) ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT void Close(CDrawingFile* pFile)
|
||||
{
|
||||
delete pFile;
|
||||
|
||||
@ -1125,6 +1125,13 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// OWNER PASSWORD
|
||||
if (true)
|
||||
{
|
||||
std::string sPassword = "";
|
||||
std::cout << "CheckOwnerPassword " << CheckOwnerPassword(pGrFile, sPassword.c_str()) << std::endl;
|
||||
}
|
||||
|
||||
BYTE* pColor = new BYTE[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
// REDACT
|
||||
if (false)
|
||||
@ -1230,7 +1237,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// GLYPHS
|
||||
if (false && nPagesCount > 0)
|
||||
if (true && nPagesCount > 0)
|
||||
{
|
||||
BYTE* pGlyphs = GetGlyphs(pGrFile, nTestPage);
|
||||
nLength = READ_INT(pGlyphs);
|
||||
|
||||
Reference in New Issue
Block a user