51 lines
812 B
C++
51 lines
812 B
C++
#pragma once
|
|
|
|
#include "common.h"
|
|
#include "interface.h"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <dlfcn.h>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
struct Section
|
|
{
|
|
std::string name;
|
|
void* base;
|
|
size_t size;
|
|
};
|
|
|
|
enum SigError
|
|
{
|
|
SIG_OK,
|
|
SIG_NOT_FOUND,
|
|
SIG_FOUND_MULTIPLE,
|
|
};
|
|
|
|
class CModule
|
|
{
|
|
public:
|
|
CModule(const char* relativePath, const char* module);
|
|
~CModule() = default;
|
|
|
|
void* FindSignature(const uint8_t* pattern, size_t length, int& error) const;
|
|
void* FindInterface(const char* name) const;
|
|
void* GetHandle() const { return m_handle; }
|
|
|
|
private:
|
|
void* m_handle {};
|
|
void* m_base {};
|
|
size_t m_size {};
|
|
std::vector<Section> m_sections;
|
|
std::string m_name;
|
|
};
|
|
|
|
namespace modules
|
|
{
|
|
extern CModule* engine;
|
|
extern CModule* server;
|
|
extern CModule* schemasystem;
|
|
}
|