本文整理汇总了C++中LibraryLoader::ResolveOrdinal方法的典型用法代码示例。如果您正苦于以下问题:C++ LibraryLoader::ResolveOrdinal方法的具体用法?C++ LibraryLoader::ResolveOrdinal怎么用?C++ LibraryLoader::ResolveOrdinal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LibraryLoader
的用法示例。
在下文中一共展示了LibraryLoader::ResolveOrdinal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
extern "C" FARPROC __stdcall dllGetProcAddress(HMODULE hModule, LPCSTR function)
{
uintptr_t loc = (uintptr_t)_ReturnAddress();
void* address = NULL;
LibraryLoader* dll = DllLoaderContainer::GetModule(hModule);
if( !dll )
{
CLog::Log(LOGERROR, "%s - Invalid hModule specified",__FUNCTION__);
return NULL;
}
/* how can somebody get the stupid idea to create such a stupid function */
/* where you never know if the given pointer is a pointer or a value */
if( HIGH_WORD(function) == 0 && LOW_WORD(function) < 1000)
{
if( dll->ResolveOrdinal(LOW_WORD(function), &address) )
{
CLog::Log(LOGDEBUG, "%s(%p(%s), %d) => %p", __FUNCTION__, hModule, dll->GetName(), LOW_WORD(function), address);
}
else if( dll->IsSystemDll() )
{
char ordinal[5];
sprintf(ordinal, "%d", LOW_WORD(function));
address = (void*)create_dummy_function(dll->GetName(), ordinal);
/* add to tracklist if we are tracking this source dll */
DllTrackInfo* track = tracker_get_dlltrackinfo(loc);
if( track )
tracker_dll_data_track(track->pDll, (uintptr_t)address);
CLog::Log(LOGDEBUG, "%s - created dummy function %s!%s",__FUNCTION__, dll->GetName(), ordinal);
}
else
{
address = NULL;
CLog::Log(LOGDEBUG, "%s(%p(%s), '%s') => %p",__FUNCTION__ , hModule, dll->GetName(), function, address);
}
}
else
{
if( dll->ResolveExport(function, &address) )
{
CLog::Log(LOGDEBUG, "%s(%p(%s), '%s') => %p",__FUNCTION__ , hModule, dll->GetName(), function, address);
}
else
{
DllTrackInfo* track = tracker_get_dlltrackinfo(loc);
/* some dll's require us to always return a function or it will fail, other's */
/* decide functionallity depending on if the functions exist and may fail */
if( dll->IsSystemDll() && track
&& stricmp(track->pDll->GetName(), "CoreAVCDecoder.ax") == 0 )
{
address = (void*)create_dummy_function(dll->GetName(), function);
tracker_dll_data_track(track->pDll, (uintptr_t)address);
CLog::Log(LOGDEBUG, "%s - created dummy function %s!%s", __FUNCTION__, dll->GetName(), function);
}
else
{
address = NULL;
CLog::Log(LOGDEBUG, "%s(%p(%s), '%s') => %p", __FUNCTION__, hModule, dll->GetName(), function, address);
}
}
}
return (FARPROC)address;
}