本文整理汇总了C++中LibraryLoader::GetHModule方法的典型用法代码示例。如果您正苦于以下问题:C++ LibraryLoader::GetHModule方法的具体用法?C++ LibraryLoader::GetHModule怎么用?C++ LibraryLoader::GetHModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibraryLoader
的用法示例。
在下文中一共展示了LibraryLoader::GetHModule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
extern "C" HMODULE __stdcall dllLoadLibraryExtended(LPCSTR lib_file, LPCSTR sourcedll)
{
char libname[MAX_PATH + 1] = {};
char libpath[MAX_PATH + 1] = {};
LibraryLoader* dll = NULL;
/* extract name */
const char* p = strrchr(lib_file, PATH_SEPARATOR_CHAR);
if (p)
strcpy(libname, p+1);
else
strcpy(libname, lib_file);
if( libname[0] == '\0' )
return NULL;
/* extract path */
getpath(libpath, lib_file);
CLog::Log(LOGDEBUG, "LoadLibraryA('%s')", libname);
if (sourcedll)
{
/* also check for invalid paths wich begin with a \ */
if( libpath[0] == '\0' || libpath[0] == PATH_SEPARATOR_CHAR )
{
/* use calling dll's path as base address for this call */
getpath(libpath, sourcedll);
/* mplayer has all it's dlls in a codecs subdirectory */
if (strstr(sourcedll, "mplayer.dll"))
strcat(libpath, "codecs\\");
}
}
/* if we still don't have a path, use default path */
if( libpath[0] == '\0' )
strcpy(libpath, DEFAULT_DLLPATH);
/* msdn docs state */
/* "If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended. */
/* However, the file name string can include a trailing point character (.) to indicate that the module name has no extension." */
if( strrchr(libname, '.') == NULL )
strcat(libname, ".dll");
else if( libname[strlen(libname)-1] == '.' )
libname[strlen(libname)-1] = '\0';
dll = DllLoaderContainer::LoadModule(libname, libpath);
if (dll)
{
CLog::Log(LOGDEBUG, "LoadLibrary('%s') returning: %p", libname, (void*)dll);
return (HMODULE)dll->GetHModule();
}
CLog::Log(LOGERROR, "LoadLibrary('%s') failed", libname);
return NULL;
}
示例2:
bool Win32DllLoader::NeedsHooking(const char *dllName)
{
if ( !StringUtils::EndsWithNoCase(dllName, "libdvdcss-2.dll")
&& !StringUtils::EndsWithNoCase(dllName, "libdvdnav.dll"))
return false;
LibraryLoader *loader = DllLoaderContainer::GetModule(dllName);
if (loader)
{
// may have hooked this already (we can have repeats in the import table)
for (unsigned int i = 0; i < m_referencedDlls.size(); i++)
{
if (loader->GetHModule() == m_referencedDlls[i])
return false;
}
}
return true;
}
示例3: lock
extern "C" void tracker_library_free_all(DllTrackInfo* pInfo)
{
// unloading unloaded dll's
if (!pInfo->dllList.empty())
{
CSingleLock lock(g_trackerLock);
CLog::Log(LOGDEBUG,"%s: Detected %"PRIdS" unloaded dll's", pInfo->pDll->GetFileName(), pInfo->dllList.size());
for (DllListIter it = pInfo->dllList.begin(); it != pInfo->dllList.end(); ++it)
{
LibraryLoader* pDll = DllLoaderContainer::GetModule((HMODULE)*it);
if( !pDll)
{
CLog::Log(LOGERROR, "%s - Invalid module in tracker", __FUNCTION__);
return;
}
if (!pDll->IsSystemDll())
{
if (strlen(pDll->GetFileName()) > 0) CLog::Log(LOGDEBUG," : %s", pDll->GetFileName());
}
}
// now unload the dlls
for (DllListIter it = pInfo->dllList.begin(); it != pInfo->dllList.end(); ++it)
{
LibraryLoader* pDll = DllLoaderContainer::GetModule((HMODULE)*it);
if( !pDll)
{
CLog::Log(LOGERROR, "%s - Invalid module in tracker", __FUNCTION__);
return;
}
if (!pDll->IsSystemDll())
{
dllFreeLibrary((HMODULE)pDll->GetHModule());
}
}
}
}