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

C++ LoadLibraryEx函数代码示例

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

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



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

示例1: GetModuleFileName

HRESULT CLAVAudio::InitDTSDecoder()
{
  if (!m_hDllExtraDecoder) {
    // Add path of LAVAudio.ax into the Dll search path
    WCHAR wModuleFile[1024];
    GetModuleFileName(g_hInst, wModuleFile, 1024);
    PathRemoveFileSpecW(wModuleFile);
    wcscat_s(wModuleFile, TEXT("\\dtsdecoderdll.dll"));

    // Try loading from the filters directory
    HMODULE hDll = LoadLibraryEx(wModuleFile, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
    // And try from any global directories if this failed
    if (hDll == NULL) {
      hDll = LoadLibrary(TEXT("dtsdecoderdll.dll"));
    }
    CheckPointer(hDll, E_FAIL);

    m_hDllExtraDecoder = hDll;
  }

  DTSDecoder *context = new DTSDecoder();

  context->pDtsOpen = (DtsOpen)GetProcAddress(m_hDllExtraDecoder, "DtsApiDecOpen");
  if(!context->pDtsOpen) goto fail;

  context->pDtsClose = (DtsClose)GetProcAddress(m_hDllExtraDecoder, "DtsApiDecClose");
  if(!context->pDtsClose) goto fail;

  context->pDtsReset = (DtsReset)GetProcAddress(m_hDllExtraDecoder, "DtsApiDecReset");
  if(!context->pDtsReset) goto fail;

  context->pDtsSetParam = (DtsSetParam)GetProcAddress(m_hDllExtraDecoder, "DtsApiDecSetParam");
  if(!context->pDtsSetParam) goto fail;

  context->pDtsDecode = (DtsDecode)GetProcAddress(m_hDllExtraDecoder, "DtsApiDecodeData");
  if(!context->pDtsDecode) goto fail;

  context->dtsContext = context->pDtsOpen();
  if(!context->dtsContext) goto fail;

  context->dtsPCMBuffer = (BYTE *)av_mallocz(LAV_AUDIO_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);

  m_DTSBitDepth = 24;
  m_DTSDecodeChannels = 8;

  m_pDTSDecoderContext = context;

  FlushDTSDecoder();

  return S_OK;
fail:
  SAFE_DELETE(context);
  FreeLibrary(m_hDllExtraDecoder);
  m_hDllExtraDecoder = NULL;
  return E_FAIL;
}
开发者ID:jeeb,项目名称:lavfilters,代码行数:56,代码来源:DTSDecoder.cpp


示例2: ReadMPQFiles

bool ReadMPQFiles() {
	FILE *phil;
	phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "phil reading files\n"); fclose(phil);
	int fileCount = 0;
	HMODULE hModule = GetModuleHandle("StormLib.dll");
	if (hModule) {
		phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "phil dll already loaded\n"); fclose(phil);
	}
	//HMODULE dllHandle = LoadLibrary("StormLib.dll");
	HMODULE dllHandle = LoadLibraryEx("StormLib.dll", NULL, LOAD_IGNORE_CODE_AUTHZ_LEVEL);
	phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "here with xhandle %d\n", (int)dllHandle); fclose(phil);
	if (dllHandle) {
		phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "opened dll!\n"); fclose(phil);
		SFileOpenArchive = (MPQOpenArchive)GetProcAddress(dllHandle, "SFileOpenArchive");
		SFileCloseArchive = (MPQCloseArchive)GetProcAddress(dllHandle, "SFileCloseArchive");
		SFileOpenFileEx = (MPQOpenFile)GetProcAddress(dllHandle, "SFileOpenFileEx");
		SFileGetFileSize = (MPQGetSize)GetProcAddress(dllHandle, "SFileGetFileSize");
		SFileReadFile = (MPQReadFile)GetProcAddress(dllHandle, "SFileReadFile");
		SFileCloseFile = (MPQCloseFile)GetProcAddress(dllHandle, "SFileCloseFile");

		if (SFileOpenArchive && SFileCloseArchive && SFileOpenFileEx && SFileCloseFile && SFileGetFileSize && SFileReadFile) {
			HANDLE hMpq = NULL;
			MPQArchive archive("phil.mpq"); // phil fixme phil
			if (archive.error == ERROR_SUCCESS) {
				phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "opened the archive\n"); fclose(phil);
				MPQFile armorFile(&archive, "Armor.txt");
				if (armorFile.error == ERROR_SUCCESS) {
					fileCount++;
					MpqDataMap["armor"] = new MPQData(&armorFile);
				}
				MPQFile weaponsFile(&archive, "Weapons.txt");
				if (weaponsFile.error == ERROR_SUCCESS) {
					fileCount++;
					MpqDataMap["weapons"] = new MPQData(&weaponsFile);
				}
				MPQFile miscFile(&archive, "Misc.txt");
				if (miscFile.error == ERROR_SUCCESS) {
					fileCount++;
					MpqDataMap["misc"] = new MPQData(&miscFile);
				}
				MPQFile itemTypesFile(&archive, "ItemTypes.txt");
				if (itemTypesFile.error == ERROR_SUCCESS) {
					fileCount++;
					MpqDataMap["itemtypes"] = new MPQData(&itemTypesFile);
				}
				phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "file errors %d, %d, %d, %d\n", armorFile.error, weaponsFile.error, miscFile.error, itemTypesFile.error); fclose(phil);
			}
			phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "archive error %d\n", archive.error); fclose(phil);
		}
		FreeLibrary(dllHandle);
	} else {
		phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "couldn't open dll: %d\n", GetLastError()); fclose(phil);
	}
	phil = fopen("C:\\philtest.txt", "a+"); fprintf(phil, "file count is %d\n", fileCount); fclose(phil);
	return fileCount == 4;
}
开发者ID:jkupcho,项目名称:slashdiablo-maphack,代码行数:56,代码来源:MPQReader.cpp


