Example #1
0
int LoadEgbbLibrary(const char* main_path,int egbb_cache_size) {
	HMODULE hmod;
	PLOAD_EGBB load_egbb;
	char path[256];
	char terminator;
	size_t plen = strlen(main_path);
	strcpy(path,main_path);
	if (plen) {
		terminator = main_path[strlen(main_path)-1];
		if (terminator != '/' && terminator != '\\') {
			if (strchr(path, '\\') != NULL)
				strcat(path, "\\");
			else
				strcat(path, "/");
		}
	}
	strcat(path,EGBB_NAME);

	if((hmod = LoadLibrary(path)) != 0) {
		load_egbb = (PLOAD_EGBB) GetProcAddress(hmod,"load_egbb_xmen");
     	probe_egbb = (PPROBE_EGBB) GetProcAddress(hmod,"probe_egbb_xmen");
		open_egbb = (POPEN_EGBB)  GetProcAddress(hmod,"open_egbb");
        load_egbb(main_path,egbb_cache_size,SEARCHER::egbb_load_type);
		return true;
	} else {
		printf("EgbbProbe not Loaded!\n");
		return false;
	}
}
Example #2
0
bool EGBB::load(const std::string& spath,int cache_size,int egbb_load_type) {
	static HMODULE hmod = 0;
	PLOAD_EGBB load_egbb;
	char path[256];

	strcpy(path,spath.c_str());
	size_t plen = strlen(path);
	if (plen) {
		char terminator = path[plen - 1];
		if (terminator != '/' && terminator != '\\') {
			if (strchr(path, '\\') != NULL)
				strcat(path, "\\");
			else
				strcat(path, "/");
		}
	}
	plen = strlen(path);
	strcat(path,EGBB_NAME);

	if(hmod) FreeLibrary(hmod);
	if((hmod = LoadLibrary(path)) != 0) {
		load_egbb = (PLOAD_EGBB) GetProcAddress(hmod,"load_egbb_xmen");
		probe_egbb = (PPROBE_EGBB) GetProcAddress(hmod,"probe_egbb_xmen");
		path[plen] = 0;
        load_egbb(path,cache_size * 1024 * 1024,egbb_load_type);
		is_loaded = true;
		return true;
	}
	is_loaded = false;
	return false;
}
static int LoadEgbbLibrary(char* main_path,int egbb_cache_size) {
	HMODULE hmod;
	PLOAD_EGBB load_egbb;
	char path[256];

	strcpy(path,main_path);
	strcat(path,EGBB_NAME);
	if(hmod = LoadLibrary(path)) {
		load_egbb = (PLOAD_EGBB) GetProcAddress(hmod,"load_egbb_5men");
     	probe_egbb = (PPROBE_EGBB) GetProcAddress(hmod,"probe_egbb_5men");
        load_egbb(main_path,egbb_cache_size,egbb_load_type);
		return true;
	} else {
		printf("EgbbProbe not Loaded!\n");
		return false;
	}
}
/*
 * Load Scorpio bitbases from |egbb_dir|, with the specified cache size.
 * We also need to find a compatible shared library in the directory.
 */
bool load_scorpio_bb(char* egbb_dir, int cache_size_bytes)
{
    if (!cache_size_bytes) cache_size_bytes = EGBB_DEFAULT_CACHE_SIZE;
    char path[1024];
    egbb_is_loaded = false;
    if (lib) unload_library(lib);

    strncpy(path, egbb_dir, 1000);
    strcat(path, EGBB_NAME);
    lib = load_library(path);
    if (!lib) {
        strncpy(path, egbb_dir, 1000);
        strcat(path, EGBB_NAME2);
        lib = load_library(path);
    }
    if (!lib) {
        strncpy(path, egbb_dir, 1000);
        strcat(path, EGBB64_NAME);
        lib = load_library(path);
    }
    if (!lib) {
        strncpy(path, egbb_dir, 1000);
        strcat(path, EGBB64_NAME2);
        lib = load_library(path);
    }
    if (!lib) {
        printf("info string Failed to load egbb from %s.\n", egbb_dir);
        return false;
    }

    load_egbb_fn load_egbb = (load_egbb_fn)load_function(lib, "load_egbb_5men");
    probe_egbb_internal = (probe_egbb_fn)load_function(lib, "probe_egbb_5men");
    load_egbb(egbb_dir, cache_size_bytes, SMART_LOAD);
    egbb_is_loaded = true;
    return true;
}