Add Process::LoadLibrary OS-specific function

This commit is contained in:
baldurk
2015-08-23 21:47:56 +02:00
parent fb496db764
commit 3d47587957
3 changed files with 15 additions and 0 deletions
+5
View File
@@ -396,6 +396,11 @@ void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const
RDCUNIMPLEMENTED("Global hooking of all processes on linux");
}
bool Process::LoadLibrary(const char *module)
{
return dlopen(module, RTLD_NOW) != NULL;
}
void *Process::GetFunctionAddress(const char *module, const char *function)
{
void *handle = dlopen(module, RTLD_NOW);
+1
View File
@@ -50,6 +50,7 @@ namespace Process
uint32_t LaunchProcess(const char *app, const char *workingDir, const char *cmdLine);
uint32_t LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine,
const char *logfile, const CaptureOptions *opts, bool waitForExit);
bool LoadLibrary(const char *module);
void *GetFunctionAddress(const char *module, const char *function);
uint32_t GetCurrentPID();
};
+9
View File
@@ -553,6 +553,15 @@ void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const
#endif
}
bool LoadLibrary(const char *module)
{
HMODULE mod = GetModuleHandleA(module);
if(mod != NULL)
return true;
return LoadLibraryA(module) != NULL;
}
void *Process::GetFunctionAddress(const char *module, const char *function)
{
HMODULE mod = GetModuleHandleA(module);