initial commit -- v1 code
This commit is contained in:
51
src/module.h
Normal file
51
src/module.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user