Bool ModuleManager::LoadModule( const Char* pModuleName, const Char* pModuleDir ) { GD_ASSERT(pModuleName); GD_ASSERT(pModuleDir); Char fullPath[260]; if( IsModuleLoaded(pModuleName) ) return true; strcpy(fullPath, pModuleDir); strcat(fullPath, pModuleName); Handle libHandle = Core::OpenLibrary( fullPath ); if( !libHandle ) throw ModuleNotFoundException( pModuleName, Here ); Module* module = const_cast<Module*>(FindModule(pModuleName)); if( !module ) throw ModuleNotRegisteredException( pModuleName, Here ); module->mHandle = libHandle; module->mDynamicLoad = true; return true; }
/** * Finds the base address of the specified module. * * @param module The case-insensitive name of the module. * @return The base address of the module. */ uint32_t GetBaseAddress(const std::string& module) const { StackTrace trace(__METHOD__, __FILE__, __LINE__); uint32_t address; if (process_module_address(_handle, module.c_str(), &address) == false) { throw ModuleNotFoundException(); } return address; }