コード例 #1
0
ファイル: iehook.c プロジェクト: 0x00dec0de/GMbot
//
//	Loads WININET.DLL and sets it's export and import hooks.	
//
WINERROR IeSetHooks(VOID)
{
	WINERROR Status = NO_ERROR;
	PHOOK_DESCRIPTOR ExportHooks, IatHooks;
	ULONG	NumberExportHooks, NumberIatHooks;

	if (LoadLibraryA(szWininet))
	{
		HRESULT Res;

		ExportHooks = (PHOOK_DESCRIPTOR)&IeExportHooks;
		IatHooks = (PHOOK_DESCRIPTOR)&IeIatHooks;
		NumberExportHooks = sizeof(IeExportHooks) / sizeof(HOOK_DESCRIPTOR);
		NumberIatHooks = sizeof(IeExportHooks) / sizeof(HOOK_DESCRIPTOR);

		// Init our own WININET IAT entries now, before DLL export hooked.
		Res = __HrLoadAllImportsForDll(szWininetDll); // NOTE: Dll name is case sensitive here!
		ASSERT(Res == NO_ERROR);
	
		g_HandleTable->Flags |= TF_REUSE_HANDLE;
		Status = ParserHookImportExport(IatHooks, NumberIatHooks, ExportHooks, NumberExportHooks);
	}
	else
	{
		ASSERT(FALSE);
		Status = ERROR_MOD_NOT_FOUND;
	}

	return(Status);
}
コード例 #2
0
void Component_RunPreInit()
{
#ifdef _M_AMD64
	// again, a Win7 SP1 check (Chromium x64 isn't supported below this operating level)
	if (!IsWindows7SP1OrGreater())
	{
		FatalError("CitizenFX requires Windows 7 SP1 or higher. Please upgrade to this operating system version to run CitizenFX.");
	}
#endif

	// CEF keeps loading/unloading this - load it ourselves to make the refcount always 1
	LoadLibrary(L"bluetoothapis.dll");

	// load Chrome dependencies ourselves so that the system won't try loading from other paths
	LoadLibrary(MakeRelativeCitPath(L"bin/chrome_elf.dll").c_str());
	LoadLibrary(MakeRelativeCitPath(L"bin/libEGL.dll").c_str());
	LoadLibrary(MakeRelativeCitPath(L"bin/libGLESv2.dll").c_str());

	// load the CEF library
	HMODULE libcef = LoadLibraryW(MakeRelativeCitPath(L"bin/libcef.dll").c_str());

	if (!libcef)
	{
		MessageBoxW(NULL, L"Could not load bin/libcef.dll.", L"CitizenFX", MB_ICONSTOP | MB_OK);

		ExitProcess(0);
	}

	__HrLoadAllImportsForDll("libcef.dll");

	Instance<NUIApp>::Set(new NUIApp());

	// instantiate a NUIApp
	auto selfApp = Instance<NUIApp>::Get();

	CefMainArgs args(GetModuleHandle(NULL));
	static CefRefPtr<CefApp> app(selfApp);

    auto schemeHandlerFactory = new NUISchemeHandlerFactory();
    schemeHandlerFactory->AddRef();
    Instance<NUISchemeHandlerFactory>::Set(schemeHandlerFactory);

    InitFunctionBase::RunAll();

    OnResumeGame.Connect([] ()
    {
        FinalizeInitNUI();
    });

	// try to execute as a CEF process
	int exitCode = CefExecuteProcess(args, app, nullptr);

	// and exit if we did
	if (exitCode >= 0)
	{
		ExitProcess(0);
	}
}
コード例 #3
0
bool boinc_graphics_possible() {
#ifdef _WIN32
#if 0
    // Attempt to load the dlls that are required to display graphics, if
    // any of them fail do not start the application in graphics mode.
    if (FAILED(__HrLoadAllImportsForDll("GDI32.dll"))) {
       fprintf(stderr, "Failed to load GDI32.DLL\n" );
       return false;
    }
    if (FAILED(__HrLoadAllImportsForDll("OPENGL32.dll"))) {
       fprintf( stderr, "Failed to load OPENGL32.DLL\n" );
       return false;
    }
    if (FAILED(__HrLoadAllImportsForDll("GLU32.dll"))) {
       fprintf( stderr, "Failed to load GLU32.DLL\n" );
       return false;
    }
#endif
#elif defined(__APPLE__)
#else
    if (!getenv("DISPLAY")) return false;
#endif
    return true;
}