I have a database in which we saved pdf files compressed with DynaZip Max Secure using the following code:
MemoryStream msIN = new System.IO.MemoryStream(); //Input MemoryStream MemoryStream msZip = new System.IO.MemoryStream(); //Compressed MemoryStream BinaryReader objBinaryReader; BinaryWriter objBinaryWriter; public MemoryStream CompressStream(byte[] vbuf) { System.IO.BinaryWriter bw = new System.IO.BinaryWriter(msIN); bw.Write(vbuf); CDZipSNET dz1 = new CDZipSNET(); dz1.ZipMemToMemCallback += new CDZipSNET.OnZipMemToMemCallback(this.ZipMemToMemCallback_event); dz1.ActionDZ = CDZipSNET.DZACTION.ZIP_MEMTOMEM; return msZip; }
And this is the ZipMemToMemCallback_event code:
public void ZipMemToMemCallback_event(CDZipSNET.MEMTOMEMACTION lAction,ref byte[] lpMemBuf,ref uint pdwSize,uint dwTotalReadL,uint dwTotalReadH,uint dwTotalWrittenL,uint dwTotalWrittenH,ref CDZipSNET.MEMTOMEMRESPONSE plRet) { int bytesToRead; switch(lAction) { case CDZipSNET.MEMTOMEMACTION.MEM_READ_DATA: if((dwTotalReadL == 0) && (dwTotalReadH == 0)) { msIN.Seek(0, System.IO.SeekOrigin.Begin); objBinaryReader = new System.IO.BinaryReader(msIN); } try { bytesToRead = (int)(objBinaryReader.BaseStream.Length - dwTotalReadL); if(bytesToRead > pdwSize) { bytesToRead = (int)pdwSize; plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_CONTINUE; } else { plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_DONE; } pdwSize = (uint)bytesToRead; if(bytesToRead > 0) { objBinaryReader.Read(lpMemBuf, 0, bytesToRead); } } catch { plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_ERROR; } break; case CDZipSNET.MEMTOMEMACTION.MEM_WRITE_DATA: if((dwTotalWrittenL == 0) && (dwTotalWrittenH == 0)) { objBinaryWriter = new System.IO.BinaryWriter(msZip); } try { objBinaryWriter.Write(lpMemBuf, 0, (int)pdwSize); plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_CONTINUE; } catch (System.Exception) { plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_ERROR; } break; default: plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_ERROR; break; } } byte [] lpMemBuf, ref uint pdwSize, uint dwTotalReadL, uint dwTotalReadH, uint dwTotalWrittenL, uint dwTotalWrittenH, ref CDZipSNET.MEMTOMEMRESPONSE plRet) public void ZipMemToMemCallback_event(CDZipSNET.MEMTOMEMACTION lAction,ref byte[] lpMemBuf,ref uint pdwSize,uint dwTotalReadL,uint dwTotalReadH,uint dwTotalWrittenL,uint dwTotalWrittenH,ref CDZipSNET.MEMTOMEMRESPONSE plRet) { int bytesToRead; switch(lAction) { case CDZipSNET.MEMTOMEMACTION.MEM_READ_DATA: if((dwTotalReadL == 0) && (dwTotalReadH == 0)) { msIN.Seek(0, System.IO.SeekOrigin.Begin); objBinaryReader = new System.IO.BinaryReader(msIN); } try { bytesToRead = (int)(objBinaryReader.BaseStream.Length - dwTotalReadL); if(bytesToRead > pdwSize) { bytesToRead = (int)pdwSize; plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_CONTINUE; } else { plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_DONE; } pdwSize = (uint)bytesToRead; if(bytesToRead > 0) { objBinaryReader.Read(lpMemBuf, 0, bytesToRead); } } catch { plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_ERROR; } break; case CDZipSNET.MEMTOMEMACTION.MEM_WRITE_DATA: if((dwTotalWrittenL == 0) && (dwTotalWrittenH == 0)) { objBinaryWriter = new System.IO.BinaryWriter(msZip); } try { objBinaryWriter.Write(lpMemBuf, 0, (int)pdwSize); plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_CONTINUE; } catch (System.Exception) { plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_ERROR; } break; default: plRet = CDZipSNET.MEMTOMEMRESPONSE.MEM_ERROR; break; } }
I provided everything that was necessary to answer this riddle, I tried the usual unpacking of Zip, Zlib, Gzip to no avail. I would appreciate any help. Thanks.
Edit: The problem is that DinaZip is a proprietary library with discontinued access, without the help or troubleshooting of the company that released it. I am tasked with unpacking a bunch of files that were previously compressed using this library (with avobe code), and I no longer have a library available for decompression. I wonder if anyone knows how to unzip these files using another library or method.