示例3: LoadLibraryEx

bool PluginLoader::getScyllaPluginName(Plugin * pluginData)
{
	bool retValue = false;
	char * pluginName = 0;
	def_ScyllaPluginNameW ScyllaPluginNameW = 0;
	def_ScyllaPluginNameA ScyllaPluginNameA = 0;

	HMODULE hModule = LoadLibraryEx(pluginData->fullpath, 0, DONT_RESOLVE_DLL_REFERENCES); //do not call DllMain

	if (hModule)
	{
		ScyllaPluginNameW = (def_ScyllaPluginNameW)GetProcAddress(hModule, "ScyllaPluginNameW");

		if (ScyllaPluginNameW)
		{
			wcscpy_s(pluginData->pluginName, ScyllaPluginNameW());

#ifdef DEBUG_COMMENTS
			Scylla::debugLog.log(L"getPluginName :: Plugin name %s", pluginData->pluginName);
#endif

			retValue = true;
		}
		else
		{
			ScyllaPluginNameA = (def_ScyllaPluginNameA)GetProcAddress(hModule, "ScyllaPluginNameA");

			if (ScyllaPluginNameA)
			{
				pluginName = ScyllaPluginNameA();

				StringConversion::ToUTF16(pluginName, pluginData->pluginName, _countof(pluginData->pluginName));

#ifdef DEBUG_COMMENTS
				Scylla::debugLog.log(L"getPluginName :: Plugin name mbstowcs_s %s", pluginData->pluginName);
#endif

				if (wcslen(pluginData->pluginName) > 1)
				{
					retValue = true;
				}
			}
		}

		FreeLibrary(hModule);

		return retValue;
	}
	else
	{
#ifdef DEBUG_COMMENTS
		Scylla::debugLog.log(L"getPluginName :: LoadLibraryEx failed %s", pluginData->fullpath);
#endif
		return false;
	}
}
开发者ID:AlexWMF,项目名称:Scylla,代码行数:56,代码来源:PluginLoader.cpp


示例4: ShellExecute

