summaryrefslogtreecommitdiff
path: root/plugins/!Deprecated/VersionInfo/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/!Deprecated/VersionInfo/src')
-rw-r--r--plugins/!Deprecated/VersionInfo/src/CPlugin.cpp140
-rw-r--r--plugins/!Deprecated/VersionInfo/src/CPlugin.h50
-rw-r--r--plugins/!Deprecated/VersionInfo/src/CVersionInfo.cpp964
-rw-r--r--plugins/!Deprecated/VersionInfo/src/CVersionInfo.h101
-rw-r--r--plugins/!Deprecated/VersionInfo/src/common.h89
-rw-r--r--plugins/!Deprecated/VersionInfo/src/dlgHandlers.cpp586
-rw-r--r--plugins/!Deprecated/VersionInfo/src/dlgHandlers.h40
-rw-r--r--plugins/!Deprecated/VersionInfo/src/hooked_events.cpp50
-rw-r--r--plugins/!Deprecated/VersionInfo/src/hooked_events.h32
-rw-r--r--plugins/!Deprecated/VersionInfo/src/main.cpp105
-rw-r--r--plugins/!Deprecated/VersionInfo/src/resource.h71
-rw-r--r--plugins/!Deprecated/VersionInfo/src/services.cpp61
-rw-r--r--plugins/!Deprecated/VersionInfo/src/services.h31
-rw-r--r--plugins/!Deprecated/VersionInfo/src/stdafx.cpp18
-rw-r--r--plugins/!Deprecated/VersionInfo/src/utils.cpp438
-rw-r--r--plugins/!Deprecated/VersionInfo/src/utils.h42
-rw-r--r--plugins/!Deprecated/VersionInfo/src/version.h14
17 files changed, 2832 insertions, 0 deletions
diff --git a/plugins/!Deprecated/VersionInfo/src/CPlugin.cpp b/plugins/!Deprecated/VersionInfo/src/CPlugin.cpp
new file mode 100644
index 0000000000..00f6949d38
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/CPlugin.cpp
@@ -0,0 +1,140 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+#define PLUGIN_UNCERTAIN_MARK "?"
+
+#define RJUST 70
+
+CPlugin::CPlugin() {
+ pluginID = UUID_NULL;
+}
+
+CPlugin::CPlugin(LPCTSTR eFileName, LPCTSTR eShortName, MUUID pluginID, LPCTSTR eUnicodeInfo, DWORD eVersion, LPCTSTR eTimestamp, LPCTSTR eLinkedModules) {
+ lpzFileName = eFileName;
+ lpzShortName = eShortName;
+ lpzUnicodeInfo = eUnicodeInfo;
+ lpzTimestamp = eTimestamp;
+ lpzLinkedModules = eLinkedModules;
+
+ int v1, v2, v3, v4;
+
+ DWORD unused, verInfoSize = GetFileVersionInfoSize(eFileName, &unused);
+ if (verInfoSize != 0) {
+ UINT blockSize;
+ VS_FIXEDFILEINFO* fi;
+ void* pVerInfo = mir_alloc(verInfoSize);
+ GetFileVersionInfo(eFileName, 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);
+ mir_free(pVerInfo);
+ }
+ else {
+ DWORD ver = eVersion;
+ v1 = HIBYTE(HIWORD(ver)), v2 = LOBYTE(HIWORD(ver)), v3 = HIBYTE(LOWORD(ver)), v4 = LOBYTE(LOWORD(ver));
+ }
+
+ TCHAR aux[128];
+ mir_sntprintf(aux, SIZEOF(aux), _T("%d.%d.%d.%d"), v1, v2, v3, v4);
+ lpzVersion = aux;
+
+ this->pluginID = pluginID;
+};
+
+CPlugin::CPlugin(const CPlugin& other) {
+ lpzFileName = other.lpzFileName;
+ lpzShortName = other.lpzShortName;
+ lpzUnicodeInfo = other.lpzUnicodeInfo;
+ lpzVersion = other.lpzVersion;
+ lpzTimestamp = other.lpzTimestamp;
+ lpzLinkedModules = other.lpzLinkedModules;
+ pluginID = other.pluginID;
+}
+
+CPlugin::~CPlugin()
+{
+}
+
+void CPlugin::SetErrorMessage(LPCTSTR error)
+{
+ lpzLinkedModules = error;
+}
+
+bool CPlugin::operator<(CPlugin &anotherPlugin)
+{
+ std::tstring anotherFileName = anotherPlugin.getFileName();
+
+ TCHAR szThis[MAX_PATH]; lstrcpy(szThis, lpzFileName.c_str());
+ TCHAR szThat[MAX_PATH]; lstrcpy(szThat, anotherFileName.c_str());
+
+ if (lstrcmpi(szThis, szThat) < 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+bool CPlugin::operator>(CPlugin &anotherPlugin)
+{
+ return !((*this) < anotherPlugin);
+}
+bool CPlugin::operator==(CPlugin &anotherPlugin)
+{
+ return !((*this) < anotherPlugin || (*this) > anotherPlugin);
+}
+
+std::tstring CPlugin::getFileName()
+{
+ return this->lpzFileName;
+}
+
+std::tstring CPlugin::getInformations(DWORD flags, TCHAR *szHighlightHeader, TCHAR *szHighlightFooter)
+{
+ std::tstring lpzInformations;
+ if (flags & VISF_SHOWUUID)
+ {
+ TCHAR aux[128];
+ UUIDToString(pluginID, aux, SIZEOF(aux));
+ lpzInformations = aux;
+ }
+ else lpzInformations = _T(" ");
+
+ lpzInformations += std::tstring(_T(" ") + lpzFileName + _T(" v.") + szHighlightHeader + lpzVersion + szHighlightFooter + _T(" [") + lpzTimestamp + _T("] - ") + lpzShortName);
+ if (lpzUnicodeInfo.size() > 0)
+ {
+ TCHAR *lwr = _tcslwr(_tcsdup(lpzShortName.c_str()));
+ if ( !_tcsstr(lwr, _T("unicode")) && !_tcsstr(lwr, _T("2in1")))
+ lpzInformations.append( _T(" |") + lpzUnicodeInfo + _T("|"));
+
+ free(lwr);
+ }
+ //lpzInformations.append("\t");
+ //lpzInformations.append(lpzPluginID);
+ lpzInformations.append( _T("\r\n"));
+
+ if (lpzLinkedModules.size() > 0)
+ {
+ lpzInformations.append(lpzLinkedModules);
+ lpzInformations.append( _T("\r\n"));
+ }
+// std::string lpzInformations = std::string(lpzFileName + " - " + lpzShortName + " [" + lpzTimestamp + " · " + lpzVersion +"]\r\n");
+ return lpzInformations;
+}; \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/CPlugin.h b/plugins/!Deprecated/VersionInfo/src/CPlugin.h
new file mode 100644
index 0000000000..f78826a44d
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/CPlugin.h
@@ -0,0 +1,50 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef CPLUGIN_H
+#define CPLUGIN_H
+
+class CPlugin {
+ private:
+ std::tstring lpzFileName;
+ std::tstring lpzShortName;
+ std::tstring lpzVersion;
+ std::tstring lpzUnicodeInfo; //aditional info, Unicode aware ...
+ std::tstring lpzTimestamp; //to show the last modified timestamp
+ std::tstring lpzLinkedModules; //to show linked modules that aren't found
+ MUUID pluginID;
+
+ public:
+ CPlugin();
+ CPlugin(LPCTSTR fileName, LPCTSTR shortName, MUUID pluginID, LPCTSTR unicodeInfo, DWORD version, LPCTSTR timestamp, LPCTSTR linkedModules);
+ CPlugin(const CPlugin&);
+ ~CPlugin();
+ std::tstring getFileName();
+ std::tstring getInformations(DWORD, TCHAR *, TCHAR *);
+
+ void SetErrorMessage(LPCTSTR error);
+
+ //Operators
+ bool operator<(CPlugin&);
+ bool operator>(CPlugin&);
+ bool operator==(CPlugin&);
+};
+#endif \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/CVersionInfo.cpp b/plugins/!Deprecated/VersionInfo/src/CVersionInfo.cpp
new file mode 100644
index 0000000000..ff6acb98b9
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/CVersionInfo.cpp
@@ -0,0 +1,964 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+static int ValidExtension(TCHAR *fileName, TCHAR *extension)
+{
+ TCHAR *dot = _tcschr(fileName, '.');
+ if ( dot != NULL && !lstrcmpi(dot + 1, extension))
+ if (dot[lstrlen(extension) + 1] == 0)
+ return 1;
+
+ return 0;
+}
+
+void FillLocalTime(std::tstring &output, FILETIME *fileTime)
+{
+ TIME_ZONE_INFORMATION tzInfo = {0};
+ FILETIME local = {0};
+ SYSTEMTIME sysTime;
+ TCHAR date[1024];
+ TCHAR time[256];
+
+ FileTimeToLocalFileTime(fileTime, &local);
+ FileTimeToSystemTime(&local, &sysTime);
+
+ GetDateFormat(EnglishLocale, 0, &sysTime, _T("dd' 'MMM' 'yyyy"), date, SIZEOF(date));
+ GetTimeFormat(NULL, TIME_FORCE24HOURFORMAT, &sysTime, _T("HH':'mm':'ss"), time, SIZEOF(time)); //americans love 24hour format ;)
+ output = std::tstring(date) + _T(" at ") + std::tstring(time);
+
+ int res = GetTimeZoneInformation(&tzInfo);
+ char tzName[32] = {0};
+ TCHAR tzOffset[64] = {0};
+ int offset = 0;
+ switch (res) {
+ case TIME_ZONE_ID_DAYLIGHT:
+ offset = -(tzInfo.Bias + tzInfo.DaylightBias);
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.DaylightName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ break;
+
+ case TIME_ZONE_ID_STANDARD:
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ offset = -(tzInfo.Bias + tzInfo.StandardBias);
+ break;
+
+ case TIME_ZONE_ID_UNKNOWN:
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ offset = -tzInfo.Bias;
+ break;
+ }
+
+ mir_sntprintf(tzOffset, SIZEOF(tzOffset), _T("UTC %+02d:%02d"), offset / 60, offset % 60);
+ output += _T(" (") + std::tstring(tzOffset) + _T(")");
+}
+
+CVersionInfo::CVersionInfo()
+{
+ luiFreeDiskSpace = 0;
+ bDEPEnabled = 0;
+}
+
+CVersionInfo::~CVersionInfo()
+{
+ listInactivePlugins.clear();
+ listActivePlugins.clear();
+ listUnloadablePlugins.clear();
+
+ lpzMirandaVersion.~basic_string();
+ lpzNightly.~basic_string();
+ lpzUnicodeBuild.~basic_string();
+ lpzBuildTime.~basic_string();
+ lpzMirandaPath.~basic_string();
+ lpzCPUName.~basic_string();
+ lpzCPUIdentifier.~basic_string();
+};
+
+void CVersionInfo::Initialize()
+{
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Before GetMirandaVersion().", SM_NOTIFY);
+#endif
+ GetMirandaVersion();
+
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Before GetProfileSettings().", SM_NOTIFY);
+#endif
+ GetProfileSettings();
+
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Before GetLangpackInfo().", SM_NOTIFY);
+#endif
+ GetOSLanguages();
+ GetLangpackInfo();
+
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Before GetPluginLists().", SM_NOTIFY);
+#endif
+ GetPluginLists();
+
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Before GetOSVersion().", SM_NOTIFY);
+#endif
+ GetOSVersion();
+
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Before GetHWSettings().", SM_NOTIFY);
+#endif
+ GetHWSettings();
+
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("Done with GetHWSettings().", SM_NOTIFY);
+#endif
+}
+
+bool CVersionInfo::GetMirandaVersion()
+{
+ //Miranda version
+ const BYTE str_size = 64;
+ char str[str_size];
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)str_size, (LPARAM)str);
+ this->lpzMirandaVersion = _A2T(str);
+ //Is it a nightly?
+ if (lpzMirandaVersion.find( _T("alpha"), 0) != std::string::npos)
+ lpzNightly = _T("Yes");
+ else
+ lpzNightly = _T("No");
+
+ lpzUnicodeBuild = _T("Yes");
+
+ TCHAR mirtime[128];
+ GetModuleTimeStamp(mirtime, 128);
+ lpzBuildTime = mirtime;
+ return TRUE;
+}
+
+bool CVersionInfo::GetOSVersion()
+{
+ //Operating system informations
+ OSVERSIONINFO osvi = { 0 };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ //OSName
+ //Let's read the registry.
+ HKEY hKey;
+ TCHAR szKey[MAX_PATH], szValue[MAX_PATH];
+ switch (osvi.dwPlatformId) {
+ case VER_PLATFORM_WIN32_WINDOWS:
+ lstrcpyn(szKey, _T("Software\\Microsoft\\Windows\\CurrentVersion"), MAX_PATH);
+ lstrcpyn(szValue, _T("Version"), MAX_PATH);
+ break;
+
+ case VER_PLATFORM_WIN32_NT:
+ lstrcpyn(szKey, _T("Software\\Microsoft\\Windows NT\\CurrentVersion"), MAX_PATH);
+ lstrcpyn(szValue, _T("ProductName"), MAX_PATH);
+ break;
+ }
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
+ DWORD type, size, result;
+ //Get the size of the value we'll read.
+ result = RegQueryValueEx((HKEY)hKey, szValue, (LPDWORD)NULL, (LPDWORD)&type, (LPBYTE)NULL, (LPDWORD)&size);
+ if (result == ERROR_SUCCESS) {
+ //Read it.
+ TCHAR *aux = new TCHAR[size+1];
+ result = RegQueryValueEx((HKEY)hKey, szValue, (LPDWORD)NULL, (LPDWORD)&type, (LPBYTE)aux, (LPDWORD)&size);
+ lpzOSName.append(_T("Microsoft "));
+ lpzOSName.append(aux);
+ lpzOSName.append(_T(" Edition"));
+ delete[] aux;
+ }
+ else {
+ NotifyError(GetLastError(), _T("RegQueryValueEx()"), __LINE__);
+ lpzOSName = _T("<Error in RegQueryValueEx()>");
+ }
+ RegCloseKey(hKey);
+ }
+ else {
+ NotifyError(GetLastError(), _T("RegOpenKeyEx()"), __LINE__);
+ lpzOSName = _T("<Error in RegOpenKeyEx()>");
+ }
+
+ //Now we can improve it if we can.
+ switch (LOWORD(osvi.dwBuildNumber)) {
+ case 950: lpzOSName = _T("Microsoft Windows 95"); break;
+ case 1111: lpzOSName = _T("Microsoft Windows 95 OSR2"); break;
+ case 1998: lpzOSName = _T("Microsoft Windows 98"); break;
+ case 2222: lpzOSName = _T("Microsoft Windows 98 SE"); break;
+ case 3000: lpzOSName = _T("Microsoft Windows ME"); break; //Even if this is wrong, we have already read it in the registry.
+ case 1381: lpzOSName = _T("Microsoft Windows NT"); break; //What about service packs?
+ case 2195: lpzOSName = _T("Microsoft Windows 2000"); break; //What about service packs?
+ case 2600: lpzOSName = _T("Microsoft Windows XP"); break;
+ case 3790:
+ if (GetSystemMetrics(89)) //R2 ?
+ lpzOSName = _T("Microsoft Windows 2003 R2");
+ else
+ lpzOSName = _T("Microsoft Windows 2003");
+
+ break; //added windows 2003 info
+ }
+
+ SYSTEM_INFO si = {0};
+ GetNativeSystemInfo(&si);
+
+ if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
+ lpzOSName.append(_T(", 64-bit "));
+ else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL)
+ lpzOSName.append(_T(", 32-bit "));
+
+ lpzOSName.append(osvi.szCSDVersion);
+ lpzOSName.append(_T(" (build "));
+ TCHAR buildno[MAX_PATH];
+ _itot(osvi.dwBuildNumber, buildno, 10);
+ lpzOSName.append(buildno);
+ lpzOSName.append(_T(")"));
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetHWSettings()
+{
+ //CPU Info
+ HKEY hKey;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Hardware\\Description\\System\\CentralProcessor\\0"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ TCHAR cpuIdent[512] = {0}, cpuName[512] = {0};
+ DWORD size;
+ size = SIZEOF(cpuName);
+ if (RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE) cpuName, &size) != ERROR_SUCCESS)
+ _tcscpy(cpuName, _T("Unknown"));
+ lpzCPUName = cpuName;
+ 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)
+ _tcscpy(cpuIdent, _T("Unknown"));
+ lpzCPUIdentifier = cpuIdent;
+
+ RegCloseKey(hKey);
+ }
+
+ while (true)
+ {
+ std::tstring::size_type pos = lpzCPUName.find(_T(" "));
+ if (pos != std::tstring::npos)
+ lpzCPUName.replace(lpzCPUName.begin() + pos, lpzCPUName.begin() + pos + 2, _T(" "));
+ else
+ break;
+ }
+
+ bDEPEnabled = IsProcessorFeaturePresent(PF_NX_ENABLED);
+
+ //Free space on Miranda Partition.
+ TCHAR szMirandaPath[MAX_PATH] = { 0 };
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
+ if ( str2 != NULL)
+ *str2=0;
+ ULARGE_INTEGER FreeBytes, a, b;
+ GetDiskFreeSpaceEx(szMirandaPath, &FreeBytes, &a, &b);
+ //Now we need to convert it.
+ __int64 aux = FreeBytes.QuadPart;
+ aux /= (1024*1024);
+ luiFreeDiskSpace = (unsigned long int)aux;
+
+ TCHAR szInfo[1024];
+ GetWindowsShell(szInfo, SIZEOF(szInfo));
+ lpzShell = szInfo;
+ GetInternetExplorerVersion(szInfo, SIZEOF(szInfo));
+ lpzIEVersion = szInfo;
+
+
+ lpzAdministratorPrivileges = (IsCurrentUserLocalAdministrator()) ? _T("Yes") : _T("No");
+
+ bIsWOW64 = 0;
+ if (!IsWow64Process(GetCurrentProcess(), &bIsWOW64))
+ bIsWOW64 = 0;
+
+ SYSTEM_INFO sysInfo = {0};
+ GetSystemInfo(&sysInfo);
+ luiProcessors = sysInfo.dwNumberOfProcessors;
+
+ //Installed RAM
+ MEMORYSTATUSEX ms = {0};
+ ms.dwLength = sizeof(ms);
+ GlobalMemoryStatusEx(&ms);
+ luiRAM = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetProfileSettings()
+{
+ TCHAR* tszProfileName = Utils_ReplaceVarsT(_T("%miranda_userdata%\\%miranda_profilename%.dat"));
+ lpzProfilePath = tszProfileName;
+
+ WIN32_FIND_DATA fd;
+ if ( FindFirstFile(tszProfileName, &fd) != INVALID_HANDLE_VALUE ) {
+ TCHAR number[40];
+ mir_sntprintf(number, SIZEOF(number), _T("%.2f KBytes"), double(fd.nFileSizeLow) / 1024);
+ lpzProfileSize = number;
+
+ FILETIME ftLocal;
+ SYSTEMTIME stLocal;
+ TCHAR lpszString[128];
+ FileTimeToLocalFileTime(&fd.ftCreationTime, &ftLocal);
+ FileTimeToSystemTime(&ftLocal, &stLocal);
+ GetISO8061Time(&stLocal, lpszString, 128);
+ lpzProfileCreationDate = lpszString;
+ }
+ else {
+ DWORD error = GetLastError();
+ TCHAR tmp[1024];
+ mir_sntprintf(tmp, SIZEOF(tmp), _T("%d"), error);
+ lpzProfileCreationDate = _T("<error ") + std::tstring(tmp) + _T(" at FileOpen>") + std::tstring(tszProfileName);
+ lpzProfileSize = _T("<error ") + std::tstring(tmp) + _T(" at FileOpen>") + std::tstring(tszProfileName);
+ }
+
+ mir_free( tszProfileName );
+ return true;
+}
+
+static TCHAR szSystemLocales[4096] = {0};
+static WORD systemLangID;
+#define US_LANG_ID 0x00000409
+
+BOOL CALLBACK EnumSystemLocalesProc(TCHAR *szLocale)
+{
+ DWORD locale = _ttoi(szLocale);
+ TCHAR *name = GetLanguageName(locale);
+ if ( !_tcsstr(szSystemLocales, name)) {
+ _tcscat(szSystemLocales, name);
+ _tcscat(szSystemLocales, _T(", "));
+ }
+
+ return TRUE;
+}
+
+BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam)
+{
+ if (!lpszName)
+ return FALSE;
+
+ if (wIDLanguage != US_LANG_ID)
+ systemLangID = wIDLanguage;
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetOSLanguages()
+{
+ lpzOSLanguages = _T("(UI | Locale (User/System)) : ");
+
+ LANGID UILang;
+
+ UILang = GetUserDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
+ lpzOSLanguages += _T("/");
+ UILang = GetSystemDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
+
+ lpzOSLanguages += _T(" | ");
+ lpzOSLanguages += GetLanguageName(LOCALE_USER_DEFAULT);
+ lpzOSLanguages += _T("/");
+ lpzOSLanguages += GetLanguageName(LOCALE_SYSTEM_DEFAULT);
+
+ if (db_get_b(NULL, ModuleName, "ShowInstalledLanguages", 0)) {
+ szSystemLocales[0] = '\0';
+ lpzOSLanguages += _T(" [");
+ EnumSystemLocales(EnumSystemLocalesProc, LCID_INSTALLED);
+ if (_tcslen(szSystemLocales) > 2)
+ szSystemLocales[ _tcslen(szSystemLocales) - 2] = '\0';
+
+ lpzOSLanguages += szSystemLocales;
+ lpzOSLanguages += _T("]");
+ }
+
+ return true;
+}
+
+int SaveInfo(const char *data, const char *lwrData, const char *search, TCHAR *dest, int size)
+{
+ const char *pos = strstr(lwrData, search);
+ int res = 1;
+ if (pos == lwrData) {
+ _tcsncpy(dest, _A2T(&data[strlen(search)]), size);
+ res = 0;
+ }
+
+ return res;
+}
+
+bool CVersionInfo::GetLangpackInfo()
+{
+ LCID packlcid = Langpack_GetDefaultLocale();
+
+ 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)) {
+ TCHAR langpackInfo[MAX_PATH];
+ mir_sntprintf(langpackInfo,SIZEOF(langpackInfo),TEXT("%s (%s) [%04x]"), lang, ctry, packlcid);
+ lpzLangpackInfo = langpackInfo;
+ }
+ else
+ lpzLangpackInfo.append(lang);
+ }
+ else
+ lpzLangpackInfo = _T("Locale id invalid");
+ }
+ else
+ lpzLangpackInfo = _T("No language pack installed");
+ return true;
+}
+
+std::tstring GetPluginTimestamp(FILETIME *fileTime)
+{
+ SYSTEMTIME sysTime;
+ FILETIME ftLocal;
+ FileTimeToLocalFileTime(fileTime, &ftLocal);
+ FileTimeToSystemTime(&ftLocal, &sysTime); //convert the file tyme to system time
+ TCHAR date[256]; //lovely
+ GetISO8061Time(&sysTime, date, 256);
+ return date;
+}
+
+bool CVersionInfo::GetPluginLists()
+{
+ HANDLE hFind;
+ TCHAR szMirandaPath[MAX_PATH] = { 0 }, szSearchPath[MAX_PATH] = { 0 }; //For search purpose
+ WIN32_FIND_DATA fd;
+ TCHAR szMirandaPluginsPath[MAX_PATH] = { 0 }, szPluginPath[MAX_PATH] = { 0 }; //For info reading purpose
+ BYTE PluginIsEnabled = 0;
+ HINSTANCE hInstPlugin = NULL;
+ PLUGININFOEX *(*MirandaPluginInfo)(DWORD); //These two are used to get informations from the plugin.
+ PLUGININFOEX *pluginInfo = NULL; //Read above.
+ DWORD mirandaVersion = 0;
+ BOOL asmCheckOK = FALSE;
+ DWORD loadError;
+ // SYSTEMTIME sysTime; //for timestamp
+
+ mirandaVersion = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
+ {
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
+ if(str2!=NULL) *str2=0;
+ }
+ lpzMirandaPath = szMirandaPath;
+
+ //We got Miranda path, now we'll use it for two different purposes.
+ //1) finding plugins.
+ //2) Reading plugin infos
+ lstrcpyn(szSearchPath,szMirandaPath, MAX_PATH); //We got the path, now we copy it into szSearchPath. We'll use szSearchPath as am auxiliary variable, while szMirandaPath will keep a "fixed" value.
+ lstrcat(szSearchPath, _T("\\Plugins\\*.dll"));
+
+ lstrcpyn(szMirandaPluginsPath, szMirandaPath, MAX_PATH);
+ lstrcat(szMirandaPluginsPath, _T("\\Plugins\\"));
+
+ hFind=FindFirstFile(szSearchPath,&fd);
+ if ( hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (verbose) PUShowMessageT(fd.cFileName, SM_NOTIFY);
+ if (!ValidExtension(fd.cFileName, _T("dll")))
+ continue; //do not report plugins that do not have extension .dll
+
+ hInstPlugin = GetModuleHandle(fd.cFileName); //try to get the handle of the module
+
+ if (hInstPlugin) //if we got it then the dll is loaded (enabled)
+ PluginIsEnabled = 1;
+ else {
+ PluginIsEnabled = 0;
+ lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
+ lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
+ hInstPlugin = LoadLibrary(szPluginPath);
+ }
+ if (!hInstPlugin) { //It wasn't loaded.
+ loadError = GetLastError();
+ int bUnknownError = 1; //assume plugin didn't load because of unknown error
+ //Some error messages.
+ //get the dlls the plugin statically links to
+ if (db_get_b(NULL, ModuleName, "CheckForDependencies", TRUE))
+ {
+ std::tstring linkedModules;
+
+ lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
+ lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
+ if (GetLinkedModulesInfo(szPluginPath, linkedModules)) {
+ std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime);
+ CPlugin thePlugin(fd.cFileName, _T("<unknown>"), UUID_NULL, _T(""), 0, time.c_str(), linkedModules.c_str());
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ bUnknownError = 0; //we know why the plugin didn't load
+ }
+ }
+ if (bUnknownError) { //if cause is unknown then report it
+ std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime);
+ TCHAR buffer[4096];
+ TCHAR error[2048];
+ //DWORD_PTR arguments[2] = {loadError, 0};
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, loadError, 0, error, SIZEOF(error), NULL);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T(" Error %ld - %s"), loadError, error);
+ CPlugin thePlugin( fd.cFileName, _T("<unknown>"), UUID_NULL, _T(""), 0, time.c_str(), buffer);
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ }
+ }
+ else { //It was successfully loaded.
+ MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfoEx");
+ if (!MirandaPluginInfo)
+ MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfo");
+
+ if (!MirandaPluginInfo) //There is no function: it's not a valid plugin. Let's move on to the next file.
+ continue;
+
+ //It's a valid plugin, since we could find MirandaPluginInfo
+ #if (!defined(WIN64) && !defined(_WIN64))
+ asmCheckOK = FALSE;
+ __asm {
+ push mirandaVersion
+ push mirandaVersion
+ call MirandaPluginInfo
+ pop eax
+ pop eax
+ cmp eax, mirandaVersion
+ jne a1
+ mov asmCheckOK, 0xffffffff
+ a1:
+ }
+ #else
+ asmCheckOK = TRUE;
+ #endif
+ if (asmCheckOK)
+ pluginInfo = CopyPluginInfo(MirandaPluginInfo(mirandaVersion));
+ else {
+ ZeroMemory(&pluginInfo, sizeof(pluginInfo));
+ MessageBox(NULL, fd.cFileName, _T("Invalid plugin"), MB_OK);
+ }
+ }
+
+ //Let's get the info.
+ if (MirandaPluginInfo == NULL || pluginInfo == NULL) {
+ FreeLibrary(hInstPlugin); //We don't need it anymore.
+ continue;
+ }
+
+ //We have loaded the informations into pluginInfo.
+ std::tstring timedate = GetPluginTimestamp(&fd.ftLastWriteTime);
+ CPlugin thePlugin(fd.cFileName, _A2T(pluginInfo->shortName), pluginInfo->uuid, /*(pluginInfo->flags & 1) ? _T("Unicode aware") :*/ _T(""), (DWORD) pluginInfo->version, timedate.c_str(), _T(""));
+
+ if (PluginIsEnabled)
+ AddPlugin(thePlugin, listActivePlugins);
+ else {
+ AddPlugin(thePlugin, listInactivePlugins);
+ FreeLibrary(hInstPlugin); //We don't need it anymore.
+ }
+ FreePluginInfo(pluginInfo);
+ MirandaPluginInfo = NULL;
+ }
+ while (FindNextFile(hFind,&fd));
+ FindClose(hFind);
+ }
+ return TRUE;
+}
+
+bool CVersionInfo::AddPlugin(CPlugin &aPlugin, std::list<CPlugin> &aList)
+{
+ std::list<CPlugin>::iterator pos = aList.begin();
+ bool inserted = FALSE;
+
+ if (aList.begin() == aList.end()) { //It's empty
+ aList.push_back(aPlugin);
+ return TRUE;
+ }
+ else { //It's not empty
+ while (pos != aList.end()) {
+ //It can be either < or >, not equal.
+ if (aPlugin < (*pos)) {
+ aList.insert(pos, aPlugin);
+ return TRUE;
+ }
+
+ //It's greater: we need to insert it.
+ pos++;
+ } }
+
+ if (inserted == FALSE) {
+ aList.push_back(aPlugin);
+ return TRUE;
+ }
+ return TRUE;
+};
+
+static char *GetStringFromRVA(DWORD RVA, const LOADED_IMAGE *image)
+{
+ char *moduleName;
+ moduleName = (char *) ImageRvaToVa(image->FileHeader, image->MappedAddress, RVA, NULL);
+ return moduleName;
+}
+
+bool CVersionInfo::GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules)
+{
+ LOADED_IMAGE image;
+ ULONG importTableSize;
+ IMAGE_IMPORT_DESCRIPTOR *importData;
+ //HMODULE dllModule;
+ linkedModules = _T("");
+ bool result = false;
+ TCHAR szError[20];
+ char* szModuleName = mir_t2a(moduleName);
+ if (MapAndLoad(szModuleName, NULL, &image, TRUE, TRUE) == FALSE) {
+ mir_sntprintf(szError, SIZEOF(szError), _T("%d"), GetLastError());
+ mir_free(szModuleName);
+ linkedModules = _T("<error ") + std::tstring(szError) + _T(" at MapAndLoad()>\r\n");
+ return result;
+ }
+ mir_free(szModuleName);
+ importData = (IMAGE_IMPORT_DESCRIPTOR *) ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &importTableSize);
+ if (!importData) {
+ mir_sntprintf(szError, SIZEOF(szError), _T("%d"), GetLastError());
+ linkedModules = _T("<error ") + std::tstring(szError) + _T(" at ImageDirectoryEntryToDataEx()>\r\n");
+ }
+ else {
+ while (importData->Name) {
+ char *moduleName;
+ moduleName = GetStringFromRVA(importData->Name, &image);
+ if (!DoesDllExist(moduleName)) {
+ linkedModules.append( _T(" Plugin statically links to missing dll file: ") + std::tstring(_A2T(moduleName)) + _T("\r\n"));
+ result = true;
+ }
+
+ importData++; //go to next record
+ } }
+
+ // FreeLibrary(dllModule);
+ UnMapAndLoad(&image); //unload the image
+ return result;
+}
+
+std::tstring CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flags, int beautify) {
+ std::list<CPlugin>::iterator pos = aList.begin();
+ std::tstring out = _T("");
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, begin.", SM_NOTIFY);
+#endif
+
+ TCHAR szHeader[32] = {0};
+ TCHAR szFooter[32] = {0};
+ if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (db_get_b(NULL, ModuleName, "BoldVersionNumber", TRUE))) {
+ GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
+ }
+
+ while (pos != aList.end()) {
+ out.append(std::tstring((*pos).getInformations(flags, szHeader, szFooter)));
+ pos++;
+ }
+ #ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, end.", SM_NOTIFY);
+ #endif
+ return out;
+};
+
+void CVersionInfo::BeautifyReport(int beautify, LPCTSTR szBeautifyText, LPCTSTR szNonBeautifyText, std::tstring &out)
+{
+ if (beautify)
+ out.append(szBeautifyText);
+ else
+ out.append(szNonBeautifyText);
+}
+
+void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautify, std::tstring &out)
+{
+ if (forumStyle) { //forum style
+ TCHAR szSize[256], szQuote[256];
+
+ GetStringFromDatabase("SizeBegin", _T("[quote]"), szSize, SIZEOF(szSize));
+ GetStringFromDatabase("QuoteBegin", _T("[spoiler=VersionInfo]"), szQuote, SIZEOF(szQuote));
+ out.append(szQuote);
+ out.append(szSize);
+ }
+ else out = _T("");
+
+ if (!suppressHeader) {
+ out.append( _T("Miranda NG - VersionInformation plugin by Hrk, modified by Eblis\r\n"));
+ if (!forumStyle) {
+ out.append( _T("Miranda's homepage: http://miranda-ng.org/\r\n")); //changed homepage
+ out.append( _T("Miranda tools: http://miranda-ng.org/\r\n\r\n")); //was missing a / before download
+ } }
+
+ TCHAR buffer[1024]; //for beautification
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T(""), out);
+ GetStringFromDatabase("BeautifyBlockStart", _T("<blockquote>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T(""), out);
+ if (!suppressHeader) {
+ //Time of report:
+ TCHAR lpzTime[12]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm':'ss"), lpzTime, SIZEOF(lpzTime));
+ TCHAR lpzDate[32]; GetDateFormat(EnglishLocale, 0, NULL, _T("dd' 'MMMM' 'yyyy"), lpzDate, SIZEOF(lpzDate));
+ out.append( _T("Report generated at: ") + std::tstring(lpzTime) + _T(" on ") + std::tstring(lpzDate) + _T("\r\n\r\n"));
+ }
+
+ //Operating system
+ out.append(_T("CPU: ") + lpzCPUName + _T(" [") + lpzCPUIdentifier + _T("]"));
+ if (bDEPEnabled)
+ out.append(_T(" [DEP enabled]"));
+
+ if (luiProcessors > 1) {
+ TCHAR noProcs[128];
+ mir_sntprintf(noProcs, SIZEOF(noProcs), _T(" [%d CPUs]"), luiProcessors);
+ out.append(noProcs);
+ }
+ out.append( _T("\r\n"));
+
+ //RAM
+ TCHAR szRAM[64];
+ mir_sntprintf(szRAM, SIZEOF(szRAM), _T("%d"), luiRAM);
+ out.append( _T("Installed RAM: ") + std::tstring(szRAM) + _T(" MBytes\r\n"));
+
+ //operating system
+ out.append( _T("Operating System: ") + lpzOSName + _T("\r\n"));
+
+ //shell, IE, administrator
+ out.append( _T("Shell: ") + lpzShell + _T("\r\n"));
+ out.append( _T("Internet Explorer: ") + lpzIEVersion + _T("\r\n"));
+ out.append( _T("Administrator privileges: ") + lpzAdministratorPrivileges + _T("\r\n"));
+
+ //languages
+ out.append( _T("OS Languages: ") + lpzOSLanguages + _T("\r\n"));
+
+ //FreeDiskSpace
+ if (luiFreeDiskSpace) {
+ TCHAR szDiskSpace[64];
+ mir_sntprintf(szDiskSpace, SIZEOF(szDiskSpace), _T("%d"), luiFreeDiskSpace);
+ out.append( _T("Free disk space on Miranda partition: ") + std::tstring(szDiskSpace) + _T(" MBytes\r\n\r\n"));
+ }
+
+ //Miranda
+ out.append( _T("Miranda path: ") + lpzMirandaPath + _T("\r\n"));
+ out.append( _T("Miranda NG version: ") + lpzMirandaVersion);
+ if (bIsWOW64)
+ out.append( _T(" [running inside WOW64]"));
+
+ out.append( _T("\r\nBuild time: ") + lpzBuildTime + _T("\r\n"));
+ out.append( _T("Profile path: ") + lpzProfilePath + _T("\r\n"));
+ out.append( _T("Profile size: ") + lpzProfileSize + _T("\r\n"));
+ out.append( _T("Profile creation date: ") + lpzProfileCreationDate + _T("\r\n"));
+ out.append( _T("Language pack: ") + lpzLangpackInfo);
+ out.append((lpzLangpackModifiedDate.size() > 0) ? _T(", modified: ") + lpzLangpackModifiedDate : _T(""));
+ out.append( _T("\r\n"));
+ out.append(_T("Service Mode: "));
+ if (bServiceMode)
+ out.append( _T("Yes"));
+ else
+ out.append( _T("No"));
+
+ // out.append( _T("Nightly: ") + lpzNightly + _T("\r\n"));
+ // out.append( _T("Unicode core: ") + lpzUnicodeBuild);
+
+ GetStringFromDatabase("BeautifyBlockEnd", _T("</blockquote>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T("\r\n"), out);
+}
+
+void CVersionInfo::AddInfoFooter(int suppressFooter, int forumStyle, int beautify, std::tstring &out)
+{
+ //End of report
+ TCHAR buffer[1024]; //for beautification purposes
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
+ if (!suppressFooter) {
+ BeautifyReport(beautify, buffer, _T("\r\n"), out);
+ out.append( _T("\r\nEnd of report.\r\n"));
+ }
+
+ if (!forumStyle) {
+ if (!suppressFooter)
+ out.append( TranslateT("If you are going to use this report to submit a bug, remember to check the website for questions or help the developers may need.\r\nIf you don't check your bug report and give feedback, it will not be fixed!"));
+ }
+ else {
+ TCHAR szSize[256], szQuote[256];
+ GetStringFromDatabase("SizeEnd", _T("[/quote]"), szSize, SIZEOF(szSize));
+ GetStringFromDatabase("QuoteEnd", _T("[/spoiler]"), szQuote, SIZEOF(szQuote));
+ out.append(szSize);
+ out.append(szQuote);
+ }
+}
+
+static void AddSectionAndCount(std::list<CPlugin> list, LPCTSTR listText, std::tstring &out)
+{
+ TCHAR tmp[64];
+ mir_sntprintf(tmp, SIZEOF(tmp), _T(" (%u)"), list.size());
+ out.append(listText);
+ out.append(tmp);
+ out.append( _T(":"));
+}
+
+std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
+ //Begin of report
+ std::tstring out;
+ int forumStyle = (bDisableForumStyle) ? 0 : db_get_b(NULL, ModuleName, "ForumStyle", TRUE);
+ int showUUID = db_get_b(NULL, ModuleName, "ShowUUIDs", FALSE);
+ int beautify = db_get_b(NULL, ModuleName, "Beautify", 0) & (!forumStyle);
+ int suppressHeader = db_get_b(NULL, ModuleName, "SuppressHeader", TRUE);
+
+ DWORD flags = (forumStyle) | (showUUID << 1);
+
+ AddInfoHeader(suppressHeader, forumStyle, beautify, out);
+ TCHAR normalPluginsStart[1024]; //for beautification purposes, for normal plugins text (start)
+ TCHAR normalPluginsEnd[1024]; //for beautification purposes, for normal plugins text (end)
+ TCHAR horizLine[1024]; //for beautification purposes
+ TCHAR buffer[1024]; //for beautification purposes
+
+ TCHAR headerHighlightStart[10] = _T("");
+ TCHAR headerHighlightEnd[10] = _T("");
+ if (forumStyle) {
+ TCHAR start[128], end[128];
+ GetStringFromDatabase("BoldBegin", _T("[b]"), start, SIZEOF(start));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), end, SIZEOF(end));
+ _tcsncpy(headerHighlightStart, start, SIZEOF(headerHighlightStart));
+ _tcsncpy(headerHighlightEnd, end, SIZEOF(headerHighlightEnd));
+ }
+
+ //Plugins: list of active (enabled) plugins.
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), horizLine, SIZEOF(horizLine));
+ BeautifyReport(beautify, horizLine, _T("\r\n"), out);
+ GetStringFromDatabase("BeautifyActiveHeaderBegin", _T("<b><font size=\"-1\" color=\"DarkGreen\">"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listActivePlugins, _T("Active Plugins"), out);
+ GetStringFromDatabase("BeautifyActiveHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append( _T("\r\n"));
+
+ GetStringFromDatabase("BeautifyPluginsBegin", _T("<font size=\"-2\" color=\"black\">"), normalPluginsStart, SIZEOF(normalPluginsStart));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
+ out.append(GetListAsString(listActivePlugins, flags, beautify));
+ GetStringFromDatabase("BeautifyPluginsEnd", _T("</font>"), normalPluginsEnd, SIZEOF(normalPluginsEnd));
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ //Plugins: list of inactive (disabled) plugins.
+ if ((!forumStyle) && ((db_get_b(NULL, ModuleName, "ShowInactive", TRUE)) || (bServiceMode))) {
+ BeautifyReport(beautify, horizLine, _T("\r\n"), out);
+ GetStringFromDatabase("BeautifyInactiveHeaderBegin", _T("<b><font size=\"-1\" color=\"DarkRed\">"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listInactivePlugins, _T("Unloadable Plugins"), out);
+ GetStringFromDatabase("BeautifyInactiveHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append( _T("\r\n"));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
+ out.append(GetListAsString(listInactivePlugins, flags, beautify));
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ }
+ if (listUnloadablePlugins.size() > 0) {
+ BeautifyReport(beautify, horizLine, _T("\r\n"), out);
+ GetStringFromDatabase("BeautifyUnloadableHeaderBegin", _T("<b><font size=\"-1\"><font color=\"Red\">"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listUnloadablePlugins, _T("Unloadable Plugins"), out);
+ GetStringFromDatabase("BeautifyUnloadableHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append( _T("\r\n"));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
+ out.append(GetListAsString(listUnloadablePlugins, flags, beautify));
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ }
+
+ AddInfoFooter(suppressHeader, forumStyle, beautify, out);
+ return out;
+}
+
+//========== Print functions =====
+
+void CVersionInfo::PrintInformationsToFile(const TCHAR *info)
+{
+ TCHAR buffer[MAX_PATH], outputFileName[MAX_PATH];
+ if (hOutputLocation) {
+ FoldersGetCustomPathT(hOutputLocation, buffer, SIZEOF(buffer), _T("%miranda_path%"));
+ _tcscat(buffer, _T("\\VersionInfo.txt"));
+ }
+ else GetStringFromDatabase("OutputFile", _T("VersionInfo.txt"), buffer, SIZEOF(buffer));
+
+ PathToAbsoluteT(buffer, outputFileName);
+
+ FILE *fp = _tfopen(outputFileName, _T("wb"));
+ if ( fp != NULL ) {
+ char* utf = mir_utf8encodeT( info );
+ fputs( "\xEF\xBB\xBF", fp);
+ fputs( utf, fp );
+ fclose(fp);
+
+ TCHAR mex[512];
+ mir_sntprintf(mex, SIZEOF(mex), TranslateT("Information successfully written to file: \"%s\"."), outputFileName);
+ Log(mex);
+ }
+ else {
+ TCHAR mex[512];
+ mir_sntprintf(mex, SIZEOF(mex), TranslateT("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
+ Log(mex);
+ }
+}
+
+void CVersionInfo::PrintInformationsToFile()
+{
+ PrintInformationsToFile( GetInformationsAsString().c_str());
+}
+
+void CVersionInfo::PrintInformationsToMessageBox()
+{
+ MessageBox(NULL, GetInformationsAsString().c_str(), _T("VersionInfo"), MB_OK);
+}
+
+void CVersionInfo::PrintInformationsToOutputDebugString()
+{
+ OutputDebugString( GetInformationsAsString().c_str());
+}
+
+
+void CVersionInfo::PrintInformationsToDialogBox()
+{
+ HWND DialogBox = CreateDialogParam(hInst,
+ MAKEINTRESOURCE(IDD_DIALOGINFO),
+ NULL, DialogBoxProc, (LPARAM) this);
+
+ SetDlgItemText(DialogBox, IDC_TEXT, GetInformationsAsString().c_str());
+}
+
+void CVersionInfo::PrintInformationsToClipboard(bool showLog)
+{
+ if (GetOpenClipboardWindow()) {
+ Log( TranslateT("The clipboard is not available, retry."));
+ return;
+ }
+
+ OpenClipboard(NULL);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ LPTSTR lptstrCopy;
+ std::tstring aux = GetInformationsAsString();
+ size_t length = aux.length() + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length*sizeof(TCHAR) + 5);
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ lstrcpy(lptstrCopy, aux.c_str());
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+
+ SetClipboardData(CF_UNICODETEXT, hData);
+
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ if (showLog)
+ Log( TranslateT("Information successfully copied into clipboard."));
+}
diff --git a/plugins/!Deprecated/VersionInfo/src/CVersionInfo.h b/plugins/!Deprecated/VersionInfo/src/CVersionInfo.h
new file mode 100644
index 0000000000..6bff2dd8bd
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/CVersionInfo.h
@@ -0,0 +1,101 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef CVERSIONINFO_H
+#define CVERSIONINFO_H
+
+#ifndef PF_NX_ENABLED
+ #define PF_NX_ENABLED 12
+#endif
+
+class CVersionInfo
+{
+ private:
+ //Informations related to Miranda: main informations.
+ std::tstring lpzMirandaVersion;
+ std::tstring lpzMirandaPath;
+ std::tstring lpzProfilePath;
+ std::tstring lpzProfileSize;
+ std::tstring lpzProfileCreationDate;
+ std::tstring lpzNightly;
+ std::tstring lpzUnicodeBuild;
+ std::tstring lpzCPUName;
+ std::tstring lpzCPUIdentifier;
+ std::tstring lpzBuildTime;
+ std::tstring lpzShell;
+ std::tstring lpzIEVersion;
+ std::tstring lpzAdministratorPrivileges;
+ std::tstring lpzOSLanguages;
+ std::tstring lpzLangpackInfo;
+ std::tstring lpzLangpackModifiedDate;
+ //Informations related to plugins
+ std::list<CPlugin> listActivePlugins;
+ std::list<CPlugin> listInactivePlugins;
+ std::list<CPlugin> listUnloadablePlugins;
+ //OS and hardware informations.
+ std::tstring lpzOSName;
+ unsigned int luiProcessors;
+ unsigned int luiRAM;
+ unsigned int luiFreeDiskSpace;
+ int bDEPEnabled;
+ BOOL bIsWOW64;
+ //Additional Miranda informations.
+ unsigned int luiContacts;
+ unsigned int luiEvents;
+ unsigned int luiUnreadEvents;
+ unsigned int luiDBSize;
+ //Configuration
+
+ bool GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules);
+
+ public:
+ //Constructor/Destructor
+ CVersionInfo();
+ ~CVersionInfo();
+ void Initialize();
+ //Miranda informations
+ bool GetMirandaVersion();
+ bool GetProfileSettings();
+ bool GetOSLanguages();
+ bool GetLangpackInfo();
+ bool GetPluginLists();
+ bool GetEventCount(); //TODO
+ //OSInformations
+ bool GetOSVersion();
+ bool GetHWSettings();
+ //Plugins
+ bool AddPlugin(CPlugin&, std::list<CPlugin>&);
+ //Prints
+
+ void PrintInformationsToFile();
+ void PrintInformationsToFile(const TCHAR *info);
+ void PrintInformationsToDialogBox();
+ void PrintInformationsToMessageBox();
+ void PrintInformationsToOutputDebugString();
+ void PrintInformationsToClipboard(bool);
+
+ std::tstring GetListAsString(std::list<CPlugin>&, DWORD flags, int beautify);
+ std::tstring GetInformationsAsString(int bDisableForumStyle = 0);
+ void BeautifyReport(int, LPCTSTR, LPCTSTR, std::tstring &);
+ void AddInfoHeader(int, int, int, std::tstring &);
+ void AddInfoFooter(int, int, int, std::tstring &);
+};
+
+#endif \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/common.h b/plugins/!Deprecated/VersionInfo/src/common.h
new file mode 100644
index 0000000000..16107fd7e7
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/common.h
@@ -0,0 +1,89 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_VERSIONINFO_COMMON_H
+#define M_VERSIONINFO_COMMON_H
+
+#define STRICT
+#define WIN32_LEAN_AND_MEAN
+
+#define _CRT_SECURE_NO_DEPRECATE
+
+#include <windows.h>
+#include <commctrl.h>
+#include <imagehlp.h>
+#include <list>
+#include <string>
+
+#include <newpluginapi.h>
+#include <m_langpack.h>
+#include <m_utils.h>
+#include <m_clist.h>
+#include <m_options.h>
+#include <m_popup.h>
+#include <win2k.h>
+
+#include <m_versioninfo.h>
+#include <m_folders.h>
+
+#include "CPlugin.h"
+#include "version.h"
+#include "hooked_events.h"
+#include "services.h"
+#include "dlgHandlers.h"
+#include "utils.h"
+#include "CVersionInfo.h"
+#include "resource.h"
+
+#define VIPF_NONE 0x0000
+#define VIPF_UNCERTAIN 0x0010
+
+#define VISF_FORUMSTYLE 0x0001
+#define VISF_SHOWUUID 0x0002
+#define VISF_SHOWFLAGS 0x0004
+
+#ifndef MS_DB_GETPROFILEPATH_BASIC //db3xSA
+#define MS_DB_GETPROFILEPATH_BASIC "DB/GetProfilePathBasic"
+#endif
+
+//main.cpp
+extern HINSTANCE hInst;
+
+//main.cpp
+extern HICON hiVIIcon;
+
+//main.cpp
+extern DWORD EnglishLocale;
+
+//for folders support
+extern HANDLE hOutputLocation;
+
+//services.cpp
+extern int bServiceMode;
+
+//main.cpp
+extern char ModuleName[];
+extern BOOL verbose;
+
+#define DEFAULT_UPLOAD_PORT 51234
+
+const MUUID UUID_NULL = {0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }};
+
+#endif \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/dlgHandlers.cpp b/plugins/!Deprecated/VersionInfo/src/dlgHandlers.cpp
new file mode 100644
index 0000000000..c6193cc0b5
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/dlgHandlers.cpp
@@ -0,0 +1,586 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+const char *szQuoteStrings[] = {"[spoiler=VersionInfo] | [/spoiler]", "[quote] | [/quote]", "[code] | [/code]", ""};
+const char *szSizeStrings[] = {"[quote] | [/quote]", "[size=1] | [/size]", "[size=1px] | [/size]", "[size=12] | [/size]", "[size=80] | [/size]", ""};
+const char *szBoldStrings[] = {"[b] | [/b]", "[u] | [/u]", "[b][u] | [/u][/b]", "<b> | </b>", "<u> | </u>", "<b><u> | </u></b>"};
+const int nQuoteCount = SIZEOF(szQuoteStrings); //get the number of quote strings
+const int nSizeCount = SIZEOF(szSizeStrings); //get the number of size strings
+const int nBoldCount = SIZEOF(szBoldStrings); //get the number of bold strings
+
+#define MAX_TEXT 4096*4
+
+int AddInfoToComboboxes(HWND hWnd, int nQuotesComboBox, int nSizesComboBox, int nBoldComboBox)
+{
+ int i;
+ for (i = 0; i < nQuoteCount; i++)
+ SendDlgItemMessageA(hWnd, nQuotesComboBox, CB_ADDSTRING, 0, (LPARAM) szQuoteStrings[i]);
+
+ for (i = 0; i < nSizeCount; i++)
+ SendDlgItemMessageA(hWnd, nSizesComboBox, CB_ADDSTRING, 0, (LPARAM) szSizeStrings[i]);
+
+ for (i = 0; i < nBoldCount; i++)
+ SendDlgItemMessageA(hWnd, nBoldComboBox, CB_ADDSTRING, 0, (LPARAM) szBoldStrings[i]);
+
+ return 0;
+}
+
+void EnableAskComboboxes(HWND hWnd, int bEnable)
+{
+ EnableWindow(GetDlgItem(hWnd, IDC_ASK_BOLDCOMBOBOX), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_ASK_QUOTECOMBOBOX), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_ASK_SIZECOMBOBOX), bEnable);
+}
+
+INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ const int MAX_SIZE = 128;
+ static int oldFSFValue;
+ static TCHAR oldQuoteBegin[MAX_SIZE], oldQuoteEnd[MAX_SIZE];
+ static TCHAR oldSizeBegin[MAX_SIZE], oldSizeEnd[MAX_SIZE];
+ static TCHAR oldBoldBegin[MAX_SIZE], oldBoldEnd[MAX_SIZE];
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
+
+ TranslateDialogDefault(hWnd);
+
+ oldFSFValue = db_get_b(NULL, ModuleName, "ForumStyle", 1);
+
+ AddInfoToComboboxes(hWnd, IDC_ASK_QUOTECOMBOBOX, IDC_ASK_SIZECOMBOBOX, IDC_ASK_BOLDCOMBOBOX);
+
+ CheckDlgButton(hWnd, IDC_ASK_TODIALOGBOX, BST_CHECKED);
+
+ CheckDlgButton(hWnd, IDC_ASK_FORUMSTYLE, (oldFSFValue) ? BST_CHECKED : BST_UNCHECKED);
+ EnableAskComboboxes(hWnd, oldFSFValue);
+ {
+ TCHAR buffer[1024];
+ GetStringFromDatabase("QuoteBegin", _T("[spoiler=VersionInfo]"), oldQuoteBegin, MAX_SIZE);
+ GetStringFromDatabase("QuoteEnd", _T("[/spoiler]"), oldQuoteEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldQuoteBegin, oldQuoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", _T("[quote]"), oldSizeBegin, MAX_SIZE);
+ GetStringFromDatabase("SizeEnd", _T("[/quote]"), oldSizeEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldSizeBegin, oldSizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", _T("[b]"), oldBoldBegin, MAX_SIZE);
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), oldBoldEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldBoldBegin, oldBoldEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+ }
+
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ASK_FORUMSTYLE:
+ EnableAskComboboxes(hWnd, IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE));
+ break;
+
+ case IDC_ASK_CANCEL:
+ DestroyWindow(hWnd);
+ break;
+
+ case IDC_ASK_OK:
+ TCHAR quoteBegin[MAX_SIZE], quoteEnd[MAX_SIZE];
+ TCHAR sizeBegin[MAX_SIZE], sizeEnd[MAX_SIZE];
+ TCHAR boldBegin[MAX_SIZE], boldEnd[MAX_SIZE];
+ TCHAR buffer[1024];
+
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, quoteBegin, quoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, sizeBegin, sizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, boldBegin, boldEnd);
+
+ int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
+ if (newFSFValue != oldFSFValue)
+ db_set_b(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
+
+ if (newFSFValue) {
+ db_set_ts(NULL, ModuleName, "QuoteBegin", quoteBegin);
+ db_set_ts(NULL, ModuleName, "QuoteEnd", quoteEnd);
+
+ db_set_ts(NULL, ModuleName, "SizeBegin", sizeBegin);
+ db_set_ts(NULL, ModuleName, "SizeEnd", sizeEnd);
+
+ db_set_ts(NULL, ModuleName, "BoldBegin", boldBegin);
+ db_set_ts(NULL, ModuleName, "BoldEnd", boldEnd);
+ }
+
+ int debugTo = TO_DIALOGBOX; //just to be safe
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOFILE))
+ debugTo = TO_FILE;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOMESSAGEBOX))
+ debugTo = TO_MESSAGEBOX;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TODIALOGBOX))
+ debugTo = TO_DIALOGBOX;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOOUTPUTDEBUGSTRING))
+ debugTo = TO_DEBUGSTRING;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOCLIPBOARD))
+ debugTo = TO_CLIPBOARD;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOUPLOAD))
+ debugTo = TO_UPLOAD;
+
+ DoDebugTo(debugTo);
+
+ if (newFSFValue != oldFSFValue)
+ db_set_b(NULL, ModuleName, "ForumStyle", oldFSFValue);
+
+ if (newFSFValue) {
+ db_set_ts(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
+ db_set_ts(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
+
+ db_set_ts(NULL, ModuleName, "SizeBegin", oldSizeBegin);
+ db_set_ts(NULL, ModuleName, "SizeEnd", oldSizeEnd);
+
+ db_set_ts(NULL, ModuleName, "BoldBegin", oldBoldBegin);
+ db_set_ts(NULL, ModuleName, "BoldEnd", oldBoldEnd);
+ }
+
+ DestroyWindow(hWnd);
+ break;
+ }
+ break;
+ }
+ return 0;
+}
+
+int DoDebugTo(int debugTo)
+{
+ HWND parent = NULL;
+ HWND askDialog;
+ CVersionInfo myInfo;// = CVersionInfo();
+ if (verbose) PUShowMessage("I am going to read the information.", SM_NOTIFY);
+ if (debugTo != TO_ASK)
+ myInfo.Initialize();
+
+ if (verbose) PUShowMessage("I have read the information, I will now print them.", SM_NOTIFY);
+
+ switch(debugTo) {
+ case TO_ASK:
+ askDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ASKDIALOG), parent, AskDlgProc);
+ ShowWindow(askDialog, SW_SHOW);
+ break;
+
+ case TO_FILE:
+ myInfo.PrintInformationsToFile();
+ break;
+
+ case TO_MESSAGEBOX:
+ myInfo.PrintInformationsToMessageBox();
+ break;
+
+ case TO_DIALOGBOX:
+ myInfo.PrintInformationsToDialogBox();
+ break;
+
+ case TO_DEBUGSTRING:
+ myInfo.PrintInformationsToOutputDebugString();
+ break;
+
+ case TO_CLIPBOARD:
+ myInfo.PrintInformationsToClipboard(true);
+ break;
+
+ default:
+ myInfo.PrintInformationsToFile();
+ break;
+ }
+
+ if ((debugTo != TO_CLIPBOARD) && (db_get_b(NULL, ModuleName, "ClipboardAlways", FALSE)))
+ myInfo.PrintInformationsToClipboard(false);
+
+ if ((bServiceMode) && (debugTo != TO_DIALOGBOX) && (debugTo != TO_ASK)) //close miranda if in service mode and no dialog was shown
+ PostQuitMessage(0);
+
+ return 0;
+}
+
+void EnableUploadSettings(HWND hWnd, int bEnable)
+{
+ EnableWindow(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_UPLOAD_PORT), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_UPLOAD_PASSWORD), bEnable);
+}
+
+INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static int bOptionsInitializing = 0;
+ switch(msg) {
+ case WM_INITDIALOG:
+ bOptionsInitializing = 1;
+ TranslateDialogDefault(hWnd);
+ AddInfoToComboboxes(hWnd, IDC_QUOTECOMBOBOX, IDC_SIZECOMBOBOX, IDC_BOLDCOMBOBOX);
+
+ CheckDlgButton(hWnd, IDC_FORUMSTYLE, (BOOL) db_get_b(NULL, ModuleName, "ForumStyle", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_DISABLEDTOO, (BOOL) db_get_b(NULL, ModuleName, "ShowInactive", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, (BOOL) db_get_b(NULL, ModuleName, "ShowUUIDs", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWINSTALLEDLANGUAGES, (BOOL) db_get_b(NULL, ModuleName, "ShowInstalledLanguages", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SUPPRESSHEADER, (BOOL) db_get_b(NULL, ModuleName, "SuppressHeader", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hWnd, IDC_SHOWINTASKBAR, (BOOL) db_get_b(NULL, ModuleName, "ShowInTaskbar", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CLIPBOARDALSO, (BOOL) db_get_b(NULL, ModuleName, "ClipboardAlways", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_BOLDVERSION, (BOOL) db_get_b(NULL, ModuleName, "BoldVersionNumber", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CHECKUNLOADABLE, (BOOL) db_get_b(NULL, ModuleName, "CheckForDependencies", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ SetFocus(GetDlgItem(hWnd, IDC_FORUMSTYLE));
+ {
+ DBVARIANT dbv = { 0 };
+ bOptionsInitializing = 1;
+ TCHAR buffer[1024];
+ TCHAR notFound[1024];
+
+ if (db_get_ts(NULL, ModuleName, "OutputFile", &dbv) == 0)
+ PathToAbsoluteT(dbv.ptszVal, notFound);
+ else
+ PathToAbsoluteT(_T("VersionInfo.txt"), notFound);
+
+ if (hOutputLocation)
+ _tcscpy(buffer, TranslateT("Customize using folders plugin"));
+ else
+ _tcsncpy(buffer, notFound, SIZEOF(notFound));
+
+ SetDlgItemText(hWnd, IDC_FILENAME, buffer);
+
+ TCHAR start[256], end[256];
+ GetStringFromDatabase("QuoteBegin", _T("[spoiler=VersionInfo]"), start, SIZEOF(start));
+ GetStringFromDatabase("QuoteEnd", _T("[/spoiler]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", _T("[quote]"), start, SIZEOF(start));
+ GetStringFromDatabase("SizeEnd", _T("[/quote]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", _T("[b]"), start, SIZEOF(start));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+ //to add stuff
+
+ //upload server settings
+ GetStringFromDatabase("UploadServer", _T("vi.cass.cz"), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), buffer);
+
+ int port = db_get_w(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
+ _itot(port, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
+
+ GetStringFromDatabase("UploadUser", _T(""), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), buffer);
+
+ GetStringFromDatabase("UploadPassword", _T(""), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PASSWORD), buffer);
+ }
+
+ switch(db_get_b(NULL, ModuleName, "DebugTo", TO_DIALOGBOX)) {
+ case TO_FILE:
+ CheckDlgButton(hWnd, IDC_TOFILE, BST_CHECKED);
+ break;
+
+ case TO_MESSAGEBOX:
+ CheckDlgButton(hWnd, IDC_TOMESSAGEBOX, BST_CHECKED);
+ break;
+
+ case TO_DIALOGBOX:
+ CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
+ break;
+
+ case TO_DEBUGSTRING:
+ CheckDlgButton(hWnd, IDC_TODEBUGSTRING, BST_CHECKED);
+ break;
+
+ case TO_CLIPBOARD:
+ CheckDlgButton(hWnd, IDC_TOCLIPBOARD, BST_CHECKED);
+ break;
+
+ case TO_UPLOAD:
+ CheckDlgButton(hWnd, IDC_TOUPLOAD, BST_CHECKED);
+ break;
+
+ case TO_ASK:
+ CheckDlgButton(hWnd, IDC_ASKEVERYTIME, BST_CHECKED);
+ break;
+
+ default:
+ CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
+ break;
+ }
+
+ EnableWindow(GetDlgItem(hWnd, IDC_QUOTECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE);//both forum style and bold version checked
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
+ EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
+ EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!hOutputLocation)) ? TRUE : FALSE);
+ EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
+ {
+ OSVERSIONINFO osvi = { 0 };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+ EnableWindow(GetDlgItem(hWnd, IDC_CHECKUNLOADABLE), FALSE);
+ }
+
+ CheckDlgButton(hWnd, IDC_DEBUG, (BOOL) verbose == TRUE ? BST_CHECKED : BST_UNCHECKED);
+
+ SetFocus(GetDlgItem(hWnd, IDC_GETINFONOW));
+
+ bOptionsInitializing = 0;
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_ASKEVERYTIME:
+ case IDC_TOFILE:
+ case IDC_TOMESSAGEBOX:
+ case IDC_TODIALOGBOX:
+ case IDC_TODEBUGSTRING:
+ case IDC_TOCLIPBOARD:
+ case IDC_TOUPLOAD:
+ case IDC_FORUMSTYLE:
+ case IDC_BOLDVERSION:
+ EnableWindow(GetDlgItem(hWnd, IDC_QUOTECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE); //both forum style and bold version checked
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!hOutputLocation)) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
+ EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
+ EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
+ EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
+
+ case IDC_SHOWUUIDS:
+ if (IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) && MessageBox(hWnd,
+ TranslateT("Are you sure you want to enable this option?\nPlease only enable this option if you really know what you're doing and what the option is for or if someone asked you to do it."),
+ TranslateT("Show plugin UUIDs?"), MB_YESNO | MB_ICONWARNING) == IDNO)
+ {
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, FALSE);
+
+ break;
+ }//else fallthrough
+ case IDC_DISABLEDTOO:
+ case IDC_SHOWINTASKBAR:
+ case IDC_CLIPBOARDALSO:
+ case IDC_CHECKUNLOADABLE:
+ case IDC_SUPPRESSHEADER:
+ case IDC_SHOWINSTALLEDLANGUAGES:
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
+
+ case IDC_QUOTECOMBOBOX:
+ case IDC_SIZECOMBOBOX:
+ case IDC_BOLDCOMBOBOX:
+ if (!bOptionsInitializing)
+ SendMessage(GetParent(hWnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_FILENAME:
+ case IDC_UPLOAD_USERNAME:
+ case IDC_UPLOAD_PASSWORD:
+ case IDC_UPLOAD_PORT:
+ case IDC_UPLOAD_SERVER:
+ if ( HIWORD(wParam) == EN_CHANGE && !bOptionsInitializing) {
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
+ }
+ break;
+
+ case IDC_GETINFONOW:
+ //Call the plugin menu command routine.
+ PluginMenuCommand(0,0);
+ break;
+
+ case IDC_DEBUG:
+ verbose = !verbose;
+ break;
+ }
+
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
+ TCHAR buffer[1024];
+ TCHAR start[256], end[256];
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ db_set_ts(NULL, ModuleName, "QuoteBegin", start);
+ db_set_ts(NULL, ModuleName, "QuoteEnd", end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ db_set_ts(NULL, ModuleName, "SizeBegin", start);
+ db_set_ts(NULL, ModuleName, "SizeEnd", end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ db_set_ts(NULL, ModuleName, "BoldBegin", start);
+ db_set_ts(NULL, ModuleName, "BoldEnd", end);
+ }
+
+ db_set_b(NULL, ModuleName, "CheckForDependencies", IsDlgButtonChecked(hWnd, IDC_CHECKUNLOADABLE) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "BoldVersionNumber", IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ForumStyle", IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ClipboardAlways", IsDlgButtonChecked(hWnd, IDC_CLIPBOARDALSO) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "SuppressHeader", IsDlgButtonChecked(hWnd, IDC_SUPPRESSHEADER) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
+ db_set_b(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
+
+ if (!hOutputLocation) {
+ TCHAR filePath[MAX_PATH], fileName[MAX_PATH];
+ GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
+ PathToRelativeT(fileName, filePath);
+
+ db_set_ts(NULL, ModuleName, "OutputFile", filePath); //store relative path
+ }
+ db_set_b(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
+ //Debug to:
+ if (IsDlgButtonChecked(hWnd, IDC_TOFILE))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_FILE);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOMESSAGEBOX))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_MESSAGEBOX);
+ else if (IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ else if (IsDlgButtonChecked(hWnd, IDC_TODEBUGSTRING))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_DEBUGSTRING);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_CLIPBOARD);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOUPLOAD))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_UPLOAD);
+ else if (IsDlgButtonChecked(hWnd, IDC_ASKEVERYTIME))
+ db_set_b(NULL, ModuleName, "DebugTo", TO_ASK);
+
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), TRUE);
+ //Disabled plugins too?
+ db_set_b(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
+ }
+ }
+
+ break;
+ }
+ return 0;
+}
+
+INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static CVersionInfo *myInfo = NULL;
+ switch(msg) {
+ case WM_INITDIALOG:
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
+
+ myInfo = (CVersionInfo *) lParam;
+ if (db_get_b(NULL, ModuleName, "ShowInTaskbar", TRUE)) {
+ LONG_PTR ws;
+ ws = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+ SetWindowLongPtr(hWnd, GWL_EXSTYLE, ws | WS_EX_APPWINDOW);
+ //SetWindowLongPtr(hWnd, GWL_STYLE, ws | WS_DLGFRAME | WS_POPUPWINDOW);
+ }
+
+ TranslateDialogDefault(hWnd);
+ {
+ DBVARIANT dbv = { 0 };
+ LOGFONT lf = { 0 };
+
+ dbv.type = DBVT_BLOB;
+ if (db_get(NULL, "OptionFont", "Font", &dbv) == 0)
+ lf=*(LOGFONT*)dbv.pbVal;
+ else {
+ HFONT hFont = (HFONT)SendDlgItemMessage(hWnd,IDC_CLOSE,WM_GETFONT,0,0);
+ GetObject(hFont,sizeof(lf),&lf);
+ }
+ SendDlgItemMessage(hWnd,IDC_TEXT,WM_SETFONT,(WPARAM)CreateFontIndirect(&lf),0);
+ }
+
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case WM_COMMAND: {
+ switch(LOWORD(wParam)) {
+ case IDC_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case IDC_COPYTEXT:
+ SetLastError(0);
+ if (GetOpenClipboardWindow())
+ Log( TranslateT("The clipboard is not available, retry."));
+ else {
+ OpenClipboard(hWnd);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ TCHAR text[MAX_TEXT];
+ LPTSTR lptstrCopy;
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ int length = lstrlen(text) + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (length + 5)*sizeof( TCHAR ));
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ lstrcpyn(lptstrCopy, text, length);
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+
+ SetClipboardData(CF_UNICODETEXT, hData);
+
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ }
+
+ break;
+
+ case IDC_SAVETOFILE:
+ TCHAR text[MAX_TEXT];
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ myInfo->PrintInformationsToFile(text);
+ break;
+ }
+
+ break;
+ }
+ case WM_DESTROY:
+ DeleteObject((HFONT)SendDlgItemMessage(hWnd,IDC_TEXT,WM_GETFONT,0,0));
+ myInfo = NULL;
+ if (bServiceMode) //close miranda if in service mode
+ PostQuitMessage(0);
+
+ break;
+ }
+ return 0;
+}
diff --git a/plugins/!Deprecated/VersionInfo/src/dlgHandlers.h b/plugins/!Deprecated/VersionInfo/src/dlgHandlers.h
new file mode 100644
index 0000000000..b2a66f014c
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/dlgHandlers.h
@@ -0,0 +1,40 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_VERSIONINFO_DLGHEADERS_H
+#define M_VERSIONINFO_DLGHEADERS_H
+
+#define TO_ASK 0
+#define TO_FILE 1
+#define TO_MESSAGEBOX 2
+#define TO_DIALOGBOX 3
+#define TO_DEBUGSTRING 4
+#define TO_CLIPBOARD 5
+#define TO_UPLOAD 6
+
+extern INT_PTR PluginMenuCommand(WPARAM, LPARAM);
+extern INT_PTR OptionsInitialise(WPARAM, LPARAM);
+
+
+int DoDebugTo(int debugTo);
+INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+#endif \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/hooked_events.cpp b/plugins/!Deprecated/VersionInfo/src/hooked_events.cpp
new file mode 100644
index 0000000000..d718db4a09
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/hooked_events.cpp
@@ -0,0 +1,50 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+int HookEvents()
+{
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
+ return 0;
+}
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ hOutputLocation = FoldersRegisterCustomPathT(LPGEN("VersionInfo"), LPGEN("Output folder"), MIRANDA_PATHT);
+
+ return 0;
+}
+
+int OnOptionsInitialise(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.position = 100000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VERSIONINFO);
+ odp.pszTitle = LPGEN("Version Information");
+ odp.pszGroup = LPGEN("Services");
+ odp.groupPosition = 910000000;
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcOpts;
+ Options_AddPage(wParam, &odp);
+ return 0;
+} \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/hooked_events.h b/plugins/!Deprecated/VersionInfo/src/hooked_events.h
new file mode 100644
index 0000000000..e63d138998
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/hooked_events.h
@@ -0,0 +1,32 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_VERSIONINFO_HOOKED_EVENTS_H
+#define M_VERSIONINFO_HOOKED_EVENTS_H
+
+extern HANDLE hModulesLoaded;
+extern HANDLE hOptionsInitialise;
+
+int HookEvents();
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
+int OnOptionsInitialise(WPARAM wParam, LPARAM lParam);
+
+#endif \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/main.cpp b/plugins/!Deprecated/VersionInfo/src/main.cpp
new file mode 100644
index 0000000000..caf9cbffe7
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/main.cpp
@@ -0,0 +1,105 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+HINSTANCE hInst;
+
+int hLangpack;
+
+HICON hiVIIcon;
+
+DWORD EnglishLocale;
+
+HANDLE hOutputLocation = NULL; //for folders plugin
+
+void * (* MirandaMalloc)(size_t);
+void * (* MirandaRealloc)(void *, size_t);
+void (* MirandaFree)(void *);
+
+char ModuleName[] = "VersionInfo";
+
+#ifdef _DEBUG
+ BOOL verbose = FALSE;//TRUE;
+#else
+ BOOL verbose = FALSE;
+#endif
+
+PLUGININFOEX pluginInfo={
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ // {2F174488-489C-4FE1-940D-596CF0F35E65}
+ {0x2f174488, 0x489c, 0x4fe1, {0x94, 0x0d, 0x59, 0x6c, 0xf0, 0xf3, 0x5e, 0x65}}
+};
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SERVICEMODE, MIID_LAST};
+
+bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+extern "C" int __declspec(dllexport) Load(void)
+{
+ mir_getLP(&pluginInfo);
+
+ InitServices();
+ HookEvents();
+
+ hiVIIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIN));
+
+ //get the name of the dll itself
+ TCHAR filePath[512] = {0};
+ GetModuleFileName(hInst, filePath, SIZEOF(filePath));
+ TCHAR *fileName = NULL;
+ size_t i = _tcslen(filePath) - 1;
+ _tcslwr(filePath);
+
+ //Menu item
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = mi.popupPosition = 2000089999;
+ mi.hIcon = hiVIIcon;
+ mi.pszName = LPGEN("Version Information");
+ mi.pszService = MS_VERSIONINFO_MENU_COMMAND;
+ Menu_AddMainMenuItem(&mi);
+
+ if (LoadLibraryA("RichEd32.dll") == NULL)
+ MessageBoxA(NULL, "d'oh", "d'oh", MB_OK);
+
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ return 0;
+} \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/resource.h b/plugins/!Deprecated/VersionInfo/src/resource.h
new file mode 100644
index 0000000000..b282e8bca6
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/resource.h
@@ -0,0 +1,71 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+#define IDD_DIALOG1 101
+#define IDD_OPT_VERSIONINFO 102
+#define IDD_DIALOGBOX 103
+#define IDD_DIALOGINFO 103
+#define IDI_ICON1 104
+#define IDI_MAIN 104
+#define IDD_ASKDIALOG 106
+#define IDC_MENUITEM 1000
+#define IDC_TOFILE 1001
+#define IDC_TOMESSAGEBOX 1002
+#define IDC_TODIALOGBOX 1003
+#define IDC_DISABLEDTOO 1004
+#define IDC_FILENAME 1005
+#define IDC_TEXT 1006
+#define IDC_TODEBUGSTRING 1006
+#define IDC_CLOSE 1007
+#define IDC_TOCLIPBOARD 1007
+#define IDC_GETINFONOW 1009
+#define IDC_TOUPLOAD 1010
+#define IDC_GETINFONOW2 1011
+#define IDC_COPYTEXT 1012
+#define IDC_DEBUG 1013
+#define IDC_FORUMSTYLE 1014
+#define IDC_CLIPBOARDALSO 1015
+#define IDC_SHOWINTASKBAR 1016
+#define IDC_QUOTECOMBOBOX 1017
+#define IDC_SIZECOMBOBOX 1018
+#define IDC_BOLDVERSION 1020
+#define IDC_CHECKUNLOADABLE 1021
+#define IDC_ASKEVERYTIME 1022
+#define IDC_ASK_TOFILE 1023
+#define IDC_ASK_TOMESSAGEBOX 1024
+#define IDC_ASK_TODIALOGBOX 1025
+#define IDC_ASK_TOOUTPUTDEBUGSTRING 1026
+#define IDC_ASK_TOCLIPBOARD 1027
+#define IDC_ASK_CANCEL 1028
+#define IDC_ASK_OK 1029
+#define IDC_BOLDCOMBOBOX 1030
+#define IDC_SUPPRESSHEADER 1031
+#define IDC_SHOWHARDWAREINFO 1033
+#define IDC_UPLOAD 1034
+#define IDC_ASK_UPLOAD 1036
+#define IDC_ASK_TOUPLOAD 1036
+#define IDC_UPLOAD_SERVER 1038
+#define IDC_UPLOAD_PORT 1039
+#define IDC_UPLOAD_USERNAME 1040
+#define IDC_UPLOAD_PASSWORD 1041
+#define IDC_TEMPORARY_FORUMSTYLE 1042
+#define IDC_ASK_FORUMSTYLE 1042
+#define IDC_ASK_QUOTECOMBOBOX 1043
+#define IDC_ASK_SIZECOMBOBOX 1044
+#define IDC_ASK_BOLDCOMBOBOX 1045
+#define IDC_SAVETOFILE 1046
+#define IDC_SHOWUUIDS 1048
+#define IDC_CHECK1 1049
+#define IDC_SHOWINSTALLEDLANGUAGES 1049
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 107
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1050
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/plugins/!Deprecated/VersionInfo/src/services.cpp b/plugins/!Deprecated/VersionInfo/src/services.cpp
new file mode 100644
index 0000000000..85bc1b7347
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/services.cpp
@@ -0,0 +1,61 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+int bServiceMode = 0; //true only if plugin is running in service mode
+
+int InitServices()
+{
+ CreateServiceFunction(MS_VERSIONINFO_MENU_COMMAND, PluginMenuCommand);
+ CreateServiceFunction(MS_VERSIONINFO_GETINFO, GetInfoService);
+ CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeService);
+ return 0;
+}
+
+INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam)
+{
+ int debugTo = db_get_b(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ DoDebugTo(debugTo);
+ if (verbose) PUShowMessage("I have printed the information.", SM_NOTIFY);
+ return 0;
+}
+
+INT_PTR GetInfoService(WPARAM wParam, LPARAM lParam)
+{
+ int result = 1; //failure
+ if (lParam != NULL) {
+ CVersionInfo myInfo;
+ myInfo.Initialize();
+ std::tstring VI = myInfo.GetInformationsAsString(wParam);
+ char **retData = (char **) lParam;
+ *retData = mir_utf8encodeT( VI.c_str());
+ if (*retData)
+ result = 0; //success
+ }
+ return result;
+}
+
+INT_PTR ServiceModeService(WPARAM wParam, LPARAM lParam)
+{
+ bServiceMode = 1;
+ DoDebugTo(TO_ASK);
+ return SERVICE_ONLYDB; // load database and open a window
+}
diff --git a/plugins/!Deprecated/VersionInfo/src/services.h b/plugins/!Deprecated/VersionInfo/src/services.h
new file mode 100644
index 0000000000..38acbc7731
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/services.h
@@ -0,0 +1,31 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_VERSIONINFO_SERVICES_H
+#define M_VERSIONINFO_SERVICES_H
+
+int InitServices();
+int DestroyServices();
+
+INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam);
+INT_PTR GetInfoService(WPARAM wParam, LPARAM lParam);
+INT_PTR ServiceModeService(WPARAM wParam, LPARAM lParam);
+
+#endif //M_VERSIONINFO_SERVICES_H \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/stdafx.cpp b/plugins/!Deprecated/VersionInfo/src/stdafx.cpp
new file mode 100644
index 0000000000..2aa7ce281e
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/stdafx.cpp
@@ -0,0 +1,18 @@
+/*
+Copyright (C) 2012-14 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "common.h" \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/utils.cpp b/plugins/!Deprecated/VersionInfo/src/utils.cpp
new file mode 100644
index 0000000000..49bbba5a07
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/utils.cpp
@@ -0,0 +1,438 @@
+/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+
+void Log(const TCHAR* message)
+{
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ POPUPDATAT pu = {0};
+ pu.lchIcon = hiVIIcon;
+ _tcsncpy(pu.lptzContactName, TranslateT("Version Information"), MAX_CONTACTNAME);
+ _tcsncpy(pu.lptzText, message, MAX_SECONDLINE);
+ PUAddPopupT(&pu);
+ }
+ else MessageBox(NULL, message, _T("VersionInfo"), MB_OK | MB_ICONINFORMATION);
+}
+
+int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText)
+{
+ const TCHAR *pos = _tcschr(szWholeText, '|');
+ if (pos) {
+ size_t index = pos - szWholeText;
+ lstrcpyn(szStartText, szWholeText, (int)index);
+ szStartText[index] = '\0';
+ StrTrim(szStartText, _T(" "));
+ lstrcpyn(szEndText, pos + 1, (int)_tcslen(pos)); //copies the \0 as well ... :)
+ StrTrim(szEndText, _T(" "));
+ }
+ else szStartText[0] = szEndText[0] = '\0';
+
+ return 0;
+}
+
+int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, size_t size)
+{
+ DBVARIANT dbv = {0};
+ int res = 1;
+ size_t len;
+ if ( db_get_ts(NULL, ModuleName, szSettingName, &dbv) == 0) {
+ res = 0;
+ size_t tmp = _tcslen(dbv.ptszVal);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ _tcsncpy(szResult, dbv.ptszVal, len);
+ szResult[len] = '\0';
+ mir_free(dbv.ptszVal);
+ }
+ else {
+ res = 1;
+ size_t tmp = _tcslen(szError);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ _tcsncpy(szResult, szError, len);
+ szResult[len] = '\0';
+ }
+ return res;
+}
+
+#define GetFacility(dwError) (HIWORD(dwError) && 0x0000111111111111)
+#define GetErrorCode(dwError) (LOWORD(dwError))
+
+void NotifyError(DWORD dwError, const TCHAR* szSetting, int iLine)
+{
+ TCHAR str[1024];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d"), szSetting, GetFacility(dwError), GetErrorCode(dwError), iLine);
+ Log(str);
+}
+
+TCHAR *StrTrim(TCHAR *szText, const TCHAR *szTrimChars)
+{
+ size_t i = _tcslen(szText) - 1;
+ while (i >= 0 && _tcschr(szTrimChars, szText[i]))
+ szText[i--] = '\0';
+
+ i = 0;
+ while (((unsigned int )i < _tcslen(szText)) && _tcschr(szTrimChars, szText[i]))
+ i++;
+
+ if (i) {
+ size_t size = _tcslen(szText);
+ size_t j;
+ for (j = i; j <= size; j++) //shift the \0 as well
+ szText[j - i] = szText[j];
+ }
+ return szText;
+}
+
+bool DoesDllExist(char *dllName)
+{
+ HMODULE dllHandle;
+ dllHandle = LoadLibraryExA(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ if (dllHandle)
+ {
+ FreeLibrary(dllHandle);
+ return true;
+ }
+ return false;
+}
+
+void GetISO8061Time(SYSTEMTIME* stLocal, LPTSTR lpszString, DWORD dwSize)
+{
+ SYSTEMTIME loctime;
+ if (stLocal == NULL)
+ {
+ stLocal = &loctime;
+ GetLocalTime(stLocal);
+ }
+
+ 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);
+}
+
+void GetModuleTimeStamp(LPTSTR lpszString, DWORD dwSize)
+{
+ TCHAR tszModule[MAX_PATH];
+ GetModuleFileName(NULL, tszModule, SIZEOF(tszModule));
+ WIN32_FIND_DATA fd;
+ if (FindFirstFile(tszModule, &fd) != INVALID_HANDLE_VALUE) {
+ FILETIME ftLocal;
+ SYSTEMTIME stLocal;
+ FileTimeToLocalFileTime(&fd.ftLastWriteTime, &ftLocal);
+ FileTimeToSystemTime(&ftLocal, &stLocal);
+ GetISO8061Time(&stLocal, lpszString, dwSize);
+ }
+}
+
+//From Egodust or Cyreve... I don't really know.
+PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *piSrc)
+{
+ if(piSrc==NULL)
+ return NULL;
+
+ PLUGININFOEX *pi = (PLUGININFOEX *)malloc(sizeof(PLUGININFOEX));
+ *pi = *piSrc;
+
+ if (piSrc->cbSize >= sizeof(PLUGININFOEX))
+ pi->uuid = piSrc->uuid;
+ else
+ pi->uuid = UUID_NULL;
+
+ if (pi->author) pi->author = _strdup(pi->author);
+ if (pi->authorEmail) pi->authorEmail = _strdup(pi->authorEmail);
+ if (pi->copyright) pi->copyright = _strdup(pi->copyright);
+ if (pi->description) pi->description = _strdup(pi->description);
+ if (pi->homepage) pi->homepage = _strdup(pi->homepage);
+ if (pi->shortName) pi->shortName = _strdup(pi->shortName);
+ return pi;
+}
+
+void FreePluginInfo(PLUGININFOEX *pi)
+{
+ if (pi->author) free(pi->author);
+ if (pi->authorEmail) free(pi->authorEmail);
+ if (pi->copyright) free(pi->copyright);
+ if (pi->description) free(pi->description);
+ if (pi->homepage) free(pi->homepage);
+ if (pi->shortName) free(pi->shortName);
+ free(pi);
+}
+
+BOOL IsCurrentUserLocalAdministrator(void)
+{
+ BOOL fReturn = FALSE;
+ DWORD dwStatus;
+ DWORD dwAccessMask;
+ DWORD dwAccessDesired;
+ DWORD dwACLSize;
+ DWORD dwStructureSize = sizeof(PRIVILEGE_SET);
+ PACL pACL = NULL;
+ PSID psidAdmin = NULL;
+
+ HANDLE hToken = NULL;
+ HANDLE hImpersonationToken = NULL;
+
+ PRIVILEGE_SET ps;
+ GENERIC_MAPPING GenericMapping;
+
+ PSECURITY_DESCRIPTOR psdAdmin = NULL;
+ SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
+
+ /*
+ Determine if the current thread is running as a user that is a member of
+ the local admins group. To do this, create a security descriptor that
+ has a DACL which has an ACE that allows only local aministrators access.
+ Then, call AccessCheck with the current thread's token and the security
+ descriptor. It will say whether the user could access an object if it
+ had that security descriptor. Note: you do not need to actually create
+ the object. Just checking access against the security descriptor alone
+ will be sufficient.
+ */
+ const DWORD ACCESS_READ = 1;
+ const DWORD ACCESS_WRITE = 2;
+
+
+ __try
+ {
+
+ /*
+ AccessCheck() requires an impersonation token. We first get a primary
+ token and then create a duplicate impersonation token. The
+ impersonation token is not actually assigned to the thread, but is
+ used in the call to AccessCheck. Thus, this function itself never
+ impersonates, but does use the identity of the thread. If the thread
+ was impersonating already, this function uses that impersonation context.
+ */
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken))
+ {
+ if (GetLastError() != ERROR_NO_TOKEN)
+ __leave;
+
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken))
+ __leave;
+ }
+
+ if (!DuplicateToken (hToken, SecurityImpersonation, &hImpersonationToken))
+ __leave;
+
+
+ /*
+ Create the binary representation of the well-known SID that
+ represents the local administrators group. Then create the security
+ descriptor and DACL with an ACE that allows only local admins access.
+ After that, perform the access check. This will determine whether
+ the current user is a local admin.
+ */
+ if (!AllocateAndInitializeSid(&SystemSidAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdmin))
+ __leave;
+
+ psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
+ if (psdAdmin == NULL)
+ __leave;
+
+ if (!InitializeSecurityDescriptor(psdAdmin, SECURITY_DESCRIPTOR_REVISION))
+ __leave;
+
+ // Compute size needed for the ACL.
+ dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidAdmin) - sizeof(DWORD);
+
+ pACL = (PACL)LocalAlloc(LPTR, dwACLSize);
+ if (pACL == NULL)
+ __leave;
+
+ if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2))
+ __leave;
+
+ dwAccessMask= ACCESS_READ | ACCESS_WRITE;
+
+ if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask, psidAdmin))
+ __leave;
+
+ if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE))
+ __leave;
+
+ /*
+ AccessCheck validates a security descriptor somewhat; set the group
+ and owner so that enough of the security descriptor is filled out to
+ make AccessCheck happy.
+ */
+ SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE);
+ SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE);
+
+ if (!IsValidSecurityDescriptor(psdAdmin))
+ __leave;
+
+ dwAccessDesired = ACCESS_READ;
+
+ /*
+ Initialize GenericMapping structure even though you
+ do not use generic rights.
+ */
+ GenericMapping.GenericRead = ACCESS_READ;
+ GenericMapping.GenericWrite = ACCESS_WRITE;
+ GenericMapping.GenericExecute = 0;
+ GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE;
+
+ if (!AccessCheck(psdAdmin, hImpersonationToken, dwAccessDesired, &GenericMapping, &ps, &dwStructureSize, &dwStatus, &fReturn))
+ {
+ fReturn = FALSE;
+ __leave;
+ }
+ }
+ __finally
+ {
+ // Clean up.
+ if (pACL) LocalFree(pACL);
+ if (psdAdmin) LocalFree(psdAdmin);
+ if (psidAdmin) FreeSid(psidAdmin);
+ if (hImpersonationToken) CloseHandle (hImpersonationToken);
+ if (hToken) CloseHandle (hToken);
+ }
+
+ return fReturn;
+}
+
+BOOL GetWindowsShell(TCHAR *shellPath, size_t shSize)
+{
+ OSVERSIONINFO vi = {0};
+ vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&vi);
+
+ TCHAR szShell[1024] = {0};
+ DWORD size = SIZEOF(szShell);
+
+ if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ {
+ HKEY hKey;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\system.ini\\boot"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ RegQueryValueEx(hKey, _T("Shell"), NULL, NULL, (LPBYTE) szShell, &size);
+ _tcslwr(szShell);
+ HKEY hRootKey = ( _tcsstr(szShell, _T("sys:")) == szShell) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ RegCloseKey(hKey);
+
+ _tcscpy(szShell, _T("<unknown>"));
+ if (RegOpenKeyEx(hRootKey, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ size = SIZEOF(szShell);
+ RegQueryValueEx(hKey, _T("Shell"), NULL, NULL, (LPBYTE) szShell, &size);
+ RegCloseKey(hKey);
+ }
+ }
+ }
+ else{
+ TCHAR szSystemIniPath[2048];
+ GetWindowsDirectory(szSystemIniPath, SIZEOF(szSystemIniPath));
+ size_t len = lstrlen(szSystemIniPath);
+ if (len > 0)
+ {
+ if (szSystemIniPath[len - 1] == '\\') { szSystemIniPath[--len] = '\0'; }
+ _tcscat(szSystemIniPath, _T("\\system.ini"));
+ GetPrivateProfileString( _T("boot"), _T("shell"), _T("<unknown>"), szShell, size, szSystemIniPath);
+ }
+ }
+
+ TCHAR *pos = _tcsrchr(szShell, '\\');
+ TCHAR *res = (pos) ? pos + 1 : szShell;
+ _tcsncpy(shellPath, res, shSize);
+
+ return TRUE;
+}
+
+BOOL GetInternetExplorerVersion(TCHAR *ieVersion, size_t ieSize)
+{
+ HKEY hKey;
+ TCHAR ieVer[1024] = {0}, ieBuild[64] = {0}, iVer[64] = {0};
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ DWORD size;
+ size = SIZEOF(ieVer);
+ if (RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE) ieVer, &size) != ERROR_SUCCESS)
+ ieVer[0] = 0;
+ size = SIZEOF(ieBuild);
+ if (RegQueryValueEx(hKey, TEXT("Build"), NULL, NULL, (LPBYTE) ieBuild, &size) != ERROR_SUCCESS)
+ ieBuild[0] = 0;
+ size = SIZEOF(iVer);
+ if (RegQueryValueEx(hKey, TEXT("IVer"), NULL, NULL, (LPBYTE) iVer, &size) != ERROR_SUCCESS)
+ iVer[0] = 0;
+
+ RegCloseKey(hKey);
+ }
+
+ if (ieVer[0] == 0)
+ {
+ if (iVer[0] == 0)
+ _tcsncpy(ieVersion, _T("<not installed>"), ieSize);
+ else if (_tcscmp(iVer, _T("100")) == 0)
+ _tcsncpy(ieVersion, _T("1.0"), ieSize);
+ else if (_tcscmp(iVer, _T("101")) == 0)
+ _tcsncpy(ieVersion, _T("NT"), ieSize);
+ else if (_tcscmp(iVer, _T("102")) == 0)
+ _tcsncpy(ieVersion, _T("2.0"), ieSize);
+ else if (_tcscmp(iVer, TEXT("103")) == 0)
+ _tcsncpy(ieVersion, _T("3.0"), ieSize);
+ } else
+ _tcsncpy(ieVersion, ieVer, ieSize);
+
+ if (ieBuild[0] != 0)
+ {
+ _tcsncat(ieVersion, _T(" (build "), ieSize);
+ _tcsncat(ieVersion, ieBuild, ieSize);
+ _tcsncat(ieVersion, _T(")"), ieSize);
+ }
+
+ return TRUE;
+}
+
+TCHAR *GetLanguageName(LANGID language)
+{
+ LCID lc = MAKELCID(language, SORT_DEFAULT);
+ return GetLanguageName(lc);
+}
+
+extern TCHAR *GetLanguageName(LCID locale)
+{
+ static TCHAR name[1024];
+ GetLocaleInfo(locale, LOCALE_SENGLANGUAGE, name, SIZEOF(name));
+ return name;
+}
+
+BOOL UUIDToString(MUUID uuid, TCHAR *str, size_t len)
+{
+ if ( len < sizeof(MUUID) || !str )
+ return 0;
+
+ mir_sntprintf(str, len, _T("{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"), uuid.a, uuid.b, uuid.c, uuid.d[0], uuid.d[1], uuid.d[2], uuid.d[3], uuid.d[4], uuid.d[5], uuid.d[6], uuid.d[7]);
+ return 1;
+}
+
+BOOL IsUUIDNull(MUUID uuid)
+{
+ int i;
+ for (i = 0; i < sizeof(uuid.d); i++)
+ {
+ if (uuid.d[i])
+ {
+ return 0;
+ }
+ }
+
+ return ((uuid.a == 0) && (uuid.b == 0) && (uuid.c == 0));
+} \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/utils.h b/plugins/!Deprecated/VersionInfo/src/utils.h
new file mode 100644
index 0000000000..7c8711ad3e
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/utils.h
@@ -0,0 +1,42 @@
+#ifndef _M_VERSIONINFO_UTILS_H
+#define _M_VERSIONINFO_UTILS_H
+
+//utils.cpp
+void Log(const TCHAR*);
+TCHAR *StrTrim(TCHAR *, const TCHAR *);
+
+//returns a string from the database and uses MirandaFree to deallocate the string, leaving only the local copy
+//utils.cpp
+int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, size_t size);
+
+//a string of the form %s(start) | %s(end) is split into the two strings (start and end)
+//utils.cpp
+int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText);
+
+//utils.cpp
+bool DoesDllExist(char *dllName);
+
+//utils.cpp
+void GetModuleTimeStamp(LPTSTR lpszString, DWORD dwSize);
+void GetISO8061Time(SYSTEMTIME* stLocal, LPTSTR lpszString, DWORD dwSize);
+void NotifyError(DWORD, const TCHAR*, int);
+
+//utils.cpp
+PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *);
+void FreePluginInfo(PLUGININFOEX *);
+
+//utils.cpp
+
+BOOL IsCurrentUserLocalAdministrator();
+
+TCHAR *GetLanguageName(LANGID language);
+TCHAR *GetLanguageName(LCID locale);
+
+BOOL GetWindowsShell(TCHAR *shellPath, size_t shSize);
+BOOL GetInternetExplorerVersion(TCHAR *ieVersion, size_t ieSize);
+
+BOOL UUIDToString(MUUID uuid, TCHAR *str, size_t len);
+
+BOOL IsUUIDNull(MUUID uuid);
+
+#endif \ No newline at end of file
diff --git a/plugins/!Deprecated/VersionInfo/src/version.h b/plugins/!Deprecated/VersionInfo/src/version.h
new file mode 100644
index 0000000000..395a73c38d
--- /dev/null
+++ b/plugins/!Deprecated/VersionInfo/src/version.h
@@ -0,0 +1,14 @@
+#define __MAJOR_VERSION 1
+#define __MINOR_VERSION 5
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 3
+
+#include <stdver.h>
+
+#define __PLUGIN_NAME "Version information"
+#define __FILENAME "VersionInfo.dll"
+#define __DESCRIPTION "Collects and prints information related to Miranda, the plugins and the OS."
+#define __AUTHOR "Luca Santarelli, Cristian Libotean, George Hazan"
+#define __AUTHOREMAIL "hrk@users.sourceforge.net, eblis102@yahoo.com, ghazan@miranda.im"
+#define __AUTHORWEB "http://miranda-ng.org/p/VersionInfo/"
+#define __COPYRIGHT "© 2002-2005 Luca Santarelli, 2005-2009 Cristian Libotean"