示例#1
0
void InitFactory()
{
#ifdef NIX
    if (!g_hMcfCore.load("libmcfcore.so"))
    {
        fprintf(stderr, "Cannont open library: %s\n", dlerror());
        printf("Error loading mcfcore.so\n");
        exit(-1);
    }
#else
	#ifdef DEBUG
		if (!g_hMcfCore.load("mcfcore-d.dll"))
	#else
		if (!g_hMcfCore.load("mcfcore.dll"))
	#endif
		{
			printf("Error loading mcfcore.dll\n");
			exit(-1);
		}
#endif

    buildFactory = g_hMcfCore.getFunction<BFACT>("FactoryBuilder");
    if (!buildFactory)
    {
        printf("Error loading buildfactory\n");
        exit(-1);
    }

	delFactory = g_hMcfCore.getFunction<DFACT>("FactoryDelete");
    if (!delFactory)
    {
        printf("Error loading del factory\n");
        exit(-1);
    }
}
void RemoveGameFromWindowsGameExplorer(const char* dllPath, bool deleteDl)
{
	if (!dllPath)
		return;

	if (!UTIL::FS::isValidFile(dllPath))
		return;

	SharedObjectLoader sol;

	if (!sol.load("GameuxInstallHelper.dll"))
	{
		WarningS("Failed to open GameuxInstallHelper.dll: {0}\n", GetLastError());
		return;
	}

	GameExplorerUninstallWFn GameExplorerUninstall = sol.getFunction<GameExplorerUninstallWFn>("GameExplorerUninstallW");

	if (!GameExplorerUninstall)
	{
		WarningS("Failed to find uninstall function in GameuxInstallHelper.dll\n");
		return;
	}

	gcWString wDllPath(dllPath);
	GameExplorerUninstall(const_cast<wchar_t*>(wDllPath.c_str()));

	if (deleteDl)
		UTIL::FS::delFile(dllPath);
}
示例#3
0
void BootLoader::loadUICore()
{
#ifndef DEBUG
	BootLoaderUtil::SetCurrentDir();
#endif

	if (!BootLoaderUtil::SetDllDir(".\\bin"))
	{
		::MessageBox(nullptr, "Failed to set the DLL path to the bin folder.", PRODUCT_NAME ": ERROR!",  MB_OK);
		exit(-100);			
	}

	const char* dllname = "utilcore.dll";

	if (!m_hUICore.load(dllname))
	{
		DWORD err = GetLastError();
		::MessageBox(nullptr, "Failed to load utilcore.dll", PRODUCT_NAME ": ERROR!",  MB_OK);
		exit(-200);
	}
	
	UICoreFP UICoreGetInterface = m_hUICore.getFunction<UICoreFP>("GetInterface");

	if (!UICoreGetInterface)
	{
		::MessageBox(nullptr, "Failed to load wxWidgets mappings in utilcore.dll", PRODUCT_NAME ": ERROR!", MB_OK);
		exit(-500);
	} 

	m_pUICore = UICoreGetInterface();
}
示例#4
0
bool LoadCEFDll()
{
	if (!g_CEFDll.load(szCefDLL))
	{
		Warning(gcString("Failed to load cef library: {0}\n", GetLastError()));
		return false;
	}

	CEF_Init = g_CEFDll.getFunction<CEF_InitFn>("CEF_InitEx");

	UserAgentFN userAgent = (UserAgentFN) WebCore::FactoryBuilder(WEBCORE_USERAGENT);
	gcString ua;

	//stupid hack cause crappy paypal does useragent sniffing. FFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUU
#ifdef WIN32
	ua += "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1";
#else
	ua += "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1";
#endif

	ua += " " + userAgent();

	UTIL::FS::Path path(UTIL::OS::getTempInternetPath(L"desura"), L"", false);
	UTIL::FS::recMakeFolder(path);

	gcString logPath;

#ifdef DEBUG
	logPath = "Chromium_log.txt";
#endif

#ifdef WIN32
	bool multiThreaded = true;
#else
	bool multiThreaded = false;
#endif

	if (CEF_Init)
		g_pChromiumController = CEF_Init(multiThreaded, gcString(path.getFolderPath()).c_str(), logPath.c_str(), ua.c_str());
	else
		g_pChromiumController = CEF_Init_Legacy(g_CEFDll, multiThreaded, gcString(path.getFolderPath()).c_str(), logPath.c_str(), ua.c_str());

	if (!g_pChromiumController)
	{
		Warning("Failed to init cef.\n");
		return false;
	}

	g_pChromiumController->SetApiVersion(2);
	return true;
}
示例#5
0
bool SetDllDir(const char* dir)
{
	SharedObjectLoader sol;

	if (sol.load("kernel32.dll"))
	{
		SetDllDirectoryFunc set_dll_directory = sol.getFunction<SetDllDirectoryFunc>("SetDllDirectoryA");

		if (set_dll_directory && set_dll_directory(dir))
			return true;
	}

	return false;
}
示例#6
0
void initFactory()
{
	bool res = false;

#if defined(WIN32) && !defined(DEBUG) && defined(DESURA_OFFICIAL_BUILD) && defined(WITH_CODESIGN)
	char message[255] = {0};
	if (UTIL::WIN::validateCert(L".\\bin\\mcfcore.dll", message, 255) != ERROR_SUCCESS)
	{
		Warning(gcString("Cert validation failed on mcfcore.dll: {0}\n", message));
		exit(-1);
	}
#endif

#ifdef WIN32
	res = g_pMCFCore.load("mcfcore.dll");
#else
	res = g_pMCFCore.load("libmcfcore.so");
#endif

    if (!res)
        exit(-1);

	buildFactory = g_pMCFCore.getFunction<BFACT>("FactoryBuilder");

    if (!buildFactory)
        exit(-1);

	delFactory = g_pMCFCore.getFunction<DFACT>("FactoryDelete");

    if (!delFactory)
        exit(-1);

	RegDLLCB_MCF regMsg = g_pMCFCore.getFunction<RegDLLCB_MCF>("RegDLLCB_MCF");

	if (regMsg)
		InitLogging(regMsg);
}
void AddGameToWindowsGameExplorer(const char* name, const char* dllPath)
{
	if (!dllPath || !UTIL::FS::isValidFile(dllPath))
	{
		WarningS("Not a valid dll for {0} to install into game explorer! [{1}]\n", name, dllPath);
		return;
	}

	SharedObjectLoader sol;

	if (!sol.load("GameuxInstallHelper.dll"))
	{
		WarningS("Failed to open GameuxInstallHelper.dll: {0}\n", GetLastError());
		return;
	}

	GameExplorerInstallWFn GameExplorerInstall = sol.getFunction<GameExplorerInstallWFn>("GameExplorerInstallW");
	GameExplorerUninstallWFn GameExplorerUninstall = sol.getFunction<GameExplorerUninstallWFn>("GameExplorerUninstallW");

	if (!GameExplorerInstall)
	{
		WarningS("Failed to find install function in GameuxInstallHelper.dll\n");
		return;
	}

	if (!GameExplorerUninstall)
	{
		WarningS("Failed to find uninstall function in GameuxInstallHelper.dll\n");
		return;
	}


	UTIL::FS::Path path = UTIL::FS::PathWithFile(dllPath);

	std::string fullPath = path.getFullPath();
	std::string folderPath = path.getFolderPath();

	gcWString wDllPath(dllPath);
	gcWString wFolderPath(folderPath);
	gcWString wFullPath(fullPath);

	GameExplorerUninstall(const_cast<wchar_t*>(wDllPath.c_str()));
	HRESULT res = GameExplorerInstall(const_cast<wchar_t*>(wFullPath.c_str()), const_cast<wchar_t*>(wFolderPath.c_str()), GIS_ALL_USERS);

	if (res != 0)
		WarningS("Failed to install {0} for game explorer: {1} [{2}]\n", name, (uint32)res, dllPath);
	else
		Msg("Installed {0} for game explorer\n", name);
}
示例#8
0
	bool Login(std::string &strUsername, std::string &strPassword)
	{
		gcString path = UTIL::OS::getAppDataPath();

#ifdef WIN32
		const char* szDllName = "usercore.dll";
#else
		const char* szDllName = "libusercore.so";
#endif

		if (!m_hUserCore.load(szDllName))
		{
			Msg(gcString("Failed to load {0}", szDllName).c_str());
			return false;
		}

		FactoryBuilderUCfn usercoreFactory = m_hUserCore.getFunction<FactoryBuilderUCfn>("FactoryBuilderUC");

		if (!usercoreFactory)
		{
			Msg("Failed to find factory builder function");
			return false;
		}

		g_pUserHandle = (UserCore::UserI*)usercoreFactory(USERCORE);
		g_pUserHandle->init(path.c_str());

		try
		{
			//need to do this here as news items will be passed onlogin
			*g_pUserHandle->getNeedCvarEvent() += delegate(this, &UploadMCF::OnNeedCvar);

			g_pUserHandle->lockDelete();
			g_pUserHandle->logInTool(strUsername.c_str(), strPassword.c_str());
			g_pUserHandle->unlockDelete();
		}
		catch (gcException e)
		{
			g_pUserHandle->logOut();
			g_pUserHandle->unlockDelete();
			safe_delete(g_pUserHandle);

			Warning(gcString("Failed to login: {0}", e));
		}

		return !!g_pUserHandle;
	}
