mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
use ImageBase when loading dependency
Change-Id: I8033ffcc9391ea809964f3cd3cd60da0c01fe156
This commit is contained in:
committed by
sys_ocldev
parent
7cbc35a45a
commit
a66a92af57
@@ -39,9 +39,12 @@ namespace Windows {
|
||||
decltype(&LoadLibraryExA) OsLibrary::loadLibraryExA = LoadLibraryExA;
|
||||
decltype(&GetModuleFileNameA) OsLibrary::getModuleFileNameA = GetModuleFileNameA;
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
__inline HINSTANCE GetModuleHINSTANCE() { return (HINSTANCE)&__ImageBase; }
|
||||
|
||||
HMODULE OsLibrary::loadDependency(const std::string &dependencyFileName) const {
|
||||
char dllPath[MAX_PATH];
|
||||
DWORD length = getModuleFileNameA(GetModuleHandle(NULL), dllPath, MAX_PATH);
|
||||
DWORD length = getModuleFileNameA(GetModuleHINSTANCE(), dllPath, MAX_PATH);
|
||||
for (DWORD idx = length; idx > 0; idx--) {
|
||||
if (dllPath[idx - 1] == '\\') {
|
||||
dllPath[idx] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user