• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LoadLibraryExW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LoadLibraryExW函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadLibraryExW函数的具体用法?C++ LoadLibraryExW怎么用?C++ LoadLibraryExW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LoadLibraryExW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _Py_CheckPython3

int
_Py_CheckPython3()
{
    wchar_t py3path[MAXPATHLEN+1];
    wchar_t *s;
    if (python3_checked)
        return hPython3 != NULL;
    python3_checked = 1;

    /* If there is a python3.dll next to the python3y.dll,
       assume this is a build tree; use that DLL */
    wcscpy(py3path, dllpath);
    s = wcsrchr(py3path, L'\\');
    if (!s)
        s = py3path;
    wcscpy(s, L"\\python3.dll");
    hPython3 = LoadLibraryExW(py3path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
    if (hPython3 != NULL)
        return 1;

    /* Check sys.prefix\DLLs\python3.dll */
    wcscpy(py3path, Py_GetPrefix());
    wcscat(py3path, L"\\DLLs\\python3.dll");
    hPython3 = LoadLibraryExW(py3path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
    return hPython3 != NULL;
}
开发者ID:cpcloud,项目名称:cpython,代码行数:26,代码来源:getpathp.c


示例2: PVOID

static void *_load_dll(const wchar_t *lib_path, const wchar_t *dll_search_path)
{
    void *result;

    typedef PVOID(WINAPI *AddDllDirectoryF)  (PCWSTR);
    typedef BOOL(WINAPI *RemoveDllDirectoryF)(PVOID);
    AddDllDirectoryF pAddDllDirectory;
    RemoveDllDirectoryF pRemoveDllDirectory;
    pAddDllDirectory = (AddDllDirectoryF)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "AddDllDirectory");
    pRemoveDllDirectory = (RemoveDllDirectoryF)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "RemoveDllDirectory");

    if (pAddDllDirectory && pRemoveDllDirectory) {

        result = LoadLibraryExW(lib_path, NULL,
                               LOAD_LIBRARY_SEARCH_SYSTEM32);

        if (!result) {
            PVOID cookie = pAddDllDirectory(dll_search_path);
            result = LoadLibraryExW(lib_path, NULL,
                                    LOAD_LIBRARY_SEARCH_SYSTEM32 |
                                    LOAD_LIBRARY_SEARCH_USER_DIRS);
            pRemoveDllDirectory(cookie);
        }
    } else {
        result = LoadLibraryW(lib_path);
        if (!result) {
            SetDllDirectoryW(dll_search_path);
            result = LoadLibraryW(lib_path);
            SetDllDirectoryW(L"");
        }
    }

    return result;
}
开发者ID:ShiftMediaProject,项目名称:libbluray,代码行数:34,代码来源:bdj.c


示例3: LOG_ERROR

