|
|
@ -52,31 +52,26 @@ VersionInfoFactory::~VersionInfoFactory()
|
|
|
|
|
|
|
|
|
|
|
|
void VersionInfoFactory::clear()
|
|
|
|
void VersionInfoFactory::clear()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// for each stored version, delete
|
|
|
|
|
|
|
|
for(size_t i = 0; i < versions.size();i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
delete versions[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
versions.clear();
|
|
|
|
versions.clear();
|
|
|
|
error = false;
|
|
|
|
error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VersionInfo * VersionInfoFactory::getVersionInfoByMD5(string hash)
|
|
|
|
const VersionInfo * VersionInfoFactory::getVersionInfoByMD5(string hash)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for(size_t i = 0; i < versions.size();i++)
|
|
|
|
for(size_t i = 0; i < versions.size();i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(versions[i]->hasMD5(hash))
|
|
|
|
if(versions[i]->hasMD5(hash))
|
|
|
|
return versions[i];
|
|
|
|
return versions[i].get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VersionInfo * VersionInfoFactory::getVersionInfoByPETimestamp(uintptr_t timestamp)
|
|
|
|
const VersionInfo * VersionInfoFactory::getVersionInfoByPETimestamp(uintptr_t timestamp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for(size_t i = 0; i < versions.size();i++)
|
|
|
|
for(size_t i = 0; i < versions.size();i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(versions[i]->hasPE(timestamp))
|
|
|
|
if(versions[i]->hasPE(timestamp))
|
|
|
|
return versions[i];
|
|
|
|
return versions[i].get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -230,8 +225,8 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
|
|
|
|
const char *name = pMemInfo->Attribute("name");
|
|
|
|
const char *name = pMemInfo->Attribute("name");
|
|
|
|
if(name)
|
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VersionInfo *version = new VersionInfo();
|
|
|
|
auto version = std::make_shared<VersionInfo>();
|
|
|
|
ParseVersion( pMemInfo , version );
|
|
|
|
ParseVersion( pMemInfo , version.get() );
|
|
|
|
versions.push_back(version);
|
|
|
|
versions.push_back(version);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|