bool CUpdateUtil::RegisterOLE(CString pszDllName, CString pszDllEntryPoint)
{
	::CoInitialize(NULL);
	bool bReturn =  false;
	CString strTempFileName = pszDllName;
	strTempFileName.MakeLower();
	if(strTempFileName.Find(".exe") > 0)
	{
		strTempFileName += " /RegServer";
		ShellExecute(NULL, NULL, strTempFileName, NULL, NULL, SW_HIDE);
		bReturn = true;
	}
	else
	{
			
		// Load the library.
		HINSTANCE hLib = LoadLibraryEx(pszDllName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
		if (hLib < (HINSTANCE)HINSTANCE_ERROR) {
			SetLastError(UPDATE_ERROR_DLL_LOAD_LIBRARY);
			TRACE("UPDATE_ERROR_DLL_LOAD_LIBRARY : %s\n", pszDllName);
			goto CleanupOle;
		}

		// Find the entry point.
		FARPROC lpDllEntryPoint;
		(FARPROC&)lpDllEntryPoint = GetProcAddress(hLib, pszDllEntryPoint);

		if (lpDllEntryPoint == NULL) {
			SetLastError(UPDATE_ERROR_DLL_GET_PROC_ADDRESS);
			TRACE("UPDATE_ERROR_DLL_GET_PROC_ADDRESS : %s\n", pszDllName);
			goto CleanupLibrary;
		}
		
		// Call the entry point.
		if (lpDllEntryPoint)
		{
			if(Error((*lpDllEntryPoint)()) )
					goto CleanupLibrary;
		}

		SetLastError(UPDATE_SUCCESS_REGSVR_DLL);
		TRACE("UPDATE_SUCCESS_REGSVR_DLL : %s\n", pszDllName);
		
		//Horray
		bReturn = true;

	CleanupLibrary:
			FreeLibrary(hLib);
	    
	CleanupOle:
		OleUninitialize();
	}
	::CoUninitialize();	

    return bReturn;
}
开发者ID:jongha,项目名称:update-dll,代码行数:56,代码来源:UpdateUtil.cpp


示例5: render_message

	std::wstring render_message(const int truncate_message, DWORD dwLang = 0) const {
		std::vector<std::wstring> args;
		std::wstring ret;
		std::wstring file;
		if (!get_dll(file)) {
			return file;
		}
		strEx::splitList dlls = strEx::splitEx(file, _T(";"));
		for (strEx::splitList::const_iterator cit = dlls.begin(); cit != dlls.end(); ++cit) {
			//std::wstring msg = error::format::message::from_module((*cit), eventID(), _sz);
			std::wstring msg;
			try {
				HMODULE hDLL = LoadLibraryEx((*cit).c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES);
				if (hDLL == NULL) {
					msg = _T("failed to load: ") + (*cit) + _T(", reason: ") + strEx::itos(GetLastError());
					continue;
				}
				if (dwLang == 0)
					dwLang = MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT);
				boost::tuple<DWORD,std::wstring> formated_data = safe_format(hDLL, dwLang);
				if (formated_data.get<0>() != 0) {
					FreeLibrary(hDLL);
					if (formated_data.get<0>() == 15100) {
						// Invalid MUI file (wrong language)
						msg = _T("");
						continue;
					}
					if (formated_data.get<0>() == 317) {
						// Missing message
						msg = _T("");
						continue;
					}
					msg = _T("failed to lookup error code: ") + strEx::itos(eventID()) + _T(" from DLL: ") + (*cit) + _T("( reason: ") + strEx::itos(formated_data.get<0>()) + _T(")");
					continue;
				}
				FreeLibrary(hDLL);
				msg = formated_data.get<1>();
			} catch (...) {
				msg = _T("Unknown exception getting message");
			}
			strEx::replace(msg, _T("\n"), _T(" "));
			strEx::replace(msg, _T("\t"), _T(" "));
			std::string::size_type pos = msg.find_last_not_of(_T("\n\t "));
			if (pos != std::string::npos) {
				msg = msg.substr(0,pos);
			}
			if (!msg.empty()) {
				if (!ret.empty())
					ret += _T(", ");
				ret += msg;
			}
		}
		if (truncate_message > 0 && ret.length() > truncate_message)
			ret = ret.substr(0, truncate_message);
		return ret;
	}
开发者ID:dataliven,项目名称:nscp,代码行数:56,代码来源:eventlog_record.hpp


示例6: LoadLibraryEx

