Использовал библиотеку
miniz и
example2BOOL isZipCorrect(const char *pFilename) {
int ci;
void *p;
size_t uncomp_size;
mz_bool status;
mz_zip_archive zip_archive;
// open the archive.
memset(&zip_archive, 0, sizeof(zip_archive));
status = mz_zip_reader_init_file(&zip_archive, pFilename, 0);
if (!status) {
return FALSE;
}
// go throw all files
for (ci = 0; ci < (int)mz_zip_reader_get_num_files(&zip_archive); ci++) {
// get information about each file in the archive
mz_zip_archive_file_stat file_stat;
if (!mz_zip_reader_file_stat(&zip_archive, ci, &file_stat))
{
mz_zip_reader_end(&zip_archive);
return FALSE;
}
// try to extract this file
p = mz_zip_reader_extract_file_to_heap(&zip_archive, file_stat.m_filename, &uncomp_size, 0);
if (!p)
{
mz_zip_reader_end(&zip_archive);
return FALSE;
}
// we're done.
mz_free(p);
}
// close the archive, freeing any resources it was using
mz_zip_reader_end(&zip_archive);
// return ok state
return TRUE;
}