Exemple #1
0
boost::optional<Manifest>
Manifest::make_Manifest (std::string s)
{
    try
    {
        STObject st (sfGeneric);
        SerialIter sit (s.data (), s.size ());
        st.set (sit);
        auto const pk = st.getFieldVL (sfPublicKey);
        if (! publicKeyType (makeSlice(pk)))
            return boost::none;

        auto const opt_seq = get (st, sfSequence);
        auto const opt_msig = get (st, sfMasterSignature);
        if (!opt_seq || !opt_msig)
            return boost::none;

        // Signing key and signature are not required for
        // master key revocations
        if (*opt_seq != std::numeric_limits<std::uint32_t>::max ())
        {
            auto const spk = st.getFieldVL (sfSigningPubKey);
            if (! publicKeyType (makeSlice(spk)))
                return boost::none;
            auto const opt_sig = get (st, sfSignature);
            if (! opt_sig)
                return boost::none;

            return Manifest (std::move (s), PublicKey (makeSlice(pk)),
                PublicKey (makeSlice(spk)), *opt_seq);
        }

        return Manifest (std::move (s), PublicKey (makeSlice(pk)),
            PublicKey(), *opt_seq);
    }
    catch (std::exception const&)
    {
        return boost::none;
    }
}
Exemple #2
0
bool TeslaCallerInstrumenter::doInitialization(Module &M) {
  OwningPtr<Manifest> Manifest(Manifest::load(llvm::errs()));
  if (!Manifest) return false;

  for (auto& Fn : Manifest->FunctionsToInstrument()) {
    if (!Fn.context() & FunctionEvent::Caller) continue;

    auto Name = Fn.function().name();
    auto *Existing = FunctionsToInstrument[Name];

    if (Existing) Existing->AddDirection(Fn.direction());
    else
      FunctionsToInstrument[Name] =
        CallerInstrumentation::Build(M.getContext(), M, Name, Fn.direction());
  }

  return false;
}
int main(int anzahlArgumente, char *Argumente[]) 
{
	QT_REQUIRE_VERSION(anzahlArgumente, Argumente, "4.2.2")
	QApplication Programm(anzahlArgumente,Argumente);
#ifdef QT_SIDE_BY_SIDE_ASSEMBLY
	/*
		Alle Side-By-Side PlugIns müssen den Schema Hersteller.Qt.PlugIn-XXXX entsprechen!!!
		Wobei XXXX einem Plugin-Namen entspricht. z.B. HansMutermann.Qt.PlugIn-mysql
		All side-by-side plugIns must fit to the pattern vendor.Qt.PlugIn-XXXX!!
		XXXX is the name of the PlugIN. Example: HansMustermann.Qt.PlugIn-mysql
	*/
	QString Manifestname=QCoreApplication::instance()->arguments().at(0)+".manifest";
	QFile Manifest(Manifestname);
	if(Manifest.open(QIODevice::ReadOnly))
	{
		QTextStream Inhalt(&Manifest);
		QString Hersteller;
		QString Plattform;
		int PlattformStart;
		int PlattformEnde;
		int HerstellerStart;
		int HerstellerEnde;
		QString Zeile;
		while(!Inhalt.atEnd())
		{
			//Wie ist der Platfom/Hersteller meiner Qt Lib??
			Zeile=Inhalt.readLine();
			//Jedes Qt Programm benötigt QtCore. Darauf kann man sicher testen.
			if(Zeile.contains("QtCore"))
			{
				PlattformStart=Zeile.indexOf("processorArchitecture");				
				PlattformStart=Zeile.indexOf(QRegExp("[x,X,i]"),PlattformStart+21);//wo fängt der Platformtext an 21=Länge processorArchitecture
				PlattformEnde=Zeile.indexOf(QRegExp("[\",\']"),PlattformStart+1);
				Plattform=Zeile.mid(PlattformStart,PlattformEnde-PlattformStart);
				HerstellerStart=Zeile.indexOf("name");
				HerstellerStart=Zeile.indexOf(QRegExp("[\",\']"),HerstellerStart+4)+1;
				HerstellerEnde=Zeile.indexOf(QRegExp("[\",\']"),HerstellerStart+1);
				Hersteller=Zeile.mid(HerstellerStart,HerstellerEnde-HerstellerStart).split('.').first();				
				break;
			}
		}
		Manifest.close();
		//Welche Verzeichnise haben wir??
		//Die Plug-INs als Side-by-Side Assekmblys gehen nicht, da Qt immer in unterverzeichnissen suchen will!!
		QDir WindowsSXS(QProcess::systemEnvironment().filter("SystemRoot").first().split('=').last()+"\\winsxs");
		QStringList VerzeichnisseMitPlugINs=WindowsSXS.entryList(QStringList(Plattform+"_"+Hersteller+".Qt.PlugIn-*"),QDir::Dirs|QDir::CaseSensitive);
		/*for(int Verzeichnis=0;Verzeichnis<VerzeichnisseMitPlugINs.size();Verzeichnis++)
		{
			QCoreApplication::addLibraryPath(WindowsSXS.path().replace('/','\\')+"\\"+VerzeichnisseMitPlugINs.at(Verzeichnis));
		}*/
		QString GemeinsamesVerzeichnis=QProcess::systemEnvironment().filter("CommonProgramFiles").first().split('=').last()+"\\"+Hersteller+"\\Qt\\"+qVersion();
		/*
			Also diese Lösung bis es in Qt geht:
			Die Plug-Is befinden sich unter %CommonProgramFiles%\Entwicklername\Qt\Version\plugins
		*/		
		QCoreApplication::setLibraryPaths(QStringList(GemeinsamesVerzeichnis+"\\plugins"));
		//Übersetzungen für Qt
		QTranslator QtUebersetzung;
		QtUebersetzung.load("qt_"+QLocale::system().name().left(QLocale::system().name().indexOf("_")),GemeinsamesVerzeichnis+"\\Uebersetzungen");
		QCoreApplication::instance()->installTranslator(&QtUebersetzung);
	}	
#else
	QTranslator QtSystem;
	// Ein Gruss an die Doku von Qt 4.2
	QtSystem.load("qt_" + QLocale::system().name(),QLibraryInfo::location(QLibraryInfo::TranslationsPath));
	Programm.installTranslator(&QtSystem);
#endif
	
	QTranslator Meine;	
	Meine.load(":/Uebersetzungen/Uebersetzung");	
	Programm.installTranslator(&Meine);
	QFrank::QtSBSADlgHaupt Hauptdialog;
	Hauptdialog.show();
	return Programm.exec(); 
}