![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cOSModule.h>
Public Member Functions | |
cOSModule (HMODULE hModule=((HMODULE) nullptr), UINT32 uFlags=k_Load_Normal) | |
cOSModule (const FILECHAR_t *pszModuleName, UINT32 uFlags) | |
~cOSModule () | |
FARPROC | GetSymbolAddress (const char *pszSymbolName) const |
bool | isValidModule () const noexcept |
operator HMODULE () const noexcept | |
HMODULE | get_ModuleHandle () const noexcept |
UINT_PTR | get_ModuleInt () const noexcept |
bool | isResourceModule () const noexcept |
StrLen_t | GetModulePath (FILECHAR_t *pszModuleName, StrLen_t nSizeMax) const |
cStringF | get_Name () const |
HRESULT | GetLastErrorDef (HRESULT hResDef=E_FAIL) const |
void | AttachModule (HMODULE hModule=((HMODULE) nullptr), UINT32 uFlags=k_Load_Normal) |
void | ClearModule () noexcept |
HMODULE | DetachModule () noexcept |
void | FreeThisModule () |
bool | AttachModuleName (const FILECHAR_t *pszModuleName, UINT32 uFlags=k_Load_NoRefCount) |
HRESULT | LoadModule (const FILECHAR_t *pszModuleName, UINT32 uFlags=k_Load_Normal) |
HRESULT | LoadModuleWithSymbol (const FILECHAR_t *pszModuleName, const char *pszSymbolName) |
Static Public Member Functions | |
static MIME_TYPE __stdcall | CheckModuleTypeFile (const FILECHAR_t *pszPathName) |
static HMODULE __stdcall | GetModuleHandleForAddr (const void *pAddr) |
Static Public Attributes | |
static const UINT | k_Load_OSMask = 0x0FFFFFFF |
static const UINT | k_Load_ByName = 0x40000000 |
try to find it (by just its file name, NOT Path) already loaded first. NOT OS flag. More... | |
static const UINT | k_Load_NoRefCount = 0x80000000 |
I DO NOT own the ref count. Don't free. NOT OS Flag. More... | |
Protected Member Functions | |
void | FreeModuleLast () |
Friends | |
class | cOSModuleTests |
manage access to a dynamically loaded *.DLL file. (or .SO in linux) in _WIN32 HMODULE is just a load address. Not the same as cOSHandle? ASSUME Default = loaded into my app space ! Use cOSModuleX for other processes modules. Inside a DLL there may be procedures and resources. DLL's are "shared objects" or "shared libraries" in linux linux link with "dl" library other times use 1. static binding or 2. delayed binding to DLL
Gray::cOSModule::cOSModule | ( | HMODULE | hModule = ((HMODULE)nullptr) , |
UINT32 | uFlags = k_Load_Normal |
||
) |
Gray::cOSModule::cOSModule | ( | const FILECHAR_t * | pszModuleName, |
UINT32 | uFlags | ||
) |
Use isValidModule()
Gray::cOSModule::~cOSModule | ( | ) |
|
inline |
bool Gray::cOSModule::AttachModuleName | ( | const FILECHAR_t * | pszModuleName, |
UINT32 | uFlags = k_Load_NoRefCount |
||
) |
is the DLL/SO already loaded? Find it by name. Full Path is NOT necessary
|
static |
Does this file appear to be a module/PE type ?
|
inlinenoexcept |
|
inlinenoexcept |
|
protected |
Assume someone else will clear m_hModule
void Gray::cOSModule::FreeThisModule | ( | ) |
|
inlinenoexcept |
|
inlinenoexcept |
Get the modules handle as an int.
cStringF Gray::cOSModule::get_Name | ( | ) | const |
|
static |
Return the handle for the module this pAddr is in. Do NOT increment ref count.
StrLen_t Gray::cOSModule::GetModulePath | ( | FILECHAR_t * | pszModuleName, |
StrLen_t | nSizeMax | ||
) | const |
Get the file path to the loaded module.
FARPROC Gray::cOSModule::GetSymbolAddress | ( | const char * | pszSymbolName | ) | const |
Get a Generic function call address in the module. assume nothing about the functions args.
|
inlinenoexcept |
|
inlinenoexcept |
HRESULT Gray::cOSModule::LoadModule | ( | const FILECHAR_t * | pszModuleName, |
UINT32 | uFlags = k_Load_Normal |
||
) |
HRESULT Gray::cOSModule::LoadModuleWithSymbol | ( | const FILECHAR_t * | pszModuleName, |
const char * | pszSymbolName | ||
) |
Load this module ONLY if it exposes this symbol.
|
inlinenoexcept |
|
friend |
|
static |
try to find it (by just its file name, NOT Path) already loaded first. NOT OS flag.
|
static |
I DO NOT own the ref count. Don't free. NOT OS Flag.
|
static |