From 6c2775a7fa796220a8e6c4e6c5e4f27783f4d7f3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 14 Sep 2014 13:08:56 +0000 Subject: CrashDumper: - fails to start in service mode; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@10444 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/src/crshdmp.cpp | 55 +++++----- plugins/CrashDumper/src/crshdmp_icons.cpp | 4 +- plugins/CrashDumper/src/dumper.cpp | 108 ++++++++++---------- plugins/CrashDumper/src/exhndlr.cpp | 21 ++-- plugins/CrashDumper/src/ui.cpp | 102 +++++++++---------- plugins/CrashDumper/src/upload.cpp | 54 +++++----- plugins/CrashDumper/src/utils.cpp | 160 +++++++++++++++--------------- plugins/CrashDumper/src/version.h | 18 ++-- 8 files changed, 255 insertions(+), 267 deletions(-) diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 710eae0a11..5e8024bdfa 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -50,7 +50,7 @@ static const PLUGININFOEX pluginInfoEx = __AUTHORWEB, UNICODE_AWARE, // {F62C1D7A-FFA4-4065-A251-4C9DD9101CC8} - {0xf62c1d7a, 0xffa4, 0x4065, {0xa2, 0x51, 0x4c, 0x9d, 0xd9, 0x10, 0x1c, 0xc8}} + { 0xf62c1d7a, 0xffa4, 0x4065, { 0xa2, 0x51, 0x4c, 0x9d, 0xd9, 0x10, 0x1c, 0xc8 } } }; const PLUGININFOEX* GetPluginInfoEx(void) { return &pluginInfoEx; } @@ -62,7 +62,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVers } // MirandaInterfaces - returns the protocol interface to the core -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SERVICEMODE, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SERVICEMODE, MIID_LAST }; INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) { @@ -72,9 +72,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) mir_sntprintf(path, MAX_PATH, TEXT("%s\\VersionInfo.txt"), VersionInfoFolder); HANDLE hDumpFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - - if (hDumpFile != INVALID_HANDLE_VALUE) - { + if (hDumpFile != INVALID_HANDLE_VALUE) { CMString buffer; PrintVersionInfo(buffer, (unsigned int)lParam | VI_FLAG_PRNVAR); @@ -86,8 +84,7 @@ INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam) ShowMessage(3, TranslateT("VersionInfo stored into file %s"), path); } - else - ShowMessage(2, TranslateT("VersionInfo file %s is inaccessible"), path); + else ShowMessage(2, TranslateT("VersionInfo file %s is inaccessible"), path); return 0; } @@ -121,15 +118,13 @@ INT_PTR UploadVersionInfo(WPARAM, LPARAM lParam) INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM) { - if(hViewWnd) - { + if (hViewWnd) { SetForegroundWindow(hViewWnd); SetFocus(hViewWnd); } - else - { - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), NULL, - DlgProcView, wParam ? (VI_FLAG_PRNVAR | VI_FLAG_PRNDLL) : VI_FLAG_PRNVAR); + else { + DWORD dwFlags = wParam ? (VI_FLAG_PRNVAR | VI_FLAG_PRNDLL) : VI_FLAG_PRNVAR; + hViewWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), NULL, DlgProcView, dwFlags); } return 0; @@ -137,8 +132,7 @@ INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM) INT_PTR OpenUrl(WPARAM wParam, LPARAM) { - switch (wParam) - { + switch (wParam) { case 0: ShellExecute(NULL, TEXT("explore"), CrashLogFolder, NULL, NULL, SW_SHOW); break; @@ -153,20 +147,21 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM) INT_PTR ServiceModeLaunch(WPARAM, LPARAM) { servicemode = true; + DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VIEWVERSION), NULL, DlgProcView, VI_FLAG_PRNVAR | VI_FLAG_PRNDLL); return SERVICE_ONLYDB; } static int FoldersPathChanged(WPARAM, LPARAM) { - FOLDERSGETDATA fgd = {0}; + FOLDERSGETDATA fgd = { 0 }; fgd.cbSize = sizeof(FOLDERSGETDATA); fgd.nMaxPathSize = MAX_PATH; fgd.szPathT = CrashLogFolder; fgd.flags = FF_TCHAR; - CallService(MS_FOLDERS_GET_PATH, (WPARAM) hCrashLogFolder, (LPARAM) &fgd); + CallService(MS_FOLDERS_GET_PATH, (WPARAM)hCrashLogFolder, (LPARAM)&fgd); fgd.szPathT = VersionInfoFolder; - CallService(MS_FOLDERS_GET_PATH, (WPARAM) hVerInfoFolder, (LPARAM) &fgd); + CallService(MS_FOLDERS_GET_PATH, (WPARAM)hVerInfoFolder, (LPARAM)&fgd); return 0; } @@ -218,8 +213,8 @@ static int ModulesLoaded(WPARAM, LPARAM) crs_a2t(vertxt, temp); profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat")); - if ( ServiceExists(MS_FOLDERS_REGISTER_PATH)) - profpath = mir_tstrdup( _T("%miranda_userdata%")); + if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) + profpath = mir_tstrdup(_T("%miranda_userdata%")); else profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); @@ -229,7 +224,7 @@ static int ModulesLoaded(WPARAM, LPARAM) SetExceptionHandler(); hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder); - hVerInfoFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Version Information"), VersionInfoFolder); + hVerInfoFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Version Information"), VersionInfoFolder); FoldersPathChanged(0, 0); @@ -263,40 +258,40 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.pszService = MS_CRASHDUMPER_STORETOFILE; Menu_AddMainMenuItem(&mi); - mi.position = 2000089997; + mi.position = 2000089997; mi.ptszName = LPGENT("Show"); mi.icolibItem = GetIconHandle(IDI_VISHOW); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_AddMainMenuItem(&mi); mi.popupPosition = 1; - mi.position = 2000089998; + mi.position = 2000089998; mi.ptszName = LPGENT("Show with DLLs"); mi.icolibItem = GetIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_AddMainMenuItem(&mi); mi.popupPosition = 0; - mi.position = 2000089999; + mi.position = 2000089999; mi.ptszName = LPGENT("Upload"); mi.icolibItem = GetIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_UPLOAD; Menu_AddMainMenuItem(&mi); - mi.position = 2000099990; + mi.position = 2000099990; mi.ptszName = LPGENT("Open crash report directory"); mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_FILE); mi.pszService = MS_CRASHDUMPER_URL; Menu_AddMainMenuItem(&mi); mi.popupPosition = 1; - mi.position = 2000099991; + mi.position = 2000099991; mi.ptszName = LPGENT("Open miranda-vi.org"); mi.icolibItem = LoadSkinnedIconHandle(SKINICON_EVENT_URL); mi.pszService = MS_CRASHDUMPER_URL; Menu_AddMainMenuItem(&mi); - HOTKEYDESC hk = {0}; + HOTKEYDESC hk = { 0 }; hk.cbSize = sizeof(hk); hk.pszSection = PluginName; @@ -328,6 +323,9 @@ static int PreShutdown(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void) { + if (LoadLibraryA("riched20.dll") == NULL) + return 1; + clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0; dtsubfldr = db_get_b(NULL, PluginName, "SubFolders", 1) != 0; @@ -367,8 +365,7 @@ extern "C" int __declspec(dllexport) Unload(void) extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/) { - switch(fdwReason) - { + switch (fdwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hinstDLL); hInst = hinstDLL; diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index 5ab76319b0..dfead53dd0 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -34,7 +34,7 @@ void InitIcons(void) HICON LoadIconEx(int iconId, bool big) { - for (int i=0; i < SIZEOF(iconList); i++) + for (int i = 0; i < SIZEOF(iconList); i++) if (iconList[i].defIconID == iconId) return Skin_GetIconByHandle(iconList[i].hIcolib); @@ -43,7 +43,7 @@ HICON LoadIconEx(int iconId, bool big) HANDLE GetIconHandle(int iconId) { - for (int i=0; i < SIZEOF(iconList); i++) + for (int i = 0; i < SIZEOF(iconList); i++) if (iconList[i].defIconID == iconId) return iconList[i].hIcolib; diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index aac4ecc9e1..4418b40111 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -29,7 +29,7 @@ void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr) exceptionInfo.ExceptionPointers = exc_ptr; exceptionInfo.ClientPointers = false; - MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), + MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpNormal, &exceptionInfo, NULL, NULL); } @@ -87,7 +87,7 @@ BOOL CALLBACK LoadedModulesFind64(LPCSTR ModuleName, DWORD64 ModuleBase, ULONG M if ((DWORD)(data->Offset - ModuleBase) < ModuleSize) { const size_t len = SIZEOF(data->pModule->ModuleName); strncpy(data->pModule->ModuleName, ModuleName, len); - data->pModule->ModuleName[len-1] = 0; + data->pModule->ModuleName[len - 1] = 0; data->pModule->BaseOfImage = ModuleBase; @@ -120,7 +120,7 @@ void GetLinkedModulesInfo(TCHAR *moduleName, CMString &buffer) PIMAGE_NT_HEADERS nthdrs = ImageNtHeader(dllAddr); ULONG tableSize; - PIMAGE_IMPORT_DESCRIPTOR importData = (PIMAGE_IMPORT_DESCRIPTOR)ImageDirectoryEntryToData(dllAddr, FALSE, + PIMAGE_IMPORT_DESCRIPTOR importData = (PIMAGE_IMPORT_DESCRIPTOR)ImageDirectoryEntryToData(dllAddr, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &tableSize); if (importData) { while (importData->Name) { @@ -133,23 +133,23 @@ void GetLinkedModulesInfo(TCHAR *moduleName, CMString &buffer) } bool found = false; - PIMAGE_EXPORT_DIRECTORY exportData = (PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(dllAddr, FALSE, + PIMAGE_EXPORT_DIRECTORY exportData = (PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(dllAddr, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &tableSize); if (exportData) { ULONG* funcAddr = (ULONG*)ImageRvaToVa(nthdrs, dllAddr, exportData->AddressOfNames, NULL); - for(unsigned i=0; iNumberOfNames && !found; ++i) { + for (unsigned i = 0; i < exportData->NumberOfNames && !found; ++i) { char* funcName = (char*)ImageRvaToVa(nthdrs, dllAddr, funcAddr[i], NULL); - found = strcmp(funcName, "MirandaPluginInfoEx") == 0 || strcmp(funcName, "MirandaPluginInfo") == 0; + found = strcmp(funcName, "MirandaPluginInfoEx") == 0 || strcmp(funcName, "MirandaPluginInfo") == 0; if (strcmp(funcName, "DatabasePluginInfo") == 0) { buffer.Append(TEXT(" This dll is a Miranda database plugin, another database is active right now\r\n")); found = true; } } } - if (!found) + if (!found) buffer.Append(TEXT(" This dll is not a Miranda plugin and should be removed from plugins directory\r\n")); } - __except(EXCEPTION_EXECUTE_HANDLER) {} + __except (EXCEPTION_EXECUTE_HANDLER) {} UnmapViewOfFile(dllAddr); CloseHandle(hDllMapping); @@ -174,7 +174,7 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) LPTSTR fname = _tcsrchr(path, TEXT('\\')); if (fname == NULL) fname = path; - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\*.dll")); + mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\*.dll")); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(path, &FindFileData); @@ -189,20 +189,20 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) do { bool loaded = false; - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\%s"), FindFileData.cFileName); + mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\%s"), FindFileData.cFileName); HMODULE hModule = GetModuleHandle(path); if (hModule == NULL && servicemode) { hModule = LoadLibrary(path); loaded = true; } - if (hModule == NULL) { + if (hModule == NULL) { if ((flags & VI_FLAG_PRNVAR) && IsPluginEnabled(FindFileData.cFileName)) { TCHAR timebuf[30] = TEXT(""); GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30); - ubuffer.AppendFormat(format, TEXT(' '), FindFileData.cFileName, + ubuffer.AppendFormat(format, TEXT(' '), FindFileData.cFileName, (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), - 0, 0, 0, 0, + 0, 0, 0, 0, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT(""), timebuf, "", TEXT("")); @@ -233,17 +233,17 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) GetFileVersionInfo(path, 0, verInfoSize, pVerInfo); VerQueryValue(pVerInfo, _T("\\"), (LPVOID*)&fi, &blockSize); v1 = HIWORD(fi->dwProductVersionMS), v2 = LOWORD(fi->dwProductVersionMS), - v3 = HIWORD(fi->dwProductVersionLS), v4 = LOWORD(fi->dwProductVersionLS); + v3 = HIWORD(fi->dwProductVersionLS), v4 = LOWORD(fi->dwProductVersionLS); mir_free(pVerInfo); } else { DWORD ver = pi->version; v1 = HIBYTE(HIWORD(ver)), v2 = LOBYTE(HIWORD(ver)), v3 = HIBYTE(LOWORD(ver)), v4 = LOBYTE(LOWORD(ver)); } - - lst->str.AppendFormat(format, ep ? TEXT('\xa4') : TEXT(' '), FindFileData.cFileName, + + lst->str.AppendFormat(format, ep ? TEXT('\xa4') : TEXT(' '), FindFileData.cFileName, (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), - v1, v2, v3, v4, + v1, v2, v3, v4, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT(""), timebuf, pi->shortName ? pi->shortName : "", unica); @@ -269,10 +269,10 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) } if (loaded) FreeLibrary(hModule); } - while (FindNextFile(hFind, &FindFileData)); + while (FindNextFile(hFind, &FindFileData)); FindClose(hFind); - buffer.AppendFormat(TEXT("\r\n%sActive Plugins (%u):%s\r\n"), + buffer.AppendFormat(TEXT("\r\n%sActive Plugins (%u):%s\r\n"), (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), count, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT("")); ListItem* lsttmp = dlllist; @@ -281,10 +281,10 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) ListItem* lsttmp1 = lsttmp->next; delete lsttmp; lsttmp = lsttmp1; - } + } if (ucount) { - buffer.AppendFormat(TEXT("\r\n%sUnloadable Plugins (%u):%s\r\n"), + buffer.AppendFormat(TEXT("\r\n%sUnloadable Plugins (%u):%s\r\n"), (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), ucount, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT("")); buffer.Append(ubuffer); } @@ -320,8 +320,8 @@ static void GetProtocolStrings(CMString& buffer) } for (j = 0; j < accCount; j++) { - for (i = 0; i < protoCountMy; i++) - if ( !strcmp(protoListMy[i], accList[j]->szProtoName)) + for (i = 0; i < protoCountMy; i++) + if (!strcmp(protoListMy[i], accList[j]->szProtoName)) break; if (i == protoCountMy) @@ -331,11 +331,11 @@ static void GetProtocolStrings(CMString& buffer) ProtoCount *protos = (ProtoCount*)alloca(sizeof(ProtoCount) * protoCountMy); memset(protos, 0, sizeof(ProtoCount) * protoCountMy); - for (j = 0; j < accCount; j++) + for (j = 0; j < accCount; j++) for (i = 0; i < protoCountMy; i++) - if ( !strcmp(protoListMy[i], accList[j]->szProtoName)) { + if (!strcmp(protoListMy[i], accList[j]->szProtoName)) { protos[i].nloaded = accList[j]->bDynDisabled != 0; - if ( IsAccountEnabled(accList[j])) + if (IsAccountEnabled(accList[j])) ++protos[i].countse; else ++protos[i].countsd; @@ -343,9 +343,9 @@ static void GetProtocolStrings(CMString& buffer) } for (i = 0; i < protoCountMy; i++) - buffer.AppendFormat(TEXT("%-24s %d - Enabled %d - Disabled %sLoaded\r\n"), - (TCHAR*)_A2T(protoListMy[i]), protos[i].countse, - protos[i].countsd, protos[i].nloaded ? _T("Not ") : _T("")); + buffer.AppendFormat(TEXT("%-24s %d - Enabled %d - Disabled %sLoaded\r\n"), + (TCHAR*)_A2T(protoListMy[i]), protos[i].countse, + protos[i].countsd, protos[i].nloaded ? _T("Not ") : _T("")); } @@ -356,7 +356,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) LPTSTR fname = _tcsrchr(path, TEXT('\\')); if (fname == NULL) fname = path; - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\*.ini")); + mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\*.ini")); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(path, &FindFileData); @@ -365,7 +365,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) do { if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName); + mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\plugins\\weather\\%s"), FindFileData.cFileName); HANDLE hDumpFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); @@ -395,7 +395,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) endid = strchr(id, '\n'); if (endid != NULL) *endid = 0; } - id += 5; + id += 5; } TCHAR timebuf[30] = TEXT(""); @@ -404,7 +404,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) static const TCHAR format[] = TEXT(" %s v.%s%S%s [%s] - %S\r\n"); - buffer.AppendFormat(format, FindFileData.cFileName, + buffer.AppendFormat(format, FindFileData.cFileName, (flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""), ver, (flags & VI_FLAG_FORMAT) ? TEXT("[/b]") : TEXT(""), @@ -412,7 +412,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) CloseHandle(hDumpFile); } } - while (FindNextFile(hFind, &FindFileData)); + while (FindNextFile(hFind, &FindFileData)); FindClose(hFind); } @@ -424,7 +424,7 @@ static void GetIconStrings(CMString& buffer) LPTSTR fname = _tcsrchr(path, TEXT('\\')); if (fname == NULL) fname = path; - mir_sntprintf(fname, MAX_PATH-(fname-path), TEXT("\\Icons\\*.*")); + mir_sntprintf(fname, MAX_PATH - (fname - path), TEXT("\\Icons\\*.*")); WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(path, &FindFileData); @@ -438,7 +438,7 @@ static void GetIconStrings(CMString& buffer) buffer.AppendFormat(TEXT(" %s [%s]\r\n"), FindFileData.cFileName, timebuf); } - while (FindNextFile(hFind, &FindFileData)); + while (FindNextFile(hFind, &FindFileData)); FindClose(hFind); } @@ -469,14 +469,14 @@ void PrintVersionInfo(CMString& buffer, unsigned flags) buffer.Append(TEXT("\r\n")); } - buffer.AppendFormat(TEXT("\r\nMiranda NG Version: %s"), vertxt); + 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); + GetModuleFileName(NULL, path, MAX_PATH); GetLastWriteTime(path, mirtime, 30); - buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime); + buffer.AppendFormat(TEXT("Build time: %s\r\n"), mirtime); TCHAR profpn[MAX_PATH]; mir_sntprintf(profpn, SIZEOF(profpn), TEXT("%s\\%s"), profpathfull, profname); @@ -491,7 +491,7 @@ void PrintVersionInfo(CMString& buffer, unsigned flags) FindClose(hFind); unsigned __int64 fsize = (unsigned __int64)FindFileData.nFileSizeHigh << 32 | FindFileData.nFileSizeLow; - buffer.AppendFormat(TEXT("Profile size: %I64u Bytes\r\n"), fsize), + 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); @@ -533,19 +533,19 @@ void PrintVersionInfo(CMString& buffer, unsigned flags) buffer.Append(TEXT("\r\nLoaded Modules:\r\n-------------------------------------------------------------------------------\r\n")); EnumerateLoadedModules64(GetCurrentProcess(), LoadedModules64, &buffer); } - __except(EXCEPTION_EXECUTE_HANDLER) {} + __except (EXCEPTION_EXECUTE_HANDLER) {} } } void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHAR* msg) { - if (exc_ptr->ContextRecord == NULL || (exc_ptr->ContextRecord->ContextFlags & CONTEXT_CONTROL) == 0) + if (exc_ptr->ContextRecord == NULL || (exc_ptr->ContextRecord->ContextFlags & CONTEXT_CONTROL) == 0) return; CONTEXT context = *exc_ptr->ContextRecord; - STACKFRAME64 frame = {0}; + STACKFRAME64 frame = { 0 }; #if defined(_AMD64_) #define IMAGE_FILE_MACHINE IMAGE_FILE_MACHINE_AMD64 @@ -575,8 +575,8 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA CMString buffer; buffer.AppendFormat(TEXT("Miranda Crash Report from %s. Crash Dumper v.%d.%d.%d.%d\r\n"), - curtime, - HIBYTE(HIWORD(pluginInfoEx->version)), LOBYTE(HIWORD(pluginInfoEx->version)), + curtime, + HIBYTE(HIWORD(pluginInfoEx->version)), LOBYTE(HIWORD(pluginInfoEx->version)), HIBYTE(LOWORD(pluginInfoEx->version)), LOBYTE(LOWORD(pluginInfoEx->version))); int crashpos = buffer.GetLength(); @@ -592,16 +592,16 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA buffer.Append(TEXT("\r\nStack Trace:\r\n---------------------------------------------------------------\r\n")); - for (int i=81; --i;) { - char symbuf[sizeof(IMAGEHLP_SYMBOL64) + MAX_SYM_NAME * sizeof(TCHAR) + 4] = {0}; + for (int i = 81; --i;) { + char symbuf[sizeof(IMAGEHLP_SYMBOL64) + MAX_SYM_NAME * sizeof(TCHAR) + 4] = { 0 }; PIMAGEHLP_SYMBOL64 pSym = (PIMAGEHLP_SYMBOL64)symbuf; pSym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); pSym->MaxNameLength = MAX_SYM_NAME; - IMAGEHLP_LINE64 Line = {0}; + IMAGEHLP_LINE64 Line = { 0 }; Line.SizeOfStruct = sizeof(Line); - IMAGEHLP_MODULE64 Module = {0}; + IMAGEHLP_MODULE64 Module = { 0 }; Module.SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V2); char undName[MAX_SYM_NAME] = ""; @@ -611,7 +611,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA DWORD offsetFromLine = 0; if (!StackWalk64(IMAGE_FILE_MACHINE, hProcess, GetCurrentThread(), &frame, &context, - NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL)) break; + NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL)) break; if (frame.AddrPC.Offset == frame.AddrReturn.Offset) break; @@ -637,7 +637,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA else if (undName[0] != 0) name = undName; else if (pSym->Name[0] != 0) - name = pSym->Name; + name = pSym->Name; else name = "(function-name not available)"; @@ -662,8 +662,8 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA static const TCHAR formatd[] = TEXT("%p (%S %p): %S (%d): %S\r\n"); - buffer.AppendFormat(formatd, - (LPVOID)frame.AddrPC.Offset, moduleName, (LPVOID)Module.BaseOfImage, + buffer.AppendFormat(formatd, + (LPVOID)frame.AddrPC.Offset, moduleName, (LPVOID)Module.BaseOfImage, lineFileName, Line.LineNumber, name); } SymCleanup(hProcess); @@ -681,6 +681,6 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA if (len > 8192) free(dst); - if (db_get_b(0,PluginName,"ShowCrashMessageBox",1) && msg && MessageBox(NULL, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES) + if (db_get_b(0, PluginName, "ShowCrashMessageBox", 1) && msg && MessageBox(NULL, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES) StoreStringToClip(buffer); } diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index c2bc9ce8f5..e110e43eff 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -24,19 +24,18 @@ void RemoveExceptionHandler(void) int myDebugFilter(unsigned int code, PEXCEPTION_POINTERS ep) { - if (code == VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND) || - code == VcppException(ERROR_SEVERITY_ERROR, ERROR_PROC_NOT_FOUND)) - { + if (code == VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND) || + code == VcppException(ERROR_SEVERITY_ERROR, ERROR_PROC_NOT_FOUND)) { PDelayLoadInfo dlld = (PDelayLoadInfo)ep->ExceptionRecord->ExceptionInformation[0]; char str[256]; int off = mir_snprintf(str, SIZEOF(str), "dbghelp.dll v.5.0 or later required to provide a crash report\n"); - off += mir_snprintf(str+off, SIZEOF(str)-off, "Missing Module: %s ", dlld->szDll); + off += mir_snprintf(str + off, SIZEOF(str) - off, "Missing Module: %s ", dlld->szDll); if (dlld->dlp.fImportByName) - mir_snprintf(str+off, SIZEOF(str)-off, "Function: %s ", dlld->dlp.szProcName); + mir_snprintf(str + off, SIZEOF(str) - off, "Function: %s ", dlld->dlp.szProcName); else - mir_snprintf(str+off, SIZEOF(str)-off, "Ordinal: %x ", dlld->dlp.dwOrdinal); + mir_snprintf(str + off, SIZEOF(str) - off, "Ordinal: %x ", dlld->dlp.dwOrdinal); MessageBoxA(NULL, str, "Miranda Crash Dumper", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST); } @@ -63,7 +62,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) } else mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.mdmp"), CrashLogFolder, - st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); + st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); if (hDumpFile != INVALID_HANDLE_VALUE) @@ -73,7 +72,9 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST); } - __except(EXCEPTION_EXECUTE_HANDLER) {} + __except (EXCEPTION_EXECUTE_HANDLER) + { + } bool empty = GetFileSize(hDumpFile, NULL) == 0; CloseHandle(hDumpFile); @@ -88,7 +89,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) } else mir_sntprintf(path, MAX_PATH, TEXT("%s\\crash%02d%02d%02d%02d%02d%02d.txt"), CrashLogFolder, - st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); + st.wYear, st.wMonth, st.wDay, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); hDumpFile = CreateFile(path, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); @@ -97,7 +98,7 @@ void myfilterWorker(PEXCEPTION_POINTERS exc_ptr, bool notify) if (hDumpFile != INVALID_HANDLE_VALUE) CreateCrashReport(hDumpFile, exc_ptr, notify ? path : NULL); } - __except(myDebugFilter(GetExceptionCode(), GetExceptionInformation())) {} + __except (myDebugFilter(GetExceptionCode(), GetExceptionInformation())) {} bool empty1 = GetFileSize(hDumpFile, NULL) == 0; CloseHandle(hDumpFile); diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 66da7e6b6c..5566165478 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -21,30 +21,27 @@ along with this program. If not, see . HWND hViewWnd; extern HINSTANCE hInst; - -HDWP MyResizeWindow (HDWP hDwp, HWND hwndDlg, HWND hwndCtrl, int nHorizontalOffset, int nVerticalOffset, - int nWidthOffset, int nHeightOffset) +HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndCtrl, int nHorizontalOffset, int nVerticalOffset, int nWidthOffset, int nHeightOffset) { - POINT pt; - RECT rcinit; - // get current bounding rectangle + RECT rcinit; GetWindowRect(hwndCtrl, &rcinit); // get current top left point + POINT pt; pt.x = rcinit.left; pt.y = rcinit.top; ScreenToClient(hwndDlg, &pt); return DeferWindowPos(hDwp, hwndCtrl, NULL, - pt.x + nHorizontalOffset, + pt.x + nHorizontalOffset, pt.y + nVerticalOffset, - rcinit.right - rcinit.left + nWidthOffset, + rcinit.right - rcinit.left + nWidthOffset, rcinit.bottom - rcinit.top + nHeightOffset, SWP_NOZORDER); } -BOOL MyResizeGetOffset(HWND hwndCtrl, int nWidth, int nHeight, int* nDx, int* nDy) +BOOL MyResizeGetOffset(HWND hwndCtrl, int nWidth, int nHeight, int* nDx, int* nDy) { RECT rcinit; @@ -58,13 +55,14 @@ BOOL MyResizeGetOffset(HWND hwndCtrl, int nWidth, int nHeight, int* nDx, int* nD return rcinit.bottom != rcinit.top && nHeight > 0; } -INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + RECT rc; + switch (msg) { case WM_INITDIALOG: - if (hViewWnd == NULL) { - hViewWnd = hwndDlg; - TranslateDialogDefault(hwndDlg); + TranslateDialogDefault(hwndDlg); + { SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_VI, true)); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_VI)); @@ -78,37 +76,30 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara PrintVersionInfo(buffer, (unsigned int)lParam); SetDlgItemText(hwndDlg, IDC_VIEWVERSIONINFO, buffer.c_str()); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + } - if(lParam & VI_FLAG_PRNDLL) - SetWindowText(hwndDlg,TranslateT("View Version Information (with DLLs)")); + if (lParam & VI_FLAG_PRNDLL) + SetWindowText(hwndDlg, TranslateT("View Version Information (with DLLs)")); - Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, PluginName, "ViewInfo_"); - ShowWindow(hwndDlg, SW_SHOW); - } - else DestroyWindow(hwndDlg); + Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, PluginName, "ViewInfo_"); + ShowWindow(hwndDlg, SW_SHOW); break; - case WM_SIZE: - { - int dx, dy, bsz; - HDWP hDwp; - RECT rc; - - GetWindowRect(GetDlgItem(hwndDlg, IDC_FILEVER), &rc); - bsz = rc.bottom - rc.top; - - if (MyResizeGetOffset(GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO), LOWORD(lParam)-20, HIWORD(lParam)-30-bsz, &dx, &dy)) { - hDwp = BeginDeferWindowPos(4); - hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_FILEVER), 0, dy, 0, 0); - hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_CLIPVER), dx/2, dy, 0, 0); - hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDCANCEL), dx, dy, 0, 0); - hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO), 0, 0, dx, dy); - EndDeferWindowPos(hDwp); - } - } + case WM_SIZE: + GetWindowRect(GetDlgItem(hwndDlg, IDC_FILEVER), &rc); + + int dx, dy; + if (MyResizeGetOffset(GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO), LOWORD(lParam) - 20, HIWORD(lParam) - 30 - (rc.bottom - rc.top), &dx, &dy)) { + HDWP hDwp = BeginDeferWindowPos(4); + hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_FILEVER), 0, dy, 0, 0); + hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_CLIPVER), dx / 2, dy, 0, 0); + hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDCANCEL), dx, dy, 0, 0); + hDwp = MyResizeWindow(hDwp, hwndDlg, GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO), 0, 0, dx, dy); + EndDeferWindowPos(hDwp); + } break; - case WM_GETMINMAXINFO: + case WM_GETMINMAXINFO: { LPMINMAXINFO mmi = (LPMINMAXINFO)lParam; mmi->ptMinTrackSize.x = 350; // The minimum width in points @@ -117,7 +108,7 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDC_CLIPVER: CallService(MS_CRASHDUMPER_STORETOCLIP, 0, GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); break; @@ -135,21 +126,19 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_CONTEXTMENU: { HWND hView = GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO); - RECT rc; GetWindowRect(hView, &rc); POINT pt; - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - if (PtInRect(&rc, pt)) - { + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + if (PtInRect(&rc, pt)) { static const CHARRANGE all = { 0, -1 }; HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); HMENU hSubMenu = GetSubMenu(hMenu, 0); TranslateMenu(hSubMenu); - CHARRANGE sel; + CHARRANGE sel; SendMessage(hView, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin == sel.cpMax) EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); @@ -174,12 +163,13 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara } break; - case WM_DESTROY: + case WM_DESTROY: hViewWnd = NULL; Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0)); Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0)); Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_"); - if (servicemode) PostQuitMessage(0); + if (servicemode) + PostQuitMessage(0); break; } return FALSE; @@ -188,12 +178,13 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara void DestroyAllWindows(void) { - if (hViewWnd != NULL) DestroyWindow(hViewWnd); - hViewWnd = NULL; + if (hViewWnd != NULL) { + DestroyWindow(hViewWnd); + hViewWnd = NULL; + } } - -INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: @@ -215,7 +206,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case WM_COMMAND: - if ((HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == BN_CLICKED) && (HWND)lParam == GetFocus()) + if ((HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == BN_CLICKED) && (HWND)lParam == GetFocus()) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; @@ -228,8 +219,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szSetting, SIZEOF(szSetting)); db_set_s(NULL, PluginName, "Password", szSetting); - db_set_b(NULL, PluginName, "UploadChanged", - (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN)); + db_set_b(NULL, PluginName, "UploadChanged", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UPLOADCHN)); clsdates = IsDlgButtonChecked(hwndDlg, IDC_CLASSICDATES) == BST_CHECKED; if (clsdates) @@ -286,11 +276,11 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) void ShowMessage(int type, const TCHAR* format, ...) { - POPUPDATAT pi = {0}; + POPUPDATAT pi = { 0 }; va_list va; va_start(va, format); - int len = mir_vsntprintf(pi.lptzText, SIZEOF(pi.lptzText)-1, format, va); + int len = mir_vsntprintf(pi.lptzText, SIZEOF(pi.lptzText) - 1, format, va); pi.lptzText[len] = 0; va_end(va); diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index dfe664396e..a964c41967 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -23,7 +23,7 @@ HANDLE hNetlibUser; static void arrayToHex(BYTE* data, size_t datasz, char* res) { char* resptr = res; - for (unsigned i=0; i> 4); @@ -33,7 +33,7 @@ static void arrayToHex(BYTE* data, size_t datasz, char* res) *resptr++ = (char)((ch1 <= 9) ? ('0' + ch1) : (('a' - 10) + ch1)); } *resptr = '\0'; -} +} void GetLoginStr(char* user, size_t szuser, char* pass) { @@ -68,7 +68,7 @@ void OpenAuthUrl(const char* url) if (user[0] && pass[0]) { char str[256]; mir_snprintf(str, sizeof(str), url, user); - mir_snprintf(str, sizeof(str), "http://www.miranda-vi.org/cdlogin?name=%s&pass=%s&redir=%s", user, pass, ptrA( mir_urlEncode(str))); + mir_snprintf(str, sizeof(str), "http://www.miranda-vi.org/cdlogin?name=%s&pass=%s&redir=%s", user, pass, ptrA(mir_urlEncode(str))); CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)str); } else CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://www.miranda-vi.org/"); @@ -81,35 +81,35 @@ void CreateAuthString(char* auth) char str[110]; int len = mir_snprintf(str, sizeof(str), "%s:%s", user, pass); - mir_snprintf(auth, 250, "Basic %s", ptrA( mir_base64_encode((PBYTE)str, len))); + mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode((PBYTE)str, len))); } -bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) +bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) { int result = 0xBADBAD; - char* szRedirUrl = NULL; - NETLIBHTTPREQUEST nlhr = {0}; + char* szRedirUrl = NULL; + NETLIBHTTPREQUEST nlhr = { 0 }; // initialize the netlib request nlhr.cbSize = sizeof(nlhr); nlhr.requestType = REQUEST_POST; - nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMP; + nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMP; nlhr.szUrl = (char*)szUrl; nlhr.headersCount = 6; - nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount); - nlhr.headers[0].szName = "Connection"; + nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount); + nlhr.headers[0].szName = "Connection"; nlhr.headers[0].szValue = "close"; - nlhr.headers[1].szName = "Cache-Control"; + nlhr.headers[1].szName = "Cache-Control"; nlhr.headers[1].szValue = "no-cache"; - nlhr.headers[2].szName = "Pragma"; + nlhr.headers[2].szName = "Pragma"; nlhr.headers[2].szValue = "no-cache"; - nlhr.headers[3].szName = "Content-Type"; + nlhr.headers[3].szName = "Content-Type"; nlhr.headers[3].szValue = "text/plain; charset=utf-8"; - nlhr.headers[4].szName = "AutoUpload"; + nlhr.headers[4].szName = "AutoUpload"; nlhr.headers[4].szValue = (char*)(szReq->autot ? "1" : "0"); - nlhr.headers[5].szName = "Authorization"; + nlhr.headers[5].szName = "Authorization"; char auth[256]; CreateAuthString(auth); @@ -120,17 +120,17 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) while (result == 0xBADBAD) { // download the page - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser,(LPARAM)&nlhr); + NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); if (nlhrReply) { int i; // if the recieved code is 200 OK - switch(nlhrReply->resultCode) { - case 200: + switch (nlhrReply->resultCode) { + case 200: if (db_get_b(NULL, PluginName, "UploadChanged", 0)) ProcessVIHash(true); - for (i=nlhrReply->headersCount; i--; ) + for (i = nlhrReply->headersCount; i--;) if (_stricmp(nlhrReply->headers[i].szName, "OldPlugins") == 0) { i = atoi(nlhrReply->headers[i].szValue); break; @@ -160,7 +160,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) case 307: // get the url for the new location and save it to szInfo // look for the reply header "Location" - for (i=0; iheadersCount; i++) { + for (i = 0; i < nlhrReply->headersCount; i++) { if (!strcmp(nlhrReply->headers[i].szName, "Location")) { size_t rlen = 0; if (nlhrReply->headers[i].szValue[0] == '/') { @@ -168,14 +168,14 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) const char* szPref = strstr(szUrl, "://"); szPref = szPref ? szPref + 3 : szUrl; szPath = strchr(szPref, '/'); - rlen = szPath != NULL ? szPath - szUrl : strlen(szUrl); + rlen = szPath != NULL ? szPath - szUrl : strlen(szUrl); } - szRedirUrl = (char*)mir_realloc(szRedirUrl, - rlen + strlen(nlhrReply->headers[i].szValue)*3 + 1); + szRedirUrl = (char*)mir_realloc(szRedirUrl, + rlen + strlen(nlhrReply->headers[i].szValue) * 3 + 1); strncpy(szRedirUrl, szUrl, rlen); - strcpy(szRedirUrl+rlen, nlhrReply->headers[i].szValue); + strcpy(szRedirUrl + rlen, nlhrReply->headers[i].szValue); nlhr.szUrl = szRedirUrl; break; @@ -193,7 +193,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) ShowMessage(0, TranslateT("Cannot upload VersionInfo. Host unreachable.")); } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply); + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); } mir_free(szRedirUrl); @@ -210,7 +210,7 @@ void __cdecl VersionInfoUploadThread(void* arg) mir_free(trn); } -void UploadInit(void) +void UploadInit(void) { NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_TCHAR; @@ -219,7 +219,7 @@ void UploadInit(void) hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); } -void UploadClose(void) +void UploadClose(void) { Netlib_CloseHandle(hNetlibUser); } diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 2bc906fb23..4a8feb88b0 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -37,10 +37,10 @@ void CheckForOtherCrashReportingPlugins(void) TEXT("Miranda Crash Dumper"), MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST); } -void GetOSDisplayString(CMString& buffer) +void GetOSDisplayString(CMString &buffer) { - OSVERSIONINFOEX osvi = {0}; - SYSTEM_INFO si = {0}; + OSVERSIONINFOEX osvi = { 0 }; + SYSTEM_INFO si = { 0 }; BOOL bOsVersionInfoEx; DWORD dwType = 0; @@ -49,7 +49,7 @@ void GetOSDisplayString(CMString& buffer) bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*)&osvi); if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (!GetVersionEx((OSVERSIONINFO*)&osvi)) + if (!GetVersionEx((OSVERSIONINFO*)&osvi)) return; } @@ -64,21 +64,21 @@ void GetOSDisplayString(CMString& buffer) case 0: if (osvi.wProductType == VER_NT_WORKSTATION) buffer.Append(TEXT("Windows Vista ")); - else + else buffer.Append(TEXT("Windows Server 2008 ")); break; case 1: if (osvi.wProductType == VER_NT_WORKSTATION) buffer.Append(TEXT("Windows 7 ")); - else + else buffer.Append(TEXT("Windows Server 2008 R2 ")); break; - + case 2: if (osvi.wProductType == VER_NT_WORKSTATION) buffer.Append(TEXT("Windows 8 ")); - else + else buffer.Append(TEXT("Windows Server 2012 ")); break; @@ -93,7 +93,7 @@ void GetOSDisplayString(CMString& buffer) if (pGetProductInfo) pGetProductInfo(6, 0, 0, 0, &dwType); - switch(dwType) { + switch (dwType) { case PRODUCT_ULTIMATE: buffer.Append(TEXT("Ultimate Edition")); break; @@ -147,18 +147,18 @@ void GetOSDisplayString(CMString& buffer) break; } - if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) + if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) buffer.Append(TEXT(", 64-bit")); - else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL) + else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) buffer.Append(TEXT(", 32-bit")); } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { if (GetSystemMetrics(SM_SERVERR2)) buffer.Append(TEXT("Windows Server 2003 R2, ")); - else if (osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER) + else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER) buffer.Append(TEXT("Windows Storage Server 2003")); - else if (osvi.wProductType == VER_NT_WORKSTATION && + else if (osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) buffer.Append(TEXT("Windows XP Professional x64 Edition")); else buffer.Append(TEXT("Windows Server 2003, ")); @@ -166,24 +166,24 @@ void GetOSDisplayString(CMString& buffer) // Test for the server type. if (osvi.wProductType != VER_NT_WORKSTATION) { if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) { - if(osvi.wSuiteMask & VER_SUITE_DATACENTER) + if (osvi.wSuiteMask & VER_SUITE_DATACENTER) buffer.Append(TEXT("Datacenter Edition for Itanium-based Systems")); - else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) buffer.Append(TEXT("Enterprise Edition for Itanium-based Systems")); } else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { - if(osvi.wSuiteMask & VER_SUITE_DATACENTER) + if (osvi.wSuiteMask & VER_SUITE_DATACENTER) buffer.Append(TEXT("Datacenter x64 Edition")); - else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) buffer.Append(TEXT("Enterprise x64 Edition")); else buffer.Append(TEXT("Standard x64 Edition")); } else { if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER) buffer.Append(TEXT("Compute Cluster Edition")); - else if(osvi.wSuiteMask & VER_SUITE_DATACENTER) + else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) buffer.Append(TEXT("Datacenter Edition")); - else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) buffer.Append(TEXT("Enterprise Edition")); else if (osvi.wSuiteMask & VER_SUITE_BLADE) buffer.Append(TEXT("Web Edition")); @@ -196,7 +196,7 @@ void GetOSDisplayString(CMString& buffer) buffer.Append(TEXT("Windows XP ")); if (osvi.wSuiteMask & VER_SUITE_PERSONAL) buffer.Append(TEXT("Home Edition")); - else + else buffer.Append(TEXT("Professional")); } @@ -205,9 +205,9 @@ void GetOSDisplayString(CMString& buffer) if (osvi.wProductType == VER_NT_WORKSTATION) buffer.Append(TEXT("Professional")); - else if(osvi.wSuiteMask & VER_SUITE_DATACENTER) + else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) buffer.Append(TEXT("Datacenter Server")); - else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) buffer.Append(TEXT("Advanced Server")); else buffer.Append(TEXT("Server")); @@ -227,22 +227,22 @@ void GetOSDisplayString(CMString& buffer) buffer.Append(TEXT("Workstation 4.0 ")); else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) buffer.Append(TEXT("Server 4.0, Enterprise Edition ")); - else + else buffer.Append(TEXT("Server 4.0 ")); } if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && osvi.dwMajorVersion == 4) { if (osvi.dwMinorVersion == 0) { buffer.Append(TEXT("Microsoft Windows 95 ")); - if (osvi.szCSDVersion[1]==TEXT('C') || osvi.szCSDVersion[1]==TEXT('B')) + if (osvi.szCSDVersion[1] == TEXT('C') || osvi.szCSDVersion[1] == TEXT('B')) buffer.Append(TEXT("OSR2 ")); - } + } if (osvi.dwMinorVersion == 10) { buffer.Append(TEXT("Microsoft Windows 98 ")); - if (osvi.szCSDVersion[1]==TEXT('A') || osvi.szCSDVersion[1]==TEXT('B')) + if (osvi.szCSDVersion[1] == TEXT('A') || osvi.szCSDVersion[1] == TEXT('B')) buffer.Append(TEXT("SE ")); - } + } if (osvi.dwMinorVersion == 90) buffer.Append(TEXT("Microsoft Windows Millennium Edition")); @@ -256,12 +256,11 @@ void GetOSDisplayString(CMString& buffer) int GetTZOffset(void) { - TIME_ZONE_INFORMATION tzInfo = {0}; + TIME_ZONE_INFORMATION tzInfo = { 0 }; DWORD type = GetTimeZoneInformation(&tzInfo); int offset = 0; - switch (type) - { + switch (type) { case TIME_ZONE_ID_DAYLIGHT: offset = -(tzInfo.Bias + tzInfo.DaylightBias); break; @@ -277,7 +276,7 @@ int GetTZOffset(void) return offset; } -void GetISO8061Time(SYSTEMTIME* stLocal, LPTSTR lpszString, DWORD dwSize) +void GetISO8061Time(SYSTEMTIME *stLocal, LPTSTR lpszString, DWORD dwSize) { SYSTEMTIME loctime; if (stLocal == NULL) { @@ -288,20 +287,20 @@ void GetISO8061Time(SYSTEMTIME* stLocal, LPTSTR lpszString, DWORD dwSize) if (clsdates) { GetDateFormat(LOCALE_INVARIANT, 0, stLocal, TEXT("d MMM yyyy"), lpszString, dwSize); int dlen = (int)_tcslen(lpszString); - GetTimeFormat(LOCALE_INVARIANT, 0, stLocal, TEXT(" H:mm:ss"), lpszString+dlen, dwSize-dlen); + GetTimeFormat(LOCALE_INVARIANT, 0, stLocal, TEXT(" H:mm:ss"), lpszString + dlen, dwSize - dlen); } else { int offset = GetTZOffset(); // Build a string showing the date and time. - mir_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"), - stLocal->wYear, stLocal->wMonth, stLocal->wDay, + mir_sntprintf(lpszString, dwSize, TEXT("%d-%02d-%02d %02d:%02d:%02d%+03d%02d"), + stLocal->wYear, stLocal->wMonth, stLocal->wDay, stLocal->wHour, stLocal->wMinute, stLocal->wSecond, offset / 60, offset % 60); } } -void GetLastWriteTime(FILETIME* ftime, LPTSTR lpszString, DWORD dwSize) +void GetLastWriteTime(FILETIME *ftime, LPTSTR lpszString, DWORD dwSize) { FILETIME ftLocal; SYSTEMTIME stLocal; @@ -335,26 +334,26 @@ PLUGININFOEX* GetMirInfo(HMODULE hModule) return bpi(mirandaVersion); } -void GetInternetExplorerVersion(CMString& buffer) +void GetInternetExplorerVersion(CMString &buffer) { HKEY hKey; DWORD size; - TCHAR ieVersion[1024] = {0}; - TCHAR ieBuild[512] = {0}; - TCHAR iVer[64] = {0}; + TCHAR ieVersion[1024] = { 0 }; + TCHAR ieBuild[512] = { 0 }; + TCHAR iVer[64] = { 0 }; if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey)) { size = SIZEOF(ieBuild); - if (RegQueryValueEx(hKey, TEXT("Build"), NULL, NULL, (LPBYTE) ieBuild, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("Build"), NULL, NULL, (LPBYTE)ieBuild, &size) != ERROR_SUCCESS) ieBuild[0] = 0; size = SIZEOF(ieVersion); - if (RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE) ieVersion, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE)ieVersion, &size) != ERROR_SUCCESS) ieVersion[0] = 0; size = SIZEOF(iVer); - if (RegQueryValueEx(hKey, TEXT("IVer"), NULL, NULL, (LPBYTE) iVer, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("IVer"), NULL, NULL, (LPBYTE)iVer, &size) != ERROR_SUCCESS) iVer[0] = 0; RegCloseKey(hKey); @@ -379,7 +378,7 @@ void GetInternetExplorerVersion(CMString& buffer) buffer.AppendFormat(TEXT(" (build %s)"), ieBuild); } -void TrimMultiSpaces(TCHAR* str) +void TrimMultiSpaces(TCHAR *str) { TCHAR *src = str, *dest = str; bool trimst = false; @@ -395,26 +394,26 @@ void TrimMultiSpaces(TCHAR* str) trimst = false; *dest++ = *src; } - if (*src++ == 0) break; + if (*src++ == 0) break; } -} +} -void GetProcessorString(CMString& buffer) +void GetProcessorString(CMString &buffer) { HKEY hKey; DWORD size; - TCHAR cpuIdent[512] = {0}; - TCHAR cpuName[512] = {0}; + TCHAR cpuIdent[512] = { 0 }; + TCHAR cpuName[512] = { 0 }; if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey)) { size = SIZEOF(cpuName); - if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE) cpuName, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)cpuName, &size) != ERROR_SUCCESS) _tcscpy(cpuName, TEXT("Unknown")); size = SIZEOF(cpuIdent); - if (RegQueryValueEx(hKey, TEXT("Identifier"), NULL, NULL, (LPBYTE) cpuIdent, &size) != ERROR_SUCCESS) - if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), NULL, NULL, (LPBYTE) cpuIdent, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("Identifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS) + if (RegQueryValueEx(hKey, TEXT("VendorIdentifier"), NULL, NULL, (LPBYTE)cpuIdent, &size) != ERROR_SUCCESS) _tcscpy(cpuIdent, TEXT("Unknown")); RegCloseKey(hKey); @@ -425,28 +424,28 @@ void GetProcessorString(CMString& buffer) if (IsProcessorFeaturePresent(PF_NX_ENABLED)) buffer.Append(TEXT(" [DEP Enabled]")); - SYSTEM_INFO si = {0}; + SYSTEM_INFO si = { 0 }; GetSystemInfo(&si); if (si.dwNumberOfProcessors > 1) buffer.AppendFormat(TEXT(" [%u CPUs]"), si.dwNumberOfProcessors); } -void GetFreeMemoryString(CMString& buffer) +void GetFreeMemoryString(CMString &buffer) { unsigned ram; - MEMORYSTATUSEX ms = {0}; + MEMORYSTATUSEX ms = { 0 }; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); - ram = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1); + ram = (unsigned int)((ms.ullTotalPhys / (1024 * 1024)) + 1); buffer.AppendFormat(TEXT("Installed RAM: %u MBytes"), ram); } -void GetFreeDiskString(LPCTSTR dirname, CMString& buffer) +void GetFreeDiskString(LPCTSTR dirname, CMString &buffer) { - ULARGE_INTEGER tnb, tfb, fs = {0}; + ULARGE_INTEGER tnb, tfb, fs = { 0 }; GetDiskFreeSpaceEx(dirname, &fs, &tnb, &tfb); - fs.QuadPart /= (1024*1024); + fs.QuadPart /= (1024 * 1024); buffer.AppendFormat(TEXT("Free disk space on Miranda partition: %u MBytes"), fs.LowPart); } @@ -529,14 +528,14 @@ void ReadableExceptionInfo(PEXCEPTION_RECORD excrec, CMString& buffer) break; default: - buffer.AppendFormat(TEXT("%x"), excrec->ExceptionCode); + buffer.AppendFormat(TEXT("%x"), excrec->ExceptionCode); break; } - buffer.AppendFormat(TEXT(" at address %p."), excrec->ExceptionAddress); + buffer.AppendFormat(TEXT(" at address %p."), excrec->ExceptionAddress); if (excrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION || excrec->ExceptionCode == EXCEPTION_IN_PAGE_ERROR) { - switch(excrec->ExceptionInformation[0]) { + switch (excrec->ExceptionInformation[0]) { case 0: buffer.AppendFormat(TEXT(" Reading from address %p."), (LPVOID)excrec->ExceptionInformation[1]); break; @@ -552,31 +551,31 @@ void ReadableExceptionInfo(PEXCEPTION_RECORD excrec, CMString& buffer) } } -void GetAdminString(CMString& buffer) +void GetAdminString(CMString &buffer) { BOOL b; __try { SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; - PSID AdministratorsGroup; + PSID AdministratorsGroup; b = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup); + DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup); if (b) { if (!CheckTokenMembership(NULL, AdministratorsGroup, &b)) b = FALSE; - FreeSid(AdministratorsGroup); + FreeSid(AdministratorsGroup); } else b = GetLastError() == ERROR_CALL_NOT_IMPLEMENTED; } - __except(EXCEPTION_EXECUTE_HANDLER) + __except (EXCEPTION_EXECUTE_HANDLER) { b = TRUE; } - buffer.AppendFormat(TEXT("Administrator privileges: %s"), b ? TEXT("Yes") : TEXT ("No")); + buffer.AppendFormat(TEXT("Administrator privileges: %s"), b ? TEXT("Yes") : TEXT("No")); } -void GetLanguageString(CMString& buffer) +void GetLanguageString(CMString &buffer) { TCHAR name1[256], name2[256], name3[256], name4[256]; @@ -589,13 +588,13 @@ void GetLanguageString(CMString& buffer) buffer.AppendFormat(TEXT("OS Languages: (UI | Locale (User/System)) : %s/%s | %s/%s"), name3, name4, name1, name2); } -void GetLanguagePackString(CMString& buffer) +void GetLanguagePackString(CMString &buffer) { - buffer.Append(TEXT("Language pack: ")); + buffer.Append(TEXT("Language pack: ")); if (packlcid != LOCALE_USER_DEFAULT) { TCHAR lang[MAX_PATH], ctry[MAX_PATH]; - if(GetLocaleInfo(packlcid, LOCALE_SENGLANGUAGE, lang, MAX_PATH)) { - if(GetLocaleInfo(packlcid, LOCALE_SISO3166CTRYNAME, ctry, MAX_PATH)) + if (GetLocaleInfo(packlcid, LOCALE_SENGLANGUAGE, lang, MAX_PATH)) { + if (GetLocaleInfo(packlcid, LOCALE_SISO3166CTRYNAME, ctry, MAX_PATH)) buffer.AppendFormat(TEXT("%s (%s) [%04x]"), lang, ctry, packlcid); else buffer.Append(lang); @@ -603,17 +602,18 @@ void GetLanguagePackString(CMString& buffer) else buffer.Append(TEXT("Locale id invalid")); } - else + else buffer.Append(TEXT("No language pack installed")); } -void GetWow64String(CMString& buffer) +void GetWow64String(CMString &buffer) { BOOL wow64 = 0; if (!IsWow64Process(GetCurrentProcess(), &wow64)) wow64 = 0; - if (wow64) buffer.Append(TEXT(" [running inside WOW64]")); + if (wow64) + buffer.Append(TEXT(" [running inside WOW64]")); } @@ -640,9 +640,9 @@ void GetVersionInfo(HMODULE hLib, CMString& buffer) { HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); if (hVersion != NULL) { - HGLOBAL hGlobal = LoadResource(hLib, hVersion); - if (hGlobal != NULL) { - LPVOID versionInfo = LockResource(hGlobal); + HGLOBAL hGlobal = LoadResource(hLib, hVersion); + if (hGlobal != NULL) { + LPVOID versionInfo = LockResource(hGlobal); if (versionInfo != NULL) { int vl = *(unsigned short*)versionInfo; unsigned *res = (unsigned*)versionInfo; @@ -650,12 +650,12 @@ void GetVersionInfo(HMODULE hLib, CMString& buffer) if (((char*)res - (char*)versionInfo) < vl) { VS_FIXEDFILEINFO *vsInfo = (VS_FIXEDFILEINFO*)res; - buffer.AppendFormat(TEXT(" v.%u.%u.%u.%u"), + buffer.AppendFormat(TEXT(" v.%u.%u.%u.%u"), HIWORD(vsInfo->dwFileVersionMS), LOWORD(vsInfo->dwFileVersionMS), HIWORD(vsInfo->dwFileVersionLS), LOWORD(vsInfo->dwFileVersionLS)); } } - FreeResource(hGlobal); + FreeResource(hGlobal); } } } diff --git a/plugins/CrashDumper/src/version.h b/plugins/CrashDumper/src/version.h index 33e14bf6a6..2a58b264b2 100644 --- a/plugins/CrashDumper/src/version.h +++ b/plugins/CrashDumper/src/version.h @@ -1,14 +1,14 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 0 -#define __RELEASE_NUM 4 -#define __BUILD_NUM 22 +#define __RELEASE_NUM 5 +#define __BUILD_NUM 1 #include -#define __PLUGIN_NAME "Crash dumper" -#define __FILENAME "CrashDumper.dll" -#define __DESCRIPTION "Crash Dumper for Miranda NG." -#define __AUTHOR "borkra" -#define __AUTHOREMAIL "borkra@miranda-im.org" -#define __AUTHORWEB "http://miranda-ng.org/p/CrashDumper/" -#define __COPYRIGHT "© 2008 - 2012 Boris Krasnovskiy" +#define __PLUGIN_NAME "Crash dumper" +#define __FILENAME "CrashDumper.dll" +#define __DESCRIPTION "Crash Dumper for Miranda NG." +#define __AUTHOR "borkra" +#define __AUTHOREMAIL "borkra@miranda-im.org" +#define __AUTHORWEB "http://miranda-ng.org/p/CrashDumper/" +#define __COPYRIGHT "© 2008 - 2012 Boris Krasnovskiy" -- cgit v1.2.3