2 * PROJECT: ReactOS Zip Shell Extension
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: CZipEnumerator
5 * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
13 CAtlList<CStringA> m_Returned;
20 bool initialize(IZip* zip)
28 unzFile uf = m_Zip->getZip();
30 if (unzGoToFirstFile(uf) != UNZ_OK)
32 m_Returned.RemoveAll();
36 bool next_unique(const char* prefix, CStringA& name, bool& folder, unz_file_info64& info)
38 size_t len = strlen(prefix);
40 while (next(tmp, info))
42 if (!_strnicmp(tmp, prefix, len))
44 int pos = tmp.Find('/', len);
52 name = tmp.Mid(len, pos - len);
55 tmp = name.MakeLower();
57 POSITION it = m_Returned.Find(tmp);
58 if (!name.IsEmpty() && !it)
60 m_Returned.AddTail(tmp);
68 bool next(CStringA& name, unz_file_info64& info)
72 unzFile uf = m_Zip->getZip();
75 err = unzGoToNextFile(uf);
76 if (err == UNZ_END_OF_LIST_OF_FILE)
83 err = unzGetCurrentFileInfo64(uf, &info, NULL, 0, NULL, 0, NULL, 0);
86 PSTR buf = name.GetBuffer(info.size_filename);
87 err = unzGetCurrentFileInfo64(uf, NULL, buf, name.GetAllocLength(), NULL, 0, NULL, 0);
88 name.ReleaseBuffer(info.size_filename);
89 name.Replace('\\', '/');