XAudio2Thread::XAudio2Thread()
{
	if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL))
	{
		LOG_ERROR(GENERAL, "XAudio: failed to increase thread priority");
	}

	if (auto lib2_9 = LoadLibraryExW(L"XAudio2_9.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32))
	{
		// xa28* implementation is fully compatible with library 2.9
		xa28_init(lib2_9);

		m_funcs.destroy = &xa28_destroy;
		m_funcs.play    = &xa28_play;
		m_funcs.flush   = &xa28_flush;
		m_funcs.stop    = &xa28_stop;
		m_funcs.open    = &xa28_open;
		m_funcs.add     = &xa28_add;

		LOG_SUCCESS(GENERAL, "XAudio 2.9 initialized");
		return;
	}

	if (auto lib2_7 = LoadLibraryExW(L"XAudio2_7.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32))
	{
		xa27_init(lib2_7);

		m_funcs.destroy = &xa27_destroy;
		m_funcs.play    = &xa27_play;
		m_funcs.flush   = &xa27_flush;
		m_funcs.stop    = &xa27_stop;
		m_funcs.open    = &xa27_open;
		m_funcs.add     = &xa27_add;

		LOG_SUCCESS(GENERAL, "XAudio 2.7 initialized");
		return;
	}
	
	if (auto lib2_8 = LoadLibraryExW(L"XAudio2_8.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32))
	{
		xa28_init(lib2_8);

		m_funcs.destroy = &xa28_destroy;
		m_funcs.play    = &xa28_play;
		m_funcs.flush   = &xa28_flush;
		m_funcs.stop    = &xa28_stop;
		m_funcs.open    = &xa28_open;
		m_funcs.add     = &xa28_add;

		LOG_SUCCESS(GENERAL, "XAudio 2.8 initialized");
		return;
	}

	fmt::throw_exception("No supported XAudio2 library found");
}
开发者ID:DHrpcs3,项目名称:rpcs3,代码行数:55,代码来源:XAudio2Thread.cpp


示例4: real_init

static void real_init(void) {
#ifdef VS_TARGET_OS_WINDOWS
    // portable
    const std::wstring pythonDllName = L"python37.dll";
    HMODULE module;
    GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)&real_init, &module);
    std::vector<wchar_t> pathBuf(65536);
    GetModuleFileNameW(module, pathBuf.data(), (DWORD)pathBuf.size());
    std::wstring dllPath = pathBuf.data();
    dllPath.resize(dllPath.find_last_of('\\') + 1);
    std::wstring portableFilePath = dllPath + L"portable.vs";
    FILE *portableFile = _wfopen(portableFilePath.c_str(), L"rb");
    bool isPortable = !!portableFile;
    if (portableFile)
        fclose(portableFile);

    HMODULE pythonDll = nullptr;

    if (isPortable) {
        std::wstring pyPath = dllPath + L"\\" + pythonDllName;
        pythonDll = LoadLibraryExW(pyPath.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
    } else {
        DWORD dwType = REG_SZ;
        HKEY hKey = 0;

        wchar_t value[1024];
        DWORD valueLength = 1000;
        if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\VapourSynth", &hKey) != ERROR_SUCCESS)
            return;
        LSTATUS status = RegQueryValueExW(hKey, L"PythonPath", nullptr, &dwType, (LPBYTE)&value, &valueLength);
        RegCloseKey(hKey);
        if (status != ERROR_SUCCESS)
            return;

        std::wstring pyPath = value;
        pyPath += L"\\" + pythonDllName;

        pythonDll = LoadLibraryExW(pyPath.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
    }
    if (!pythonDll)
        return;
#endif
    int preInitialized = Py_IsInitialized();
    if (!preInitialized)
        Py_InitializeEx(0);
    s = PyGILState_Ensure();
    if (import_vapoursynth())
        return;
    if (vpy_initVSScript())
        return;
    ts = PyEval_SaveThread();
    initialized = true;
}
开发者ID:dubhater,项目名称:vapoursynth,代码行数:53,代码来源:vsscript.cpp


示例5: GetFileName

bool Win32DllLoader::Load()
{
  if (m_dllHandle != NULL)
    return true;

  CStdString strFileName = GetFileName();

  CStdStringW strDllW;
  g_charsetConverter.utf8ToW(CSpecialProtocol::TranslatePath(strFileName), strDllW);
  m_dllHandle = LoadLibraryExW(strDllW.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  if (!m_dllHandle)
  {
    LPVOID lpMsgBuf;
    DWORD dw = GetLastError(); 

    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, 0, (LPTSTR) &lpMsgBuf, 0, NULL );
    CLog::Log(LOGERROR, "%s: Failed to load %s with error %d:%s", __FUNCTION__, CSpecialProtocol::TranslatePath(strFileName).c_str(), dw, lpMsgBuf);
    LocalFree(lpMsgBuf);
    return false;
  }

  // handle functions that the dll imports
  if (NeedsHooking(strFileName.c_str()))
    OverrideImports(strFileName);
  else
    bIsSystemDll = true;

  return true;
}
开发者ID:2BReality,项目名称:xbmc,代码行数:29,代码来源:Win32DllLoader.cpp


示例6: PickIconDlg

BOOL WINAPI PickIconDlg(
    HWND hwndOwner,
    LPWSTR lpstrFile,
    UINT nMaxFile,
    INT* lpdwIconIndex)
{
    HMODULE hLibrary;
    int res;
    PICK_ICON_CONTEXT IconContext;

    hLibrary = LoadLibraryExW(lpstrFile, NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
    IconContext.hLibrary = hLibrary;
    IconContext.Index = *lpdwIconIndex;
    wcscpy(IconContext.szName, lpstrFile);

    res = DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCEW(IDD_PICK_ICON), hwndOwner, PickIconProc, (LPARAM)&IconContext);
    if (res)
    {
        wcscpy(lpstrFile, IconContext.szName);
        *lpdwIconIndex = IconContext.Index;
    }

    FreeLibrary(hLibrary);
    return res;
}
开发者ID:RareHare,项目名称:reactos,代码行数:25,代码来源:dialogs.cpp


示例7: tt_dll_create_ntv

tt_result_t tt_dll_create_ntv(IN tt_dll_ntv_t *dll,
                              IN const tt_char_t *path,
                              IN OPT tt_dll_attr_t *attr)
{
    void *handle;
    DWORD dwFlags = 0;
    wchar_t *w_path;

    TT_ASSERT(dll != NULL);
    TT_ASSERT(path != NULL);

    // may set mode according to attr;
    // dwFlags |= ...;

    w_path = tt_wchar_create(path, 0, NULL);
    if (w_path == NULL) {
        return TT_FAIL;
    }

    handle = LoadLibraryExW(w_path, NULL, dwFlags);
    tt_wchar_destroy(w_path);
    if (handle == NULL) {
        TT_ERROR_NTV("LoadLibraryExW failed: %s");
        return TT_FAIL;
    }

    dll->handle = handle;
    return TT_SUCCESS;
}
开发者ID:newser,项目名称:TitanSDK,代码行数:29,代码来源:tt_dll_native.c


示例8: lock

void LOCATOR::SYMSRV::Init()
{
    AutoLock lock(&m_cs);

    if (m_fInit) {
        return;
    }

    m_fInit = true;

    PREFAST_SUPPRESS(6321, "It's ok");
    HMODULE hmod = LoadLibraryExW(L"SYMSRV.DLL", NULL, 0);

    if ((UINT_PTR) hmod < 32) {
        return;
    }

    m_hmod = hmod;

    m_pfnsymbolserverw =
        PFNSYMBOLSERVERW(GetProcAddress(m_hmod, "SymbolServerW"));

    m_pfnsymbolserversetoptions =
        PFNSYMBOLSERVERSETOPTIONS(GetProcAddress(m_hmod, "SymbolServerSetOptions"));

    m_pfnsymbolserverstorefilew = 
        PFNSYMBOLSERVERSTOREFILEW(GetProcAddress(m_hmod, "SymbolServerStoreFileW"));
}
开发者ID:9176324,项目名称:microsoft-pdb,代码行数:28,代码来源:locator.cpp


示例9: LoadCoreClrFromPath

HMODULE LoadCoreClrFromPath(const std::wstring& coreclr_dir, dnx::trace_writer& trace_writer)
{
    auto loader_module = LoadLoaderModule(trace_writer);
    if (!loader_module)
    {
        trace_writer.write(L"Failed to load loader module", false);
        return nullptr;
    }

    auto pfnAddDllDirectory = (FnAddDllDirectory)GetProcAddress(loader_module, "AddDllDirectory");
    auto pfnSetDefaultDllDirectories = (FnSetDefaultDllDirectories)GetProcAddress(loader_module, "SetDefaultDllDirectories");
    if (!pfnAddDllDirectory || !pfnSetDefaultDllDirectories)
    {
        trace_writer.write(std::wstring(L"Failed to find function: ")
            .append(pfnAddDllDirectory ? L"SetDefaultDllDirectories" : L"AddDllDirectory"), false);
        return nullptr;
    }

    pfnAddDllDirectory(coreclr_dir.c_str());

    // Modify the default dll flags so that dependencies can be found in this path
    pfnSetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_USER_DIRS);

    return LoadLibraryExW(dnx::utils::path_combine(coreclr_dir, L"coreclr.dll").c_str(), NULL, 0);
}
开发者ID:henghu-bai,项目名称:dnx,代码行数:25,代码来源:dnx.coreclr.cpp


示例10: pyi_utils_dlopen

/* Load the shared dynamic library (DLL) */
dylib_t pyi_utils_dlopen(const char *dllpath)
{

#ifdef _WIN32
    wchar_t * dllpath_w;
    dylib_t ret;
#else
    int dlopenMode = RTLD_NOW | RTLD_GLOBAL;
#endif

#ifdef AIX
    /* Append the RTLD_MEMBER to the open mode for 'dlopen()'
     * in order to load shared object member from library.
     */
    dlopenMode |= RTLD_MEMBER;
#endif

#ifdef _WIN32
    dllpath_w = pyi_win32_utils_from_utf8(NULL, dllpath, 0);
	ret = LoadLibraryExW(dllpath_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
	free(dllpath_w);
	return ret;
#else
	return dlopen(dllpath, dlopenMode);
#endif

}
开发者ID:cbgp,项目名称:diyabc,代码行数:28,代码来源:pyi_utils.c


示例11: LoadLibraryW

/*
 * @implemented
 */
HINSTANCE
WINAPI
LoadLibraryW(LPCWSTR lpLibFileName)
{
    /* Call Ex version of the API */
    return LoadLibraryExW (lpLibFileName, 0, 0);
}
开发者ID:RareHare,项目名称:reactos,代码行数:10,代码来源:loader.c


示例12: file

/*
  Load the Python DLL, either from the resource in the library file (if found),
  or from the file system.
  
  This function should also be used to get all the function pointers that
  python3.c needs at once.
 */
HMODULE load_pythondll(void)
{
	HMODULE hmod_pydll;
	HANDLE hrsrc;
	HMODULE hmod = LoadLibraryExW(libfilename, NULL, LOAD_LIBRARY_AS_DATAFILE);

	// Try to locate pythonxy.dll as resource in the exe
	hrsrc = FindResource(hmod, MAKEINTRESOURCE(1), PYTHONDLL);
	if (hrsrc) {
		HGLOBAL hgbl;
		DWORD size;
		char *ptr;
		hgbl = LoadResource(hmod, hrsrc);
		size = SizeofResource(hmod, hrsrc);
		ptr = LockResource(hgbl);
		hmod_pydll = MyLoadLibrary(PYTHONDLL, ptr, NULL);
	} else
		/*
		  XXX We should probably call LoadLibraryEx with
		  LOAD_WITH_ALTERED_SEARCH_PATH so that really our own one is
		  used.
		 */
		hmod_pydll = LoadLibrary(PYTHONDLL);
	FreeLibrary(hmod);
	return hmod_pydll;
}
开发者ID:ABI-Software,项目名称:py2exe,代码行数:33,代码来源:start.c


示例13: Java_com_kenai_jffi_Foreign_dlopen

/*
 * Class:     com_kenai_jffi_Foreign
 * Method:    dlopen
 * Signature: (Ljava/lang/String;I)J
 */
JNIEXPORT jlong JNICALL
Java_com_kenai_jffi_Foreign_dlopen(JNIEnv* env, jobject self, jstring jPath, jint jFlags)
{
#ifdef _WIN32
    wchar_t path[PATH_MAX];
    getWideString(env, path, jstr, sizeof(path) / sizeof(path[0]));
    return p2j(LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH));
#else
    char path_[PATH_MAX];
    const char* path = NULL; // Handle dlopen(NULL, flags);
    int flags = 0;
#define F(x) (jFlags & com_kenai_jffi_Foreign_RTLD_##x) != 0 ? RTLD_##x : 0;
    flags |= F(LAZY);
    flags |= F(GLOBAL);
    flags |= F(LOCAL);
    flags |= F(NOW);
#undef F

#ifdef _AIX
    flags |= RTLD_MEMBER; //  Needed for AIX
#endif
    
    if (jPath != NULL) {
        path = path_;
        getMultibyteString(env, path_, jPath, sizeof(path_));
    }
    return p2j(dl_open(path, flags));
#endif
}
开发者ID:mallampatisuresh,项目名称:Glassfish,代码行数:34,代码来源:Library.c


示例14: LoadLibraryExW

int32_t CSystem::GetSystemVersionNum()
{
	DWORD dwVersion = 0;
	HMODULE hinstDLL = LoadLibraryExW(L"kernel32.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
	if (hinstDLL != NULL)
	{
		HRSRC hResInfo = FindResource(hinstDLL, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
		if (hResInfo != NULL)
		{
			HGLOBAL hResData = LoadResource(hinstDLL, hResInfo);
			if (hResData != NULL)
			{
				static const WCHAR wszVerInfo[] = L"VS_VERSION_INFO";
				struct VS_VERSIONINFO {
					WORD wLength;
					WORD wValueLength;
					WORD wType;
					WCHAR szKey[ARRAYSIZE(wszVerInfo)];
					VS_FIXEDFILEINFO Value;
					WORD Children[];
				} *lpVI = (struct VS_VERSIONINFO *)LockResource(hResData);
				if ((lpVI != NULL) && (lstrcmpiW(lpVI->szKey, wszVerInfo) == 0) && (lpVI->wValueLength > 0))
				{
					dwVersion = lpVI->Value.dwFileVersionMS;
				}
			}
		}
		FreeLibrary(hinstDLL);
	}
	return dwVersion;
}
开发者ID:xylsxyls,项目名称:xueyelingshuang,代码行数:31,代码来源:CSystem.cpp


示例15: Java_org_gudy_azureus2_platform_win32_access_impl_AEWin32AccessInterface_testNativeAvailabilityW

JNIEXPORT jboolean JNICALL 
Java_org_gudy_azureus2_platform_win32_access_impl_AEWin32AccessInterface_testNativeAvailabilityW(
	JNIEnv *env, 
	jclass	cla, 
	jstring _name )
{
	WCHAR		name[2048];
    
	if ( !jstringToCharsW( env, _name, name, sizeof( name )-1)){

		return( 0 );
	}


	HMODULE	mod = 
		LoadLibraryExW( 
			name,
			NULL,
			LOAD_LIBRARY_AS_DATAFILE );

	if ( mod == NULL ){

		return( 0 );

	}else{

		FreeLibrary( mod );

		return( 1 );
	}
}
开发者ID:cnh,项目名称:BitMate,代码行数:31,代码来源:aereg.cpp


示例16: Win32KDisable

/*
    Win2KDisable : DisallowWin32kSystemCalls
    SET DNX_WIN32K_DISABLE=1
*/
void Win32KDisable(dnx::trace_writer& trace_writer)
{
    wchar_t buff[2] = { 0 , 0 };

    if (GetEnvironmentVariable(L"DNX_WIN32K_DISABLE", buff, 2) != 1 || buff[0] != L'1')
    {
        return;
    }

    auto process_threads_module = LoadLibraryExW(L"api-ms-win-core-processthreads-l1-1-1.dll", NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
    if (process_threads_module)
    {
        auto SetProcessMitigationPolicy_function = (FnSetProcessMitigationPolicy)GetProcAddress(process_threads_module, "SetProcessMitigationPolicy");
        if (SetProcessMitigationPolicy_function)
        {
            PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY system_call_disable_policy = {};
            system_call_disable_policy.DisallowWin32kSystemCalls = 1;

            if (SetProcessMitigationPolicy_function(ProcessSystemCallDisablePolicy,
                &system_call_disable_policy, sizeof(system_call_disable_policy)))
            {
                trace_writer.write(L"DNX_WIN32K_DISABLE successful", false);
            }
        }
    }

    FreeLibrary(process_threads_module);
}
开发者ID:henghu-bai,项目名称:dnx,代码行数:32,代码来源:dnx.coreclr.cpp


示例17: LoadLibraryExW

bool File::LoadFromResource(const wstring& sFileName, int nResId, SafeXMLReader xml)
{
	HMODULE hLib = LoadLibraryExW(sFileName.c_str(), NULL, LOAD_LIBRARY_AS_DATAFILE);
	if (NULL == hLib) return false;

	HRSRC hResourceInfo = FindResourceExW(hLib, RT_MANIFEST, MAKEINTRESOURCE(nResId) ,0);
	if (NULL == hResourceInfo) return false;

	HGLOBAL hGlobal = ::LoadResource(hLib, hResourceInfo);
	bool bResult = true;

	if (NULL == hGlobal) {
		bResult = false;			
	}
	else {
		int nResSize = SizeofResource(hLib, hResourceInfo);	
		LPVOID pResValue = LockResource(hGlobal);

		if (pResValue != NULL) {
			if (S_OK != xml->LoadFromBuffer(reinterpret_cast<const BYTE *>(pResValue), nResSize)) {
				bResult = false;	
			}
		}
		else bResult = false;
	}

	FreeLibrary(hLib);

	return bResult;
}
开发者ID:jetlive,项目名称:skiaming,代码行数:30,代码来源:File.cpp


示例18: wWinMain

int WINAPI wWinMain(HINSTANCE ins, HINSTANCE prev, LPWSTR cmd, int show)
{
   _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
   OleInitialize(NULL);

   WCHAR path [MAX_PATH];
   if(GetModuleFileNameW(NULL, path, _countof(path))) {
      PathRenameExtensionW(path, L".dll");
      //DONT_RESOLVE_DLL_REFERENCESを指定すると依存関係の解決や
      //DllMainの呼び出しが行われない
      hinstDLL = LoadLibraryExW(path, NULL, DONT_RESOLVE_DLL_REFERENCES);
   }
   if(!hinstDLL) {
      errmsg(IDS_DLL, HresultFromLastError());
   } else {
      PathRemoveFileSpecW(path);
      SetCurrentDirectoryW(path);

      HRESULT hr = HookAndExecute(show);
      if(hr != S_OK) {
         errmsg(IDC_EXEC, hr);
      }
   }

   OleUninitialize();
   return 0;
}
开发者ID:CoolOppo,项目名称:ezgdi,代码行数:27,代码来源:run.cpp


示例19: defined

JL_DLLEXPORT void *jl_dlopen(const char *filename, unsigned flags)
{
#if defined(_OS_WINDOWS_)
    needsSymRefreshModuleList = 1;
    size_t len = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
    if (!len) return NULL;
    WCHAR *wfilename = (WCHAR*)alloca(len * sizeof(WCHAR));
    if (!MultiByteToWideChar(CP_UTF8, 0, filename, -1, wfilename, len)) return NULL;
    return LoadLibraryExW(wfilename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
#else
    dlerror(); /* Reset error status. */
    return dlopen(filename,
                  (flags & JL_RTLD_NOW ? RTLD_NOW : RTLD_LAZY)
                  | JL_RTLD(flags, LOCAL)
                  | JL_RTLD(flags, GLOBAL)
#ifdef RTLD_NODELETE
                  | JL_RTLD(flags, NODELETE)
#endif
#ifdef RTLD_NOLOAD
                  | JL_RTLD(flags, NOLOAD)
#endif
#if defined(RTLD_DEEPBIND) && !defined(JL_ASAN_ENABLED)
                  | JL_RTLD(flags, DEEPBIND)
#endif
#ifdef RTLD_FIRST
                  | JL_RTLD(flags, FIRST)
#endif
                  );
#endif
}
开发者ID:JuliaLang,项目名称:julia,代码行数:30,代码来源:dlload.c


示例20: GetFileName

bool Win32DllLoader::Load()
{
  if (m_dllHandle != NULL)
    return true;

  CStdString strFileName = GetFileName();
  CLog::Log(LOGDEBUG, "%s(%s)\n", __FUNCTION__, strFileName.c_str());

  CStdStringW strDllW;
  g_charsetConverter.utf8ToW(_P(strFileName), strDllW);
  m_dllHandle = LoadLibraryExW(strDllW.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  if (!m_dllHandle)
  {
    CLog::Log(LOGERROR, "%s: Unable to load %s (%d)", __FUNCTION__, strFileName.c_str(), GetLastError());
    return false;
  }

  // handle functions that the dll imports
  if (NeedsHooking(strFileName.c_str()))
    OverrideImports(strFileName);
  else
    bIsSystemDll = true;

  return true;
}
开发者ID:marlboroman,项目名称:xbmc,代码行数:25,代码来源:Win32DllLoader.cpp



注:本文中的LoadLibraryExW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LoadLibraryW函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadLibraryEx函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap