int initConfiguration() { getIniValue("face_detect.ini","main","CAM_ID",CV_CAP_ANY,cam_id); if (!getIniValue("face_detect.ini","main","OPENCV_ROOT","not initialized",OPENCV_ROOT)){ cerr << "Can't extract location of opencv data files from ini file" << endl; return 0; } if (!getIniValue("face_detect.ini","main","OUTPUT_PLAYBACK_VIDEOS_DIR","not initialized",OUTPUT_PLAYBACK_VIDEOS_DIR)){ cerr << "Can't extract location of ouptut *playback* videos (not the faces videos dir)!" << endl; return 0; } return 1; }
/* * Load a base64 blowfish key for contact * If theKey is NULL, only a test is made (= IsKeySetForContact) * @param contactPtr * @param theKey * @return 1 if everything ok 0 if not */ int getContactKey(const char *contactPtr, char *theKey) { char tmpKey[KEYBUF_SIZE] = ""; int bRet = FALSE; getIniValue(contactPtr, "key", "", tmpKey, KEYBUF_SIZE, iniPath); // don't process, encrypted key not found in ini if (strlen(tmpKey) < 16) return FALSE; // encrypted key found if (strncmp(tmpKey, "+OK ", 4) == 0) { if (theKey) { // if it's not just a test, lets decrypt the key decrypt_string((char *)iniKey, tmpKey + 4, theKey, strlen(tmpKey + 4)); } bRet = TRUE; } ZeroMemory(tmpKey, KEYBUF_SIZE); return bRet; }
void get_ini_password_hash(int password_size, char* password) { strcpy(iniPath, get_irssi_config()); // path to irssi config file strcpy(strrchr(iniPath, '/'), blow_ini); getIniValue("FiSH", "ini_password_Hash", "0", password, password_size, iniPath); }
bool getIniValue(string filename,string section,string key,float defultValue,float& value){ string value_default_str,value_str; if (getIniValue(filename,section,key,value_default_str,value_str)) if (sscanf_s(value_str.c_str(),"%f",&value,value_str.length()) == 1) //can't parse float return true; value = defultValue; return false; }
//eigentliche laderoutine Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { Xfire_icon_cache entry = { 0 }; //shortname char shortname[255] = ""; if (!getIniValue(gameid, "ShortName", shortname)) return entry; //spielid zuweisen entry.gameid = gameid; //Icons.dll noch nicht geladen?!? if (!hIconDll) { //versuch die Icons.dll zuladen char path[MAX_PATH] = ""; if (!getIconPath(path)) return entry; strcat_s(path, MAX_PATH, IconsdllName); hIconDll = LoadLibraryA(path); } //dll konnte geladen werden if (hIconDll) { char resourcename[255]; //kurznamen des spiels uppercasen und .ICO anhängen mir_snprintf(resourcename, _countof(resourcename), "XF_%s.ICO", shortname); Xfire_base::strtoupper(resourcename); //versuche die resource zufinden HRSRC hrsrc = FindResourceA(hIconDll, resourcename, "ICONS"); if (hrsrc) { //aus der resource ein HICON erstellen int size = SizeofResource(hIconDll, hrsrc); //iconresource laden HGLOBAL hglobal = LoadResource(hIconDll, hrsrc); if (hglobal) { //lock LPVOID data = LockResource(hglobal); if (data) { //erzeuge ein handle für das icon und ab in den cache damit entry.hicon = this->createHICONfromdata(data, size); UnlockResource(hglobal); } FreeResource(hglobal); } } } //kein icon in der dll, dann aus dem internet laden if (!entry.hicon) entry.hicon = downloadIcon(shortname); //wenn ein hicon erzeugt wurde, dann handle erstellen und in den cache laden if (entry.hicon) entry.handle = this->createIconHandle(entry.hicon); //eintrag in den cache, selbst wenn kein icon geladen werden konnte this->iconcache.push_back(entry); return entry; }
void fish_init(void) { char iniPasswordHash[50], B64digest[50]; strcpy(iniPath, get_irssi_config()); // path to irssi config file strcpy(strrchr(iniPath, '/'), blow_ini); if (DH1080_Init() == FALSE) return; getIniValue("FiSH", "ini_password_Hash", "0", iniPasswordHash, sizeof(iniPasswordHash), iniPath); if (strlen(iniPasswordHash) == 43) { prompt_for_password(iniKey); calculate_password_key_and_hash(iniKey, iniKey, B64digest); if (strcmp(B64digest, iniPasswordHash) != 0) { printtext(NULL, NULL, MSGLEVEL_CRAP, "\002FiSH:\002 Wrong blow.ini password entered, try again..."); printtext(NULL, NULL, MSGLEVEL_CRAP, "\002FiSH module NOT loaded.\002"); return; } printtext(NULL, NULL, MSGLEVEL_CRAP, "\002FiSH:\002 Correct blow.ini password entered, lets go!"); } else { strcpy(iniKey, default_iniKey); printtext(NULL, NULL, MSGLEVEL_CRAP, "\002FiSH:\002 Using default password to decrypt blow.ini... Try /setinipw to set a custom password."); } signal_add_first("server sendmsg", (SIGNAL_FUNC) encrypt_msg); signal_add_first("message private", (SIGNAL_FUNC) decrypt_msg); signal_add_first("message public", (SIGNAL_FUNC) decrypt_msg); signal_add_first("message irc notice", (SIGNAL_FUNC) decrypt_notice); signal_add_first("message irc action", (SIGNAL_FUNC) decrypt_action); signal_add_first("message own_private", (SIGNAL_FUNC) format_msg); signal_add_first("message own_public", (SIGNAL_FUNC) format_msg); signal_add_first("channel topic changed", (SIGNAL_FUNC) decrypt_changed_topic); signal_add_first("message topic", (SIGNAL_FUNC) decrypt_topic); signal_add_first("server incoming", (SIGNAL_FUNC) raw_handler); signal_add("query created", (SIGNAL_FUNC) do_auto_keyx); signal_add("query nick changed", (SIGNAL_FUNC) query_nick_changed); command_bind("topic+", NULL, (SIGNAL_FUNC) cmd_crypt_topic); command_bind("notice+", NULL, (SIGNAL_FUNC) cmd_crypt_notice); command_bind("notfish", NULL, (SIGNAL_FUNC) cmd_crypt_notice); command_bind("me+", NULL, (SIGNAL_FUNC) cmd_crypt_action); command_bind("setkey", NULL, (SIGNAL_FUNC) cmd_setkey); command_bind("delkey", NULL, (SIGNAL_FUNC) cmd_delkey); command_bind("key", NULL, (SIGNAL_FUNC) cmd_key); command_bind("showkey", NULL, (SIGNAL_FUNC) cmd_key); command_bind("keyx", NULL, (SIGNAL_FUNC) cmd_keyx); command_bind("setinipw", NULL, (SIGNAL_FUNC) cmd_setinipw); command_bind("unsetinipw", NULL, (SIGNAL_FUNC) cmd_unsetinipw); command_bind("fishhelp", NULL, (SIGNAL_FUNC) cmd_helpfish); command_bind("helpfish", NULL, (SIGNAL_FUNC) cmd_helpfish); settings_add_bool_module("fish", "FiSH", "process_outgoing", 1); settings_add_bool_module("fish", "FiSH", "process_incoming", 1); settings_add_bool_module("fish", "FiSH", "auto_keyxchange", 1); settings_add_bool_module("fish", "FiSH", "nicktracker", 1); settings_add_str_module("fish", "FiSH", "mark_broken_block", " \002&\002"); settings_add_str_module("fish", "FiSH", "mark_encrypted", ""); settings_add_str_module("fish", "FiSH", "plain_prefix", "+p "); settings_add_int_module("fish", "FiSH", "mark_position", 0); printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE, "FiSH v1.00 - encryption module for irssi loaded! URL: https://github.com/falsovsky/FiSH-irssi\n" "Try /helpfish or /fishhelp for a short command overview"); module_register("fish", "core"); }