port(2V0-b): verify window tree and fix 64-bit LZO lengths

This commit is contained in:
shen
2026-09-22 19:18:11 -07:00
parent b4c9d6cefc
commit a0ad587f78
13 changed files with 2694 additions and 13 deletions
+11 -7
View File
@@ -157,7 +157,8 @@ void CLZObject::BeginCompressInBuffer(const void * pvIn, UINT uiInLen, void * /*
bool CLZObject::Compress()
{
UINT iOutLen;
// PORT: lzo_uint is 64-bit here; the original UINT out parameter is 32-bit on Win32.
lzo_uint iOutLen;
BYTE * pbBuffer;
pbBuffer = m_pbBuffer + sizeof(THeader);
@@ -165,9 +166,9 @@ bool CLZObject::Compress()
pbBuffer += sizeof(DWORD);
#if defined( LZO1X_999_MEM_COMPRESS )
int r = lzo1x_999_compress((BYTE *) m_pbIn, m_pHeader->dwRealSize, pbBuffer, (lzo_uint*) &iOutLen, CLZO::Instance().GetWorkMemory());
int r = lzo1x_999_compress((BYTE *) m_pbIn, m_pHeader->dwRealSize, pbBuffer, &iOutLen, CLZO::Instance().GetWorkMemory());
#else
int r = lzo1x_1_compress((BYTE *) m_pbIn, m_pHeader->dwRealSize, pbBuffer, (lzo_uint*) &iOutLen, CLZO::Instance().GetWorkMemory());
int r = lzo1x_1_compress((BYTE *) m_pbIn, m_pHeader->dwRealSize, pbBuffer, &iOutLen, CLZO::Instance().GetWorkMemory());
#endif
if (LZO_E_OK != r)
@@ -176,7 +177,9 @@ bool CLZObject::Compress()
return false;
}
m_pHeader->dwCompressedSize = iOutLen;
if (iOutLen > UINT32_MAX)
return false;
m_pHeader->dwCompressedSize = static_cast<DWORD>(iOutLen);
m_bCompressed = true;
return true;
}
@@ -260,7 +263,8 @@ private:
bool CLZObject::Decompress(DWORD * pdwKey)
{
UINT uiSize;
// PORT: liblzo writes a native-width lzo_uint, while the pack header stays 32-bit.
lzo_uint uiSize;
int r;
if (m_pHeader->dwEncryptSize)
@@ -277,7 +281,7 @@ bool CLZObject::Decompress(DWORD * pdwKey)
return false;
}
if (LZO_E_OK != (r = lzo1x_decompress(pbDecryptedBuffer + sizeof(DWORD), m_pHeader->dwCompressedSize, m_pbBuffer, (lzo_uint*) &uiSize, NULL)))
if (LZO_E_OK != (r = lzo1x_decompress(pbDecryptedBuffer + sizeof(DWORD), m_pHeader->dwCompressedSize, m_pbBuffer, &uiSize, NULL)))
{
TraceError("LZObject: Decompress failed(decrypt) ret %d\n", r);
return false;
@@ -288,7 +292,7 @@ bool CLZObject::Decompress(DWORD * pdwKey)
uiSize = m_pHeader->dwRealSize;
//if (LZO_E_OK != (r = lzo1x_decompress_safe(m_pbIn, m_pHeader->dwCompressedSize, m_pbBuffer, (lzo_uint*) &uiSize, NULL)))
if (LZO_E_OK != (r = lzo1x_decompress(m_pbIn, m_pHeader->dwCompressedSize, m_pbBuffer, (lzo_uint*) &uiSize, NULL)))
if (LZO_E_OK != (r = lzo1x_decompress(m_pbIn, m_pHeader->dwCompressedSize, m_pbBuffer, &uiSize, NULL)))
{
TraceError("LZObject: Decompress failed : ret %d, CompressedSize %d\n", r, m_pHeader->dwCompressedSize);
return false;