示例#9
0
bool MainApp::loadCrashHelper()
{
	if (!g_CrashObject.load("libcrashuploader.so"))
	{
		fprintf(stderr, "Failed to load dump uploader.\n\t[%s]\n", dlerror());
		return false;
	}

	g_UploadCrashfn = g_CrashObject.getFunction<UploadCrashFn>("UploadCrash");

	if (!g_UploadCrashfn)
	{
		fprintf(stderr, "Failed to find UploadCrash function.\n\t[%s]\n", dlerror());
		return false;
	}
	
	return true;
}
示例#10
0
UINT UploadDump(const std::string &strFile, const std::string &strUser, const std::string &strTracer)
{
	int build = 0;
	int branch = 0;

	GetBuildBranch(build, branch);

	const char* modualName = "crashuploader.dll";

	if (!g_CrashUploader.load(modualName))
		return -1;

	UploadCrashExFn uploadCrash = g_CrashUploader.getFunction<UploadCrashExFn>("UploadCrashEx");

	if (!uploadCrash)
		return -2;

	if (!uploadCrash(strFile.c_str(), strUser.c_str(), build, branch, strTracer.c_str()))
		return -3;

	return 0;
}
示例#11
0
void BootLoader::loadUICore()
{
	if (!BootLoaderUtil::SetDllDir(".\\bin"))
	{
		::MessageBox(nullptr, "Failed to set the DLL path to the bin folder.", PRODUCT_NAME ": ERROR!",  MB_OK);
		exit(-100);			
	}

	preReadImages();

	const char* dllname = "uicore.dll";

	if (!m_hUICore.load(dllname))
	{
		DWORD err = GetLastError();
		::MessageBox(nullptr, "Failed to load uicore.dll", PRODUCT_NAME ": ERROR!",  MB_OK);
		exit(-200);
	}
	
	UICoreFP UICoreGetInterface = m_hUICore.getFunction<UICoreFP>("GetInterface");

	if (!UICoreGetInterface)
	{
		::MessageBox(nullptr, "Failed to load wxWidgets mappings in uicore.dll", PRODUCT_NAME ": ERROR!", MB_OK);
		exit(-500);
	} 

	m_pUICore = UICoreGetInterface();

	char version[100] = {0};
	_snprintf_s(version, 100, _TRUNCATE, "%d.%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_BUILDNO, VERSION_EXTEND);

	m_pUICore->setDesuraVersion(version);
	m_pUICore->setRestartFunction(&UiCoreRestart);
	m_pUICore->setCrashDumpSettings(&SetDumpArgs);
	m_pUICore->setCrashDumpLevel(&SetDumpLevel);
	m_pUICore->setTracer(&g_Tracer);
}
示例#12
0
bool LoadCEFDll()
{
	if (!g_CEFDll.load(szCefDLL))
		return false;

	CEF_Init = g_CEFDll.getFunction<CEF_InitFn>("CEF_Init");
	CEF_Stop = g_CEFDll.getFunction<CEF_StopFn>("CEF_Stop");
	CEF_RegisterJSExtender = g_CEFDll.getFunction<CEF_RegisterJSExtenderFn>("CEF_RegisterJSExtender");
	CEF_RegisterSchemeExtender = g_CEFDll.getFunction<CEF_RegisterSchemeExtenderFn>("CEF_RegisterSchemeExtender");
	CEF_DeleteCookie = g_CEFDll.getFunction<CEF_DeleteCookieFn>("CEF_DeleteCookie");
	CEF_CreateCookie = g_CEFDll.getFunction<CEF_CreateCookieFn>("CEF_CreateCookie");
	CEF_SetCookie = g_CEFDll.getFunction<CEF_SetCookieFn>("CEF_SetCookie");
	CEF_NewChromiumBrowser = g_CEFDll.getFunction<CEF_NewChromiumBrowserFn>("CEF_NewChromiumBrowser");
	CEF_DoWork = g_CEFDll.getFunction<CEF_DoWorkFn>("CEF_DoMsgLoop");
	CEF_PostCallback = g_CEFDll.getFunction<CEF_PostCallbackFn>("CEF_PostCallback");

	if (g_CEFDll.hasFailed())
	{
		UnloadCEFDll();
		return false;
	}

	return true;
}
示例#13
0
UINT __stdcall UploadDump(void* dumpInfo)
{
	int build = 0;
	int branch = 0;

	GetBuildBranch(build, branch);

	DumpInfo* di = static_cast<DumpInfo*>(dumpInfo);

	SharedObjectLoader sol;

	const char* modualName = "crashuploader.dll";

	if (!sol.load(modualName))
	{
		di->m_szComplete = true;
		return -1;
	}

	UploadCrashFn uploadCrash = sol.getFunction<UploadCrashFn>("UploadCrash");

	if (uploadCrash == nullptr)
	{
		di->m_szComplete = true;
		return -2;
	}

	if (!uploadCrash(di->m_szFile, di->m_szUser, build, branch))
	{
		di->m_szComplete = true;
		return -3;		
	}

	di->m_szComplete = true;
	return 0;
}