程序中需要打开用户上传ZIP包中的文件,但如ZIP文件中有密码则不对ZIP进行解压,但目前问题是如何判断ZIP包是否有密码??

解决方案 »

  1.   

    是不是要分析ZIP文件的文件头信息?
      

  2.   

    http://www.codeproject.com/cpp/zip.asp
    使用这个可以,在加密的Zip中获得的文件名前面都有一个"(*)"标志,是通过IsEncrypted函数判断的。我尝试过了!
      

  3.   

    You can find out what files are password encrypted by calling CZipArchive::GetFileInfo() which fills the structure CZipFileHeader with data, and then the method IsEncrypted() of this structure. If it returns true, the file needs a password to extract.
      

  4.   

    尝试正常访问ZIP里面的文件 如果能访问不就不用密码了吗
    如果中间出现错误,就证明需要密码  just a idea