Martin H. - 2013-07-17

Hello folks,

I am using the 7zip api version 9.2 (#define SEVENZIP32_VERSION 9200002) in my c++ application. The application handles encrypted zip files, and not always the password is known.

I would like to check the zip files for CRC error and use the command:

BOOL bResult = SevenZipCheckArchive(zipFile.c_str(), CHECKARCHIVE_FULLCRC);

This raises a popup box asking for a password.

Here is the funny thing: if I enter a wrong password or press cancel the CRC check is still performed and returns the bool value correctly (tested with zip file with and without CRC error).

Therefore what I would like to achieve is, that no password dialog is shown and the CRC test is still performed correctly.

Any ideas how to do so?

I tried several workarounds:
1) Specify a dummy password before checking:

_harc = SevenZipOpenArchive(hWnd, zipFile.c_str(), 0);
int ret = SevenZipSetDefaultPassword(_harc, "dummyPassword");
BOOL bResult = SevenZipCheckArchive(zipFile.c_str(), CHECKARCHIVE_FULLCRC);
ret = SevenZipCloseArchive(_harc);

2) switch to command line, use "-hide" option, use * to recursivly check all contained files

string cmd = "t \""+ zipFile + "\" * -r -hide";
int iCode = SevenZip(hWnd, cmd.c_str(), _szOutput, _dwSize);
//returns: ERROR_PASSWORD_FILE      0x800A

or with fake password:

string cmd = "t \""+ zipFile + "\" * -r -hide -pFAKE";
int iCode = SevenZip(hWnd, cmd.c_str(), _szOutput, _dwSize);
//returns: ERROR_PASSWORD_FILE      0x800A

Your help is appreciated! Thank you and greetings from Germany
Martin