int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) { size_t tPathLen; bool found = false; init_custom_folders(); TCHAR* path = (TCHAR*)_malloca(cbLen * sizeof(TCHAR)); if (hAvatarsFolder == NULL || FoldersGetCustomPathT(hAvatarsFolder, path, (int)cbLen, _T(""))) { TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_avatarcache%")); TCHAR *tszModuleName = mir_a2t(m_szModuleName); tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%s"), tmpPath, tszModuleName); mir_free(tszModuleName); mir_free(tmpPath); } else { _tcscpy(pszDest, path); tPathLen = _tcslen(pszDest); } if (ext && _taccess(pszDest, 0)) CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)pszDest); size_t tPathLen2 = tPathLen; DBVARIANT dbv; if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR; tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal); DBFreeVariant(&dbv); if (ext == NULL) { mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T(".*")); _tfinddata_t c_file; long hFile = _tfindfirst(pszDest, &c_file); if (hFile > -1L) { do { if (_tcsrchr(c_file.name, '.')) { mir_sntprintf(pszDest + tPathLen2, cbLen - tPathLen2, _T("\\%s"), c_file.name); found = true; } } while (_tfindnext(hFile, &c_file) == 0); _findclose( hFile ); } if (!found) pszDest[0] = 0; } else { mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, ext); found = _taccess(pszDest, 0) == 0; } return found ? GAIR_SUCCESS : GAIR_WAITFOR; }
void GetAvatarCache(LPTSTR szPath) { // Получить путь новым способом if ( ServiceExists( MS_UTILS_REPLACEVARS ) ) { LPTSTR szAvatarCache = Utils_ReplaceVarsT( _T("%miranda_avatarcache%\\") modname_t _T("\\") ); if ( szAvatarCache && szAvatarCache != (LPTSTR)0x80000000 ) { lstrcpyn( szPath, szAvatarCache, MAX_PATH ); // Создание пути до будущего файла аватара CallService( MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath ); return; } } // Получить путь старым способом char szProfilePath[ MAX_PATH ], szProfileName[ MAX_PATH ]; CallService( MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath ); CallService( MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM)szProfileName ); char *pos = strrchr( szProfileName, '.' ); if ( lstrcmpA( pos, ".dat" ) == 0 ) *pos = 0; lstrcpy( szPath, CA2T( szProfilePath ) ); lstrcat( szPath, _T("\\") ); lstrcat( szPath, CA2T( szProfileName ) ); lstrcat( szPath, _T("\\AvatarCache\\") modname_t _T("\\") ); // Создание пути до будущего файла аватара CallService( MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szPath ); return; }
int SaveOptions(void) { TCHAR prof_dir[MAX_PATH]; db_set_b(0, "AutoBackups", "BackupType", (BYTE)options.backup_types); if (options.period < 1) options.period = 1; db_set_w(0, "AutoBackups", "Period", (WORD)options.period); db_set_b(0, "AutoBackups", "PeriodType", (BYTE)options.period_type); mir_sntprintf(prof_dir, _countof(prof_dir), _T("%s\\"), profilePath); size_t prof_len = mir_tstrlen(prof_dir); size_t opt_len = mir_tstrlen(options.folder); if (opt_len > prof_len && _tcsncmp(options.folder, prof_dir, prof_len) == 0) { db_set_ts(0, "AutoBackups", "Folder", (options.folder + prof_len)); } else db_set_ts(0, "AutoBackups", "Folder", options.folder); TCHAR *tmp = Utils_ReplaceVarsT(options.folder); if (mir_tstrlen(tmp) < 2 || tmp[1] != ':') { _tcsncpy_s(prof_dir, options.folder, _TRUNCATE); mir_sntprintf(options.folder, _countof(options.folder), _T("%s\\%s"), profilePath, prof_dir); } mir_free(tmp); db_set_w(0, "AutoBackups", "NumBackups", options.num_backups); db_set_b(0, "AutoBackups", "NoProgress", (BYTE)options.disable_progress); db_set_b(0, "AutoBackups", "NoPopups", (BYTE)options.disable_popups); db_set_b(0, "AutoBackups", "UseZip", (BYTE)options.use_zip); SetBackupTimer(); return 0; }
int ModulesLoad(WPARAM, LPARAM) { profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) { HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath); FoldersGetBackupPath(0, 0); } CreateServiceFunction(MS_AB_BACKUP, ABService); CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs); CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000); mi.name.a = LPGEN("Backup profile"); mi.pszService = MS_AB_BACKUP; mi.hIcolibItem = iconList[0].hIcolib; mi.position = 500100000; Menu_AddMainMenuItem(&mi); mi.name.a = LPGEN("Save profile as..."); mi.pszService = MS_AB_SAVEAS; mi.hIcolibItem = iconList[1].hIcolib; mi.position = 500100001; Menu_AddMainMenuItem(&mi); HookEvent(ME_OPT_INITIALISE, OptionsInit); LoadOptions(); if (options.backup_types & BT_START) BackupStart(NULL); return 0; }
int LoadOptions(void) { options.backup_types = (BackupType)db_get_b(0, "AutoBackups", "BackupType", (BYTE)(BT_PERIODIC)); options.period = (unsigned int)db_get_w(0, "AutoBackups", "Period", 1); options.period_type = (PeriodType)db_get_b(0, "AutoBackups", "PeriodType", (BYTE)PT_DAYS); if (!ServiceExists(MS_FOLDERS_GET_PATH)) { DBVARIANT dbv; if (!db_get_ts(0, "AutoBackups", "Folder", &dbv)) { TCHAR *tmp = Utils_ReplaceVarsT(dbv.ptszVal); if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':') _tcsncpy_s(options.folder, dbv.ptszVal, _TRUNCATE); else mir_sntprintf(options.folder, _countof(options.folder), _T("%s\\%s"), profilePath, dbv.ptszVal); db_free(&dbv); mir_free(tmp); } else mir_sntprintf(options.folder, _countof(options.folder), _T("%s%s"), DIR, SUB_DIR); } options.num_backups = db_get_w(0, "AutoBackups", "NumBackups", 3); options.disable_progress = (BOOL)db_get_b(0, "AutoBackups", "NoProgress", 0); options.disable_popups = (BOOL)db_get_b(0, "AutoBackups", "NoPopups", 0); options.use_zip = (BOOL)db_get_b(0, "AutoBackups", "UseZip", 0); SetBackupTimer(); return 0; }
// returns 1 if something that looks like a profile is there static int getProfileCmdLineArgs(TCHAR * szProfile, size_t cch) { TCHAR *szCmdLine = GetCommandLine(); TCHAR *szEndOfParam; TCHAR szThisParam[1024]; int firstParam=1; while(szCmdLine[0]) { if(szCmdLine[0]=='"') { szEndOfParam = _tcschr(szCmdLine+1, '"'); if(szEndOfParam == NULL) break; lstrcpyn(szThisParam, szCmdLine+1, min(SIZEOF(szThisParam), szEndOfParam - szCmdLine)); szCmdLine = szEndOfParam + 1; } else { szEndOfParam = szCmdLine + _tcscspn(szCmdLine, _T(" \t")); lstrcpyn(szThisParam, szCmdLine, min(SIZEOF(szThisParam), szEndOfParam - szCmdLine+1)); szCmdLine = szEndOfParam; } while(*szCmdLine && *szCmdLine<=' ') szCmdLine++; if (firstParam) { firstParam=0; continue; } //first param is executable name if (szThisParam[0] == '/' || szThisParam[0] == '-') continue; //no switches supported TCHAR* res = Utils_ReplaceVarsT(szThisParam); if (res == NULL) return 0; _tcsncpy(szProfile, res, cch); szProfile[cch-1] = 0; mir_free(res); return 1; } return 0; }
int RotateBackups(HWND progress_dialog, DWORD start_time) { TCHAR backupfilename1[MAX_PATH] = {0}, backupfilename2[MAX_PATH] = {0}, backupfolderTmp[MAX_PATH] = {0}; TCHAR* backupfolder; unsigned int i = 0; HWND prog = GetDlgItem(progress_dialog, IDC_PROGRESS); MSG msg; WIN32_FIND_DATA FindFileData; HANDLE hFind; backupfolder = Utils_ReplaceVarsT(options.folder); mir_sntprintf(backupfolderTmp, SIZEOF(backupfolderTmp), _T("%s\\*"), backupfolder); hFind = FindFirstFile(backupfolderTmp, &FindFileData); if (hFind == INVALID_HANDLE_VALUE) return 0; _tcscpy(FileNameFound.Name, _T("")); while (FindNextFile(hFind, &FindFileData)) { if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; else if (_tcsicmp(&FindFileData.cFileName[_tcslen(FindFileData.cFileName)-4], _T(".bak")) == 0) { if (_tcsicmp(FileNameFound.Name, _T("")) == 0) { _tcscpy(FileNameFound.Name, FindFileData.cFileName); FileNameFound.CreationTime = FindFileData.ftCreationTime; } else if ((FindFileData.ftCreationTime.dwHighDateTime < FileNameFound.CreationTime.dwHighDateTime) || (FindFileData.ftCreationTime.dwHighDateTime == FileNameFound.CreationTime.dwHighDateTime && FindFileData.ftCreationTime.dwLowDateTime < FileNameFound.CreationTime.dwLowDateTime)) { _tcscpy(FileNameFound.Name, FindFileData.cFileName); FileNameFound.CreationTime = FindFileData.ftCreationTime; } i++; while(PeekMessage(&msg, progress_dialog, 0, 0, PM_REMOVE) != 0) { if(!IsDialogMessage(progress_dialog, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } SendMessage(prog, PBM_SETPOS, (WPARAM)(int)(100 * (options.num_backups - i) / options.num_backups), 0); UpdateWindow(progress_dialog); } } FindClose(hFind); if (i >= options.num_backups) { mir_sntprintf(backupfilename1, MAX_PATH, _T("%s\\%s"), backupfolder, FileNameFound.Name); DeleteFile(backupfilename1); } mir_free(backupfolder); return 0; }
static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai) { if (ai->argc != 1) return NULL; ai->flags |= AIF_DONTPARSE; TCHAR corevar[MAX_PATH]; mir_sntprintf(corevar, _countof(corevar), _T("%%%s%%"), ai->targv[0]); return Utils_ReplaceVarsT(corevar); }
// move profile from profile subdir static void moveProfileDirProfiles(TCHAR * profiledir, BOOL isRootDir = TRUE) { TCHAR pfd[MAX_PATH]; if (isRootDir) { TCHAR *path = Utils_ReplaceVarsT(_T("%miranda_path%\\*.dat")); mir_sntprintf(pfd, SIZEOF(pfd), _T("%s"), path); mir_free(path); } else mir_sntprintf(pfd, SIZEOF(pfd), _T("%s\\*.dat"), profiledir); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(pfd, &ffd); if (hFind != INVALID_HANDLE_VALUE) { TCHAR *c =_tcsrchr(pfd, '\\'); if (c) *c = 0; do { TCHAR path[MAX_PATH], path2[MAX_PATH]; TCHAR* profile = mir_tstrdup(ffd.cFileName); TCHAR *c =_tcsrchr(profile, '.'); if (c) *c = 0; mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), pfd, ffd.cFileName); mir_sntprintf(path2, SIZEOF(path2), _T("%s\\%s"), profiledir, profile); CreateDirectoryTreeT(path2); mir_sntprintf(path2, SIZEOF(path2), _T("%s\\%s\\%s"), profiledir, profile, ffd.cFileName); if (_taccess(path2, 0) == 0) { const TCHAR tszMoveMsg[] = _T("Miranda is trying upgrade your profile structure.\n") _T("It cannot move profile %s to the new location %s\n") _T("Because profile with this name already exist. Please resolve the issue manually."); TCHAR buf[512]; mir_sntprintf(buf, SIZEOF(buf), TranslateTS(tszMoveMsg), path, path2); MessageBox(NULL, buf, _T("Miranda IM"), MB_ICONERROR | MB_OK); } else if (MoveFile(path, path2) == 0) { const TCHAR tszMoveMsg[] = _T("Miranda is trying upgrade your profile structure.\n") _T("It cannot move profile %s to the new location %s automatically\n") _T("Most likely due to insufficient privileges. Please move profile manually."); TCHAR buf[512]; mir_sntprintf(buf, SIZEOF(buf), TranslateTS(tszMoveMsg), path, path2); MessageBox(NULL, buf, _T("Miranda IM"), MB_ICONERROR | MB_OK); break; } mir_free(profile); } while(FindNextFile(hFind, &ffd)); } FindClose(hFind); }
int CALLBACK BrowseProc(HWND hwnd, UINT uMsg, LPARAM, LPARAM) { switch (uMsg) { case BFFM_INITIALIZED: TCHAR *folder = Utils_ReplaceVarsT(options.folder); SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)folder); mir_free(folder); break; } return 0; }
static void patchDir(TCHAR *str, size_t strSize) { TCHAR *result = Utils_ReplaceVarsT(str, 0, sttVarsToReplace); if (result) { _tcsncpy(str, result, strSize); mir_free(result); } size_t len = mir_tstrlen(str); if (len + 1 < strSize && str[len - 1] != '\\') mir_tstrcpy(str + len, _T("\\")); }
static int ModulesLoad(WPARAM, LPARAM) { profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); MenuInit(); FoldersInit(); LoadOptions(); if (options.backup_types & BT_START) mir_forkthread(BackupThread, NULL); return 0; }
void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type) { size_t tPathLen; InitCustomFolders(); TCHAR* path = (TCHAR*)alloca(cbLen * sizeof(TCHAR)); if (hCustomSmileyFolder == NULL || FoldersGetCustomPathT(hCustomSmileyFolder, path, (int)cbLen, _T(""))) { TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); TCHAR *tszModuleName = mir_a2t(m_szModuleName); tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%s\\CustomSmiley"), tmpPath, tszModuleName); mir_free(tszModuleName); mir_free(tmpPath); } else { _tcscpy(pszDest, path); tPathLen = _tcslen(pszDest); } if (hContact != NULL) { DBVARIANT dbv = {0}; if (getTString(hContact, "e-mail", &dbv)) { dbv.type = DBVT_ASCIIZ; dbv.ptszVal = (TCHAR*)mir_alloc(11); _ui64tot((UINT_PTR)hContact, dbv.ptszVal, 10); } tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal); db_free(&dbv); } else { TCHAR *tszModuleName = mir_a2t(m_szModuleName); tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), tszModuleName); mir_free(tszModuleName); } bool exist = _taccess(pszDest, 0) == 0; if (type == 0) { if (!exist) pszDest[0] = 0; return; } if (!exist) CreateDirectoryTreeT(pszDest); TCHAR *sztSmileyName = mir_a2t(SmileyName); mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s.%s"), sztSmileyName, type == MSN_APPID_CUSTOMSMILEY ? _T("png") : _T("gif")); mir_free(sztSmileyName); }
extern "C" int __declspec(dllexport) Load(void) { hMsftedit = LoadLibrary(_T("Msftedit.dll")); if (hMsftedit == NULL) return 1; clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0; dtsubfldr = db_get_b(NULL, PluginName, "SubFolders", 1) != 0; catchcrashes = db_get_b(NULL, PluginName, "CatchCrashes", 1) != 0; mir_getLP(&pluginInfoEx); profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat")); profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); if (catchcrashes && !needrestart) mir_sntprintf(CrashLogFolder, TEXT("%s\\CrashLog"), profpath); _tcsncpy_s(VersionInfoFolder, profpath, _TRUNCATE); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_OPT_INITIALISE, OptionsInit); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); packlcid = (LCID)Langpack_GetDefaultLocale(); InitIcons(); if (catchcrashes && !needrestart) InitExceptionHandler(); CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile); CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard); CreateServiceFunction(MS_CRASHDUMPER_VIEWINFO, ViewVersionInfo); CreateServiceFunction(MS_CRASHDUMPER_GETINFO, GetVersionInfo); CreateServiceFunction(MS_CRASHDUMPER_UPLOAD, UploadVersionInfo); CreateServiceFunction(MS_CRASHDUMPER_URL, OpenUrl); CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeLaunch); CreateServiceFunction(MS_CRASHDUMPER_URLTOCLIP, CopyLinkToClipboard); return 0; }
bool IsInsideRootDir(TCHAR* profiledir, bool exact) { int res; TCHAR* pfd = Utils_ReplaceVarsT(_T("%miranda_path%")); if (exact) res = _tcsicmp(profiledir, pfd); else { size_t len = _tcslen(pfd); res = _tcsnicmp(profiledir, pfd, len); } mir_free(pfd); return res == 0; }
static void getDefaultProfile(TCHAR * szProfile, size_t cch, TCHAR * profiledir) { TCHAR defaultProfile[MAX_PATH]; GetPrivateProfileString(_T("Database"), _T("DefaultProfile"), _T(""), defaultProfile, SIZEOF(defaultProfile), mirandabootini); if (defaultProfile[0] == 0) return; TCHAR* res = Utils_ReplaceVarsT(defaultProfile); if (res) { mir_sntprintf(szProfile, cch, _T("%s\\%s\\%s%s"), profiledir, res, res, isValidProfileName(res) ? _T("") : _T(".dat")); mir_free(res); } else szProfile[0] = 0; }
void pathToAbsolute(const CMString& pSrc, CMString& pOut) { TCHAR szOutPath[MAX_PATH]; TCHAR *szVarPath = Utils_ReplaceVarsT(pSrc.c_str()); if (szVarPath == (TCHAR*)CALLSERVICE_NOTFOUND || szVarPath == NULL) { TCHAR szExpPath[MAX_PATH]; ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, SIZEOF(szExpPath)); PathToAbsoluteT(szExpPath, szOutPath); } else { PathToAbsoluteT(szVarPath, szOutPath); mir_free(szVarPath); } pOut = szOutPath; }
extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\" DEFAULT_UPDATES_FOLDER)); mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot)); hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER); if (hPackUpdaterFolder) FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, _T("")); mir_free(tszFolder); LoadOptions(); InitPopupList(); NetlibInit(); IcoLibInit(); // Add cheking update menu item CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand); CMenuItem mi; SET_UID(mi, 0x326495e8, 0xab0a, 0x47d2, 0xb2, 0x22, 0x2a, 0x8e, 0xa8, 0xae, 0x53, 0x1a); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = IcoLib_GetIcon("check_update"); mi.name.t = LPGENT("Check for pack updates"); mi.pszService = MODNAME"/CheckUpdates"; Menu_AddMainMenuItem(&mi); // Add empty updates folder menu item CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder); memset(&mi, 0, sizeof(mi)); SET_UID(mi, 0xc3eea590, 0xaba3, 0x454f, 0x93, 0x93, 0xbc, 0x97, 0x15, 0x2c, 0x3b, 0x3d); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = IcoLib_GetIcon("empty_folder"); mi.name.t = LPGENT("Clear pack updates folder"); mi.pszService = MODNAME"/EmptyFolder"; Menu_AddMainMenuItem(&mi); // Add options hook HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); return 0; }
static INT_PTR ShowGuideFile(WPARAM, LPARAM) { LPTSTR pszDirName = (LPTSTR)mir_alloc(250*sizeof(TCHAR)); LPTSTR pszFileName = (LPTSTR)mir_alloc(250*sizeof(TCHAR)); TCHAR *ptszHelpFile = db_get_tsa(NULL, "UserGuide", "PathToHelpFile"); if (ptszHelpFile==0) { mir_tstrcpy(pszDirName, _T("%miranda_path%\\Plugins")); mir_tstrcpy(pszFileName, _T("UserGuide.chm")); } else { if(!mir_tstrcmp(ptszHelpFile, _T(""))) { mir_tstrcpy(pszDirName, _T("%miranda_path%\\Plugins")); mir_tstrcpy(pszFileName, _T("UserGuide.chm")); } else { LPTSTR pszDivider = _tcsrchr(ptszHelpFile, '\\'); if (pszDivider == NULL) { mir_tstrcpy(pszDirName, _T("")); _tcsncpy(pszFileName, ptszHelpFile, mir_tstrlen(ptszHelpFile)); } else { _tcsncpy(pszFileName, pszDivider + 1, mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1); pszFileName[mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1] = 0; _tcsncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile); pszDirName[pszDivider - ptszHelpFile] = 0; } } mir_free(ptszHelpFile); } LPTSTR pszDirNameEx; pszDirNameEx = Utils_ReplaceVarsT(pszDirName); mir_free(pszDirName); ShellExecute(NULL, _T("open"), pszFileName, NULL, pszDirNameEx, SW_SHOW); mir_free(pszFileName); mir_free(pszDirNameEx); return 0; }
// returns 1 if the profile path was returned, without trailing slash int getProfilePath(TCHAR * buf, size_t cch) { TCHAR profiledir[MAX_PATH]; GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), profiledir, SIZEOF(profiledir), mirandabootini); if (profiledir[0] == 0) _tcscpy(profiledir, _T("%miranda_path%\\Profiles")); TCHAR* exprofiledir = Utils_ReplaceVarsT(profiledir); size_t len = pathToAbsoluteT(exprofiledir, buf, NULL); mir_free(exprofiledir); if (buf[len-1] == '/' || buf[len-1] == '\\') buf[len-1] = 0; return 0; }
int InitServices() { CallService(MS_DB_GETPROFILEPATHT, _countof(szCurrentProfilePath), (LPARAM)szCurrentProfilePath); CallService(MS_DB_GETPROFILENAMET, _countof(szCurrentProfile), (LPARAM)szCurrentProfile); TCHAR *pos = _tcsrchr(szCurrentProfile, '.'); if (pos) *pos = 0; GetModuleFileName(GetModuleHandleA("mir_app.mir"), szMirandaPath, _countof(szMirandaPath)); pos = _tcsrchr(szMirandaPath, '\\'); if (pos) *pos = 0; TCHAR *szTemp = Utils_ReplaceVarsT(_T("%miranda_userdata%")); mir_sntprintf(szUserDataPath, szTemp); mir_free(szTemp); CreateServiceFunction(MS_FOLDERS_GET_PATH, GetPathService); CreateServiceFunction(MS_FOLDERS_GET_SIZE, GetPathSizeService); CreateServiceFunction(MS_FOLDERS_REGISTER_PATH, RegisterPathService); return 0; }
void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL patchVars) { TCHAR tszTemp[MAX_PATH]; ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv")); if (tszRecvPath) _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE); else mir_sntprintf(tszTemp, _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files")); if (hContact) { hContact = db_mc_tryMeta(hContact); REPLACEVARSARRAY rvaVarsToReplace[4]; rvaVarsToReplace[0].key.t = _T("nick"); rvaVarsToReplace[0].value.t = mir_tstrdup((TCHAR *)pcli->pfnGetContactDisplayName(hContact, 0)); rvaVarsToReplace[1].key.t = _T("userid"); rvaVarsToReplace[1].value.t = GetContactID(hContact); rvaVarsToReplace[2].key.t = _T("proto"); rvaVarsToReplace[2].value.t = mir_a2t(GetContactProto(hContact)); rvaVarsToReplace[3].key.t = NULL; rvaVarsToReplace[3].value.t = NULL; for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++) RemoveInvalidFilenameChars(rvaVarsToReplace[i].value.t); TCHAR *result = Utils_ReplaceVarsT(tszTemp, hContact, rvaVarsToReplace); if (result) { _tcsncpy(tszTemp, result, _countof(tszTemp)); mir_free(result); for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++) mir_free(rvaVarsToReplace[i].value.t); } } if (patchVars) patchDir(tszTemp, _countof(tszTemp)); RemoveInvalidPathChars(tszTemp); mir_tstrncpy(szDir, tszTemp, cchDir); }
int Backup(TCHAR* backup_filename) { TCHAR source_file[MAX_PATH] = {0}, dest_file[MAX_PATH] = {0}; TCHAR* backupfolder,* pathtmp,* puText; HWND progress_dialog; DWORD start_time = GetTickCount64(); int i; size_t dest_file_len; CallService(MS_DB_GETPROFILENAMET, MAX_PATH, (LPARAM)dbname); if (backup_filename == NULL) { int err = 0; SYSTEMTIME st; TCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1 ]; //GetComputerName (buffer , & size); DWORD size = sizeof(buffer); /* Buffer size is chosen large enough to contain any DNS name, not just MAX_COMPUTERNAME_LENGTH + 1 */ /* characters. MAX_COMPUTERNAME_LENGTH is usually less than 32, but it varies among systems, so we */ /* cannot use the constant in a precompiled Windows agent, which is expected to work on any system. */ backupfolder = Utils_ReplaceVarsT(options.folder); // ensure the backup folder exists (either create it or return non-zero signifying error) err = CreateDirectoryTree(backupfolder); if(err != ERROR_ALREADY_EXISTS && err != 0) { return 1; } GetLocalTime(&st); GetComputerName(buffer, &size); mir_sntprintf(dest_file, MAX_PATH, _T("%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.bak"), backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer); mir_free(backupfolder); } else lstrcpyn(dest_file, backup_filename, MAX_PATH); if(!options.disable_popups) ShowPopup(dbname, TranslateT("Backup in Progress")); if(!options.disable_progress) { progress_dialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, (DLGPROC)DlgProcProgress); SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Rotating backup files...")); } RotateBackups(progress_dialog, start_time); SetDlgItemText(progress_dialog, 0xDAED, TranslateT("Copying database file...")); SendMessage(progress_dialog, PBM_SETPOS, (WPARAM)(int)(0), 0); UpdateWindow(progress_dialog); mir_sntprintf(source_file, MAX_PATH, _T("%s\\%s"), profilePath, dbname); pathtmp = Utils_ReplaceVarsT(source_file); if (CopyFile(pathtmp, dest_file, 0)) { SendMessage(progress_dialog, PBM_SETPOS, (WPARAM)(int)(100), 0); UpdateWindow(progress_dialog); DBWriteContactSettingDword(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0)); if(!options.disable_popups) { dest_file_len = lstrlen(dest_file); if(dest_file_len > 50) { puText = mir_alloc(sizeof(TCHAR) * (dest_file_len + 2)); for(i = (int)dest_file_len - 1; dest_file[i] != _T('\\'); i--); lstrcpyn(puText, dest_file, i + 2); lstrcat(puText, _T("\n")); lstrcat(puText, dest_file + i + 1); } else puText = mir_tstrdup(dest_file); ShowPopup(puText, TranslateT("Database backuped")); mir_free(puText); } } else DeleteFile(dest_file); mir_free(pathtmp); DestroyWindow(progress_dialog); return 0; }
int Backup(TCHAR *backup_filename) { bool bZip = false; TCHAR dbname[MAX_PATH], source_file[MAX_PATH] = { 0 }, dest_file[MAX_PATH]; HWND progress_dialog = NULL; SYSTEMTIME st; CallService(MS_DB_GETPROFILENAMET, _countof(dbname), (LPARAM)dbname); if (backup_filename == NULL) { int err; TCHAR *backupfolder, buffer[MAX_COMPUTERNAME_LENGTH + 1]; DWORD size = _countof(buffer); bZip = options.use_zip != 0; backupfolder = Utils_ReplaceVarsT(options.folder); // ensure the backup folder exists (either create it or return non-zero signifying error) err = CreateDirectoryTreeT(backupfolder); if (err != ERROR_ALREADY_EXISTS && err != 0) { mir_free(backupfolder); return 1; } RotateBackups(backupfolder, dbname); GetLocalTime(&st); GetComputerName(buffer, &size); mir_sntprintf(dest_file, _T("%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s"), backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? _T("zip") : _T("dat")); mir_free(backupfolder); } else { _tcsncpy_s(dest_file, backup_filename, _TRUNCATE); if (!mir_tstrcmp(_tcsrchr(backup_filename, _T('.')), _T(".zip"))) bZip = true; } if (!options.disable_popups) ShowPopup(dbname, TranslateT("Backup in progress"), NULL); if (!options.disable_progress) progress_dialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_COPYPROGRESS), 0, DlgProcProgress); SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file...")); mir_sntprintf(source_file, _T("%s\\%s"), profilePath, dbname); TCHAR *pathtmp = Utils_ReplaceVarsT(source_file); BOOL res = 0; if (bZip) res = MakeZip(pathtmp, dest_file, dbname, progress_dialog); else res = CopyFile(pathtmp, dest_file, 0); if (res) { if (!bZip) { // Set the backup file to the current time for rotator's correct work FILETIME ft; HANDLE hFile = CreateFile(dest_file, FILE_WRITE_ATTRIBUTES, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); SetFileTime(hFile, NULL, NULL, &ft); CloseHandle(hFile); } SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0); UpdateWindow(progress_dialog); db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0)); if (!options.disable_popups) { size_t dest_file_len = mir_tstrlen(dest_file); TCHAR *puText; if (dest_file_len > 50) { size_t i; puText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (dest_file_len + 2)); for (i = (dest_file_len - 1); dest_file[i] != _T('\\'); i--) ; //_tcsncpy_s(dest_file, backup_filename, _TRUNCATE); mir_tstrncpy(puText, dest_file, (i + 2)); mir_tstrcat(puText, _T("\n")); mir_tstrcat(puText, (dest_file + i + 1)); } else puText = mir_tstrdup(dest_file); // Now we need to know, which folder we made a backup. Let's break unnecessary variables :) while (dest_file[--dest_file_len] != L'\\') ; dest_file[dest_file_len] = 0; ShowPopup(puText, TranslateT("Database backed up"), dest_file); mir_free(puText); } } else DeleteFile(dest_file); mir_free(pathtmp); DestroyWindow(progress_dialog); return 0; }
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); if (!png2dibavail) { ShowWindow(GetDlgItem(hwndDlg, IDC_PNG2DIBWARN), SW_SHOW); EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVE), false); EnableWindow(GetDlgItem(hwndDlg, IDC_RANDOM), false); EnableWindow(GetDlgItem(hwndDlg, IDC_SPLASHPATH), false); EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSESPLASH), false); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWVERSION), false); EnableWindow(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), false); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWTIME), false); EnableWindow(GetDlgItem(hwndDlg, IDC_ST_SPIN), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FADEIN), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FADEOUT), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), false); } else { ReadDbConfig(); TCHAR inBuf[80]; DBVARIANT dbv = {0}; if (!db_get_ts(NULL, MODNAME, "Path", &dbv)) { _tcscpy_s(inBuf, dbv.ptszVal); db_free(&dbv); } else _tcscpy_s(inBuf, _T("splash\\splash.png")); SetDlgItemText(hwndDlg, IDC_SPLASHPATH, inBuf); if (!db_get_ts(NULL, MODNAME, "Sound", &dbv)) { _tcscpy_s(inBuf, dbv.ptszVal); db_free(&dbv); } else _tcscpy_s(inBuf, _T("sounds\\startup.wav")); SetDlgItemText(hwndDlg, IDC_SNDPATH, inBuf); if (!db_get_ts(NULL, MODNAME, "VersionPrefix", &dbv)) { _tcscpy_s(inBuf, dbv.ptszVal); db_free(&dbv); } else _tcscpy_s(inBuf, _T("")); SetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, inBuf); if (options.active) CheckDlgButton(hwndDlg, IDC_ACTIVE, BST_CHECKED); if (options.playsnd && !options.inheritGS) CheckDlgButton(hwndDlg, IDC_PLAYSND, BST_INDETERMINATE); else if (options.playsnd) CheckDlgButton(hwndDlg, IDC_PLAYSND, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_LOOPSOUND), false); if (options.fadein) CheckDlgButton(hwndDlg, IDC_FADEIN, BST_CHECKED); if (options.fadeout) CheckDlgButton(hwndDlg, IDC_FADEOUT, BST_CHECKED); if (options.random) CheckDlgButton(hwndDlg, IDC_RANDOM, BST_CHECKED); if (options.showversion) CheckDlgButton(hwndDlg, IDC_SHOWVERSION, BST_CHECKED); SetWindowText(GetDlgItem(hwndDlg, IDC_SHOWTIME), _itot(options.showtime, inBuf, 10)); SetWindowText(GetDlgItem(hwndDlg, IDC_FISTEP), _itot(options.fisteps, inBuf, 10)); SetWindowText(GetDlgItem(hwndDlg, IDC_FOSTEP), _itot(options.fosteps, inBuf, 10)); SendDlgItemMessage(hwndDlg, IDC_SHOWTIME, EM_LIMITTEXT, 5, 0); } return TRUE; } case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_PREVIEW: { ShowSplash(true); break; } case IDC_ACTIVE: case IDC_PLAYSND: case IDC_LOOPSOUND: case IDC_FADEIN: case IDC_FADEOUT: case IDC_SHOWTIME: case IDC_RANDOM: case IDC_SHOWVERSION: case IDC_FISTEP: case IDC_FOSTEP: { if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN)) { EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), true); EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), true); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_FISTEP), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FI_SPIN), false); } if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT)) { EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), true); EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), true); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_FOSTEP), false); EnableWindow(GetDlgItem(hwndDlg, IDC_FO_SPIN), false); } if ((HWND)lParam != GetFocus()) return 0; else { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; } case IDC_CHOOSESPLASH: { TCHAR szTempPath[MAX_PATH], initDir[MAX_PATH]; TCHAR *pos; if (Exists(szSplashFile)) { _tcscpy_s(initDir, szSplashFile); pos = _tcsrchr(initDir, _T('\\')); if(pos != NULL) *pos = 0; } else { szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%")); _tcscpy_s(initDir, szMirDir); mir_free(szMirDir); } OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; TCHAR tmp[MAX_PATH]; mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; ofn.lpstrFile = szTempPath; ofn.nMaxFile = MAX_PATH; ofn.nMaxFileTitle = MAX_PATH; ofn.Flags = OFN_HIDEREADONLY; ofn.lpstrInitialDir = initDir; *szTempPath = '\0'; ofn.lpstrDefExt = _T(""); if (GetOpenFileName(&ofn)) { _tcscpy_s(szSplashFile, szTempPath); #ifdef _DEBUG logMessage(_T("Set path"), szSplashFile); #endif // Make path relative int result = PathToRelativeT(szTempPath, szPath2Spash); if(result && lstrlen(szPath2Spash) > 0) { if (options.random) { TCHAR *pos; pos = _tcsrchr(szPath2Spash, _T('\\')); if (pos != NULL) { *pos = 0; _tcscat_s(szPath2Spash, _T("\\")); } } SetWindowText(GetDlgItem(hwndDlg, IDC_SPLASHPATH), szPath2Spash); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; } case IDC_CHOOSESND: { TCHAR szTempPath[MAX_PATH], initDir[MAX_PATH]; TCHAR *pos; if (Exists(szSoundFile)) { _tcscpy_s(initDir, szSoundFile); pos = _tcsrchr(initDir, _T('\\')); if(pos != NULL) *pos = 0; } else { szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%")); _tcscpy_s(initDir, szMirDir); mir_free(szMirDir); } OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; TCHAR tmp[MAX_PATH]; mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0); ofn.lpstrFilter = tmp; ofn.hwndOwner = 0; ofn.lpstrFile = szTempPath; ofn.nMaxFile = MAX_PATH; ofn.nMaxFileTitle = MAX_PATH; ofn.Flags = OFN_HIDEREADONLY; ofn.lpstrInitialDir = initDir; *szTempPath = '\0'; ofn.lpstrDefExt = _T(""); if (GetOpenFileName(&ofn)) { _tcscpy_s(szSoundFile,szTempPath); #ifdef _DEBUG logMessage(_T("Set sound path"), szSoundFile); #endif // Make path relative int result = PathToRelativeT(szTempPath, szSoundFilePath); if(result && lstrlen(szSoundFile) > 0) SetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH),szSoundFilePath); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; } } default: { if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) return 0; else SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; } case WM_NOTIFY: { if (((LPNMHDR)lParam)->idFrom == 0) switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { TCHAR tmp[MAX_PATH]; GetWindowText(GetDlgItem(hwndDlg, IDC_SPLASHPATH), tmp, MAX_PATH); db_set_ts(NULL, MODNAME, "Path", tmp); GetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH), tmp, MAX_PATH); db_set_ts(NULL, MODNAME, "Sound", tmp); GetWindowText(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), tmp, MAX_PATH); db_set_ts(NULL, MODNAME, "VersionPrefix", tmp); _tcscpy_s(szPrefix, tmp); GetWindowText(GetDlgItem(hwndDlg, IDC_SHOWTIME), tmp, MAX_PATH); db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp)); options.showtime = _ttoi(tmp); GetWindowText(GetDlgItem(hwndDlg, IDC_FISTEP), tmp, MAX_PATH); db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp)); options.fisteps = _ttoi(tmp); GetWindowText(GetDlgItem(hwndDlg, IDC_FOSTEP), tmp, MAX_PATH); db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp)); options.fosteps = _ttoi(tmp); if (IsDlgButtonChecked(hwndDlg, IDC_ACTIVE)) { db_set_b(NULL, MODNAME, "Active", 1); options.active = 1; } else { db_set_b(NULL, MODNAME, "Active", 0); options.active = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND)) { db_set_b(NULL, MODNAME, "PlaySound", 1); options.playsnd = 1; db_set_b(NULL, MODNAME, "InheritGlobalSound", 1); options.inheritGS = 1; } else { db_set_b(NULL, MODNAME, "PlaySound", 0); options.playsnd = 0; db_set_b(NULL, MODNAME, "InheritGlobalSound", 0); options.inheritGS = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND) == BST_INDETERMINATE) { db_set_b(NULL, MODNAME, "PlaySound", 1); options.playsnd = 1; db_set_b(NULL, MODNAME, "InheritGlobalSound", 0); options.inheritGS = 0; } /* if (IsDlgButtonChecked(hwndDlg, IDC_LOOPSOUND)) { WritePrivateProfileString("Splash","LoopSound","1",szIniFile); options.loopsnd = 1; } else { WritePrivateProfileString("Splash","LoopSound","0",szIniFile); options.loopsnd = 0; } */ if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN)) { db_set_b(NULL, MODNAME, "FadeIn", 1); options.fadein = 1; } else { db_set_b(NULL, MODNAME, "FadeIn", 0); options.fadein = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT)) { db_set_b(NULL, MODNAME, "FadeOut", 1); options.fadeout = 1; } else { db_set_b(NULL, MODNAME, "FadeOut", 0); options.fadeout = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_RANDOM)) { db_set_b(NULL, MODNAME, "Random", 1); options.random = 1; } else { db_set_b(NULL, MODNAME, "Random", 0); options.random = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_SHOWVERSION)) { db_set_b(NULL, MODNAME, "ShowVersion", 1); options.showversion = 1; } else { db_set_b(NULL, MODNAME, "ShowVersion", 0); options.showversion = 0; } return TRUE; } } } case WM_DESTROY: break; } return FALSE; }
static void DoAutoExec(void) { TCHAR szUse[7], szIniPath[MAX_PATH], szFindPath[MAX_PATH]; TCHAR *str2; TCHAR buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH]; char *szSafeSections, *szUnsafeSections; int secur; GetPrivateProfileString(_T("AutoExec"),_T("Use"),_T("prompt"),szUse,SIZEOF(szUse),mirandabootini); if(!lstrcmpi(szUse,_T("no"))) return; GetPrivateProfileString(_T("AutoExec"),_T("Safe"),_T("CLC Icons CLUI CList SkinSounds"),buf,SIZEOF(buf),mirandabootini); szSafeSections = mir_t2a(buf); GetPrivateProfileString(_T("AutoExec"),_T("Unsafe"),_T("ICQ MSN"),buf,SIZEOF(buf),mirandabootini); szUnsafeSections = mir_t2a(buf); GetPrivateProfileString(_T("AutoExec"),_T("Warn"),_T("notsafe"),szSecurity,SIZEOF(szSecurity),mirandabootini); if (!lstrcmpi(szSecurity,_T("none"))) secur = 0; else if (!lstrcmpi(szSecurity,_T("notsafe"))) secur = 1; else if (!lstrcmpi(szSecurity,_T("onlyunsafe"))) secur = 2; GetPrivateProfileString(_T("AutoExec"),_T("OverrideSecurityFilename"),_T(""),szOverrideSecurityFilename,SIZEOF(szOverrideSecurityFilename),mirandabootini); GetPrivateProfileString(_T("AutoExec"),_T("OnCreateFilename"),_T(""),szOnCreateFilename,SIZEOF(szOnCreateFilename),mirandabootini); GetPrivateProfileString(_T("AutoExec"),_T("Glob"),_T("autoexec_*.ini"),szFindPath,SIZEOF(szFindPath),mirandabootini); if (dbCreated && szOnCreateFilename[0]) { str2 = Utils_ReplaceVarsT(szOnCreateFilename); pathToAbsoluteT(str2, szIniPath, NULL); mir_free(str2); ProcessIniFile(szIniPath, szSafeSections, szUnsafeSections, 0, 1); } str2 = Utils_ReplaceVarsT(szFindPath); pathToAbsoluteT(str2, szFindPath, NULL); mir_free(str2); WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFile(szFindPath, &fd); if (hFind == INVALID_HANDLE_VALUE) { mir_free(szSafeSections); mir_free(szUnsafeSections); return; } str2 = _tcsrchr(szFindPath, '\\'); if (str2 == NULL) szFindPath[0] = 0; else str2[1] = 0; do { bool secFN = lstrcmpi(fd.cFileName,szOverrideSecurityFilename) == 0; mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName); if(!lstrcmpi(szUse,_T("prompt")) && !secFN) { int result=DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_INSTALLINI),NULL,InstallIniDlgProc,(LPARAM)szIniPath); if(result==IDC_NOTOALL) break; if(result==IDCANCEL) continue; } ProcessIniFile(szIniPath, szSafeSections, szUnsafeSections, secur, secFN); if(secFN) DeleteFile(szIniPath); else { TCHAR szOnCompletion[8]; GetPrivateProfileString(_T("AutoExec"),_T("OnCompletion"),_T("recycle"),szOnCompletion,SIZEOF(szOnCompletion),mirandabootini); if(!lstrcmpi(szOnCompletion,_T("delete"))) DeleteFile(szIniPath); else if(!lstrcmpi(szOnCompletion,_T("recycle"))) { SHFILEOPSTRUCT shfo={0}; shfo.wFunc=FO_DELETE; shfo.pFrom=szIniPath; szIniPath[lstrlen(szIniPath)+1]=0; shfo.fFlags=FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; SHFileOperation(&shfo); } else if(!lstrcmpi(szOnCompletion,_T("rename"))) { TCHAR szRenamePrefix[MAX_PATH]; TCHAR szNewPath[MAX_PATH]; GetPrivateProfileString(_T("AutoExec"),_T("RenamePrefix"),_T("done_"),szRenamePrefix,SIZEOF(szRenamePrefix),mirandabootini); lstrcpy(szNewPath,szFindPath); lstrcat(szNewPath,szRenamePrefix); lstrcat(szNewPath,fd.cFileName); MoveFile(szIniPath,szNewPath); } else if(!lstrcmpi(szOnCompletion,_T("ask"))) DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(IDD_INIIMPORTDONE),NULL,IniImportDoneDlgProc,(LPARAM)szIniPath); } } while (FindNextFile(hFind, &fd)); FindClose(hFind); mir_free(szSafeSections); mir_free(szUnsafeSections); }
// Called when all the modules are loaded static int ModulesLoaded(WPARAM, LPARAM) { variables_enabled = ServiceExists(MS_VARS_FORMATSTRING); // Folders plugin support if (hDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Dictionaries"), DICTIONARIES_FOLDER)) { dictionariesFolder = (TCHAR *)mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hDictionariesFolder, dictionariesFolder, MAX_PATH, _T(".")); } else dictionariesFolder = Utils_ReplaceVarsT(DICTIONARIES_FOLDER); if (hCustomDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Custom Dictionaries"), CUSTOM_DICTIONARIES_FOLDER)) { customDictionariesFolder = (TCHAR *)mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hCustomDictionariesFolder, customDictionariesFolder, MAX_PATH, _T(".")); } else customDictionariesFolder = Utils_ReplaceVarsT(CUSTOM_DICTIONARIES_FOLDER); if (hFlagsDllFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Flags DLL"), FLAGS_DLL_FOLDER)) { flagsDllFolder = (TCHAR *)mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hFlagsDllFolder, flagsDllFolder, MAX_PATH, _T(".")); } else flagsDllFolder = Utils_ReplaceVarsT(FLAGS_DLL_FOLDER); InitOptions(); GetAvaibleDictionaries(languages, dictionariesFolder, customDictionariesFolder); LoadOptions(); if (opts.use_flags) { // Load flags dll TCHAR flag_file[MAX_PATH]; mir_sntprintf(flag_file, _T("%s\\flags_icons.dll"), flagsDllFolder); HMODULE hFlagsDll = LoadLibraryEx(flag_file, NULL, LOAD_LIBRARY_AS_DATAFILE); TCHAR path[MAX_PATH]; GetModuleFileName(hInst, path, MAX_PATH); SKINICONDESC sid = { 0 }; sid.flags = SIDF_ALL_TCHAR | SIDF_SORTED; sid.section.t = LPGENT("Spell Checker") _T("/") LPGENT("Flags"); // Get language flags for (int i = 0; i < languages.getCount(); i++) { Dictionary *p = languages[i]; sid.description.t = p->full_name; char lang[32]; mir_snprintf(lang, "spell_lang_%d", i); sid.pszName = lang; HICON hFlag = NULL, hFlagIcoLib = NULL; if (hFlagsDll != NULL) hFlag = (HICON)LoadImage(hFlagsDll, p->language, IMAGE_ICON, 16, 16, 0); if (hFlag != NULL) { sid.hDefaultIcon = hFlag; sid.defaultFile.t = NULL; sid.iDefaultIndex = 0; } else { hFlagIcoLib = IcoLib_GetIcon("spellchecker_unknown"); sid.hDefaultIcon = hFlagIcoLib; sid.defaultFile.t = NULL; sid.iDefaultIndex = 0; } // Oki, lets add to IcoLib, then p->hIcolib = IcoLib_AddIcon(&sid); if (hFlag != NULL) DestroyIcon(hFlag); else IcoLib_ReleaseIcon(hFlagIcoLib); } FreeLibrary(hFlagsDll); } for (int j = 0; j < languages.getCount(); j++) { Dictionary *dict = languages[j]; TCHAR filename[MAX_PATH]; mir_sntprintf(filename, _T("%s\\%s.ar"), customDictionariesFolder, dict->language); dict->autoReplace = new AutoReplaceMap(filename, dict); if (mir_tstrcmp(dict->language, opts.default_language) == 0) dict->load(); } HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged); HookEvent(ME_MSG_WINDOWEVENT, MsgWindowEvent); HookEvent(ME_MSG_WINDOWPOPUP, MsgWindowPopup); HookEvent(ME_MSG_ICONPRESSED, IconPressed); StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE_NAME; sid.hIconDisabled = IcoLib_GetIcon("spellchecker_disabled"); sid.flags = MBF_TCHAR | MBF_HIDDEN; for (int i = 0; i < languages.getCount(); i++) { sid.dwId = i; TCHAR tmp[128]; mir_sntprintf(tmp, _T("%s - %s"), TranslateT("Spell Checker"), languages[i]->full_name); sid.tszTooltip = tmp; sid.hIcon = (opts.use_flags) ? IcoLib_GetIconByHandle(languages[i]->hIcolib) : IcoLib_GetIcon("spellchecker_enabled"); Srmm_AddIcon(&sid); } HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = "Spell Checker/Toggle"; hkd.pszSection = LPGEN("Spell Checker"); hkd.pszDescription = LPGEN("Enable/disable spell checker"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_ALT, 'S'); hkd.lParam = HOTKEY_ACTION_TOGGLE; Hotkey_Register(&hkd); loaded = TRUE; return 0; }
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TCHAR folder_buff[MAX_PATH] = { 0 }; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); memcpy(&new_options, &options, sizeof(Options)); if (ServiceExists(MS_FOLDERS_GET_PATH)) { ShowWindow(GetDlgItem(hwndDlg, IDC_ED_FOLDER), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_BUT_BROWSE), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_LNK_FOLDERS), SW_SHOW); } else { TCHAR tszTooltipText[4096]; mir_sntprintf(tszTooltipText, _countof(tszTooltipText), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), _T("%miranda_path%"), TranslateT("path to Miranda root folder"), _T("%miranda_profilesdir%"), TranslateT("path to folder containing Miranda profiles"), _T("%miranda_profilename%"), TranslateT("name of current Miranda profile (filename, without extension)"), _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"), _T("%appdata%"), TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"), _T("%username%"), TranslateT("username for currently logged-on Windows user"), _T("%mydocuments%"), TranslateT("\"My Documents\" folder for currently logged-on Windows user"), _T("%desktop%"), TranslateT("\"Desktop\" folder for currently logged-on Windows user"), _T("%xxxxxxx%"), TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)") ); hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_ED_FOLDER), tszTooltipText, TranslateT("Variables")); } SetDlgState(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_PT, CB_ADDSTRING, 0, (LPARAM)TranslateT("days")); SendDlgItemMessage(hwndDlg, IDC_PT, CB_ADDSTRING, 0, (LPARAM)TranslateT("hours")); SendDlgItemMessage(hwndDlg, IDC_PT, CB_ADDSTRING, 0, (LPARAM)TranslateT("minutes")); switch (new_options.period_type) { case PT_DAYS: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 0, 0); break; case PT_HOURS: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 1, 0); break; case PT_MINUTES: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 2, 0); break; } if (hPathTip) SetTimer(hwndDlg, 0, 3000, NULL); return TRUE; case WM_COMMAND: if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { switch (LOWORD(wParam)) { case IDC_ED_PERIOD: case IDC_ED_FOLDER: case IDC_ED_NUMBACKUPS: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); if (HIWORD(wParam) == BN_CLICKED) { switch (LOWORD(wParam)) { case IDC_RAD_DISABLED: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DISABLED)) new_options.backup_types = BT_DISABLED; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_RAD_START: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_START)) new_options.backup_types |= BT_START; else new_options.backup_types &= ~BT_START; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_RAD_EXIT: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_EXIT)) new_options.backup_types |= BT_EXIT; else new_options.backup_types &= ~BT_EXIT; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_RAD_PERIODIC: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_PERIODIC)) new_options.backup_types |= BT_PERIODIC; else new_options.backup_types &= ~BT_PERIODIC; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_BUT_BROWSE: { BROWSEINFO bi; bi.hwndOwner = hwndDlg; bi.pidlRoot = 0; bi.pszDisplayName = folder_buff; bi.lpszTitle = TranslateT("Select backup folder"); bi.ulFlags = BIF_NEWDIALOGSTYLE; bi.lpfn = BrowseProc; bi.lParam = 0; bi.iImage = 0; LPCITEMIDLIST pidl = SHBrowseForFolder(&bi); if (pidl != 0) { SHGetPathFromIDList(pidl, folder_buff); SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); CoTaskMemFree((void *)pidl); } break; } case IDC_BUT_NOW: BackupStart(NULL); break; case IDC_CHK_NOPROG: new_options.disable_progress = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPROG); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_CHK_NOPOPUP: new_options.disable_popups = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPOPUP); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_CHK_USEZIP: new_options.use_zip = IsDlgButtonChecked(hwndDlg, IDC_CHK_USEZIP); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_LNK_FOLDERS: { OPENOPTIONSDIALOG ood = { 0 }; ood.cbSize = sizeof(ood); ood.pszGroup = "Customize"; ood.pszPage = "Folders"; Options_Open(&ood); break; } } } break; case WM_TIMER: if (IsWindow(hPathTip)) KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { TCHAR buff[10]; GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, _countof(buff)); new_options.period = _ttoi(buff); GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, _countof(buff)); new_options.num_backups = _ttoi(buff); switch (SendDlgItemMessage(hwndDlg, IDC_PT, CB_GETCURSEL, 0, 0)) { case 0: new_options.period_type = PT_DAYS; break; case 1: new_options.period_type = PT_HOURS; break; case 2: new_options.period_type = PT_MINUTES; break; } GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, _countof(folder_buff)); { TCHAR backupfolder[MAX_PATH] = { 0 }; BOOL folder_ok = TRUE; TCHAR *tmp = Utils_ReplaceVarsT(folder_buff); if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':') _tcsncpy_s(backupfolder, tmp, _TRUNCATE); else mir_sntprintf(backupfolder, _countof(backupfolder), _T("%s\\%s"), profilePath, tmp); mir_free(tmp); int err = CreateDirectoryTreeT(backupfolder); if (err != ERROR_ALREADY_EXISTS && err != 0) { TCHAR msg_buff[512]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0); MessageBox(0, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR); folder_ok = FALSE; } if (folder_ok) { _tcsncpy_s(new_options.folder, folder_buff, _TRUNCATE); memcpy(&options, &new_options, sizeof(Options)); SaveOptions(); } else { memcpy(&new_options, &options, sizeof(Options)); SetDlgState(hwndDlg); } } return TRUE; } break; case WM_DESTROY: if (hPathTip) { KillTimer(hwndDlg, 0); DestroyWindow(hPathTip); hPathTip = 0; } return FALSE; } return FALSE; }
INT addEvent(WPARAM hContact, LPARAM hDBEvent) { BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1); if (!fEnabled || !hContact || !hDBEvent) return FALSE; /// unspecifyed error char* pszProto = GetContactProto(hContact); int status = CallProtoService(pszProto, PS_GETSTATUS, 0, 0); if (status == ID_STATUS_ONLINE || status == ID_STATUS_FREECHAT || status == ID_STATUS_INVISIBLE) return FALSE; DBEVENTINFO dbei = {sizeof(dbei)}; db_event_get(hDBEvent, &dbei); /// detect size of msg if ((dbei.eventType != EVENTTYPE_MESSAGE) || (dbei.flags == DBEF_READ)) return FALSE; /// we need EVENTTYPE_MESSAGE event.. else { /// needed event has occured.. DBVARIANT dbv; if (!dbei.cbBlob) /// invalid size return FALSE; if (db_get_ts(hContact,"Protocol","p",&dbv)) // Contact with no protocol ?!! return FALSE; else db_free(&dbv); if(db_get_b(hContact, "CList", "NotOnList", 0)) return FALSE; if(db_get_b(hContact, protocolname, "TurnedOn", 0)) return FALSE; if (!( dbei.flags & DBEF_SENT)) { int timeBetween=time(NULL)-db_get_dw(hContact,protocolname,"LastReplyTS",0); if (timeBetween>interval || db_get_w(hContact,protocolname,"LastStatus",0)!=status) { char szStatus[6]={0}; int msgLen=1; int isQun=db_get_b(hContact,pszProto,"IsQun",0); if (isQun) return FALSE; mir_snprintf(szStatus,_countof(szStatus),"%d",status); if (!db_get_ts(NULL,protocolname,szStatus,&dbv)) { if (*dbv.ptszVal) { DBVARIANT dbvHead={0}, dbvNick={0}; CMString ptszTemp; TCHAR *ptszTemp2; db_get_ts(hContact,pszProto,"Nick",&dbvNick); if (mir_tstrcmp(dbvNick.ptszVal, NULL) == 0) { db_free(&dbvNick); return FALSE; } msgLen += (int)mir_tstrlen(dbv.ptszVal); if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbvHead)) { ptszTemp = dbvHead.ptszVal; ptszTemp.Replace(_T("%user%"), dbvNick.ptszVal); msgLen += (int)(mir_tstrlen(ptszTemp)); } ptszTemp2 = (TCHAR*)mir_alloc(sizeof(TCHAR) * (msgLen+5)); mir_sntprintf(ptszTemp2, msgLen+5, _T("%s\r\n\r\n%s"), ptszTemp.c_str(), dbv.ptszVal); if (ServiceExists(MS_VARS_FORMATSTRING)) { FORMATINFO fi = { 0 }; fi.cbSize = sizeof(fi); fi.flags = FIF_TCHAR; fi.tszFormat = ptszTemp2; ptszTemp = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); } else ptszTemp = Utils_ReplaceVarsT(ptszTemp2); T2Utf pszUtf(ptszTemp); CallContactService(hContact, PSS_MESSAGE, 0, pszUtf); dbei.cbSize = sizeof(dbei); dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT; //DBEF_READ; dbei.szModule = pszProto; dbei.timestamp = time(NULL); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; dbei.pBlob = (PBYTE)pszUtf; db_event_add(hContact, &dbei); mir_free(ptszTemp2); if (dbvNick.ptszVal) db_free(&dbvNick); if (dbvHead.ptszVal) db_free(&dbvHead); } db_free(&dbv); } } } db_set_dw(hContact,protocolname,"LastReplyTS",time(NULL)); db_set_w(hContact,protocolname,"LastStatus",status); } return 0; }
void PrintVersionInfo(CMString& buffer, unsigned flags) { GetProcessorString(buffer); buffer.Append(TEXT("\r\n")); GetFreeMemoryString(buffer); buffer.Append(TEXT("\r\n")); GetOSDisplayString(buffer); buffer.Append(TEXT("\r\n")); GetInternetExplorerVersion(buffer); buffer.Append(TEXT("\r\n")); GetAdminString(buffer); buffer.Append(TEXT("\r\n")); GetLanguageString(buffer); buffer.Append(TEXT("\r\n")); TCHAR *profpathfull = Utils_ReplaceVarsT(profpath); if (flags & VI_FLAG_PRNVAR) { GetFreeDiskString(profpathfull, buffer); buffer.Append(TEXT("\r\n")); } buffer.AppendFormat(TEXT("\r\nMiranda NG Version: %s"), vertxt); GetWow64String(buffer); buffer.Append(TEXT("\r\n")); TCHAR path[MAX_PATH], mirtime[30]; GetModuleFileName(NULL, path, MAX_PATH); GetLastWriteTime(path, mirtime, 30); buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime); TCHAR profpn[MAX_PATH]; mir_sntprintf(profpn, _countof(profpn), TEXT("%s\\%s"), profpathfull, profname); buffer.AppendFormat(TEXT("Profile: %s\r\n"), profpn); if (flags & VI_FLAG_PRNVAR) { WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(profpn, &FindFileData); if (hFind != INVALID_HANDLE_VALUE) { FindClose(hFind); unsigned __int64 fsize = (unsigned __int64)FindFileData.nFileSizeHigh << 32 | FindFileData.nFileSizeLow; buffer.AppendFormat(TEXT("Profile size: %I64u Bytes\r\n"), fsize), GetLastWriteTime(&FindFileData.ftCreationTime, mirtime, 30); buffer.AppendFormat(TEXT("Profile creation date: %s\r\n"), mirtime); } } mir_free(profpathfull); GetLanguagePackString(buffer); buffer.Append(TEXT("\r\n")); // buffer.AppendFormat(TEXT("Nightly: %s\r\n"), _tcsstr(vertxt, TEXT("alpha")) ? TEXT("Yes") : TEXT("No")); // buffer.AppendFormat(TEXT("Unicode: %s\r\n"), _tcsstr(vertxt, TEXT("Unicode")) ? TEXT("Yes") : TEXT("No")); GetPluginsString(buffer, flags); if (flags & VI_FLAG_WEATHER) { buffer.AppendFormat(TEXT("\r\n%sWeather ini files:%s\r\n-------------------------------------------------------------------------------\r\n"), (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT("")); GetWeatherStrings(buffer, flags); } if (flags & VI_FLAG_PRNVAR && !servicemode) { buffer.AppendFormat(TEXT("\r\n%sProtocols and Accounts:%s\r\n-------------------------------------------------------------------------------\r\n"), (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT("")); GetProtocolStrings(buffer); } if (flags & VI_FLAG_PRNVAR) { buffer.AppendFormat(TEXT("\r\n%sIcon Packs:%s\r\n-------------------------------------------------------------------------------\r\n"), (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT("")); GetIconStrings(buffer); } if (flags & VI_FLAG_PRNDLL) { __try { buffer.Append(TEXT("\r\nLoaded Modules:\r\n-------------------------------------------------------------------------------\r\n")); EnumerateLoadedModules64(GetCurrentProcess(), LoadedModules64, &buffer); } __except (EXCEPTION_EXECUTE_HANDLER) {} }