Ejemplo n.º 1
0
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);
	}
}
Ejemplo n.º 2
0
HRESULT ArcLib::get_prop(UInt32 index, PROPID prop_id, PROPVARIANT* prop) const {
  if (GetHandlerProperty2) {
    return GetHandlerProperty2(index, prop_id, prop);
  }
  else {
    assert(index == 0);
    return GetHandlerProperty(prop_id, prop);
  }
}