void InitDecoder() { CleanupDecoder(); fex_init(); const fex_type_t * type_list = fex_type_list(); for(unsigned int i = 0; type_list[i]; i++) { ArchiveFormatInfo info; const char * extension = fex_type_extension(type_list[i]); if (strlen(extension) == 0) continue; info.name = fex_type_name(type_list[i]); info.extensions.push_back(extension + 1); // all extensions have a period on them info.type = type_list[i]; const char ** signatures = fex_type_signatures(type_list[i]); for (unsigned int j = 0; signatures[j]; j++) { info.signatures.push_back(signatures[j]); } s_formatInfos.push_back(info); } }
void InitDecoder() { CleanupDecoder(); UINT32 numFormats = 0; GetNumberOfFormats(&numFormats); for(unsigned int i = 0; i < numFormats; i++) { PROPVARIANT var = {VT_EMPTY}; ArchiveFormatInfo info; GetHandlerProperty2(i, NArchive::kName, &var); if(var.vt == VT_BSTR) info.name = wstrToStr(var.bstrVal); GetHandlerProperty2(i, NArchive::kExtension, &var); if(var.vt == VT_BSTR) info.extensions = tokenize(wstrToStr(var.bstrVal), " "); GetHandlerProperty2(i, NArchive::kStartSignature, &var); if(var.vt == VT_BSTR) info.signature = (const char*)var.bstrVal; // note: there's no 100% correct way of doing this with the existing 7-zip interface, but this is much better than using SysStringLen() in any way (it would return 1 for the signature "BZh", for example) GetHandlerProperty2(i,NArchive::kClassID,&var); if(var.vt == VT_BSTR) memcpy(&info.guid, var.bstrVal, 16); else memset(&info.guid, 0, 16); s_formatInfos.push_back(info); VariantClear((VARIANTARG*)&var); } }