BOOL CVersionInfo::LoadVersionInfoResource(const CString& strModulePath, CVersionInfoBuffer &viBuf, LPCTSTR lpszResourceId, WORD wLangId)
{
	HRSRC hResInfo; 

	HMODULE hModule = LoadLibraryEx(strModulePath, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
	if (NULL == hModule)
		return FALSE;

	if ((NULL == lpszResourceId) && (wLangId == 0xFFFF))
	{
		//Load first RT_VERSION resource that will be found
		
		m_lpszResourceId = NULL;

		EnumResourceNames(hModule, RT_VERSION, (ENUMRESNAMEPROC)EnumResourceNamesFuncFindFirst, (LONG_PTR)this);
		
		if (NULL == m_lpszResourceId)
		{
			FreeLibrary(hModule);
			return FALSE;
		}
		
		// Now the m_lpszResourceId must be the name of the resource
		m_wLangId = 0xFFFF;
		EnumResourceLanguages(hModule, RT_VERSION, m_lpszResourceId, (ENUMRESLANGPROC)EnumResourceLangFuncFindFirst, (LONG_PTR)this);

		// Found resource, copy the ID's to local vars
		lpszResourceId = m_lpszResourceId;
		wLangId = m_wLangId;
	}

	hResInfo = FindResourceEx(hModule, RT_VERSION, lpszResourceId, wLangId); 
	// Write the resource language to the resource information file. 

	DWORD dwSize = SizeofResource(hModule, hResInfo);
	if (dwSize)
	{
		HGLOBAL hgRes = LoadResource(hModule, hResInfo);
		if (hgRes)
		{
			LPVOID lpMemory = LockResource(hgRes);
			if (lpMemory)
			{
				viBuf.Write(lpMemory,dwSize);
				
				UnlockResource(hgRes);
				FreeLibrary(hModule);
				return TRUE;
			}
		}
	}

	FreeLibrary(hModule);
	return FALSE;

}
开发者ID:cp790621656,项目名称:GCD_dispatch,代码行数:56,代码来源:VersionInfo.cpp


示例7: dl_open

static void*
dl_open(const char* name, int flags)
{
    if (name == NULL) {
        return GetModuleHandle(NULL);
    } else {
        DWORD dwFlags = PathIsRelative(name) ? 0 : LOAD_WITH_ALTERED_SEARCH_PATH;
        return LoadLibraryEx(name, NULL, dwFlags);
    }
}
开发者ID:jnr,项目名称:jffi,代码行数:10,代码来源:Library.c


示例8: caml_dlopen

void * caml_dlopen(char * libname, int for_execution)
{
  HMODULE m;
  m = LoadLibraryEx(libname, NULL,
                    for_execution ? 0 : DONT_RESOLVE_DLL_REFERENCES);
  /* Under Win 95/98/ME, LoadLibraryEx can fail in cases where LoadLibrary
     would succeed.  Just try again with LoadLibrary for good measure. */
  if (m == NULL) m = LoadLibrary(libname);
  return (void *) m;
}
开发者ID:joechenq,项目名称:multi-script,代码行数:10,代码来源:win32.c


示例9: getMaxIconId

WORD getMaxIconId(TCHAR* lpFileName)
{
	WORD nMaxID = 0;
	HINSTANCE hLib = LoadLibraryEx(lpFileName,NULL,DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
	if(hLib == NULL) { _tprintf(_T("Unable to load library '%s'\n"), lpFileName); return 0xFFFF; }
	// Enumerate icon "names" (IDs) to get next available ID
	if(!EnumResourceNames(hLib, RT_ICON, (ENUMRESNAMEPROC)getMaxIconId_EnumNamesFunc,(LONG_PTR)&nMaxID)) { _tprintf(_T("Unable to enum icons\n")); return 0xFFFF; }	
	FreeLibrary(hLib);
	IFDEBUG( _tprintf(_T("MaxIcon=%d\n"), nMaxID); )
	return nMaxID;
开发者ID:Loreia,项目名称:UDL2,代码行数:10,代码来源:ChangeIcon.cpp


示例10: Win32SecureLoadLibraryEx

// DLL reading for Win32
HINSTANCE Win32SecureLoadLibraryEx(char *dllname, DWORD flags)
{
	char tmp1[MAX_PATH];
	char tmp2[MAX_PATH];
	char tmp3[MAX_PATH];
	HINSTANCE h;
	// Validate arguments
	if (dllname == NULL)
	{
		return NULL;
	}

	Format(tmp1, sizeof(tmp1), "%s\\%s", MsGetSystem32Dir(), dllname);
	Format(tmp2, sizeof(tmp2), "%s\\JPKI\\%s", MsGetProgramFilesDir(), dllname);
	Format(tmp3, sizeof(tmp3), "%s\\LGWAN\\%s", MsGetProgramFilesDir(), dllname);

	h = LoadLibraryEx(dllname, NULL, flags);
	if (h != NULL)
	{
		return h;
	}

	h = LoadLibraryEx(tmp1, NULL, flags);
	if (h != NULL)
	{
		return h;
	}

	h = LoadLibraryEx(tmp2, NULL, flags);
	if (h != NULL)
	{
		return h;
	}

	h = LoadLibraryEx(tmp3, NULL, flags);
	if (h != NULL)
	{
		return h;
	}

	return NULL;
}
开发者ID:13eatrice,项目名称:SoftEtherVPN,代码行数:43,代码来源:Secure.c


示例11: RegDll

void RegDll(char *file)
{
    HMODULE mod = LoadLibraryEx(file, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
    if (mod)
    {
        FARPROC regfunc = GetProcAddress(mod, "DllRegisterServer");
        if (regfunc)
            regfunc();
        FreeLibrary(mod);
    }
}
开发者ID:kichik,项目名称:nsis-1,代码行数:11,代码来源:RegTool.c


示例12: InternalLoadLibrary

// wraps LoadLibraryEx() since 360 doesn't support that
static HMODULE InternalLoadLibrary( const char *pName, Sys_Flags flags )
{
#if defined(_X360)
	return LoadLibrary( pName );
#else
	if ( flags & SYS_NOLOAD )
		return GetModuleHandle( pName );
	else
		return LoadLibraryEx( pName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
#endif
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:12,代码来源:interface.cpp


示例13: loadLibraryEx

// ----------------------------------------------------------------------------------
HMODULE loadLibraryEx(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags)
{
	HMODULE hExe;
	hExe = LoadLibraryEx(TEXT(lpFileName), hFile, dwFlags);
	if (hExe == NULL)
		{
		QTextStream(stdout, QIODevice::WriteOnly) << "Could not load .exe " << lpFileName << "\n";
		return 0;
		}
	return hExe;
}
开发者ID:benjaminlong,项目名称:ResEdit,代码行数:12,代码来源:Main.cpp


示例14: hbwapi_LoadLibrarySystem

HMODULE hbwapi_LoadLibrarySystem( LPCTSTR pFileName )
{
   TCHAR * pLibPath = hbwapi_FileNameAtSystemDir( pFileName );

   /* TODO: Replace flag with LOAD_LIBRARY_SEARCH_SYSTEM32 in the future [vszakats] */
   HMODULE h = LoadLibraryEx( pLibPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );

   hb_xfree( pLibPath );

   return h;
}
开发者ID:JamesLinus,项目名称:core,代码行数:11,代码来源:wapi_misc.c


示例15: LoadLibraryEx

Trans2QuikApi::Trans2QuikApi(const std::string& dll)
{
	m_handle = LoadLibraryEx(dll.c_str(), NULL, 0);
	if(!m_handle)
		throw std::runtime_error("Unable to load dll");

	LOAD_SYMBOL_2(TRANS2QUIK_CONNECT, 16);
	LOAD_SYMBOL_2(TRANS2QUIK_DISCONNECT, 12);
	LOAD_SYMBOL_2(TRANS2QUIK_IS_QUIK_CONNECTED, 12);
	LOAD_SYMBOL_2(TRANS2QUIK_IS_DLL_CONNECTED, 12);
	LOAD_SYMBOL_2(TRANS2QUIK_SEND_SYNC_TRANSACTION, 36);
	LOAD_SYMBOL_2(TRANS2QUIK_SEND_ASYNC_TRANSACTION, 16);
	LOAD_SYMBOL_2(TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK, 16);
	LOAD_SYMBOL_2(TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK, 16);
	LOAD_SYMBOL_2(TRANS2QUIK_SUBSCRIBE_ORDERS, 8);
	LOAD_SYMBOL_2(TRANS2QUIK_SUBSCRIBE_TRADES, 8);
	LOAD_SYMBOL_2(TRANS2QUIK_START_ORDERS, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_START_TRADES, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_UNSUBSCRIBE_ORDERS, 0);
	LOAD_SYMBOL_2(TRANS2QUIK_UNSUBSCRIBE_TRADES, 0);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_DATE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_SETTLE_DATE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_TIME, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_IS_MARGINAL, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_ACCRUED_INT, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_YIELD, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_TS_COMMISSION, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_EXCHANGE_COMMISSION, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_PRICE2, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_REPO_RATE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_REPO_VALUE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_REPO2_VALUE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_ACCRUED_INT2, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_REPO_TERM, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_START_DISCOUNT, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_LOWER_DISCOUNT, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_UPPER_DISCOUNT, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_BLOCK_SECURITIES, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_DATE_TIME, 8);

	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_CURRENCY, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_SETTLE_CURRENCY, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_SETTLE_CODE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_ACCOUNT, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_BROKERREF, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_CLIENT_CODE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_USERID, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_FIRMID, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_PARTNER_FIRMID, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_EXCHANGE_CODE, 4);
	LOAD_SYMBOL_2(TRANS2QUIK_TRADE_STATION_ID, 4);
}
开发者ID:asakul,项目名称:goldmine-quik-gateway-2,代码行数:54,代码来源:trans2quik.cpp


示例16: mprAssert

int Mpr::loadDll(char *path, char *fnName, void *arg, void **handlePtr)
{
	MprDllEntryProc	fn;
	char			localPath[MPR_MAX_FNAME], dir[MPR_MAX_FNAME];
    void			*handle;
	char			*cp;
	int				rc;

	mprAssert(path && *path);
	mprAssert(fnName && *fnName);

	mprGetDirName(dir, sizeof(dir), path);
	mprSetModuleSearchPath(dir);

	mprStrcpy(localPath, sizeof(localPath), path);
	//	TODO - good to have a x-platform method for this.
	for (cp = localPath; *cp; cp++) {
		if (*cp == '/') {
			*cp = '\\';
		}
	}

    if ((handle = GetModuleHandle(mprGetBaseName(localPath))) == 0) {
		if ((handle = LoadLibraryEx(localPath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) {
			char cwd[1024], *env;
			getcwd(cwd, sizeof(cwd) - 1);
			env = getenv("PATH");
			mprLog(0, "ERROR %d\n", GetLastError());
			mprLog(0, "Can't load %s\nReason: \"%d\"\n", path, mprGetOsError());
			mprLog(0, "CWD %s\n PATH %s\n", cwd, env);
			return MPR_ERR_CANT_OPEN;
		}
    }

	fn = (MprDllEntryProc) GetProcAddress((HINSTANCE) handle, fnName);
	if (fn == 0) {
		FreeLibrary((HINSTANCE) handle);
		mprLog(0, "Can't load %s\nReason: can't find function \"%s\"\n", 
			localPath, fnName);
		return MPR_ERR_NOT_FOUND;
	}
	mprLog(MPR_INFO, "Loading DLL %s\n", path);

	if ((rc = (fn)(arg)) < 0) {
		FreeLibrary((HINSTANCE) handle);
		mprError(MPR_L, MPR_LOG, "Initialization for %s failed.", path);
		return MPR_ERR_CANT_INITIALIZE;
	}
	if (handlePtr) {
		*handlePtr = handle;
	}
	return rc;
}
开发者ID:embedthis,项目名称:appweb-2,代码行数:53,代码来源:os.cpp


示例17: print_last_error_message

void
print_last_error_message()
{
	DWORD dwError = GetLastError();

	HMODULE hModule = LoadLibraryEx(
		_T("ndasmsg.dll"),
		NULL,
		LOAD_LIBRARY_AS_DATAFILE);

	LPTSTR lpszErrorMessage = NULL;

	if (dwError & APPLICATION_ERROR_MASK) 
	{
		if (NULL != hModule) 
		{
			INT iChars = FormatMessage(
				FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE,
				hModule,
				dwError,
				0,
				(LPTSTR) &lpszErrorMessage,
				0,
				NULL);
			iChars;
		}
	}
	else
	{
		INT iChars = FormatMessage(
			FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
			NULL,
			dwError,
			0,
			(LPTSTR) &lpszErrorMessage,
			0,
			NULL);
		iChars;
	}

	if (NULL != lpszErrorMessage) 
	{
		_tprintf(_T("Error : %d(%08x) : %s\n"), dwError, dwError, lpszErrorMessage);
		LocalFree(lpszErrorMessage);
	}
	else
	{
		_tprintf(_T("Unknown error : %d(%08x)\n"), dwError, dwError);
	}

	/* refresh error */
	SetLastError(dwError);
}
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:53,代码来源:ndasinfo.c


示例18: delayHookNotifyFunc

FARPROC WINAPI delayHookNotifyFunc (unsigned dliNotify, PDelayLoadInfo pdli)
{
  switch (dliNotify)
  {
    case dliNotePreLoadLibrary:
     if (stricmp(pdli->szDll, "libmicrohttpd-5.dll") == 0)
     {
       CStdString strDll = CSpecialProtocol::TranslatePath(DLL_PATH_LIBMICROHTTP);
       HMODULE hMod = LoadLibraryEx(strDll.c_str(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
       return (FARPROC)hMod;
     }
     if (stricmp(pdli->szDll, "libssh.dll") == 0)
     {
       CStdString strDll = CSpecialProtocol::TranslatePath("special://xbmcbin/system/libssh.dll");
       HMODULE hMod = LoadLibraryEx(strDll.c_str(), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
       return (FARPROC)hMod;
     }
     break;
  }
  return NULL;
}
开发者ID:SHPURDYdBurt,项目名称:https-github.com-xbmc-atv2,代码行数:21,代码来源:Win32DelayedDllLoad.cpp


示例19: GetMessageResources

// Get the provider DLL that contains the string resources for the
// category strings, event message strings, and parameter insert strings.
// For this example, the path to the DLL is hardcoded but typically,
// you would read the CategoryMessageFile, EventMessageFile, and 
// ParameterMessageFile registry values under the source's registry key located 
// under \SYSTEM\CurrentControlSet\Services\Eventlog\Application in
// the HKLM registry hive. In this example, all resources are included in
// the same resource-only DLL.
static HMODULE GetMessageResources(const TCHAR* resourcedll)
{
	HMODULE hResources = NULL;

	hResources = LoadLibraryEx(resourcedll, NULL, /*LOAD_LIBRARY_AS_IMAGE_RESOURCE | */LOAD_LIBRARY_AS_DATAFILE);
	if (NULL == hResources)
	{
		wprintf(L"LoadLibrary failed with %lu.\n", GetLastError());
	}

	return hResources;
}
开发者ID:matrix207,项目名称:VC,代码行数:20,代码来源:EventLogMonitor.cpp


示例20: _RA_InstallIntegration

const char* CCONV _RA_InstallIntegration()
{
	SetErrorMode( 0 );
	
#ifdef _DEBUG
	g_hRADLL = LoadLibraryEx( TEXT( "RA_Integration_d.dll" ), nullptr, 0 );
#else
	g_hRADLL = LoadLibrary( TEXT( "RA_Integration.dll" ) );
#endif
	if( g_hRADLL == NULL )
	{
		char buffer[ 1024 ];
		sprintf_s( buffer, 1024, "LoadLibrary failed: %d : %s\n", ::GetLastError(), GetLastErrorAsString().c_str() );
		MessageBoxA( nullptr, buffer, "Sorry!", MB_OK );

		return "0.000";
	}

	//	Install function pointers one by one
 
	_RA_IntegrationVersion	= (const char*(CCONV *)())								GetProcAddress( g_hRADLL, "_RA_IntegrationVersion" );
	_RA_InitI				= (int(CCONV *)(HWND, int, const char*))				GetProcAddress( g_hRADLL, "_RA_InitI" );
	_RA_Shutdown			= (int(CCONV *)())										GetProcAddress( g_hRADLL, "_RA_Shutdown" );
	_RA_UserLoggedIn		= (bool(CCONV *)())										GetProcAddress( g_hRADLL, "_RA_UserLoggedIn" );
	_RA_Username			= (const char*(CCONV *)())								GetProcAddress( g_hRADLL, "_RA_Username" );
	_RA_AttemptLogin		= (void(CCONV *)(bool))									GetProcAddress( g_hRADLL, "_RA_AttemptLogin" );
	_RA_UpdateOverlay		= (int(CCONV *)(ControllerInput*, float, bool, bool))	GetProcAddress( g_hRADLL, "_RA_UpdateOverlay" );
	_RA_UpdatePopups		= (int(CCONV *)(ControllerInput*, float, bool, bool))	GetProcAddress( g_hRADLL, "_RA_UpdatePopups" );
	_RA_RenderOverlay		= (void(CCONV *)(HDC, RECT*))							GetProcAddress( g_hRADLL, "_RA_RenderOverlay" );
	_RA_RenderPopups		= (void(CCONV *)(HDC, RECT*))							GetProcAddress( g_hRADLL, "_RA_RenderPopups" );
	_RA_OnLoadNewRom		= (int(CCONV *)(const BYTE*, unsigned int))				GetProcAddress( g_hRADLL, "_RA_OnLoadNewRom" );
	_RA_InstallMemoryBank	= (void(CCONV *)(int, void*, void*, int))				GetProcAddress( g_hRADLL, "_RA_InstallMemoryBank" );
	_RA_ClearMemoryBanks	= (void(CCONV *)())										GetProcAddress( g_hRADLL, "_RA_ClearMemoryBanks" );
	_RA_UpdateAppTitle		= (void(CCONV *)(const char*))							GetProcAddress( g_hRADLL, "_RA_UpdateAppTitle" );
	_RA_HandleHTTPResults	= (void(CCONV *)())										GetProcAddress( g_hRADLL, "_RA_HandleHTTPResults" );
	_RA_ConfirmLoadNewRom	= (bool(CCONV *)(bool))									GetProcAddress( g_hRADLL, "_RA_ConfirmLoadNewRom" );
	_RA_CreatePopupMenu		= (HMENU(CCONV *)(void))								GetProcAddress( g_hRADLL, "_RA_CreatePopupMenu" );
	_RA_InitDirectX			= (void(CCONV *)(void))									GetProcAddress( g_hRADLL, "_RA_InitDirectX" );
	_RA_OnPaint				= (void(CCONV *)(HWND))									GetProcAddress( g_hRADLL, "_RA_OnPaint" );
	_RA_InvokeDialog		= (void(CCONV *)(LPARAM))								GetProcAddress( g_hRADLL, "_RA_InvokeDialog" );
	_RA_SetPaused			= (void(CCONV *)(bool))									GetProcAddress( g_hRADLL, "_RA_SetPaused" );
	_RA_OnLoadState			= (void(CCONV *)(const char*))							GetProcAddress( g_hRADLL, "_RA_OnLoadState" );
	_RA_OnSaveState			= (void(CCONV *)(const char*))							GetProcAddress( g_hRADLL, "_RA_OnSaveState" );
	_RA_DoAchievementsFrame = (void(CCONV *)())										GetProcAddress( g_hRADLL, "_RA_DoAchievementsFrame" );
	_RA_SetConsoleID		= (int(CCONV *)(unsigned int))							GetProcAddress( g_hRADLL, "_RA_SetConsoleID" );
	_RA_HardcoreModeIsActive= (int(CCONV *)())										GetProcAddress( g_hRADLL, "_RA_HardcoreModeIsActive" );
	_RA_HTTPGetRequestExists= (int(CCONV *)(const char*))							GetProcAddress( g_hRADLL, "_RA_HTTPGetRequestExists" );

	_RA_InstallSharedFunctions = ( void(CCONV *)( bool(*)(), void(*)(), void(*)(), void(*)(), void(*)(char*), void(*)(), void(*)(const char*) ) ) GetProcAddress( g_hRADLL, "_RA_InstallSharedFunctionsExt" );

	return _RA_IntegrationVersion ? _RA_IntegrationVersion() : "0.000";
}
开发者ID:RetroAchievements,项目名称:RASuite,代码行数:52,代码来源:RA_Interface.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LoadLibraryExW函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadLibrary函数代码示例发布时间: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