Files
archived-Reclass/src/providerregistry.h
IChooseYou b08736245b feat: kernel memory plugin + unified source menu + driver improvements
- KernelMemory plugin: kernel-mode process/physical memory R/W via IOCTL driver
- rcxdrv.sys: MmCopyMemory for reads, MDL mapping with correct cache types
  (MmCached for RAM, MmNonCached for MMIO only — fixes cache corruption BSOD)
- Driver reconnect: ensureDriverLoaded tries device handle first, no auto
  stop+delete cycle. Manual unload closes handle only, service stays running.
- Unified source menu: ProviderRegistry::populateSourceMenu() shared by both
  main window Data Source menu and RcxEditor inline picker (icons + dll names)
- IProviderPlugin::populatePluginMenu() for conditional plugin actions
  (e.g. "Unload Kernel Driver" only when loaded)
- Physical memory mode removed from selectTarget (access via context menu only)
- requestOpenProviderTab sets base address from provider after template load
- Address parser: vtop(), cr3(), physRead() callbacks for kernel paging expressions
2026-03-13 14:46:22 -06:00

77 lines
2.7 KiB
C++

#pragma once
#include "iplugin.h"
#include <QList>
#include <QString>
#include <functional>
// Forward declarations
namespace rcx { class Provider; }
class QWidget;
class QMenu;
// Lightweight struct for saved source display in menus
struct SavedSourceDisplay {
QString text;
bool active = false;
};
/**
* Global registry for data source providers
*
* Providers register themselves here so they can be listed in the Source picker.
* Supports both plugin-based providers and built-in providers.
*/
class ProviderRegistry {
public:
// Factory function for creating built-in providers
using BuiltinFactory = std::function<bool(QWidget* parent, QString* target)>;
struct ProviderInfo {
QString name; // Display name (e.g., "Process Memory")
QString identifier; // Unique ID (e.g., "process")
IProviderPlugin* plugin; // Plugin (if plugin-based)
BuiltinFactory factory; // Factory (if built-in)
bool isBuiltin;
QString dllFileName; // Original DLL/SO filename (plugin-based only)
ProviderInfo(const QString& n, const QString& id, IProviderPlugin* p,
const QString& dll = {})
: name(n), identifier(id), plugin(p), factory(nullptr),
isBuiltin(false), dllFileName(dll) {}
ProviderInfo(const QString& n, const QString& id, BuiltinFactory f)
: name(n), identifier(id), plugin(nullptr), factory(f), isBuiltin(true) {}
};
static ProviderRegistry& instance();
// Register a plugin-based provider
void registerProvider(const QString& name, const QString& identifier, IProviderPlugin* plugin,
const QString& dllFileName = {});
// Register a built-in provider with a factory function
void registerBuiltinProvider(const QString& name, const QString& identifier, BuiltinFactory factory);
// Unregister a provider (called when unloading plugins)
void unregisterProvider(const QString& identifier);
// Get all registered providers
const QList<ProviderInfo>& providers() const { return m_providers; }
// Find provider by identifier
const ProviderInfo* findProvider(const QString& identifier) const;
// Clear all providers
void clear();
// Populate a QMenu with source items (File, providers with icons/dll names,
// plugin actions, saved sources). Used by both the main window Data Source
// menu and the RcxEditor inline source picker.
static void populateSourceMenu(QMenu* menu,
const QVector<SavedSourceDisplay>& savedSources = {});
private:
ProviderRegistry() = default;
QList<ProviderInfo> m_providers;
};