2019-01-26 07:54:56 +03:00
|
|
|
/*
|
2021-01-05 13:17:11 +03:00
|
|
|
* Copyright (C) 2018-2021 QuasarApp.
|
2019-01-26 07:54:56 +03:00
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
2018-11-15 18:00:23 +03:00
|
|
|
#ifndef WINDEPENDENCIESSCANNER_H
|
|
|
|
#define WINDEPENDENCIESSCANNER_H
|
|
|
|
|
2018-11-18 17:22:05 +03:00
|
|
|
#include <QMultiMap>
|
|
|
|
#include <QStringList>
|
2019-01-27 15:37:19 +03:00
|
|
|
#include "deploy_global.h"
|
2020-09-09 14:15:54 +03:00
|
|
|
#include "pe_type.h"
|
|
|
|
#include "elf_type.h"
|
2019-04-05 14:23:42 +03:00
|
|
|
#include "libinfo.h"
|
2021-01-22 10:05:20 +03:00
|
|
|
#include "generalfiles_type.h"
|
2019-04-05 14:23:42 +03:00
|
|
|
|
2019-03-19 21:50:05 +03:00
|
|
|
|
|
|
|
enum class PrivateScaner: unsigned char {
|
|
|
|
UNKNOWN,
|
|
|
|
PE,
|
|
|
|
ELF
|
|
|
|
};
|
|
|
|
|
|
|
|
class DEPLOYSHARED_EXPORT DependenciesScanner {
|
2018-11-18 17:22:05 +03:00
|
|
|
|
2019-03-17 18:42:07 +03:00
|
|
|
|
2018-11-18 17:22:05 +03:00
|
|
|
private:
|
2019-08-31 22:22:26 +03:00
|
|
|
|
2019-03-25 21:27:26 +03:00
|
|
|
QMultiHash<QString, QString> _EnvLibs;
|
2019-04-05 14:23:42 +03:00
|
|
|
QHash<QString, LibInfo> _scanedLibs;
|
2019-03-17 18:42:07 +03:00
|
|
|
|
2019-03-19 21:50:05 +03:00
|
|
|
PE _peScaner;
|
2019-03-23 23:13:52 +03:00
|
|
|
ELF _elfScaner;
|
2021-01-22 10:05:20 +03:00
|
|
|
GeneralFiles _filesScaner;
|
2019-03-19 21:50:05 +03:00
|
|
|
|
|
|
|
PrivateScaner getScaner(const QString& lib) const;
|
|
|
|
|
2019-08-31 22:22:26 +03:00
|
|
|
QMultiMap<LibPriority, LibInfo> getLibsFromEnvirement(const QString& libName) const;
|
2019-04-04 18:11:38 +03:00
|
|
|
|
2020-02-07 17:33:36 +03:00
|
|
|
void recursiveDep(LibInfo& lib, QSet<LibInfo> &res, QSet<QString> &libStack);
|
2019-04-04 18:11:38 +03:00
|
|
|
|
2019-12-24 13:48:37 +03:00
|
|
|
void addToWinAPI(const QString& lib, QHash<WinAPI, QSet<QString> > &res);
|
2019-12-24 11:46:11 +03:00
|
|
|
|
2018-11-15 18:00:23 +03:00
|
|
|
public:
|
2019-03-19 21:50:05 +03:00
|
|
|
explicit DependenciesScanner();
|
2018-11-15 18:00:23 +03:00
|
|
|
|
2018-11-23 14:56:55 +03:00
|
|
|
void setEnvironment(const QStringList &env);
|
2018-11-18 17:22:05 +03:00
|
|
|
|
2019-04-04 18:11:38 +03:00
|
|
|
QSet<LibInfo> scan(const QString& path);
|
2019-11-13 18:18:44 +03:00
|
|
|
bool fillLibInfo(LibInfo& info ,const QString& file) const;
|
2019-03-19 21:50:05 +03:00
|
|
|
|
|
|
|
~DependenciesScanner();
|
2018-11-15 18:00:23 +03:00
|
|
|
|
2019-03-19 21:50:05 +03:00
|
|
|
friend class deploytest;
|
2019-04-05 14:23:42 +03:00
|
|
|
void clearScaned();
|
2018-11-15 18:00:23 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WINDEPENDENCIESSCANNER_H
|