Providers
How ImHex accesses data
Last updated
How ImHex accesses data
Last updated
Providers in ImHex are how any data is being accessed. They expose a common interface to read or write any data to ImHex and handle everything else that's necessary for it to work in the background. Every file you open, every process you attach to, creates a new instance of a provider which handles data accesses to this source.
The most simple way to use Providers is by loading any file. Either through
File -> Open File...
, the Open File
shortcut on the Welcome Screen or by dragging a file onto ImHex. This will open a FileProvider to access its data.
Besides the FileProvider, there's also more complex ones accessed through File -> Open Other...
or Other Providers
on the Welcome Screen.
Clicking on any of these buttons creates a new instance of this provider and opens a configuration popup to specify additional parameters. Some providers simply open a file picker here, others display custom windows. Clicking Open
opens the provider with these settings.
In C++, Providers are implemented as a polymorphic Provider base class which, amongst others, has the following functions:
The standard File Provider for example uses standard C File IO functions to access a file. It calls fopen()
in the open()
function, fclose()
in the close()
function and fread()
/fwrite
in the readRaw()
/writeRaw()
function. This is the simplest example for a Provider and it's far from what a Provider can do. readRaw
and writeRaw
can make calls to other applications, a web service, the Kernel or any other data source one might want to analyze.
This system allows ImHex to act as a universal data access frontend. If a new source is needed, simply implement a new Provider for it.