mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refs #910, obtain DLL and modules info
windows specific utility functions to obtain info about DLL / DLLs loaded (to be used to test P3D/FSX Simconnect DLLs)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
705e83e156
commit
099680c054
72
src/blackmisc/windllutils.h
Normal file
72
src/blackmisc/windllutils.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2017
|
||||
* Swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of Swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_WINDLLUTILS_H
|
||||
#define BLACKMISC_WINDLLUTILS_H
|
||||
|
||||
#include "blackmiscexport.h"
|
||||
#include <QString>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Functions dealing with Windows DLLs
|
||||
class BLACKMISC_EXPORT CWinDllUtils
|
||||
{
|
||||
public:
|
||||
//! No ctor
|
||||
CWinDllUtils() = delete;
|
||||
|
||||
//! Info about an DLL
|
||||
struct DLLInfo
|
||||
{
|
||||
QString iso; //!< language iso code
|
||||
QString errorMsg; //!< error message if any
|
||||
QString fileVersion; //!< file version, like 3.2.1.3
|
||||
QString fileDescription; //!< file description
|
||||
QString productVersion; //!< product version, like 3.2.1.3
|
||||
QString productVersionName; //!< version and name
|
||||
QString productName; //!< product name
|
||||
QString originalFilename; //!< original filename
|
||||
QString fullFilename; //!< full filename
|
||||
|
||||
//! Product or file version
|
||||
const QString &productOrFileVersion() const
|
||||
{
|
||||
if (!productVersionName.isEmpty()) { return productVersionName; }
|
||||
if (!productVersion.isEmpty()) { return productVersion; }
|
||||
return fileVersion;
|
||||
}
|
||||
|
||||
//! Summary
|
||||
QString summary() const
|
||||
{
|
||||
if (!errorMsg.isEmpty()) { return errorMsg; }
|
||||
static const QString s("Product: '%1' version: %2 language: %3 filename: '%4'");
|
||||
return s.arg(productName, productOrFileVersion(), iso, fullFilename);
|
||||
}
|
||||
};
|
||||
|
||||
//! Process modules
|
||||
struct ProcessModule
|
||||
{
|
||||
QString moduleName; //!< module / dll name
|
||||
QString executable; //!< full executable path
|
||||
qint64 processId = -1; //!< pid
|
||||
};
|
||||
|
||||
//! Get DDL
|
||||
static DLLInfo getDllInfo(const QString &dllFile);
|
||||
|
||||
//! Process modules per id
|
||||
static QList<ProcessModule> getModules(qint64 processId = -1, const QString &nameFilter = {});
|
||||
};
|
||||
} // ns
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user