diff options
Diffstat (limited to 'plugins/VersionInfo')
38 files changed, 5809 insertions, 0 deletions
diff --git a/plugins/VersionInfo/AggressiveOptimize.h b/plugins/VersionInfo/AggressiveOptimize.h new file mode 100644 index 0000000000..1b646c301c --- /dev/null +++ b/plugins/VersionInfo/AggressiveOptimize.h @@ -0,0 +1,58 @@ +
+//////////////////////////////
+// Version 1.10
+// Jan 23rd, 2000
+// Version 1.00
+// May 20th, 1999
+// Todd C. Wilson, Fresh Ground Software
+// (todd@nopcode.com)
+// This header file will kick in settings for Visual C++ 5 and 6 that will (usually)
+// result in smaller exe's.
+// The "trick" is to tell the compiler to not pad out the function calls; this is done
+// by not using the /O1 or /O2 option - if you do, you implicitly use /Gy, which pads
+// out each and every function call. In one single 500k dll, I managed to cut out 120k
+// by this alone!
+// The other two "tricks" are telling the Linker to merge all data-type segments together
+// in the exe file. The relocation, read-only (constants) data, and code section (.text)
+// sections can almost always be merged. Each section merged can save 4k in exe space,
+// since each section is padded out to 4k chunks. This is very noticable with smaller
+// exes, since you could have only 700 bytes of data, 300 bytes of code, 94 bytes of
+// strings - padded out, this could be 12k of runtime, for 1094 bytes of stuff!
+// Note that if you're using MFC static or some other 3rd party libs, you may get poor
+// results with merging the readonly (.rdata) section - the exe may grow larger.
+// To use this feature, define _MERGE_DATA_ in your project or before this header is used.
+// With Visual C++ 5, the program uses a file alignement of 512 bytes, which results
+// in a small exe. Under VC6, the program instead uses 4k, which is the same as the
+// section size. The reason (from what I understand) is that 4k is the chunk size of
+// the virtual memory manager, and that WinAlign (an end-user tuning tool for Win98)
+// will re-align the programs on this boundary. The problem with this is that all of
+// Microsoft's system exes and dlls are not tuned like this, and using 4k causes serious
+// exe bloat. Very noticable for smaller programs.
+// The "trick" for this is to use the undocumented FILEALIGN linker parm to change the
+// padding from 4k to 1/2k, which results in a much smaller exe - anywhere from 20%-75%
+// depending on the size.
+
+
+#ifdef NDEBUG
+// /Og (global optimizations), /Os (favor small code), /Oy (no frame pointers)
+#pragma optimize("gsy",on)
+
+#pragma comment(linker,"/RELEASE")
+
+// Note that merging the .rdata section will result in LARGER exe's if you using
+// MFC (esp. static link). If this is desirable, define _MERGE_RDATA_ in your project.
+#ifdef _MERGE_RDATA_
+#pragma comment(linker,"/merge:.rdata=.data")
+#endif // _MERGE_RDATA_
+
+#pragma comment(linker,"/merge:.text=.data")
+#pragma comment(linker,"/merge:.reloc=.data")
+
+#if _MSC_VER >= 1000
+// Only supported/needed with VC6; VC5 already does 0x200 for release builds.
+// Totally undocumented! And if you set it lower than 512 bytes, the program crashes.
+// Either leave at 0x200 or 0x1000
+#pragma comment(linker,"/FILEALIGN:0x200")
+#endif // _MSC_VER >= 1000
+
+#endif // NDEBUG
diff --git a/plugins/VersionInfo/CPlugin.cpp b/plugins/VersionInfo/CPlugin.cpp new file mode 100644 index 0000000000..8d87457cf1 --- /dev/null +++ b/plugins/VersionInfo/CPlugin.cpp @@ -0,0 +1,143 @@ +/*
+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 "CPlugin.h"
+//#include "AggressiveOptimize.h"
+
+#include "common.h"
+
+const int cPLUGIN_UUID_MARK = 4;
+char PLUGIN_UUID_MARK[cPLUGIN_UUID_MARK];
+
+#define PLUGIN_UNCERTAIN_MARK "?"
+
+#define RJUST 70
+
+CPlugin::CPlugin() {
+ lpzFileName = "";
+ lpzShortName = "";
+ lpzVersion = "";
+ lpzTimestamp = "";
+ lpzLinkedModules = "";
+ pluginID = UUID_NULL;
+};
+
+CPlugin::CPlugin(std::string eFileName, std::string eShortName, MUUID pluginID, std::string eUnicodeInfo, DWORD eVersion, std::string eTimestamp, std::string eLinkedModules) {
+ lpzFileName = std::string(eFileName);
+ lpzShortName = std::string(eShortName);
+ lpzUnicodeInfo = std::string(eUnicodeInfo);
+ lpzTimestamp = std::string(eTimestamp);
+ lpzLinkedModules = std::string(eLinkedModules);
+
+ char aux[128];
+ wsprintf(aux,"%d.%d.%d.%d", (eVersion>>24)&0xFF, (eVersion>>16)&0xFF, (eVersion>>8)&0xFF, (eVersion)&0xFF);
+ lpzVersion = std::string(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() {
+ //Debug information
+// char str[64]; wsprintf(str, "~CPlugin(): %s", lpzFileName.c_str());
+// MB(str);
+ //
+ lpzFileName.~basic_string();
+ lpzShortName.~basic_string();
+ lpzVersion.~basic_string();
+ lpzUnicodeInfo.~basic_string();
+ lpzTimestamp.~basic_string();
+ lpzLinkedModules.~basic_string();
+}
+
+void CPlugin::SetErrorMessage(std::string error)
+{
+ lpzLinkedModules = error;
+}
+
+bool CPlugin::operator<(CPlugin &anotherPlugin) {
+ std::string anotherFileName = anotherPlugin.getFileName();
+
+ char szThis[MAX_PATH]; lstrcpy(szThis, lpzFileName.c_str());
+ char 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::string CPlugin::getFileName() {
+ return this->lpzFileName;
+}
+
+std::string CPlugin::getInformations(DWORD flags, char *szHighlightHeader, char *szHighlightFooter) {
+// std::string lpzInformations = std::string(lpzFileName + "\t\t" + lpzVersion + "\r\n");
+// std::string lpzInformations = std::string(lpzFileName + " - " + lpzShortName + " [" + lpzTimestamp + "], version: " + lpzVersion +"\r\n");
+// std::string lpzInformations = std::string(lpzShortName + " [" + lpzFileName + " · " + lpzTimestamp + "] - version " + lpzVersion + "\r\n");
+// std::string lpzInformations = std::string(lpzFileName + " [" + lpzShortName + " · " + lpzTimestamp + "] - version: " + lpzVersion +"\r\n");
+ std::string lpzInformations;
+ if (flags & VISF_SHOWUUID)
+ {
+ char aux[128];
+ UUIDToString(pluginID, aux, sizeof(aux));
+ lpzInformations = std::string(aux);
+ }
+ else{
+ lpzInformations = (IsUUIDNull(pluginID)) ? " " : PLUGIN_UUID_MARK;
+ }
+ lpzInformations += std::string(" " + lpzFileName + " v." + szHighlightHeader + lpzVersion + szHighlightFooter + " [" + lpzTimestamp + "] - " + lpzShortName);
+ if (lpzUnicodeInfo.size() > 0)
+ {
+ char *lwr = _strlwr(_strdup(lpzShortName.c_str()));
+ if ((strstr(lwr, "unicode") == NULL) && (strstr(lwr, "2in1") == NULL))
+ {
+ lpzInformations.append(" |" + lpzUnicodeInfo + "|");
+ }
+ free(lwr);
+ }
+ //lpzInformations.append("\t");
+ //lpzInformations.append(lpzPluginID);
+ lpzInformations.append("\r\n");
+
+ if (lpzLinkedModules.size() > 0)
+ {
+ lpzInformations.append(lpzLinkedModules);
+ lpzInformations.append("\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/VersionInfo/CPlugin.h b/plugins/VersionInfo/CPlugin.h new file mode 100644 index 0000000000..4eb1adc69a --- /dev/null +++ b/plugins/VersionInfo/CPlugin.h @@ -0,0 +1,69 @@ +/*
+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
+
+//#define STRICT
+#define WIN32_LEAN_AND_MEAN
+
+#define _CRT_SECURE_NO_DEPRECATE
+
+#include <windows.h>
+#include <string>
+
+#ifndef M_NEWPLUGINAPI_H__
+#include "../../include/newpluginapi.h"
+#endif
+
+#define DEF_UUID_CHARMARK "¤"
+
+extern const int cPLUGIN_UUID_MARK;
+extern char PLUGIN_UUID_MARK[];
+
+//using namespace std;
+
+class CPlugin {
+ private:
+ std::string lpzFileName;
+ std::string lpzShortName;
+ std::string lpzVersion;
+ std::string lpzUnicodeInfo; //aditional info, Unicode aware ...
+ std::string lpzTimestamp; //to show the last modified timestamp
+ std::string lpzLinkedModules; //to show linked modules that aren't found
+ MUUID pluginID;
+
+ public:
+ CPlugin();
+ CPlugin(std::string fileName, std::string shortName, MUUID pluginID, std::string unicodeInfo, DWORD version, std::string timestamp, std::string linkedModules);
+ CPlugin(const CPlugin&);
+ ~CPlugin();
+ std::string getFileName();
+ std::string getInformations(DWORD, char *, char *);
+
+ void SetErrorMessage(std::string error);
+
+ //Operators
+ bool operator<(CPlugin&);
+ bool operator>(CPlugin&);
+ bool operator==(CPlugin&);
+};
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/CVersionInfo.cpp b/plugins/VersionInfo/CVersionInfo.cpp new file mode 100644 index 0000000000..43087c3837 --- /dev/null +++ b/plugins/VersionInfo/CVersionInfo.cpp @@ -0,0 +1,1588 @@ +/*
+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 "CVersionInfo.h"
+//#include "AggressiveOptimize.h"
+
+#include "common.h"
+
+//using namespace std;
+
+BOOL (WINAPI *MyGetDiskFreeSpaceEx)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
+BOOL (WINAPI *MyIsWow64Process)(HANDLE, PBOOL);
+void (WINAPI *MyGetSystemInfo)(LPSYSTEM_INFO);
+BOOL (WINAPI *MyGlobalMemoryStatusEx)(LPMEMORYSTATUSEX lpBuffer) = NULL;
+
+LANGID (WINAPI *MyGetUserDefaultUILanguage)() = NULL;
+LANGID (WINAPI *MyGetSystemDefaultUILanguage)() = NULL;
+
+static int ValidExtension(char *fileName, char *extension)
+{
+ char *dot = strrchr(fileName, '.');
+ if ((dot != NULL) && (lstrcmpiA(dot + 1, extension) == 0))
+ {
+ if (dot[strlen(extension) + 1] == 0)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+int EnumSettings(const char *setting, LPARAM lParam)
+{
+ char *name = (char *) lParam;
+ char *tmp = _strdup(setting);
+ _strlwr(tmp);
+
+ int res = 0;
+
+ if (strcmp(tmp, name) == 0)
+ {
+ strcpy((char *) lParam, setting);
+ res = 1;
+ }
+
+ free(tmp);
+
+ return res;
+}
+
+int IsPluginDisabled(char *fileName)
+{
+ char *name = _strdup(fileName);
+ _strlwr(name);
+ DBCONTACTENUMSETTINGS dbEnum = {0};
+ dbEnum.pfnEnumProc = EnumSettings;
+ dbEnum.lParam = (LPARAM) name;
+ dbEnum.szModule = "PluginDisable";
+
+ int res = -1;
+
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM) &dbEnum);
+ DBVARIANT dbv = {0};
+ dbv.type = DBVT_BYTE;
+
+ int exists = !(DBGetContactSetting(NULL, "PluginDisable", name, &dbv));
+ if (exists)
+ {
+ res = dbv.bVal;
+ }
+ free(name);
+
+ return res;
+}
+*/
+
+void FillLocalTime(std::string &output, FILETIME *fileTime)
+{
+ TIME_ZONE_INFORMATION tzInfo = {0};
+ FILETIME local = {0};
+ SYSTEMTIME sysTime;
+ char date[1024];
+ char time[256];
+
+ FileTimeToLocalFileTime(fileTime, &local);
+ FileTimeToSystemTime(&local, &sysTime);
+
+ GetDateFormat(EnglishLocale, 0, &sysTime, "dd' 'MMM' 'yyyy", date, sizeof(date));
+ GetTimeFormat(NULL, TIME_FORCE24HOURFORMAT, &sysTime, "HH':'mm':'ss", time, sizeof(time)); //americans love 24hour format ;)
+ output = std::string(date) + " at " + std::string(time);
+
+ int res = GetTimeZoneInformation(&tzInfo);
+ char tzName[32] = {0};
+ char 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;
+ }
+ }
+
+ sprintf(tzOffset, "UTC %+02d:%02d", offset / 60, offset % 60);
+ output += " (" /*+ std::string(tzName) + ", " */ + std::string(tzOffset) + ")";
+}
+
+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();
+ lpzOSVersion.~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() {
+ const BYTE str_size = 64;
+ char str[str_size];
+ //Miranda version
+
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)str_size, (LPARAM)(char*)str);
+ this->lpzMirandaVersion = std::string(str);
+ //Is it a nightly?
+ if (lpzMirandaVersion.find("alpha",0) != std::string::npos)
+ lpzNightly = "Yes";
+ else
+ lpzNightly = "No";
+ if (lpzMirandaVersion.find("Unicode", 0) != std::string::npos)
+ {
+ lpzUnicodeBuild = "Yes";
+ }
+ else{
+ lpzUnicodeBuild = "No";
+ }
+ char time[128], date[128];
+ GetModuleTimeStamp(date, time);
+ lpzBuildTime = std::string(time) + " on " + std::string(date);
+ return TRUE;
+}
+
+bool CVersionInfo::GetOSVersion() {
+ //Operating system informations
+ OSVERSIONINFO osvi;
+ ZeroMemory(&osvi, sizeof(osvi));
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+ //Now fill the private members.
+ char aux[256];
+ wsprintf(aux, "%d.%d.%d %s", osvi.dwMajorVersion, osvi.dwMinorVersion, LOWORD(osvi.dwBuildNumber), osvi.szCSDVersion);
+ lpzOSVersion = std::string(aux);
+ //OSName
+ //Let's read the registry.
+ HKEY hKey;
+ char szKey[MAX_PATH], szValue[MAX_PATH];
+
+
+ lstrcpyn(szKey, "Hardware\\Description\\System\\CentralProcessor\\0", MAX_PATH);
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ DWORD type, size, result;
+
+ lstrcpyn(szValue, "Identifier", MAX_PATH);
+ result = RegQueryValueEx(hKey, szValue, 0, &type, NULL, &size);
+ if (result == ERROR_SUCCESS)
+ {
+ char *aux = (char *) malloc(size);
+ result = RegQueryValueEx(hKey, szValue, 0, &type, (LPBYTE) aux, &size);
+ lpzCPUIdentifier = std::string(aux);
+ free(aux);
+ }
+ else{
+ NotifyError(GetLastError(), "RegQueryValueEx()", __LINE__);
+ lpzCPUIdentifier = "<Error in RegQueryValueEx()>";
+ }
+ lstrcpyn(szValue, "ProcessorNameString", MAX_PATH);
+ result = RegQueryValueEx(hKey, szValue, 0, &type, NULL, &size); //get the size
+ if (result == ERROR_SUCCESS)
+ {
+// MessageBox(0, "ProcessorNameString available in the registry", "Info", 0);
+ char *aux = (char *) malloc(size);
+ result = RegQueryValueEx(hKey, szValue, 0, &type, (LPBYTE) aux, &size);
+ lpzCPUName = std::string(aux);
+ free(aux);
+ }
+ else{ //else try to use cpuid instruction to get the proc name
+ char szName[49] = "<cpuid extension N/A>";
+ #if (!defined(WIN64) && !defined(_WIN64))
+ __asm
+ {
+ push eax //save the registers
+ push ebx
+ push ecx
+ push edx
+
+ xor eax, eax //get simple name
+ cpuid
+ mov DWORD PTR szName[0], ebx
+ mov DWORD PTR szName[4], edx
+ mov DWORD PTR szName[8], ecx
+ mov DWORD PTR szName[12], 0
+
+ mov eax, 0x80000000 //try to get pretty name
+ cpuid
+
+ cmp eax, 0x80000004
+ jb end //if we don't have the extension end the check
+
+ mov DWORD PTR szName[0], 0 //make the string null
+
+ mov eax, 0x80000002 //first part of the string
+ cpuid
+ mov DWORD PTR szName[0], eax
+ mov DWORD PTR szName[4], ebx
+ mov DWORD PTR szName[8], ecx
+ mov DWORD PTR szName[12], edx
+
+ mov eax, 0x80000003 //second part of the string
+ cpuid
+ mov DWORD PTR szName[16], eax
+ mov DWORD PTR szName[20], ebx
+ mov DWORD PTR szName[24], ecx
+ mov DWORD PTR szName[28], edx
+
+ mov eax, 0x80000004 //third part of the string
+ cpuid
+ mov DWORD PTR szName[32], eax
+ mov DWORD PTR szName[36], ebx
+ mov DWORD PTR szName[40], ecx
+ mov DWORD PTR szName[44], edx
+
+ end:
+ pop edx //load them back
+ pop ecx
+ pop ebx
+ pop eax
+ }
+ szName[sizeof(szName) - 1] = '\0';
+ #endif
+ if (strlen(szName) == 0)
+ {
+ lpzCPUName = "<name N/A>";
+ }
+ else{
+ lpzCPUName = std::string(szName);
+ }
+ }
+ }
+
+ bDEPEnabled = IsProcessorFeaturePresent(PF_NX_ENABLED);
+ /*
+ if (!bDEPEnabled)
+ {
+ int x = 0;
+ __asm
+ {
+ push eax
+ push ebx
+ push ecx
+ push edx
+
+ mov eax, 0x80000001
+ cpuid
+ mov eax, 1
+ shl eax, 20
+ xor edx, eax
+ cmp edx, 0
+ je end_DEP
+ mov x, 1
+
+ end_DEP:
+ pop edx
+ pop ecx
+ pop ebx
+ pop eax
+ }
+ bDEPEnabled = x;
+ }
+ */
+ switch (osvi.dwPlatformId) {
+ case VER_PLATFORM_WIN32_WINDOWS:
+ lstrcpyn(szKey, "Software\\Microsoft\\Windows\\CurrentVersion", MAX_PATH);
+ lstrcpyn(szValue, "Version", MAX_PATH);
+ break;
+ case VER_PLATFORM_WIN32_NT:
+
+ lstrcpyn(szKey, "Software\\Microsoft\\Windows NT\\CurrentVersion", MAX_PATH);
+ lstrcpyn(szValue, "ProductName", MAX_PATH);
+ break;
+ }
+
+ RegCloseKey(hKey);
+ 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.
+ char *aux = (char*)malloc(size);
+ result = RegQueryValueEx((HKEY)hKey,szValue,(LPDWORD)NULL, (LPDWORD)&type,(LPBYTE)aux,(LPDWORD)&size);
+ lpzOSName = std::string(aux);
+ free(aux);
+ }
+ else {
+ NotifyError(GetLastError(), "RegQueryValueEx()", __LINE__);
+ lpzOSName = "<Error in RegQueryValueEx()>";
+ }
+ }
+ else {
+ NotifyError(GetLastError(), "RegOpenKeyEx()", __LINE__);
+ lpzOSName = "<Error in RegOpenKeyEx()>";
+ }
+
+ //Now we can improve it if we can.
+ switch (LOWORD(osvi.dwBuildNumber)) {
+ case 950: lpzOSName = "Microsoft Windows 95"; break;
+ case 1111: lpzOSName = "Microsoft Windows 95 OSR2"; break;
+ case 1998: lpzOSName = "Microsoft Windows 98"; break;
+ case 2222: lpzOSName = "Microsoft Windows 98 SE"; break;
+ case 3000: lpzOSName = "Microsoft Windows ME"; break; //Even if this is wrong, we have already read it in the registry.
+ case 1381: lpzOSName = "Microsoft Windows NT"; break; //What about service packs?
+ case 2195: lpzOSName = "Microsoft Windows 2000"; break; //What about service packs?
+ case 2600: lpzOSName = "Microsoft Windows XP"; break;
+ case 3790:
+ {
+ if (GetSystemMetrics(89)) { //R2 ?
+ lpzOSName = "Microsoft Windows 2003 R2";
+ }
+ else{
+ lpzOSName = "Microsoft Windows 2003";
+ }
+
+ break; //added windows 2003 info
+ }
+ }
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetHWSettings() {
+ //Free space on Miranda Partition.
+ char szMirandaPath[MAX_PATH] = { 0 };
+ { char *str2;
+ GetModuleFileName(GetModuleHandle(NULL),szMirandaPath,sizeof(szMirandaPath));
+ str2=strrchr(szMirandaPath,'\\');
+ if(str2!=NULL) *str2=0;
+ }
+ HMODULE hKernel32;
+ hKernel32 = LoadLibrary("kernel32.dll");
+ if (hKernel32) {
+ MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExA");
+ MyIsWow64Process = (BOOL (WINAPI *) (HANDLE, PBOOL)) GetProcAddress(hKernel32, "IsWow64Process");
+ MyGetSystemInfo = (void (WINAPI *) (LPSYSTEM_INFO)) GetProcAddress(hKernel32, "GetNativeSystemInfo");
+ MyGlobalMemoryStatusEx = (BOOL (WINAPI *) (LPMEMORYSTATUSEX)) GetProcAddress(hKernel32, "GlobalMemoryStatusEx");
+ if (!MyGetSystemInfo)
+ {
+ MyGetSystemInfo = GetSystemInfo;
+ }
+
+ FreeLibrary(hKernel32);
+ }
+ if (MyGetDiskFreeSpaceEx) {
+ ULARGE_INTEGER FreeBytes, a, b;
+ MyGetDiskFreeSpaceEx(szMirandaPath, &FreeBytes, &a, &b);
+ //Now we need to convert it.
+ __int64 aux = FreeBytes.QuadPart;
+ aux /= (1024*1024);
+ luiFreeDiskSpace = (unsigned long int)aux;
+ }
+ else {
+ luiFreeDiskSpace = 0;
+ }
+
+ char szInfo[1024];
+ GetWindowsShell(szInfo, sizeof(szInfo));
+ lpzShell = szInfo;
+ GetInternetExplorerVersion(szInfo, sizeof(szInfo));
+ lpzIEVersion = szInfo;
+
+
+ lpzAdministratorPrivileges = (IsCurrentUserLocalAdministrator()) ? "Yes" : "No";
+
+ bIsWOW64 = 0;
+ if (MyIsWow64Process)
+ {
+ if (!MyIsWow64Process(GetCurrentProcess(), &bIsWOW64))
+ {
+ bIsWOW64 = 0;
+ }
+ }
+
+ SYSTEM_INFO sysInfo = {0};
+ GetSystemInfo(&sysInfo);
+ luiProcessors = sysInfo.dwNumberOfProcessors;
+
+ //Installed RAM
+ if (MyGlobalMemoryStatusEx) //windows 2000+
+ {
+ MEMORYSTATUSEX ms = {0};
+ ms.dwLength = sizeof(ms);
+ MyGlobalMemoryStatusEx(&ms);
+ luiRAM = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
+ }
+ else{
+ MEMORYSTATUS ms = {0};
+ ZeroMemory(&ms, sizeof(ms));
+ ms.dwLength = sizeof(ms);
+ GlobalMemoryStatus(&ms);
+ luiRAM = (ms.dwTotalPhys/(1024*1024))+1; //Ugly hack!!!!
+ }
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetProfileSettings()
+{
+ char profileName[MAX_PATH] = {0};
+ char profilePath[MAX_PATH] = {0};
+ ServiceExists(MS_DB_GETPROFILEPATH_BASIC) ? CallService(MS_DB_GETPROFILEPATH_BASIC, MAX_PATH, (LPARAM) profilePath) : CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM) profilePath); //get the profile path
+ CallService(MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM) profileName); //get the profile name
+// strcat(profileName, ".dat"); //add the .dat extension to the profile name
+ lpzProfilePath = std::string(profilePath); //save the profile path
+
+ strcat(profilePath, "\\"); //add the last \\ to the path
+ strcat(profilePath, profileName); //now profilePath is drive:\path\profilename.dat
+ HANDLE fin = CreateFile(profilePath, FILE_READ_ATTRIBUTES | FILE_READ_EA | STANDARD_RIGHTS_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (fin == INVALID_HANDLE_VALUE) { fin = CreateFile(profilePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); }
+ if (fin != INVALID_HANDLE_VALUE)
+ {
+ DWORD size;
+ FILETIME creation, modified, accessed;
+ size = GetFileSize(fin, NULL);
+ TCHAR number[1024];
+ char tmp[1024];
+ double fileSize = (double) size / 1024;
+
+ sprintf(tmp, "%f", fileSize);
+ GetNumberFormat(EnglishLocale, NULL, tmp, NULL, number, 1024);
+
+ lpzProfileSize = std::string(number) + " KBytes";
+ GetFileTime(fin, &creation, &accessed, &modified);
+ FillLocalTime(lpzProfileCreationDate, &creation);
+
+ CloseHandle(fin);
+ }
+ else{
+ DWORD error = GetLastError();
+ char tmp[1024];
+ sprintf(tmp, "%d", error);
+ lpzProfileCreationDate = "<error " + std::string(tmp) + " at FileOpen>" + std::string(profilePath);
+ lpzProfileSize = "<error " + std::string(tmp) + " at FileOpen>" + std::string(profilePath);
+ }
+
+ return true;
+}
+
+static char szSystemLocales[4096] = {0};
+static WORD systemLangID;
+#define US_LANG_ID 0x00000409
+
+BOOL CALLBACK EnumSystemLocalesProc(char *szLocale)
+{
+ DWORD locale = atoi(szLocale);
+ char *name = GetLanguageName(locale);
+ if (!strstr(szSystemLocales, name))
+ {
+ strcat(szSystemLocales, name);
+ strcat(szSystemLocales, ", ");
+ }
+
+ 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 = "(UI | Locale (User/System)) : ";
+
+ LANGID UILang;
+
+ OSVERSIONINFO os = {0};
+ os.dwOSVersionInfoSize = sizeof(os);
+ GetVersionEx(&os);
+ switch (os.dwMajorVersion)
+ {
+ case 4: //Win 95-Me, NT
+ {
+ if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) //Win NT
+ {
+ HMODULE hLib = LoadLibrary("ntdll.dll");
+
+ if (hLib)
+ {
+ EnumResourceLanguages(hLib, RT_VERSION, MAKEINTRESOURCE(1), EnumResLangProc, NULL);
+
+ FreeLibrary(hLib);
+
+ if (systemLangID == US_LANG_ID)
+ {
+ UINT uiACP;
+
+ uiACP = GetACP();
+ switch (uiACP)
+ {
+ case 874: // Thai code page activated, it's a Thai enabled system
+ systemLangID = MAKELANGID(LANG_THAI, SUBLANG_DEFAULT);
+ break;
+
+ case 1255: // Hebrew code page activated, it's a Hebrew enabled system
+ systemLangID = MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT);
+ break;
+
+ case 1256: // Arabic code page activated, it's a Arabic enabled system
+ systemLangID = MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ else{ //Win 95-Me
+ HKEY hKey = NULL;
+ char szLangID[128] = "0x";
+ DWORD size = sizeof(szLangID) - 2;
+ char err[512];
+
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop\\ResourceLocale", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ if (RegQueryValueEx(hKey, "", 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
+ {
+ sscanf(szLangID, "%lx", &systemLangID);
+ }
+ else{
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
+ MessageBox(0, err, "Error at RegQueryValueEx()", MB_OK);
+ }
+ RegCloseKey(hKey);
+ }
+ else{
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
+ MessageBox(0, err, "Error at RegOpenKeyEx()", MB_OK);
+ }
+ }
+
+ lpzOSLanguages += GetLanguageName(systemLangID);
+
+ break;
+ }
+
+ case 5: //Win 2000, XP
+ default:
+ {
+ HMODULE hKernel32 = LoadLibrary("kernel32.dll");
+ if (hKernel32)
+ {
+ MyGetUserDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetUserDefaultUILanguage");
+ MyGetSystemDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetSystemDefaultUILanguage");
+
+ FreeLibrary(hKernel32);
+ }
+
+ if ((MyGetUserDefaultUILanguage) && (MyGetSystemDefaultUILanguage))
+ {
+ UILang = MyGetUserDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
+ lpzOSLanguages += "/";
+ UILang = MyGetSystemDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
+ }
+ else{
+ lpzOSLanguages += "Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)";
+ }
+
+ break;
+ }
+ }
+
+ lpzOSLanguages += " | ";
+ lpzOSLanguages += GetLanguageName(LOCALE_USER_DEFAULT);
+ lpzOSLanguages += "/";
+ lpzOSLanguages += GetLanguageName(LOCALE_SYSTEM_DEFAULT);
+
+ if (DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", 0))
+ {
+ szSystemLocales[0] = '\0';
+ lpzOSLanguages += " [";
+ EnumSystemLocales(EnumSystemLocalesProc, LCID_INSTALLED);
+ if (strlen(szSystemLocales) > 2)
+ {
+ szSystemLocales[strlen(szSystemLocales) - 2] = '\0';
+ }
+ lpzOSLanguages += szSystemLocales;
+ lpzOSLanguages += "]";
+ }
+
+ return true;
+}
+
+int SaveInfo(const char *data, const char *lwrData, const char *search, char *dest, int size)
+{
+ const char *pos = strstr(lwrData, search);
+ int res = 1;
+ if (pos == lwrData)
+ {
+ strncpy(dest, &data[strlen(search)], size);
+ res = 0;
+ }
+
+ return res;
+}
+
+bool CVersionInfo::GetLangpackInfo()
+{
+ char langpackPath[MAX_PATH] = {0};
+ char search[MAX_PATH] = {0};
+ char *p;
+ lpzLangpackModifiedDate = "";
+ GetModuleFileName(GetModuleHandle(NULL), langpackPath, sizeof(langpackPath));
+ p = strrchr(langpackPath, '\\');
+ if (p)
+ {
+ WIN32_FIND_DATA data = {0};
+ HANDLE hLangpack;
+
+ p[1] = '\0';
+ strcpy(search, langpackPath);
+ strcat(search, "langpack_*.txt");
+ hLangpack = FindFirstFile(search, &data);
+ if (hLangpack != INVALID_HANDLE_VALUE)
+ {
+ char buffer[1024];
+ char temp[1024];
+ //FILETIME localWriteTime;
+ //SYSTEMTIME sysTime;
+ FillLocalTime(lpzLangpackModifiedDate, &data.ftLastWriteTime);
+
+ char locale[128] = {0};
+ char language[128] = {0};
+ char version[128] = {0};
+ strcpy(version, "N/A");
+ char *p;
+ strncpy(temp, data.cFileName, sizeof(temp));
+ p = strrchr(temp, '.');
+ p[0] = '\0';
+ strncpy(language, strchr(temp, '_') + 1, sizeof(language));
+
+ strcat(langpackPath, data.cFileName);
+ FILE *fin = fopen(langpackPath, "rt");
+
+ if (fin)
+ {
+ size_t len;
+ while (!feof(fin))
+ {
+ fgets(buffer, sizeof(buffer), fin);
+ len = strlen(buffer);
+ if (buffer[len - 1] == '\n') buffer[len - 1] = '\0';
+ strncpy(temp, buffer, sizeof(temp));
+ _strlwr(temp);
+ if (SaveInfo(buffer, temp, "language: ", language, sizeof(language)))
+ {
+ if (SaveInfo(buffer, temp, "locale: ", locale, sizeof(locale)))
+ {
+ p = strstr(buffer, "; FLID: ");
+ if (p)
+ {
+ int ok = 1;
+ int i;
+ for (i = 0; ((i < 3) && (ok)); i++)
+ {
+ p = strrchr(temp, '.');
+ if (p)
+ {
+ p[0] = '\0';
+ }
+ else{
+ ok = 0;
+ }
+ }
+ p = strrchr(temp, ' ');
+ if ((ok) && (p))
+ {
+ strncpy(version, &buffer[p - temp + 1], sizeof(version));
+ }
+ else{
+ strncpy(version, "<unknown>", sizeof(version));
+ }
+ }
+ }
+ }
+ }
+
+ lpzLangpackInfo = std::string(language) + " [" + std::string(locale) + "]";
+ if (strlen(version) > 0)
+ {
+ lpzLangpackInfo += " v. " + std::string(version);
+ }
+ fclose(fin);
+ }
+ else{
+ int err = GetLastError();
+ lpzLangpackInfo = "<error> Could not open file " + std::string(data.cFileName);
+ }
+ FindClose(hLangpack);
+ }
+ else{
+ lpzLangpackInfo = "No language pack installed";
+ }
+ }
+
+ return true;
+}
+
+std::string GetPluginTimestamp(FILETIME *fileTime)
+{
+ SYSTEMTIME sysTime;
+ FileTimeToSystemTime(fileTime, &sysTime); //convert the file tyme to system time
+ //char time[256];
+ char date[256]; //lovely
+ GetDateFormat(EnglishLocale, 0, &sysTime, "dd' 'MMM' 'yyyy", date, sizeof(date));
+ //GetTimeFormat(NULL, TIME_FORCE24HOURFORMAT, &sysTime, "HH':'mm':'ss", time, sizeof(time)); //americans love 24hour format :)
+ std::string timedate(date);
+ return timedate;
+}
+
+bool CVersionInfo::GetPluginLists() {
+
+ HANDLE hFind;
+ char szMirandaPath[MAX_PATH] = { 0 }, szSearchPath[MAX_PATH] = { 0 }; //For search purpose
+ WIN32_FIND_DATA fd;
+ char 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);
+
+ { char *str2;
+ GetModuleFileName(GetModuleHandle(NULL),szMirandaPath,sizeof(szMirandaPath));
+ str2=strrchr(szMirandaPath,'\\');
+ if(str2!=NULL) *str2=0;
+ }
+ lpzMirandaPath = std::string(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,"\\Plugins\\*.dll");
+
+ lstrcpyn(szMirandaPluginsPath, szMirandaPath, MAX_PATH);
+ lstrcat(szMirandaPluginsPath,"\\Plugins\\");
+
+ hFind=FindFirstFile(szSearchPath,&fd);
+ LogToFile("Starting to load plugins");
+ if(hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (verbose) PUShowMessage(fd.cFileName, SM_NOTIFY);
+ if (!ValidExtension(fd.cFileName, "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;
+ LogToFile("Plugin '%s' is enabled and loaded", fd.cFileName);
+ }
+ else{
+ PluginIsEnabled = 0;
+ LogToFile("Plugin '%s' is not loaded, going to load it", fd.cFileName);
+ 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);
+/*
+ PluginIsEnabled = !(
+ DBGetContactSettingByte(NULL, "PluginDisable", fd.cFileName, FALSE)
+ || DBGetContactSettingByte(NULL, "PluginDisable", CharUpper(fd.cFileName), FALSE)
+ || DBGetContactSettingByte(NULL, "PluginDisable", CharLower(fd.cFileName), FALSE)
+
+ }; //If the DB does not contain that value, the plugin is enabled => default: FALSE; action: !read
+*/
+ //Let's read the informations.
+/*
+ }
+ if (PluginIsEnabled) {
+ hInstPlugin = GetModuleHandle(fd.cFileName);
+ }
+ else{
+ 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 (DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE))
+ {
+ std::string 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))
+ {
+ LogToFile("Plugin %s has unresolved dependencies, adding to unloadable list", szPluginPath);
+ std::string time = GetPluginTimestamp(&fd.ftLastWriteTime);
+ CPlugin thePlugin = CPlugin(std::string(fd.cFileName), "<unknown>", UUID_NULL, "", 0, time, linkedModules);
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ bUnknownError = 0; //we know why the plugin didn't load
+ }
+ }
+ if (bUnknownError) //if cause is unknown then report it
+ {
+ LogToFile("Plugin %s doesn't load", szPluginPath);
+ std::string time = GetPluginTimestamp(&fd.ftLastWriteTime);
+ char buffer[4096];
+ char error[2048];
+ //DWORD_PTR arguments[2] = {loadError, 0};
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, loadError, 0, error, sizeof(error), NULL);
+ sprintf(buffer, " Error %ld - %s", loadError, error);
+ CPlugin thePlugin = CPlugin(std::string(fd.cFileName), "<unknown>", UUID_NULL, "", 0, time, buffer);
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ }
+ }
+ else { //It was successfully loaded.
+ LogToFile("Plugin '%s' was loaded successfully", fd.cFileName);
+ 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;
+ }
+ else {
+ //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
+ // jmp a2
+ a1:
+ // a2:
+ }
+ #else
+ asmCheckOK = TRUE;
+ #endif
+ if (asmCheckOK)
+ pluginInfo = CopyPluginInfo(MirandaPluginInfo(mirandaVersion));
+ else {
+ ZeroMemory(&pluginInfo, sizeof(pluginInfo));
+ MessageBox(NULL, fd.cFileName, "Invalid plugin", MB_OK);
+ }
+ }
+ }
+ //Let's get the info.
+ if (MirandaPluginInfo != NULL) {//a valid miranda plugin
+ if (pluginInfo != NULL) {
+ LogToFile("Plugin '%s' is a miranda plugin", fd.cFileName);
+ //We have loaded the informations into pluginInfo.
+ std::string timedate = GetPluginTimestamp(&fd.ftLastWriteTime);
+ CPlugin thePlugin = CPlugin(std::string(fd.cFileName),std::string(pluginInfo->shortName), pluginInfo->uuid, std::string((pluginInfo->flags & 1) ? "Unicode aware" : ""), (DWORD) pluginInfo->version, timedate, "");
+
+ if (PluginIsEnabled)
+ {
+ AddPlugin(thePlugin, listActivePlugins);
+ }
+ else {
+ if ((IsUUIDNull(pluginInfo->uuid)) && (mirandaVersion >= PLUGIN_MAKE_VERSION(0,8,0,9)))
+ {
+ thePlugin.SetErrorMessage(" Plugin does not have an UUID and will not work with Miranda 0.8.\r\n");
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ }
+ else{
+ AddPlugin(thePlugin, listInactivePlugins);
+ }
+ FreeLibrary(hInstPlugin); //We don't need it anymore.
+ }
+ FreePluginInfo(pluginInfo);
+ MirandaPluginInfo = NULL;
+#ifdef _DEBUG
+ if (verbose)
+ {
+ char szMsg[4096] = { 0 };
+ wsprintf(szMsg, "Done with: %s", fd.cFileName);
+ PUShowMessage(szMsg, SM_NOTIFY);
+ }
+#endif
+ }
+ else{//pluginINFO == NULL
+ LogToFile("Plugin '%s' refuses to load", fd.cFileName);
+ pluginInfo = CopyPluginInfo(MirandaPluginInfo(PLUGIN_MAKE_VERSION(9, 9, 9, 9))); //let's see if the plugin likes this miranda version
+ char *szShortName = "<unknown>";
+ std::string time = GetPluginTimestamp(&fd.ftLastWriteTime); //get the plugin timestamp;
+ DWORD version = 0;
+ if (pluginInfo)
+ {
+ szShortName = pluginInfo->shortName;
+ version = pluginInfo->version;
+ }
+
+ CPlugin thePlugin = CPlugin(std::string(fd.cFileName), std::string(szShortName), (pluginInfo) ? (pluginInfo->uuid) : UUID_NULL, std::string(((pluginInfo) && (pluginInfo->flags & 1)) ? "Unicode aware" : ""), version, time, " Plugin refuses to load. Miranda version too old.");
+
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ if (pluginInfo)
+ {
+ FreePluginInfo(pluginInfo);
+ }
+ }
+ }
+ } while (FindNextFile(hFind,&fd));
+ FindClose(hFind);
+ }
+ LogToFile("Done loading plugins");
+ 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;
+ }
+ else { //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(char *moduleName, std::string &linkedModules)
+{
+ LogToFile("Checking dll %s for unresolved dll dependencies ...", moduleName);
+ LOADED_IMAGE image;
+ ULONG importTableSize;
+ IMAGE_IMPORT_DESCRIPTOR *importData;
+ //HMODULE dllModule;
+ linkedModules = "";
+ bool result = false;
+// LogToFile(" Before LoadLibraryEx", moduleName);
+// dllModule = LoadLibraryEx(moduleName, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ //dllModule = 0;
+ //LogToFile(" Before MapAndLoad (dll handle %ld)", moduleName, dllModule);
+ if (MapAndLoad(moduleName, NULL, &image, TRUE, TRUE) == FALSE)
+ {
+ char tmp[20];
+ sprintf(tmp, "%d", GetLastError());
+ LogToFile(" MapAndLoad failed with error %s", tmp);
+ linkedModules = "<error " + std::string(tmp) + " at MapAndLoad()>\r\n";
+// FreeLibrary(dllModule);
+ return result;
+ }
+ LogToFile(" Before ImageDirectoryEntryToData (base address %ld)", image.MappedAddress);
+ importData = (IMAGE_IMPORT_DESCRIPTOR *) ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &importTableSize);
+ if (!importData)
+ {
+ char tmp[20];
+ sprintf(tmp, "%d", GetLastError());
+ LogToFile(" ImageDirectoryEntryToData failed with error %s", tmp);
+ linkedModules = "<error " + std::string(tmp) + " at ImageDirectoryEntryToDataEx()>\r\n";
+ }
+ else{
+ LogToFile(" Checking dll dependencies");
+ while (importData->Name)
+ {
+ char *moduleName;
+ moduleName = GetStringFromRVA(importData->Name, &image);
+ LogToFile(" Checking link to dll %s", moduleName);
+ if (!DoesDllExist(moduleName))
+ {
+ LogToFile(" Dll %s not found, adding to list", moduleName);
+ linkedModules.append(" Plugin statically links to missing dll file: " + std::string(moduleName) + "\r\n");
+ result = true;
+ }
+ else{
+ LogToFile(" Dll %s found", moduleName);
+ }
+ LogToFile(" Moving to next import entry");
+ importData++; //go to next record
+ }
+ }
+ LogToFile(" Done checking dependencies");
+ LogToFile(" Cleaning up; before {FreeLibrary()} and UnMapAndLoad");
+// FreeLibrary(dllModule);
+ UnMapAndLoad(&image); //unload the image
+ return result;
+}
+
+std::string CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flags, int beautify) {
+ std::list<CPlugin>::iterator pos = aList.begin();
+ std::string out = "";
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, begin.", SM_NOTIFY);
+#endif
+
+ char szHeader[32] = {0};
+ char szFooter[32] = {0};
+ if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE)))
+ {
+ GetStringFromDatabase("BoldBegin", "[b]", szHeader, sizeof(szHeader));
+ GetStringFromDatabase("BoldEnd", "[/b]", szFooter, sizeof(szFooter));
+ }
+
+ while (pos != aList.end()) {
+ out.append(std::string((*pos).getInformations(flags, szHeader, szFooter)));
+ pos++;
+ }
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, end.", SM_NOTIFY);
+#endif
+ return out;
+};
+
+void CVersionInfo::BeautifyReport(int beautify, char *szBeautifyText, char *szNonBeautifyText, std::string &out)
+{
+ if (beautify)
+ {
+ out.append(szBeautifyText);
+ }
+ else{
+ out.append(szNonBeautifyText);
+ }
+}
+
+void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautify, std::string &out)
+{
+ if (forumStyle) //forum style
+ {
+ char szSize[256];
+ char szQuote[256];
+
+ GetStringFromDatabase("SizeBegin", "[size=1]", szSize, sizeof(szSize));
+ GetStringFromDatabase("QuoteBegin", "[quote]", szQuote, sizeof(szQuote));
+ out.append(szQuote);
+ out.append(szSize);
+ }
+ else{
+ out = "";
+ }
+ if (!suppressHeader)
+ {
+ out.append("Miranda IM - VersionInformation plugin by Hrk, modified by Eblis\r\n");
+ if (!forumStyle)
+ {
+ out.append("Miranda's homepage: http://www.miranda-im.org/\r\n"); //changed homepage
+ out.append("Miranda tools: http://miranda-im.org/download/\r\n\r\n"); //was missing a / before download
+ }
+ }
+ char buffer[1024]; //for beautification
+ GetStringFromDatabase("BeautifyHorizLine", "<hr />", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, "", out);
+ GetStringFromDatabase("BeautifyBlockStart", "<blockquote>", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, "", out);
+ if (!suppressHeader)
+ {
+ //Time of report:
+ char lpzTime[12]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,"HH':'mm':'ss",lpzTime, sizeof(lpzTime));
+ char lpzDate[32]; GetDateFormat(EnglishLocale, 0, NULL,"dd' 'MMMM' 'yyyy",lpzDate, sizeof(lpzDate));
+ out.append("Report generated at: " + std::string(lpzTime) + " on " + std::string(lpzDate) + "\r\n\r\n");
+ }
+ //Operating system
+ out.append("CPU: " + lpzCPUName + " [" + lpzCPUIdentifier + "]");
+ if (bDEPEnabled)
+ {
+ out.append(" [DEP enabled]");
+ }
+ if (luiProcessors > 1)
+ {
+ char noProcs[128];
+ sprintf(noProcs, " [%d CPUs]", luiProcessors);
+ out.append(noProcs);
+ }
+ out.append("\r\n");
+
+ //RAM
+ char szRAM[64]; wsprintf(szRAM, "%d", luiRAM);
+ out.append("Installed RAM: " + std::string(szRAM) + " MBytes\r\n");
+
+ //operating system
+ out.append("Operating System: " + lpzOSName + " [version: " + lpzOSVersion + "]\r\n");
+
+ //shell, IE, administrator
+ out.append("Shell: " + lpzShell + ", Internet Explorer " + lpzIEVersion + "\r\n");
+ out.append("Administrator privileges: " + lpzAdministratorPrivileges + "\r\n");
+
+ //languages
+ out.append("OS Languages: " + lpzOSLanguages + "\r\n");
+
+
+ //FreeDiskSpace
+ if (luiFreeDiskSpace) {
+ char szDiskSpace[64]; wsprintf(szDiskSpace, "%d", luiFreeDiskSpace);
+ out.append("Free disk space on Miranda partition: " + std::string(szDiskSpace) + " MBytes\r\n");
+ }
+
+ //Miranda
+ out.append("Miranda path: " + lpzMirandaPath + "\r\n");
+
+ out.append("Miranda IM version: " + lpzMirandaVersion);
+ if (bIsWOW64)
+ {
+ out.append(" [running inside WOW64]");
+ }
+ if (bServiceMode)
+ {
+ out.append(" [service mode]");
+ }
+ out.append("\r\nBuild time: " + lpzBuildTime + "\r\n");
+ out.append("Profile path: " + lpzProfilePath + "\r\n");
+ //if (lpzProfileSize.find("error", 0) == std::string::npos) //only show the profile size of no error occured
+ //{
+ out.append("Profile size: " + lpzProfileSize + "\r\n");
+ out.append("Profile creation date: " + lpzProfileCreationDate + "\r\n");
+ //}
+ out.append("Language pack: " + lpzLangpackInfo);
+ out.append((lpzLangpackModifiedDate.size() > 0) ? ", modified: " + lpzLangpackModifiedDate : "");
+ out.append("\r\n");
+
+ out.append("Nightly: " + lpzNightly + "\r\n");
+ out.append("Unicode core: " + lpzUnicodeBuild);
+
+ GetStringFromDatabase("BeautifyBlockEnd", "</blockquote>", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, "\r\n", out);
+ //out.append("\r\n");
+}
+
+void CVersionInfo::AddInfoFooter(int suppressFooter, int forumStyle, int beautify, std::string &out)
+{
+ //End of report
+ char buffer[1024]; //for beautification purposes
+ GetStringFromDatabase("BeautifyHorizLine", "<hr />", buffer, sizeof(buffer));
+ if (!suppressFooter)
+ {
+ BeautifyReport(beautify, buffer, "\r\n", out);
+ out.append("\r\nEnd of report.\r\n");
+ }
+ if (!forumStyle)
+ {
+ if (!suppressFooter)
+ {
+ out.append(Translate("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{
+ char szSize[256];
+ char szQuote[256];
+
+ GetStringFromDatabase("SizeEnd", "[/size]", szSize, sizeof(szSize));
+ GetStringFromDatabase("QuoteEnd", "[/quote]", szQuote, sizeof(szQuote));
+ out.append(szSize);
+ out.append(szQuote);
+ }
+}
+
+static void AddSectionAndCount(std::list<CPlugin> list, char *listText, std::string &out)
+{
+ char tmp[64];
+ sprintf(tmp, " (%u)", list.size());
+ out.append(listText);
+ out.append(tmp);
+ out.append(":");
+}
+
+std::string CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
+ //Begin of report
+ std::string out;
+ int forumStyle = (bDisableForumStyle) ? 0 : DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", TRUE);
+ int showUUID = DBGetContactSettingByte(NULL, ModuleName, "ShowUUIDs", FALSE);
+ int beautify = DBGetContactSettingByte(NULL, ModuleName, "Beautify", 0) & (!forumStyle);
+ int suppressHeader = DBGetContactSettingByte(NULL, ModuleName, "SuppressHeader", TRUE);
+
+ DWORD flags = (forumStyle) | (showUUID << 1);
+
+ AddInfoHeader(suppressHeader, forumStyle, beautify, out);
+ char normalPluginsStart[1024]; //for beautification purposes, for normal plugins text (start)
+ char normalPluginsEnd[1024]; //for beautification purposes, for normal plugins text (end)
+ char horizLine[1024]; //for beautification purposes
+ char buffer[1024]; //for beautification purposes
+
+ char headerHighlightStart[10] = "";
+ char headerHighlightEnd[10] = "";
+ if (forumStyle)
+ {
+ char start[128], end[128];
+ GetStringFromDatabase("BoldBegin", "[b]", start, sizeof(start));
+ GetStringFromDatabase("BoldEnd", "[/b]", end, sizeof(end));
+ strncpy(headerHighlightStart, start, sizeof(headerHighlightStart));
+ strncpy(headerHighlightEnd, end, sizeof(headerHighlightEnd));
+ }
+
+ //Plugins: list of active (enabled) plugins.
+ GetStringFromDatabase("BeautifyHorizLine", "<hr />", horizLine, sizeof(horizLine));
+ BeautifyReport(beautify, horizLine, "\r\n", out);
+ GetStringFromDatabase("BeautifyActiveHeaderBegin", "<b><font size=\"-1\" color=\"DarkGreen\">", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listActivePlugins, "Active Plugins", out);
+ GetStringFromDatabase("BeautifyActiveHeaderEnd", "</font></b>", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append("\r\n");
+
+ GetStringFromDatabase("BeautifyPluginsBegin", "<font size=\"-2\" color=\"black\">", normalPluginsStart, sizeof(normalPluginsStart));
+ BeautifyReport(beautify, normalPluginsStart, "", out);
+ out.append(GetListAsString(listActivePlugins, flags, beautify));
+ GetStringFromDatabase("BeautifyPluginsEnd", "</font>", normalPluginsEnd, sizeof(normalPluginsEnd));
+ BeautifyReport(beautify, normalPluginsEnd, "", out);
+ //Plugins: list of inactive (disabled) plugins.
+ if ((!forumStyle) && ((DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE)) || (bServiceMode))) {
+ BeautifyReport(beautify, horizLine, "\r\n", out);
+ GetStringFromDatabase("BeautifyInactiveHeaderBegin", "<b><font size=\"-1\" color=\"DarkRed\">", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listInactivePlugins, "Inactive Plugins", out);
+ GetStringFromDatabase("BeautifyInactiveHeaderEnd", "</font></b>", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append("\r\n");
+ BeautifyReport(beautify, normalPluginsStart, "", out);
+ out.append(GetListAsString(listInactivePlugins, flags, beautify));
+ BeautifyReport(beautify, normalPluginsEnd, "", out);
+ }
+ if (listUnloadablePlugins.size() > 0)
+ {
+ //out.append("\r\n");
+ BeautifyReport(beautify, horizLine, "\r\n", out);
+ GetStringFromDatabase("BeautifyUnloadableHeaderBegin", "<b><font size=\"-1\"><font color=\"Red\">", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listUnloadablePlugins, "Unloadable Plugins", out);
+ GetStringFromDatabase("BeautifyUnloadableHeaderEnd", "</font></b>", buffer, sizeof(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append("\r\n");
+ BeautifyReport(beautify, normalPluginsStart, "", out);
+ out.append(GetListAsString(listUnloadablePlugins, flags, beautify));
+ BeautifyReport(beautify, normalPluginsEnd, "", out);
+ }
+ AddInfoFooter(suppressHeader, forumStyle, beautify, out);
+ return out;
+}
+
+//========== Print functions =====
+
+void CVersionInfo::PrintInformationsToFile(const char *info)
+{
+ char buffer[MAX_PATH];
+ char outputFileName[MAX_PATH];
+ if (bFoldersAvailable)
+ {
+ FoldersGetCustomPath(hOutputLocation, buffer, sizeof(buffer), "%miranda_path%");
+ strcat(buffer, "\\VersionInfo.txt");
+ }
+ else{
+ GetStringFromDatabase("OutputFile", "VersionInfo.txt", buffer, sizeof(buffer));
+ }
+
+ RelativePathToAbsolute(buffer, outputFileName, sizeof(buffer));
+
+ FILE *fp = fopen(outputFileName, "wb");
+ if (fp != NULL) {
+ fprintf(fp, info);
+ fclose(fp);
+ char mex[512];
+ mir_snprintf(mex, sizeof(mex), Translate("Information successfully written to file: \"%s\"."), outputFileName);
+ Log(mex);
+ }
+ else {
+ char mex[512];
+ mir_snprintf(mex, sizeof(mex), Translate("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
+ Log(mex);
+ }
+}
+
+void CVersionInfo::PrintInformationsToFile() {
+ PrintInformationsToFile((*this).GetInformationsAsString().c_str());
+}
+
+void CVersionInfo::PrintInformationsToMessageBox() {
+ MessageBox(NULL, (*this).GetInformationsAsString().c_str(), ModuleName, MB_OK);
+ return;
+}
+
+void CVersionInfo::PrintInformationsToOutputDebugString() {
+ OutputDebugString((*this).GetInformationsAsString().c_str());
+ return;
+}
+
+#include "resource.h"
+//extern HINSTANCE hInst;
+
+void CVersionInfo::PrintInformationsToDialogBox() {
+// HWND parent = DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE)?GetDesktopWindow():NULL;
+ HWND parent = NULL;
+ HWND DialogBox = CreateDialogParam(hInst,
+ MAKEINTRESOURCE(IDD_DIALOGINFO),
+ parent, DialogBoxProc, (LPARAM) this);
+
+ SetDlgItemText(DialogBox, IDC_TEXT, (*this).GetInformationsAsString().c_str());
+ return;
+}
+
+void CVersionInfo::PrintInformationsToClipboard(bool showLog) {
+
+ if (GetOpenClipboardWindow()) {
+ Log(Translate("The clipboard is not available, retry."));
+ }
+ else {
+ OpenClipboard(NULL);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ LPTSTR lptstrCopy;
+ std::string aux = (*this).GetInformationsAsString();
+ size_t length = aux.length() + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length + 5);
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ memcpy(lptstrCopy, aux.c_str(), length);
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+ SetClipboardData(CF_TEXT, hData);
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ if (showLog)
+ {
+ Log(Translate("Information successfully copied into clipboard."));
+ }
+ }
+ return;
+}
+
+/*int MyReceive(SOCKET sClient, char *message, int size, int bShow)
+{
+ int len = recv(sClient, message, size - 1, 0);
+ int success = 0;
+ if (len != SOCKET_ERROR)
+ {
+ message[len] = '\0';
+ if (bShow)
+ {
+ PUShowMessage(message, SM_NOTIFY);
+ }
+ char *pos = message;
+ while ((pos = strchr(pos + 1, '\n')))
+ {
+ success++;
+ }
+ if (success <= 0) success = 1; //make sure success is at least 1
+ }
+ else{
+ success = 0;
+ closesocket(sClient);
+ }
+ return success;
+}*/
+
+#define UPLOAD_ERROR() {PUShowMessage("Error while trying to upload data", SM_WARNING); return 1;}
+
+DWORD WINAPI UploadWorkerTread(LPVOID param)
+{
+ //PUShowMessage("Uploading to site", SM_NOTIFY);
+ /*
+ char *text = (char *) param;
+ char message[2048];
+
+ char server[1024];
+ int port;
+ char user[512];
+ char password[512];
+
+ GetStringFromDatabase("UploadServer", "vi.cass.cz", server, sizeof(server));
+ port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
+ GetStringFromDatabase("UploadUser", "", user, sizeof(user));
+ GetStringFromDatabase("UploadPassword", "", password, sizeof(password));
+ CallService(MS_DB_CRYPT_DECODESTRING, sizeof(password), (LPARAM) password);
+
+ SOCKET sClient = socket(AF_INET, SOCK_STREAM, 0);
+ if (!sClient)
+ {
+ MB("Could not create connection socket ...");
+ return 1;
+ }
+
+ sockaddr_in addr = {0};
+ hostent *localHost = gethostbyname(server);
+ char *localIP = (localHost) ? inet_ntoa(*(struct in_addr *) *localHost->h_addr_list) : server;
+
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = inet_addr(localIP);
+ addr.sin_port = htons(port);
+
+ int res = connect(sClient, (sockaddr *) &addr, sizeof(addr));
+ if (res)
+ {
+ char buffer[1024];
+ mir_snprintf(buffer, sizeof(buffer), "Could not connect to server '%s' on port %d", server, port);
+ MB(buffer);
+ return 1;
+ }
+ res = MyReceive(sClient, message, sizeof(message), TRUE); //get the welcome message
+ switch (res)
+ {
+ case 1:
+ if (!MyReceive(sClient, message, sizeof(message), 0)) UPLOAD_ERROR(); //get the enter username message
+ break;
+
+ case 2: //the enter user message was received already
+ break;
+
+ default: //assume error by default
+ UPLOAD_ERROR();
+ }
+
+ send(sClient, user, strlen(user), 0);
+ if (!MyReceive(sClient, message, sizeof(message), FALSE)) UPLOAD_ERROR(); //get the enter password message
+ send(sClient, password, strlen(password), 0);
+ if (!MyReceive(sClient, message, sizeof(message), FALSE)) UPLOAD_ERROR(); //get the upload data message
+ send(sClient, text, strlen(text) + 1, 0); //data message needs to send \0 so the server knows when to stop.
+ if (!MyReceive(sClient, message, sizeof(message), TRUE)) UPLOAD_ERROR();
+ closesocket(sClient);
+ //PUShowMessage("Done uploading to site", SM_NOTIFY);
+
+ if (text)
+ {
+ free(text);
+ }
+ */
+ return 0;
+}
+
+void CVersionInfo::UploadToSite(char *text){
+
+ DWORD threadID;
+ HANDLE thread;
+ char *data = NULL;
+ if (!text)
+ {
+ data = _strdup(GetInformationsAsString().c_str());
+ }
+ else{
+ data = _strdup(text);
+ }
+
+ thread = CreateThread(NULL, NULL, UploadWorkerTread, data, 0, &threadID); //the thread will free the buffer
+ if (!thread)
+ {
+ MB("Upload worker thread could not be created");
+ }
+ if ((thread != NULL) && (thread != INVALID_HANDLE_VALUE))
+ {
+ CloseHandle(thread);
+ }
+}
\ No newline at end of file diff --git a/plugins/VersionInfo/CVersionInfo.h b/plugins/VersionInfo/CVersionInfo.h new file mode 100644 index 0000000000..e97eee09cb --- /dev/null +++ b/plugins/VersionInfo/CVersionInfo.h @@ -0,0 +1,116 @@ +/*
+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
+
+//#define STRICT
+#define WIN32_LEAN_AND_MEAN
+//#include "AggressiveOptimize.h"
+
+#define _CRT_SECURE_NO_DEPRECATE
+
+#ifndef PF_NX_ENABLED
+ #define PF_NX_ENABLED 12
+#endif
+
+#include <list>
+#include <string>
+//using namespace std;
+
+#include "CPlugin.h"
+
+class CVersionInfo
+{
+ private:
+ //Informations related to Miranda: main informations.
+ std::string lpzMirandaVersion;
+ std::string lpzMirandaPath;
+ std::string lpzProfilePath;
+ std::string lpzProfileSize;
+ std::string lpzProfileCreationDate;
+ std::string lpzNightly;
+ std::string lpzUnicodeBuild;
+ std::string lpzCPUName;
+ std::string lpzCPUIdentifier;
+ std::string lpzBuildTime;
+ std::string lpzShell;
+ std::string lpzIEVersion;
+ std::string lpzAdministratorPrivileges;
+ std::string lpzOSLanguages;
+ std::string lpzLangpackInfo;
+ std::string lpzLangpackModifiedDate;
+ //Informations related to plugins
+ std::list<CPlugin> listActivePlugins;
+ std::list<CPlugin> listInactivePlugins;
+ std::list<CPlugin> listUnloadablePlugins;
+ //OS and hardware informations.
+ std::string lpzOSVersion;
+ std::string 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;
+ bool bExpertSettingsOn;
+ //Configuration
+
+ bool GetLinkedModulesInfo(char *moduleName, std::string &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 char *info);
+ void PrintInformationsToDialogBox();
+ void PrintInformationsToMessageBox();
+ void PrintInformationsToOutputDebugString();
+ void PrintInformationsToClipboard(bool);
+ void UploadToSite(char *text = NULL);
+
+ std::string GetListAsString(std::list<CPlugin>&, DWORD flags, int beautify);
+ std::string GetInformationsAsString(int bDisableForumStyle = 0);
+ void BeautifyReport(int, char *, char *, std::string &);
+ void AddInfoHeader(int, int, int, std::string &);
+ void AddInfoFooter(int, int, int, std::string &);
+};
+
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/VersionInfo.html b/plugins/VersionInfo/VersionInfo.html new file mode 100644 index 0000000000..a955874979 --- /dev/null +++ b/plugins/VersionInfo/VersionInfo.html @@ -0,0 +1,11 @@ +<html>
+ <head></head>
+ <body>
+ <center>
+ <h1>Version Information Test Page</h1>
+
+ <p>Version Information version 1.4.3.2</p>
+ <p><a href="VersionInfo.zip">VersionInfo.zip</a></p>
+ </center>
+ </body>
+</html>
diff --git a/plugins/VersionInfo/VersionInfo.ico b/plugins/VersionInfo/VersionInfo.ico Binary files differnew file mode 100644 index 0000000000..b026d584c2 --- /dev/null +++ b/plugins/VersionInfo/VersionInfo.ico diff --git a/plugins/VersionInfo/VersionInfo_10.vcxproj b/plugins/VersionInfo/VersionInfo_10.vcxproj new file mode 100644 index 0000000000..65d6bed2a0 --- /dev/null +++ b/plugins/VersionInfo/VersionInfo_10.vcxproj @@ -0,0 +1,382 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug Unicode|Win32">
+ <Configuration>Debug Unicode</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug Unicode|x64">
+ <Configuration>Debug Unicode</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode|Win32">
+ <Configuration>Release Unicode</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release Unicode|x64">
+ <Configuration>Release Unicode</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>VersionInfo</ProjectName>
+ <ProjectGuid>{3CE5572B-B7B0-4D1C-9D10-4622FBA6198E}</ProjectGuid>
+ <RootNamespace>VersionInfo</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</IgnoreImportLibrary>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)/Obj/$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">true</IgnoreImportLibrary>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">svc_vi</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">svc_vi</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">svc_vi</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">svc_vi</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>C:\Programmi\Miranda\Plugins/VersionInfo.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <AssemblerOutput>All</AssemblerOutput>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0410</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>comctl32.lib;imagehlp.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/VersionInfo.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <BrowseInformationFile>$(IntDir)</BrowseInformationFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0410</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>comctl32.lib;imagehlp.lib;odbc32.lib;odbccp32.lib;delayimp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
+ <DelayLoadDLLs>imagehlp.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <GenerateMapFile>true</GenerateMapFile>
+ <MapFileName>$(OutDir)$(ProjectName).map</MapFileName>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>C:\Programmi\Miranda\Plugins/VersionInfo.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <AssemblerOutput>All</AssemblerOutput>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0410</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>comctl32.lib;imagehlp.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\Release/VersionInfo.tlb</TypeLibraryName>
+ <HeaderFileName>
+ </HeaderFileName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <BrowseInformationFile>$(IntDir)</BrowseInformationFile>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0410</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>comctl32.lib;imagehlp.lib;odbc32.lib;odbccp32.lib;delayimp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
+ <DelayLoadDLLs>imagehlp.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <TargetMachine>MachineX86</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="CPlugin.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="CVersionInfo.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="dlgHandlers.cpp" />
+ <ClCompile Include="hooked_events.cpp" />
+ <ClCompile Include="main.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ </ClCompile>
+ <ClCompile Include="services.cpp" />
+ <ClCompile Include="utils.cpp">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
+ <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="CPlugin.h" />
+ <ClInclude Include="CVersionInfo.h" />
+ <ClInclude Include="hooked_events.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="resource.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="VersionInfo.ico" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/VersionInfo/VersionInfo_10.vcxproj.filters b/plugins/VersionInfo/VersionInfo_10.vcxproj.filters new file mode 100644 index 0000000000..46d44f7f4e --- /dev/null +++ b/plugins/VersionInfo/VersionInfo_10.vcxproj.filters @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{0740347a-255e-4fb6-9e9a-14397010e8ad}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{691f667c-7c8a-4c3e-8990-a9b456b12230}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{b90941c8-389b-4c91-9298-f201b8740872}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="CPlugin.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="CVersionInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dlgHandlers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="hooked_events.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="main.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="services.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="CPlugin.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="CVersionInfo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="hooked_events.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="VersionInfo.ico">
+ <Filter>Resource Files</Filter>
+ </None>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/VersionInfo/common.h b/plugins/VersionInfo/common.h new file mode 100644 index 0000000000..9f2abfb8f3 --- /dev/null +++ b/plugins/VersionInfo/common.h @@ -0,0 +1,120 @@ +/*
+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
+
+#pragma warning(disable:4005)
+#define _CRT_SECURE_NO_DEPRECATE
+#pragma warning(default:4005)
+
+#define VIPF_NONE 0x0000
+#define VIPF_UNCERTAIN 0x0010
+
+#define VISF_FORUMSTYLE 0x0001
+#define VISF_SHOWUUID 0x0002
+#define VISF_SHOWFLAGS 0x0004
+
+#include <windows.h>
+#include <time.h>
+
+#include <commctrl.h>
+#include <list>
+#include <imagehlp.h>
+#include <winsock.h>
+
+#include <String>
+//using namespace std;
+
+#include "version.h"
+
+#include "m_versioninfo.h"
+#include "hooked_events.h"
+#include "services.h"
+#include "dlgHandlers.h"
+
+#include "../../include/newpluginapi.h"
+#include "../../include/m_system.h"
+#include "../../include/m_langpack.h"
+#include "../../include/m_database.h"
+#include "../../include/m_skin.h"
+#include "../../include/m_clist.h"
+#include "../../include/m_options.h"
+#include "../../include/m_popup.h"
+
+#include "../../include/m_utils.h"
+#include "sdk/m_updater.h"
+#include "sdk/m_folders.h"
+
+#include "utils.h"
+
+#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 BOOL bFoldersAvailable;
+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 }};
+
+//miranda [re]alloc and free functions
+//main.cpp
+extern void * (* MirandaMalloc)(size_t);
+extern void * (* MirandaRealloc)(void *, size_t);
+extern void (* MirandaFree)(void *);
+
+#define OLD_MIRANDAPLUGININFO_SUPPORT PLUGININFO oldPluginInfo = { \
+ sizeof(PLUGININFO), \
+ pluginInfo.shortName, \
+ pluginInfo.version, \
+ pluginInfo.description, \
+ pluginInfo.author, \
+ pluginInfo.authorEmail, \
+ pluginInfo.copyright, \
+ pluginInfo.homepage, \
+ pluginInfo.flags, \
+ pluginInfo.replacesDefaultModule \
+}; \
+\
+extern "C" __declspec(dllexport) PLUGININFO *MirandaPluginInfo(DWORD mirandaVersion) \
+{ \
+ return &oldPluginInfo; \
+}
+
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/dlgHandlers.cpp b/plugins/VersionInfo/dlgHandlers.cpp new file mode 100644 index 0000000000..d7f36d3f83 --- /dev/null +++ b/plugins/VersionInfo/dlgHandlers.cpp @@ -0,0 +1,700 @@ +/*
+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 "dlgHandlers.h"
+
+const char *szQuoteStrings[] = {"[quote] | [/quote]", "[code] | [/code]", ""};
+const char *szSizeStrings[] = {"[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) / sizeof(szQuoteStrings[0]); //get the number of quote strings
+const int nSizeCount = sizeof(szSizeStrings) / sizeof(szSizeStrings[0]); //get the number of size strings
+const int nBoldCount = sizeof(szBoldStrings) / sizeof(szBoldStrings[0]); //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++)
+ {
+ SendDlgItemMessage(hWnd, nQuotesComboBox, CB_ADDSTRING, 0, (LPARAM) szQuoteStrings[i]);
+ }
+ for (i = 0; i < nSizeCount; i++)
+ {
+ SendDlgItemMessage(hWnd, nSizesComboBox, CB_ADDSTRING, 0, (LPARAM) szSizeStrings[i]);
+ }
+ for (i = 0; i < nBoldCount; i++)
+ {
+ SendDlgItemMessage(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 char oldQuoteBegin[MAX_SIZE], oldQuoteEnd[MAX_SIZE];
+ static char oldSizeBegin[MAX_SIZE], oldSizeEnd[MAX_SIZE];
+ static char oldBoldBegin[MAX_SIZE], oldBoldEnd[MAX_SIZE];
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ char buffer[1024];
+
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
+
+ TranslateDialogDefault(hWnd);
+
+ oldFSFValue = DBGetContactSettingByte(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);
+
+ GetStringFromDatabase("QuoteBegin", "[quote]", oldQuoteBegin, MAX_SIZE);
+ GetStringFromDatabase("QuoteEnd", "[/quote]", oldQuoteEnd, MAX_SIZE);
+ sprintf(buffer, "%s | %s", oldQuoteBegin, oldQuoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", "[size=1]", oldSizeBegin, MAX_SIZE);
+ GetStringFromDatabase("SizeEnd", "[/size]", oldSizeEnd, MAX_SIZE);
+ sprintf(buffer, "%s | %s", oldSizeBegin, oldSizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", "[b]", oldBoldBegin, MAX_SIZE);
+ GetStringFromDatabase("BoldEnd", "[/b]", oldBoldEnd, MAX_SIZE);
+ sprintf(buffer, "%s | %s", oldBoldBegin, oldBoldEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ return TRUE;
+ break;
+
+ 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:
+ int debugTo = TO_DIALOGBOX; //just to be safe
+ int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
+ char quoteBegin[MAX_SIZE], quoteEnd[MAX_SIZE];
+ char sizeBegin[MAX_SIZE], sizeEnd[MAX_SIZE];
+ char boldBegin[MAX_SIZE], boldEnd[MAX_SIZE];
+ char 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);
+
+ if (newFSFValue != oldFSFValue)
+ {
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
+ }
+ if (newFSFValue)
+ {
+ DBWriteContactSettingString(NULL, ModuleName, "QuoteBegin", quoteBegin);
+ DBWriteContactSettingString(NULL, ModuleName, "QuoteEnd", quoteEnd);
+
+ DBWriteContactSettingString(NULL, ModuleName, "SizeBegin", sizeBegin);
+ DBWriteContactSettingString(NULL, ModuleName, "SizeEnd", sizeEnd);
+
+ DBWriteContactSettingString(NULL, ModuleName, "BoldBegin", boldBegin);
+ DBWriteContactSettingString(NULL, ModuleName, "BoldEnd", boldEnd);
+ }
+
+ 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)
+ {
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", oldFSFValue);
+ }
+ if (newFSFValue)
+ {
+ DBWriteContactSettingString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
+ DBWriteContactSettingString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
+
+ DBWriteContactSettingString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
+ DBWriteContactSettingString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
+
+ DBWriteContactSettingString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
+ DBWriteContactSettingString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
+ }
+
+ DestroyWindow(hWnd);
+
+ break;
+ }
+
+ break;
+
+ default:
+
+ 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;
+
+ case TO_UPLOAD:
+ myInfo.UploadToSite();
+
+ break;
+
+ default:
+ myInfo.PrintInformationsToFile();
+
+ break;
+
+ }
+ if ((debugTo != TO_CLIPBOARD) && (DBGetContactSettingByte(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) DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_DISABLEDTOO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowUUIDs", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWINSTALLEDLANGUAGES, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SUPPRESSHEADER, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "SuppressHeader", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hWnd, IDC_SHOWINTASKBAR, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CLIPBOARDALSO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ClipboardAlways", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_BOLDVERSION, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CHECKUNLOADABLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ SetFocus(GetDlgItem(hWnd, IDC_FORUMSTYLE));
+ {
+ DBVARIANT dbv = { 0 };
+ dbv.type = DBVT_ASCIIZ;
+ bOptionsInitializing = 1;
+ char buffer[1024];
+ char notFound[1024];
+
+ if (DBGetContactSetting(NULL, ModuleName, "OutputFile", &dbv) == 0)
+ {
+ RelativePathToAbsolute(dbv.pszVal, notFound, sizeof(notFound));
+ }
+ else{
+ RelativePathToAbsolute("VersionInfo.txt", notFound, sizeof(notFound));
+ }
+
+ if (bFoldersAvailable)
+ {
+ //FoldersGetCustomPath(hOutputLocation, buffer, sizeof(buffer), "%miranda_path%");
+ //strcat(buffer, "\\VersionInfo.txt");
+ strcpy(buffer, TranslateTS("Customize using folders plugin"));
+ }
+ else{
+ strncpy(buffer, notFound, sizeof(notFound));
+ }
+
+ SetDlgItemText(hWnd, IDC_FILENAME, buffer);
+
+ char start[256], end[256];
+ GetStringFromDatabase("QuoteBegin", "[quote]", start, sizeof(start));
+ GetStringFromDatabase("QuoteEnd", "[/quote]", end, sizeof(end));
+ sprintf(buffer, "%s | %s", start, end);
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", "[size=1]", start, sizeof(start));
+ GetStringFromDatabase("SizeEnd", "[/size]", end, sizeof(end));
+ sprintf(buffer, "%s | %s", start, end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", "[b]", start, sizeof(start));
+ GetStringFromDatabase("BoldEnd", "[/b]", end, sizeof(end));
+ sprintf(buffer, "%s | %s", start, end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+ //to add stuff
+
+ //upload server settings
+ GetStringFromDatabase("UploadServer", "vi.cass.cz", buffer, sizeof(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), buffer);
+
+ int port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
+ _itoa(port, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
+
+ GetStringFromDatabase("UploadUser", "", buffer, sizeof(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), buffer);
+
+ GetStringFromDatabase("UploadPassword", "", buffer, sizeof(buffer));
+ CallService(MS_DB_CRYPT_DECODESTRING, sizeof(buffer), (LPARAM) buffer);
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PASSWORD), buffer);
+ }
+
+ switch(DBGetContactSettingByte(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)) && (!bFoldersAvailable)) ? TRUE : FALSE);
+ EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
+
+ OSVERSIONINFO osvi;
+ ZeroMemory(&osvi, sizeof(osvi));
+ 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)) && (!bFoldersAvailable)) ? 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, Translate("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."), Translate("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))// || (HIWORD(wParam) == CBN_SELENDOK)) //CBN_EDITCHANGE
+ {
+ if (!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:
+ {
+ {
+ char buffer[1024];
+ char start[256], end[256];
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingString(NULL, ModuleName, "QuoteBegin", start);
+ DBWriteContactSettingString(NULL, ModuleName, "QuoteEnd", end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingString(NULL, ModuleName, "SizeBegin", start);
+ DBWriteContactSettingString(NULL, ModuleName, "SizeEnd", end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingString(NULL, ModuleName, "BoldBegin", start);
+ DBWriteContactSettingString(NULL, ModuleName, "BoldEnd", end);
+
+ /*//upload server settings
+ SendDlgItemMessage(hWnd, IDC_UPLOAD_SERVER, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ DBWriteContactSettingString(NULL, ModuleName, "UploadServer", buffer);
+
+ SendDlgItemMessage(hWnd, IDC_UPLOAD_PORT, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ int port = atoi(buffer);
+ DBWriteContactSettingWord(NULL, ModuleName, "UploadPort", port);
+
+ SendDlgItemMessage(hWnd, IDC_UPLOAD_USERNAME, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ DBWriteContactSettingString(NULL, ModuleName, "UploadUser", buffer);
+
+ SendDlgItemMessage(hWnd, IDC_UPLOAD_PASSWORD, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(buffer), (LPARAM) buffer);
+ DBWriteContactSettingString(NULL, ModuleName, "UploadPassword", buffer);*/
+ }
+ DBWriteContactSettingByte(NULL, ModuleName, "CheckForDependencies", IsDlgButtonChecked(hWnd, IDC_CHECKUNLOADABLE) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "BoldVersionNumber", IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ClipboardAlways", IsDlgButtonChecked(hWnd, IDC_CLIPBOARDALSO) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "SuppressHeader", IsDlgButtonChecked(hWnd, IDC_SUPPRESSHEADER) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
+
+ char fileName[MAX_PATH]; //absolute
+ char filePath[MAX_PATH]; //relative
+ if (!bFoldersAvailable)
+ {
+ GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
+ AbsolutePathToRelative(fileName, filePath, sizeof(filePath));
+
+ DBWriteContactSettingString(NULL, ModuleName, "OutputFile", filePath); //store relative path
+ }
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
+ //Debug to:
+ if (IsDlgButtonChecked(hWnd, IDC_TOFILE))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_FILE);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOMESSAGEBOX))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_MESSAGEBOX);
+ else if (IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ else if (IsDlgButtonChecked(hWnd, IDC_TODEBUGSTRING))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DEBUGSTRING);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_CLIPBOARD);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOUPLOAD))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_UPLOAD);
+ else if (IsDlgButtonChecked(hWnd, IDC_ASKEVERYTIME))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_ASK);
+
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), TRUE);
+ //Disabled plugins too?
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
+
+ GetStringFromDatabase("UUIDCharMark", DEF_UUID_CHARMARK, PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+ }
+ }
+ }
+
+ break;
+
+ default:
+
+ 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 (DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE))
+ {
+ DWORD ws;
+ ws = GetWindowLong(hWnd, GWL_EXSTYLE);
+ SetWindowLong(hWnd, GWL_EXSTYLE, ws | WS_EX_APPWINDOW);
+ //SetWindowLong(hWnd, GWL_STYLE, ws | WS_DLGFRAME | WS_POPUPWINDOW);
+ }
+
+ TranslateDialogDefault(hWnd);
+ {
+ DBVARIANT dbv = { 0 };
+ LOGFONT lf = { 0 };
+
+ dbv.type = DBVT_BLOB;
+ if (DBGetContactSetting(NULL, "OptionFont", "Font", &dbv) == 0) {
+ lf=*(LOGFONT*)dbv.pbVal;
+ }
+ else {
+ HFONT 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(Translate("The clipboard is not available, retry."));
+ }
+ else {
+ OpenClipboard(hWnd);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ char text[MAX_TEXT];
+ LPTSTR lptstrCopy;
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ int length = lstrlen(text) + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length + 5);
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ memmove(lptstrCopy, text, length);
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+ SetClipboardData(CF_TEXT, hData);
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ }
+
+ break;
+
+ case IDC_SAVETOFILE:
+ char text[MAX_TEXT];
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+
+ myInfo->PrintInformationsToFile(text);
+
+ break;
+
+ case IDC_UPLOAD:
+ if (myInfo)
+ {
+ char text[MAX_TEXT];
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ myInfo->UploadToSite(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;
+
+ default:
+
+ break;
+ }
+ return 0;
+}
\ No newline at end of file diff --git a/plugins/VersionInfo/dlgHandlers.h b/plugins/VersionInfo/dlgHandlers.h new file mode 100644 index 0000000000..1c531c231a --- /dev/null +++ b/plugins/VersionInfo/dlgHandlers.h @@ -0,0 +1,44 @@ +/*
+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
+
+#include "common.h"
+#include "resource.h"
+#include "CVersionInfo.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/VersionInfo/docs/Pack files/files_release.txt b/plugins/VersionInfo/docs/Pack files/files_release.txt new file mode 100644 index 0000000000..f70bd504e3 --- /dev/null +++ b/plugins/VersionInfo/docs/Pack files/files_release.txt @@ -0,0 +1 @@ +..\win32\Release\svc_vi.dll
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/Pack files/files_releasex64.txt b/plugins/VersionInfo/docs/Pack files/files_releasex64.txt new file mode 100644 index 0000000000..67f2eb50a6 --- /dev/null +++ b/plugins/VersionInfo/docs/Pack files/files_releasex64.txt @@ -0,0 +1 @@ +..\x64\Release\svc_vi.dll
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/Pack files/files_source.txt b/plugins/VersionInfo/docs/Pack files/files_source.txt new file mode 100644 index 0000000000..ec3390726a --- /dev/null +++ b/plugins/VersionInfo/docs/Pack files/files_source.txt @@ -0,0 +1,4 @@ +..\docs\pack files\*.*
+..\docs\*.*
+..\*.*
+..\sdk\*.*
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/Pack files/files_source_ignore.txt b/plugins/VersionInfo/docs/Pack files/files_source_ignore.txt new file mode 100644 index 0000000000..fcc9f161ac --- /dev/null +++ b/plugins/VersionInfo/docs/Pack files/files_source_ignore.txt @@ -0,0 +1,4 @@ +pack files\*.*
+..\~backup\*.*
+..\Debug\*.*
+..\Release\*.*
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/pack source.bat b/plugins/VersionInfo/docs/pack source.bat new file mode 100644 index 0000000000..0906f97cb9 --- /dev/null +++ b/plugins/VersionInfo/docs/pack source.bat @@ -0,0 +1,8 @@ +for /F "tokens=3-7* delims=. " %%i in (readme_versioninfo.txt) do (call :Pack %%i %%j %%k %%l; exit)
+
+:Pack
+d:\usr\PowerArchiver\pacl\pacomp.exe -p -a -c2 "VersionInfo src %1.%2.%3.%4.zip" @"pack files\files_source.txt" -x*.zip -x*.ncb -x*.user
+exit
+
+error:
+echo "Error packing Versioninfo"
diff --git a/plugins/VersionInfo/docs/pack symbols.bat b/plugins/VersionInfo/docs/pack symbols.bat new file mode 100644 index 0000000000..73c4fe8efe --- /dev/null +++ b/plugins/VersionInfo/docs/pack symbols.bat @@ -0,0 +1,9 @@ +@echo off
+if NOT EXIST "symbols\%1 - %3" (
+ mkdir "symbols\%1 - %3"
+)
+xcopy "..\%2\win32\Release\*.pdb" "symbols\%1 - %3\win32\*" /EXCLUDE:symbols_exclude.txt /Y
+xcopy "..\%2\x64\Release\*.pdb" "symbols\%1 - %3\x64\*" /EXCLUDE:symbols_exclude.txt /Y
+
+d:\usr\PowerArchiver\pacl\pacomp.exe -p -a -r -c2 "symbols - %1.zip" "symbols\*.*"
+rmdir "symbols\" /Q /S
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/pack x64.bat b/plugins/VersionInfo/docs/pack x64.bat new file mode 100644 index 0000000000..ae61abb3d3 --- /dev/null +++ b/plugins/VersionInfo/docs/pack x64.bat @@ -0,0 +1,10 @@ +for /F "tokens=3-7* delims=. " %%i in (readme_versioninfo.txt) do (call :Pack %%i %%j %%k %%l; exit)
+
+:Pack
+d:\usr\PowerArchiver\pacl\pacomp.exe -a -c2 "VersionInfo %1.%2.%3.%4 x64.zip" @"Pack files\files_releasex64.txt"
+d:\usr\PowerArchiver\pacl\pacomp.exe -p -a -c2 "VersionInfo %1.%2.%3.%4 x64.zip" ..\docs\*.txt ..\*.caca -xsymbols_exclude.txt
+call "pack symbols.bat" VersionInfo "" %1.%2.%3.%4
+exit
+
+error:
+echo "Error packing Versioninfo"
diff --git a/plugins/VersionInfo/docs/pack.bat b/plugins/VersionInfo/docs/pack.bat new file mode 100644 index 0000000000..4366326474 --- /dev/null +++ b/plugins/VersionInfo/docs/pack.bat @@ -0,0 +1,10 @@ +for /F "tokens=3-7* delims=. " %%i in (readme_versioninfo.txt) do (call :Pack %%i %%j %%k %%l; exit)
+
+:Pack
+d:\usr\PowerArchiver\pacl\pacomp.exe -a -c2 "VersionInfo %1.%2.%3.%4 x32.zip" @"Pack files\files_release.txt"
+d:\usr\PowerArchiver\pacl\pacomp.exe -p -a -c2 "VersionInfo %1.%2.%3.%4 x32.zip" ..\docs\*.txt ..\*.caca -xsymbols_exclude.txt
+call "pack symbols.bat" VersionInfo "" %1.%2.%3.%4
+exit
+
+error:
+echo "Error packing Versioninfo"
diff --git a/plugins/VersionInfo/docs/readme_versioninfo.txt b/plugins/VersionInfo/docs/readme_versioninfo.txt new file mode 100644 index 0000000000..8a7d49fe7a --- /dev/null +++ b/plugins/VersionInfo/docs/readme_versioninfo.txt @@ -0,0 +1,433 @@ +VersionInfo, v.1.4.3.4
+ by Luca "Hrk" Santarelli, Cristian Libotean
+ hrk@users.sf.net, eblis102@yahoo.com
+ Thanks go to: StormLord, Cyreve, Strickz, Wintime98
+ All of them helped me somehow.
+
+- INFO -
+
+Hi :-)
+
+This plugin is born from a feature request on the Open Discussion forum.
+Its purpose is to display some informations related to Miranda and to the OS
+so that you can copy/paste them in a bug report.
+
+Remember: submitting a bug report DOES NOT mean that it will be fixed.
+You need to check the bug report because developers may need your cooperation,
+testing debug builds or making other tests.
+
+The displayed informations are:
+§ Date/Time of report
+§ System cpu type
+§ OS name and version (major, minor, build, additional data)
+§ Installed RAM
+§ Miranda version, being it or not a nightly and/or unicode.
+§ List of enabled plugins (filename, short name, version and last modified date)
+§ List of disabled plugins (filename, short name, version and last modified date). Optional.
+
+
+- USE -
+
+!!! For bugs and/or suggestions please email me, eblis102@yahoo.com (please don't spam hrk as
+he's not working on this anymore).
+
+Click on the button in the main menu or the one in the options... and you're done.
+You can choose where to debug: text file, message box (no copy/paste), dialog
+box (copy/paste), OutputDebugString(), Clipboard directly. You can also check to print
+to clipboard while printing to any of the other options (except clipboard, of course :) )
+
+
+- CHANGES -
+
++ : new feature
+* : changed
+! : bufgix
+- : feature removed or disabled because of pending bugs
+
+v. 1.4.3.4 - 2009/11/13
+ + x64 support (not tested !!)
+
+v.1.4.3.3 - 2008/02/15
+ ! Plugins that do not have the extension .dll will not be listed anymore
+
+v.1.4.3.2 - 2008/01/31
+ * Report plugins without UUIDs in Miranda 0.8 #9 or later as Unloadable instead of Inactive
+
+v.1.4.3.1 - 2008/01/30
+ * When in service mode enable showing of disabled plugins if 'forum style formatting' is disabled, regardless if the option to show disabled plugins in the options is checked or not.
+ ! Ignore case when checking dll name.
+
+v.1.4.3.0 - 2008/01/29
+ * Show messages using a popup if a popup plugin is available
+ + Added service mode functionality - requires miranda 0.8 #9 or later.
+ WARNING: Please rename the plugin back to svc_vi.dll if you're using Updater to update your plugins.
+
+v.1.4.2.7 - 2008/01/25
+ ! Fixed crash when displaying information for unloadable plugins
+
+v.1.4.2.6 - 2008/01/24
+ * Changed beta versions server.
+
+v.1.4.2.5 - 2007/10/24
+ + Added profile path to VersionInfo report.
+
+v.1.4.2.4 - 2007/09/26
+ * Show warning message when user tries to activate 'Show plugin UUIDs' option.
+
+v.1.4.2.3 - 2007/07/25
+ ! Fixed time zone offset calculation.
+ ! Fixed negative time zones display.
+
+v.1.4.2.2 - 2007/07/24
+ + Added time zone information for profile creation date and language pack modified date.
+
+v.1.4.2.1 - 2007/06/22
+ * Show menu item is always checked (to disable use the menu editor).
+ * Enabled unicode flag since plugin is 2in1.
+
+v.1.4.2.0 - 2007/06/22
+ * Show UUIDs checkbox is now visible only when 'show expert options' is checked.
+ * Added checkbox to enable/disable showing installed languages - visible only when 'show expert options' is checked.
+
+v.1.4.1.5 - 2007/06/21
+ * Removed installed languages info from report (still available using the hidden setting 'ShowInstalledLanguages')
+
+v 1.4.1.4 - 2007/05/11
+ ! Show more than 2g of memory if available.
+
+v. 1.4.1.3 - 2007/03/27
+ * Fix for database plugins returning non standard profile path (dbxSA).
+
+v. 1.4.1.2 - 2007/03/22
+ ! Fix Unicode plugin detection.
+
+v. 1.4.1.1 - 2007/03/07
+ + Added icon to output dialog window.
+ * Make 'Customize using folders plugin' translatable.
+
+v. 1.4.1.0 - 2007/03/07
+ * Changed plugin UUID ( {2f174488-489c-4fe1-940d-596cf0f35e65} ).
+ + Added VERSIONINFO interface.
+
+v. 1.4.0.4 - 2007/03/06
+ + Option to show UUID info.
+ + Added VI UUID.
+ + Added hidden setting to change the character shown if plugin has a UUID defined (UUIDCharMark).
+ ! Do not enable Apply when first entering the options.
+
+v. 1.4.0.3 - 2007/02/12
+ + Read plugin Unicode aware flag. Only shown if plugin name doesn't contain 'unicode' or '2in1'.
+
+v. 1.4.0.2 - 2007/01/31
+ * Changed beta URL.
+
+v. 1.4.0.1 - 2007/01/28
+ + Added InternetExplorer version
+
+v. 1.4.0.0 - 2007/01/28
+ + Added Windows shell information.
+ ! Fix for profile creation date and size on Windows 98
+
+v. 1.3.2.2 - 2007/01/07
+ + New version resource file.
+ + Added OS languages info: {User UI language/}System UI language | Current user locale/System locale [available system languages]. User UI language is not available for Windows 95, 98, Me and NT.
+ + Folders support.
+ ! Close thread handle.
+
+v. 1.3.2.1 - 2006/12/07
+ * Changed controls tab order.
+
+v. 1.3.2.0 - 2006/11/26
+ * Reorganised the post a bit.
+ + Added empty blockquote style.
+ ! Fixed <u><b> version number highlighting.
+ + Added dll version info.
+
+v. 1.3.1.1 - 2006/11/15
+ * "Ask every time", not "Ask everytime" :)
+ + Added administrator privileges information.
+ + Added "Save to file" button to dialog.
+ * Disabled the "Upload" button.
+
+v. 1.3.1.0 - 2006/11/1
+ + Added multiple CPUs info.
+ + Added WOW64 info.
+ ! Don't get plugin information twice.
+ * Moved main menu entry near Help.
+ * Default output location changed to dialog.
+
+v. 1.3.0.4 - 2006/10/16
+ * Made langpack retrieval more robust.
+ + Show langpack info.
+ * No more dependency on winsock2 (removed upload feature for now, support isn't available anyway)
+
+v. 1.3.0.1 - 2006/09/25
+ + Updater support (beta versions)
+ ! Enable the Apply button when combobox items are changed.
+ + Added quote, size and bold comboboxes to ask dialog.
+ * Sections now use the same highlighting method as the plugins.
+ * Changed text displayed when plugins don't want to load with current Miranda version.
+
+v. 1.3.0.0 - 2006/08/08
+ * Use relative paths. The file path in the options will show as absolute but it's saved in the database as relative - uses the services in m_utils.h.
+ + New versioninfo icon - thanks Faith Healer.
+ + Option to automatically upload VI post to vi.cass.cz :) - currently there's no support on the site for it
+ + Show plugins that fail to load for unknown reasons.
+ * Use mir_snprintf where possible.
+ + Added checkbox for forum style formatting in ask dialog.
+ * Changed plugin section to "Services"
+
+v. 1.2.0.4 - 2006/07/26
+ * 'Attempt to find unloadable plugins' is checked by default now and is grayed out on Win 98.
+ + Added check for Windows 2003 R2.
+
+v. 1.2.0.3 - 2006/06/01
+ + Added a service to get the VersionInfo post as a string.
+
+v. 1.2.0.2 - 2006/05/20
+ ! Fixed a bug when notifing of errors - thanks for the patch Peter (UnregistereD).
+
+v. 1.2.0.1 - 2006/05/17
+ * People reported they don't have PF_NX_ENABLED defined so i created a workaround for those who want to build VI from sources.
+ ! Destroy services the proper way.
+
+v. 1.2.0.0 - 2006/05/01
+ + Added DEP information.
+ * Show message if CPU doesn't recognize cpuid extension.
+
+v. 1.0.1.19 - 2006/03/23
+ ! Fixed "Do it now" being disabled when first entering the options window.
+
+v. 1.0.1.18 - 2006/03/09
+ + Added a new size option for phpBB forums.
+ + Added a new highlight option (bold and underline).
+ + Added a new option to suppress header and footer information - will make the post a bit smaller.
+ ! Fixed a bug when information was copied to clipboard.
+
+v. 1.0.1.17 - 2006/01/01
+ + Added check to find out plugin information for plugins that refuse to load.
+ ! Fixed a new line issue (happened when Unloadable plugins entry was visible).
+
+v. 1.0.1.16 - 2006/01/31
+ * Removed the static edge from the dialog buttons.
+ + Added check for plugins that refuse to load.
+ * Updated the translation strings.
+
+v. 1.0.1.15 - 2005/10/17
+ + Added some hidden beautification settings. You need to use dbeditor to add these settings to
+ VersionInfo. All settings are strings and they should either be bbcodes or html codes. (do a default
+ output for an example). Check the changes in version 1.0.1.14 to see how you can activate this output.
+ ~ BeautifyHorizLine - code for a horizontal line
+ (default: <hr />)
+ ~ BeautifyBlockStart - code for a blockquote (start code) that separates the hw and miranda settings from the plugins
+ (default: <blockquote>)
+ ~ BeautifyBlockEnd - code for a blockquote (end code) that separates the hw and miranda settings from the plugins
+ (default: </blockquote>)
+ ~ BeautifyActiveHeaderBegin - code for the font and size of the active header text (start code)
+ (default: <b><font size="-1" color="DarkGreen">)
+ ~ BeautifyActiveHeaderEnd - code for the font and size of the active header text (end code)
+ (default: </font></b>)
+ ~ BeautifyInactiveHeaderBegin - code for the font and size of the inactive header text (start code)
+ (default: <b><font size="-1" color="DarkRed">)
+ ~ BeautifyInactiveHeaderEnd - code for the font and size of the inactive header text (end code)
+ (default: </font></b>)
+ ~ BeautifyUnloadableHeaderBegin - code for the font and size of the unloadable header text (start code)
+ (default: <b><font size="-1"><font color="Red">)
+ ~ BeautifyUnloadableHeaderEnd - code for the font and size of the unloadable header text (end code)
+ (default: </font></b>)
+ ~ BeautifyPluginsBegin - code for the font and size of plugins (start code)
+ (default: <font size="-2" color="black">)
+ ~ BeautifyPluginsEnd - code for the font and size of plugins (end code)
+ (default: </font>)
+ How it works:
+ $starting info [Miranda IM ... Miranda's homepage ... Miranda tools]
+ {Horizontal line}{block start}Report generated at: $date
+ $hardware, os and miranda settings
+ {block end}{horizontal line}{active header start}Active Plugins (#):{active header end}
+ {plugins start}
+ $plugins
+ {plugins end}{horizontal line}{inactive header start}Inactive Plugins (#):{inactive header end}
+ {plugins start}
+ $plugins
+ {plugins end}{horizontal line}{unloadable header start}Unloadable Plugins (#):{unloadable header end}
+ {plugins start}
+ $plugins
+ {plugins end}{horizontal line}
+ $end info [End of report ...]
+
+v. 1.0.1.14 - 2005/10/16
+ - Removed the logging functions used when attempting to find an unloadable plugin.
+ + Added hidden option to beautify the output. You need to use dbeditor and add a new
+ byte value to VersionInfo called Beautify and set it to 1 for the setting to take effect.
+ Forum style formatting must be OFF; although forum style is unchecked it will get the
+ highlighting information from the appropriate checkbox so be sure to set it
+ accordingly (usually to <b /> or <u />. The formatting is hardcoded at the moment
+ (it's set to html tags), i might add some strings in the database for it later on.
+ + Added option to select how to highlight version number; currently you can
+ select from bold or underline.
+
+v. 1.0.1.13 - 2005/10/14
+ + Added option to ask where to print the output.
+
+v. 1.0.1.12 - 2005/10/06
+ * Changed the way versioninfo scans for enabled/disabled plugins.
+ Now it should be able to detect even plugin that were reported as inactive before (like aim toc2 and clist_nicerW+)
+ + Added profile size and creation date.
+ + Added information about missing statically linked dll files. Use with care, might crash miranda on some systems.
+ This function might not work (correctly) on windows 98 and below. If you check this option a file named
+ 'versioninfo.log' will appear in miranda's folder; in case of a crash please post this info in the forums
+ (thread Plugins->Versioninfo format style) using [code][/code] bbcodes.
+
+v. 1.0.1.11 - 2005/09/24
+ + Added option to print version number in bold or not.
+ + Added [code] bbcode and empty size field (if the forum doesn't strip other bbcodes from inside a [code])
+
+v. 1.0.1.10 - 2005/09/25
+ ! Fixed issue that prevented the apply button to be enabled when changing the filename.
+ + Added options to select forum bbcodes.
+
+v. 1.0.1.9 - 2005/09/22 :)
+ + Added a new CPU check. Might be unstable and can't detect very old processors (like pentium mmx)
+ * Changed hidden settings strings to QuoteBegin, QuoteEnd, SizeBegin, SizeEnd.
+ ! Fixed updater issue - older versions should be detected as well (thanks sje). Plugin should
+ comply with updater rules from now on.
+
+v. 1.0.1.8 - 2005/09/22
+ * Changed month number to month short name (english locale)
+ + Added "hidden" settings for 'quote' and 'size' strings (only valid when using forum style formatting).
+ You need to use dbeditor++ to add these.
+ "QuoteHeader" - String value containing the starting quote string.
+ You can use this if you want to change the "[quote]" string to "[code]" for example.
+ If the setting is not present it reverts to "[quote]"
+ "SizeHeader" - String value containing the starting size string.
+ You should use this if the forum software doesn't recognize "[size=1]" and needs
+ something like "[size=1px]". If the setting is not present it reverts to "[size=1]".
+ "QuoteFooter" - String value containing the ending quote string. If the setting is not present it reverts to "[/quote]"
+ "SizeFooter" - String value containing the ending size string. If the setting is not present it reverts to "[/size]"
+ !If you change the header for one of these don't forget to change the footer as well (and vice versa).
+ + When using forum style formatting the version number will be bold.
+ + Added active and inactive plugins count (it can't hurt :) )
+
+v. 1.0.1.7 - 2005/09/21
+ ! Fixed double enter issue
+ ! Fixed unicode detection problem
+
+
+1.0.1.6 - 2005/09/11
+ * Changed miranda's homepage from 'http://miranda-icq.sourceforge.net/' to 'miranda-im.org'
+ * Changed miranda tools link.
+ * Changed some strings (date and time related).
+ + Added check for unicode core.
+ + Added miranda path to versioninfo output.
+ + Added plugin's last modified date to versioninfo output.
+ + Added plugin's short name to versioninfo output.
+ + Added os check for windows 2003.
+ + Added option to show information window in taskbar
+ + Added option to always copy to clipboard
+ + Added CPU info
+ Should still work with amd 64 (unsure)
+
+1.0.1.5 * Works on AMD64 now.
+ * Fixed some typos in the text and URLs.
+ * Changed some default settings.
+
+1.0.1.4 * Fixed the crashes when a .dll file was found but was not a plugin.
+ * Filesize somehow increased to 80KB... don't ask me why.
+ + Added support for MirandaInstaller/Wassup by Tornado.
+
+1.0.1.3 * No change at all, but it now works for everyone. Don't ask me how.
+
+1.0.1.2 * Fixed NT detection.
+ * Fixed click on X button in dialogbox.
+
+1.0.1.1 * Changed the option page UI to reflect Miranda's one and to have a
+ more intuitive usage.
+ * Size has increased, but there's not anymore the need for that
+ external DLL. :-)
+
+1.0.1.0 + Added "DialogBox" as output (Cyreve, Stormlord, myself)
+ + Added "OutputDebugString()" as output
+ + Added "Clipboard" as output
+ + Added the missing button in the options
+ + Added a cool icon
+ + Added OS name (Wintime98, myself)
+ + Added Miranda build time (Wintime98)
+ + Added free disk space on Miranda partition (Stormlord, myself)
+ * Changed "Debug to:" to "Output to:" because of its meaning
+
+1.0.0.0 First release.
+ DialogBox is not yet selectable.
+ Developers, read the REBASE information.
+
+
+- TRANSLATION -
+
+The strings you can translate are these:
+
+for version 1.4.2.4
+;Plugin description:
+;[Collects and prints information related to Miranda, the plugins and the OS.]
+;
+;Option dialog
+;[Plugins]
+;[Version Information]
+;[Output to:]
+;[Text file]
+;[MessageBox()]
+;[DialogBox]
+;[Show window in taskbar]
+;[OutputDebugString()]
+;[Clipboard]
+;[Upload to site]
+;[Ask every time]
+;[Also copy info to clipboard]
+;[Forum style formatting]
+;[Highlight version number using]
+;[Show disabled plugins too]
+;[Show plugin UUIDs]
+;[Attempt to find unloadable plugins (doesn't work on Windows 98)]
+;[Suppress header information]
+;[Add a menu item to the main Miranda Menu]
+;[You will need to restart Miranda to add/remove the menu item.]
+;[Do it now]
+;[Upload site settings]
+;[Username]
+;[Password]
+;[Customize using folders plugin]
+;[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.]
+;[Show plugin UUIDs ?]
+;
+;Dialog box
+;[Upload]
+;[Close]
+;[Copy text]
+;
+;Miscellanea
+;[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!]
+;[Information successfully written to file: \"%s\".]
+;[Error during the creation of file \"%s\". Disk may be full or write protected.]
+
+;[Ok, something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d]
+
+;[The clipboard is not available, retry.]
+;[Information successfully copied into clipboard.]
+;[Miranda Version Information]
+
+- DISCLAIMER -
+
+This plugin works just fine on my machine, it should work just fine on yours
+without conflicting with other plugins. Should you have any trouble, write me
+at hrk@users.sf.net where "sf" must be changed to "sourceforge".
+Anyway, if you are a smart programmer, give a look at the code and tell me
+the changes you'd make. If I like them, I'll put them inside. :-)
+
+This plugin is released under the GPL license, I'm too lazy to copy it, though.
+Anyway, if you do have Miranda (and you should, otherwise this plugin is
+pretty useless) you already have a file called GPL.txt with tis license.
+Being GPLed you are free to modify or change the source code (you can find it
+here: http://nortiq.com/miranda/ and look for the source section) but you
+cannot sell it.
+As I already wrote: if you do modify it, notify me, I don't see a good reason
+not to share the improvements with the Miranda community. :-)
+
+Yes, I have made a quite long disclaimer, I can save the file now. :-)
diff --git a/plugins/VersionInfo/docs/rebase_versioninfo.txt b/plugins/VersionInfo/docs/rebase_versioninfo.txt new file mode 100644 index 0000000000..fd71ab0526 --- /dev/null +++ b/plugins/VersionInfo/docs/rebase_versioninfo.txt @@ -0,0 +1,33 @@ +=§= TO PLUGIN DEVELOPERS =§=
+
+This plugin has its Base Address set to:
+0x25040000
+
+Please, avoid using this BaseAddress for your plugins: using the same addresses
+will slow Miranda.
+Read "pluginguidelines.txt" under miranda0100/miranda32/doc/ in the CVS.
+
+This Base Address is built this way:
+
+0x25 040000
+^^^^ ^^^^^^
+My radix Incremental value related to my plugins.
+
+Range for base address is 0x10000000 to 0x50000000, so 0x25040000 fits well there.
+
+040000 is an incremental value which represents VersionInfo.
+[Note: 000000 is used for RePosition, 010000 for NewStatusNotify, 030000 for PicPlugin and so on.]
+
+Why do I call 0x25 "My radix"?
+
+HRK = H + R + K
+H = 8th letter in the english alphabet.
+R = 18th letter in the english alphabet.
+K = 11th letter in the english alphabet.
+
+8 + 18 + 11 = 37.
+37(dec) = 25(Hex)
+
+Base Address can be found/configured:
+§ MSVC++ 6.0
+ Project->Settings->Link->Output->Base Address
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/symbols_exclude.txt b/plugins/VersionInfo/docs/symbols_exclude.txt new file mode 100644 index 0000000000..361cf2448b --- /dev/null +++ b/plugins/VersionInfo/docs/symbols_exclude.txt @@ -0,0 +1 @@ +vc80.pdb
\ No newline at end of file diff --git a/plugins/VersionInfo/docs/versioninfo.gif b/plugins/VersionInfo/docs/versioninfo.gif Binary files differnew file mode 100644 index 0000000000..a0e1f8eadb --- /dev/null +++ b/plugins/VersionInfo/docs/versioninfo.gif diff --git a/plugins/VersionInfo/hooked_events.cpp b/plugins/VersionInfo/hooked_events.cpp new file mode 100644 index 0000000000..b87fa355df --- /dev/null +++ b/plugins/VersionInfo/hooked_events.cpp @@ -0,0 +1,97 @@ +/*
+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 "hooked_events.h"
+
+HANDLE hModulesLoaded;
+HANDLE hOptionsInitialize;
+
+const int nExpertOnlyControls = 10;
+UINT uiExpertOnlyControls[nExpertOnlyControls] = {0};
+
+#define HOST "http://eblis.tla.ro/projects"
+
+#define VERSIONINFO_VERSION_URL HOST "/miranda/VersionInfo/updater/VersionInfo.html"
+#define VERSIONINFO_UPDATE_URL HOST "/miranda/VersionInfo/updater/VersionInfo.zip"
+#define VERSIONINFO_VERSION_PREFIX "Version Information version "
+
+int HookEvents()
+{
+ hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
+ //hPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
+
+ return 0;
+}
+
+int UnhookEvents()
+{
+ UnhookEvent(hModulesLoaded);
+ UnhookEvent(hOptionsInitialize);
+
+ return 0;
+}
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ char buffer[1024];
+ Update update = {0};
+ update.cbSize = sizeof(Update);
+ update.szComponentName = __PLUGIN_DISPLAY_NAME;
+ update.pbVersion = (BYTE *) CreateVersionString(VERSION, buffer);
+ update.cpbVersion = (int) strlen((char *) update.pbVersion);
+ update.szUpdateURL = UPDATER_AUTOREGISTER;
+ update.szBetaVersionURL = VERSIONINFO_VERSION_URL;
+ update.szBetaUpdateURL = VERSIONINFO_UPDATE_URL;
+ update.pbBetaVersionPrefix = (BYTE *) VERSIONINFO_VERSION_PREFIX;
+ update.cpbBetaVersionPrefix = (int) strlen(VERSIONINFO_VERSION_PREFIX);
+ CallService(MS_UPDATE_REGISTER, 0, (LPARAM) &update);
+
+ bFoldersAvailable = ServiceExists(MS_FOLDERS_REGISTER_PATH);
+ hOutputLocation = FoldersRegisterCustomPath("VersionInfo", "Output folder", "%miranda_path%");
+
+ GetStringFromDatabase("UUIDCharMark", DEF_UUID_CHARMARK, PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+
+ return 0;
+}
+
+int OnOptionsInitialise(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+
+ uiExpertOnlyControls[0] = IDC_SHOWUUIDS;
+ uiExpertOnlyControls[1] = IDC_SHOWINSTALLEDLANGUAGES;
+
+ odp.cbSize = sizeof(odp);
+ odp.position = 100000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_VERSIONINFO);
+ odp.pszTitle = Translate("Version Information");
+ odp.pszGroup = Translate("Services");
+ odp.groupPosition = 910000000;
+ odp.flags=ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcOpts;
+ odp.expertOnlyControls = uiExpertOnlyControls;
+ odp.nExpertOnlyControls = 2;
+
+ CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+
+ return 0;
+}
\ No newline at end of file diff --git a/plugins/VersionInfo/hooked_events.h b/plugins/VersionInfo/hooked_events.h new file mode 100644 index 0000000000..3c972fe014 --- /dev/null +++ b/plugins/VersionInfo/hooked_events.h @@ -0,0 +1,35 @@ +/*
+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
+
+#include "common.h"
+
+extern HANDLE hModulesLoaded;
+extern HANDLE hOptionsInitialise;
+
+int HookEvents();
+int UnhookEvents();
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
+int OnOptionsInitialise(WPARAM wParam, LPARAM lParam);
+
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/m_versioninfo.h b/plugins/VersionInfo/m_versioninfo.h new file mode 100644 index 0000000000..3c5ffddcc0 --- /dev/null +++ b/plugins/VersionInfo/m_versioninfo.h @@ -0,0 +1,48 @@ +/*
+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_H
+#define M_VERSIONINFO_H
+
+/*Brings up the versioninfo post as configured in the options
+wParam - not used
+lParam - not used
+*/
+#define MS_VERSIONINFO_MENU_COMMAND "VersionInfo/MenuCommand"
+
+/*Returns a string containing the versioninfo post
+wParam - (BOOL) suppress forum style formatting. If true the post won't have forum style formatting even if the option is checked in miranda's options.
+lParam - (char **) Pointer to a string that receives the info. Memory is allocated using miranda's version of malloc() and you need to use miranda's version of free() on it.
+Returns 0 on success.
+
+how to use:
+{
+//...
+ char *data;
+ if (GetInfoService(TRUE, (LPARAM) &data) == 0)
+ {//success
+ }
+ return 0;
+}
+
+*/
+#define MS_VERSIONINFO_GETINFO "Versioninfo/GetInfo"
+
+#endif //M_VERSIONINFO_H
diff --git a/plugins/VersionInfo/main.cpp b/plugins/VersionInfo/main.cpp new file mode 100644 index 0000000000..13784e8c03 --- /dev/null +++ b/plugins/VersionInfo/main.cpp @@ -0,0 +1,175 @@ +/*
+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.
+*/
+
+#define STRICT
+#define WIN32_LEAN_AND_MEAN
+
+#define _CRT_SECURE_NO_DEPRECATE
+
+#include "common.h"
+
+#include "CVersionInfo.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+HICON hiVIIcon;
+
+DWORD EnglishLocale;
+
+BOOL bFoldersAvailable = FALSE;
+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_DISPLAY_NAME,
+ VERSION,
+ __DESC,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ 1, //not transient
+ 0,
+ {0x2f174488, 0x489c, 0x4fe1, {0x94, 0x0d, 0x59, 0x6c, 0xf0, 0xf3, 0x5e, 0x65}} //{2f174488-489c-4fe1-940d-596cf0f35e65}
+};
+
+OLD_MIRANDAPLUGININFO_SUPPORT;
+
+static const MUUID interfaces[] = {MIID_VERSIONINFO, MIID_SERVICEMODE, MIID_LAST};
+
+extern "C" __declspec(dllexport) const MUUID *MirandaPluginInterfaces()
+{
+ return interfaces;
+}
+
+bool WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ LogToFileInit();
+ LogToFile("Entering %s", __FUNCTION__);
+ hInst=hinstDLL;
+ if (fdwReason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(hinstDLL);
+ EnglishLocale = MAKELCID(MAKELANGID(0x09, 0x01), SORT_DEFAULT); //create our english locale and use it everywhere it's needed
+ LogToFile("Leaving %s", __FUNCTION__);
+ return TRUE;
+}
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ LogToFile("Entering %s", __FUNCTION__);
+ LogToFile("Leaving %s", __FUNCTION__);
+ return &pluginInfo;
+}
+
+extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ LogToFile("Entering %s", __FUNCTION__);
+ pluginLink=link;
+
+ LogToFile("Initialising services ...");
+ InitServices();
+ LogToFile("Hooking events ...");
+ HookEvents();
+
+ hiVIIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
+
+ //get the name of the dll itself
+ char filePath[512] = {0};
+ GetModuleFileName(hInst, filePath, sizeof(filePath));
+ char *fileName = NULL;
+ size_t i = strlen(filePath) - 1;
+ _strlwr(filePath);
+
+ //check that the name begins with svc_
+ while ((i > 0) && (filePath[i] != '\\')) { i--; }
+ if (i > 0)
+ {
+ filePath[i] = 0;
+ fileName = filePath + i + 1;
+
+ if (strstr(fileName, "svc_") != fileName)
+ {
+ char buffer[1024];
+ mir_snprintf(buffer, sizeof(buffer), "Please rename the plugin '%s' to 'svc_vi.dll' to enable service mode functionality.", fileName);
+ MessageBox(NULL, TranslateTS(buffer), Translate("Version Information"), MB_OK | MB_ICONEXCLAMATION);
+ }
+ }
+
+ //Menu item
+ //if (DBGetContactSettingByte(NULL, ModuleName, "MenuItem", TRUE)) {
+ {
+ LogToFile("creating menu item ...");
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ mi.position = mi.popupPosition = 2000089999;
+ mi.flags = 0;
+ mi.hIcon = hiVIIcon;
+ mi.pszName = Translate("Version Information");
+ mi.pszService = MS_VERSIONINFO_MENU_COMMAND;
+ CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+// mi.pszPopupName = "Version Information";
+// mi.popupPosition = 2;
+// mi.pszName = "Test 1";
+// CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
+ }
+ LogToFile("Check riched32.dll ...");
+ if (LoadLibrary("RichEd32.dll") == NULL) {
+ MessageBox(NULL, "d'oh", "d'oh", MB_OK);
+ }
+
+ //get miranda's malloc, realloc and free functions
+ LogToFile("Get miranda memory functions ...");
+ MM_INTERFACE mmInterface;
+ mmInterface.cbSize = sizeof(MM_INTERFACE);
+ CallService(MS_SYSTEM_GET_MMI, 0, (LPARAM) &mmInterface);
+ MirandaFree = mmInterface.mmi_free;
+ MirandaMalloc = mmInterface.mmi_malloc;
+ MirandaRealloc = mmInterface.mmi_realloc;
+
+ LogToFile("Leaving %s", __FUNCTION__);
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ LogToFile("Entering %s", __FUNCTION__);
+
+ LogToFile("Unhooking events ...");
+ UnhookEvents();
+
+ LogToFile("Destroying services ...");
+ DestroyServices();
+
+ LogToFile("Leaving %s", __FUNCTION__);
+ return 0;
+}
\ No newline at end of file diff --git a/plugins/VersionInfo/resource.h b/plugins/VersionInfo/resource.h new file mode 100644 index 0000000000..b282e8bca6 --- /dev/null +++ b/plugins/VersionInfo/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/VersionInfo/resource.rc b/plugins/VersionInfo/resource.rc new file mode 100644 index 0000000000..b4a8eb819a --- /dev/null +++ b/plugins/VersionInfo/resource.rc @@ -0,0 +1,225 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ASKDIALOG DIALOGEX 0, 0, 231, 146
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Output to:"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDC_ASK_OK,63,125,50,14
+ PUSHBUTTON "Cancel",IDC_ASK_CANCEL,117,125,50,14
+ CONTROL "Text file",IDC_ASK_TOFILE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,17,206,10
+ CONTROL "MessageBox()",IDC_ASK_TOMESSAGEBOX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,27,206,10
+ CONTROL "DialogBox",IDC_ASK_TODIALOGBOX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,37,206,10
+ CONTROL "OutputDebugString()",IDC_ASK_TOOUTPUTDEBUGSTRING,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,47,206,10
+ CONTROL "Clipboard",IDC_ASK_TOCLIPBOARD,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,57,206,10
+ GROUPBOX "Select output:",IDC_STATIC,7,7,217,72
+ CONTROL "Upload to site",IDC_ASK_TOUPLOAD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_TABSTOP,15,67,206,10
+ CONTROL "Forum style formatting",IDC_ASK_FORUMSTYLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,92,206,9
+ GROUPBOX "Aditional options:",IDC_STATIC,7,81,217,39
+ COMBOBOX IDC_ASK_QUOTECOMBOBOX,15,104,75,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_ASK_SIZECOMBOBOX,93,104,71,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_ASK_BOLDCOMBOBOX,167,104,54,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_ASKDIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 224
+ VERTGUIDE, 15
+ VERTGUIDE, 221
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 139
+ HORZGUIDE, 116
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Italian (Italy) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
+#ifdef _WIN32
+LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT_VERSIONINFO DIALOGEX 0, 0, 315, 222
+STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ PUSHBUTTON "Do it now",IDC_GETINFONOW,265,4,48,13
+ GROUPBOX "Output to:",IDC_STATIC,5,4,197,130
+ CONTROL "Text file",IDC_TOFILE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,16,186,10
+ EDITTEXT IDC_FILENAME,24,26,150,14,ES_AUTOHSCROLL
+ CONTROL "MessageBox()",IDC_TOMESSAGEBOX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,40,186,10
+ CONTROL "DialogBox",IDC_TODIALOGBOX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,51,186,10
+ CONTROL "Show window in taskbar",IDC_SHOWINTASKBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,62,177,10
+ CONTROL "OutputDebugString()",IDC_TODEBUGSTRING,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,73,186,10
+ CONTROL "Clipboard",IDC_TOCLIPBOARD,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,84,186,10
+ CONTROL "Upload to site",IDC_TOUPLOAD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_TABSTOP,12,95,186,10
+ CONTROL "Ask every time",IDC_ASKEVERYTIME,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,12,106,186,10
+ CONTROL "Also copy info to clipboard",IDC_CLIPBOARDALSO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,121,186,10
+ GROUPBOX "Upload site settings",IDC_STATIC,205,74,108,60
+ EDITTEXT IDC_UPLOAD_SERVER,209,83,71,14,ES_AUTOHSCROLL | WS_DISABLED
+ EDITTEXT IDC_UPLOAD_PORT,281,83,27,14,ES_AUTOHSCROLL | WS_DISABLED
+ LTEXT "Username",IDC_STATIC,209,103,42,8
+ EDITTEXT IDC_UPLOAD_USERNAME,253,99,55,14,ES_AUTOHSCROLL | WS_DISABLED
+ LTEXT "Password",IDC_STATIC,209,118,43,8
+ EDITTEXT IDC_UPLOAD_PASSWORD,253,115,55,14,ES_PASSWORD | ES_AUTOHSCROLL | WS_DISABLED
+ CONTROL "Forum style formatting",IDC_FORUMSTYLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,139,149,10
+ COMBOBOX IDC_QUOTECOMBOBOX,159,137,75,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_SIZECOMBOBOX,238,137,75,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Highlight version number using",IDC_BOLDVERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,153,216,10
+ COMBOBOX IDC_BOLDCOMBOBOX,252,153,61,37,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Show disabled plugins too",IDC_DISABLEDTOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,164,232,10
+ CONTROL "Attempt to find unloadable plugins (doesn't work on Windows 98)",IDC_CHECKUNLOADABLE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,174,272,10
+ CONTROL "Suppress header information",IDC_SUPPRESSHEADER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,184,274,10
+ CONTROL "Enable debug messages",IDC_DEBUG,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,220,207,93,10
+ CONTROL "Show plugin UUIDs",IDC_SHOWUUIDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,195,272,10
+ CONTROL "Show installed languages",IDC_SHOWINSTALLEDLANGUAGES,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,206,273,10
+END
+
+IDD_DIALOGINFO DIALOGEX 0, 0, 373, 217
+STYLE DS_LOCALEDIT | DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CONTROLPARENT
+CAPTION "Miranda Version Information"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ CONTROL "",IDC_TEXT,"RICHEDIT",TCS_HOTTRACK | TCS_FOCUSONBUTTONDOWN | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_TABSTOP,7,7,298,203
+ PUSHBUTTON "Close",IDC_CLOSE,316,7,50,14
+ PUSHBUTTON "&Copy text",IDC_COPYTEXT,316,26,50,14
+ PUSHBUTTON "Upload",IDC_UPLOAD,316,196,50,14,WS_DISABLED
+ PUSHBUTTON "&Save to file",IDC_SAVETOFILE,316,45,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_OPT_VERSIONINFO, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 313
+ VERTGUIDE, 12
+ VERTGUIDE, 198
+ VERTGUIDE, 202
+ VERTGUIDE, 205
+ VERTGUIDE, 304
+ VERTGUIDE, 308
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 217
+ HORZGUIDE, 149
+ END
+
+ IDD_DIALOGINFO, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 366
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 210
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_MAIN ICON "VersionInfo.ico"
+#endif // Italian (Italy) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/VersionInfo/sdk/m_folders.h b/plugins/VersionInfo/sdk/m_folders.h new file mode 100644 index 0000000000..5971cff81a --- /dev/null +++ b/plugins/VersionInfo/sdk/m_folders.h @@ -0,0 +1,284 @@ +/*
+Custom profile folders plugin for Miranda IM
+
+Copyright © 2005 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_CUSTOM_FOLDERS_H
+#define M_CUSTOM_FOLDERS_H
+
+#define FOLDERS_API 501 //dunno why it's here but it is :)
+
+#define PROFILE_PATH "%profile_path%"
+#define CURRENT_PROFILE "%current_profile%"
+#define MIRANDA_PATH "%miranda_path%"
+#define PLUGINS_PATH "%miranda_path%" "\\plugins"
+#define MIRANDA_USERDATA "%miranda_userdata%"
+
+#define TO_WIDE(x) L ## x
+
+#define PROFILE_PATHW L"%profile_path%"
+#define CURRENT_PROFILEW L"%current_profile%"
+#define MIRANDA_PATHW L"%miranda_path%"
+#define MIRANDA_USERDATAW L"%miranda_userdata%"
+
+#define FOLDER_AVATARS PROFILE_PATH "\\" CURRENT_PROFILE "\\avatars"
+#define FOLDER_VCARDS PROFILE_PATH "\\" CURRENT_PROFILE "\\vcards"
+#define FOLDER_LOGS PROFILE_PATH "\\" CURRENT_PROFILE "\\logs"
+#define FOLDER_RECEIVED_FILES PROFILE_PATH "\\" CURRENT_PROFILE "\\received files"
+#define FOLDER_DOCS MIRANDA_PATH "\\" "docs"
+
+#define FOLDER_CONFIG PLUGINS_PATH "\\" "config"
+
+#define FOLDER_SCRIPTS MIRANDA_PATH "\\" "scripts"
+
+#define FOLDER_UPDATES MIRANDA_PATH "\\" "updates"
+
+#define FOLDER_CUSTOMIZE MIRANDA_PATH "\\" "customize"
+#define FOLDER_CUSTOMIZE_SOUNDS FOLDER_CUSTOMIZE "\\sounds"
+#define FOLDER_CUSTOMIZE_ICONS FOLDER_CUSTOMIZE "\\icons"
+#define FOLDER_CUSTOMIZE_SMILEYS FOLDER_CUSTOMIZE "\\smileys"
+#define FOLDER_CUSTOMIZE_SKINS FOLDER_CUSTOMIZE "\\skins"
+#define FOLDER_CUSTOMIZE_THEMES FOLDER_CUSTOMIZE "\\themes"
+
+
+#define FOLDERS_NAME_MAX_SIZE 64 //maximum name and section size
+
+#define FF_UNICODE 0x00000001
+
+#if defined (UNICODE)
+ #define FF_TCHAR FF_UNICODE
+#else
+ #define FF_TCHAR 0
+#endif
+
+typedef struct{
+ int cbSize; //size of struct
+ char szSection[FOLDERS_NAME_MAX_SIZE]; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
+ char szName[FOLDERS_NAME_MAX_SIZE]; //entry name - will be shown in options
+ union{
+ const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
+ const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const TCHAR *szFormatT;
+ };
+ DWORD flags; //FF_* flags
+} FOLDERSDATA;
+
+/*Folders/Register/Path service
+ wParam - not used, must be 0
+ lParam - (LPARAM) (const FOLDERDATA *) - Data structure filled with
+ the necessary information.
+ Returns a handle to the registered path or 0 on error.
+ You need to use this to call the other services.
+*/
+#define MS_FOLDERS_REGISTER_PATH "Folders/Register/Path"
+
+/*Folders/Get/PathSize service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (int *) - pointer to the variable that receives the size of the path
+ string (not including the null character). Depending on the flags set when creating the path
+ it will either call strlen() or wcslen() to get the length of the string.
+ Returns the size of the buffer.
+*/
+#define MS_FOLDERS_GET_SIZE "Folders/Get/PathSize"
+
+typedef struct{
+ int cbSize;
+ int nMaxPathSize; //maximum size of buffer. This represents the number of characters that can be copied to it (so for unicode strings you don't send the number of bytes but the length of the string).
+ union{
+ char *szPath; //pointer to the buffer that receives the path without the last "\\"
+ wchar_t *szPathW; //unicode version of the buffer.
+ TCHAR *szPathT;
+ };
+} FOLDERSGETDATA;
+
+/*Folders/Get/Path service
+ wParam - (WPARAM) (int) - handle to registered path
+ lParam - (LPARAM) (FOLDERSGETDATA *) pointer to a FOLDERSGETDATA that has all the relevant fields filled.
+ Should return 0 on success, or nonzero otherwise.
+*/
+#define MS_FOLDERS_GET_PATH "Folders/Get/Path"
+
+typedef struct{
+ int cbSize;
+ union{
+ char **szPath; //address of a string variable (char *) or (wchar_t*) where the path should be stored (the last \ won't be copied).
+ wchar_t **szPathW; //unicode version of string.
+ TCHAR **szPathT;
+ };
+} FOLDERSGETALLOCDATA;
+
+/*Folders/GetRelativePath/Alloc service
+ wParam - (WPARAM) (int) - Handle to registered path
+ lParam - (LPARAM) (FOLDERSALLOCDATA *) data
+ This service is the same as MS_FOLDERS_GET_PATH with the difference that this service
+ allocates the needed space for the buffer. It uses miranda's memory functions for that and you need
+ to use those to free the resulting buffer.
+ Should return 0 on success, or nonzero otherwise. Currently it only returns 0.
+*/
+#define MS_FOLDERS_GET_PATH_ALLOC "Folders/Get/Path/Alloc"
+
+
+/*Folders/On/Path/Changed
+ wParam - (WPARAM) 0
+ lParam - (LPARAM) 0
+ Triggered when the folders change, you should reget the paths you registered.
+*/
+#define ME_FOLDERS_PATH_CHANGED "Folders/On/Path/Changed"
+
+#ifndef FOLDERS_NO_HELPER_FUNCTIONS
+
+#ifndef M_UTILS_H__
+#error The helper functions require that m_utils.h be included in the project. Please include that file if you want to use the helper functions. If you don''t want to use the functions just define FOLDERS_NO_HELPER_FUNCTIONS.
+#endif
+//#include "../../../include/newpluginapi.h"
+
+__inline static HANDLE FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath)
+{
+ FOLDERSDATA fd = {0};
+ if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0;
+ fd.cbSize = sizeof(FOLDERSDATA);
+ strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE);
+ fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0';
+ strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE);
+ fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0';
+ fd.szFormat = defaultPath;
+ return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
+}
+
+__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW)
+{
+ FOLDERSDATA fd = {0};
+ if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0;
+ fd.cbSize = sizeof(FOLDERSDATA);
+ strncpy(fd.szSection, section, FOLDERS_NAME_MAX_SIZE);
+ fd.szSection[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated
+ strncpy(fd.szName, name, FOLDERS_NAME_MAX_SIZE);
+ fd.szName[FOLDERS_NAME_MAX_SIZE - 1] = '\0'; //make sure it's NULL terminated
+ fd.szFormatW = defaultPathW;
+ fd.flags = FF_UNICODE;
+ return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
+}
+
+__inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, const char *notFound)
+{
+ FOLDERSGETDATA fgd = {0};
+ INT_PTR res;
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = size;
+ fgd.szPath = path;
+ res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ char buffer[MAX_PATH];
+ CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer);
+ mir_snprintf(path, size, "%s", buffer);
+ }
+
+ return res;
+}
+
+__inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int count, const wchar_t *notFoundW)
+{
+ FOLDERSGETDATA fgd = {0};
+ INT_PTR res;
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = count;
+ fgd.szPathW = pathW;
+ res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ wcsncpy(pathW, notFoundW, count);
+ pathW[count - 1] = '\0';
+ }
+
+ return res;
+}
+
+__inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, const int size, char *notFound, char *fileName)
+{
+ FOLDERSGETDATA fgd = {0};
+ INT_PTR res;
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = size;
+ fgd.szPath = path;
+ res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ char buffer[MAX_PATH];
+ CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer);
+ mir_snprintf(path, size, "%s", buffer);
+ }
+ if (strlen(path) > 0)
+ {
+ strcat(path, "\\");
+ }
+ else{
+ path[0] = '\0';
+ }
+
+ if (fileName)
+ {
+ strcat(path, fileName);
+ }
+
+ return res;
+}
+
+__inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pathW, const int count, wchar_t *notFoundW, wchar_t *fileNameW)
+{
+ FOLDERSGETDATA fgd = {0};
+ INT_PTR res;
+ fgd.cbSize = sizeof(FOLDERSGETDATA);
+ fgd.nMaxPathSize = count;
+ fgd.szPathW = pathW;
+ res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ if (res)
+ {
+ wcsncpy(pathW, notFoundW, count);
+ pathW[count - 1] = '\0';
+ }
+
+ if (wcslen(pathW) > 0)
+ {
+ wcscat(pathW, L"\\");
+ }
+ else{
+ pathW[0] = L'\0';
+ }
+
+ if (fileNameW)
+ {
+ wcscat(pathW, fileNameW);
+ }
+
+ return res;
+}
+
+# ifdef _UNICODE
+# define FoldersGetCustomPathT FoldersGetCustomPathW
+# define FoldersGetCustomPathExT FoldersGetCustomPathExW
+# define FoldersRegisterCustomPathT FoldersRegisterCustomPathW
+#else
+# define FoldersGetCustomPathT FoldersGetCustomPath
+# define FoldersGetCustomPathExT FoldersGetCustomPath
+# define FoldersRegisterCustomPathT FoldersRegisterCustomPath
+#endif
+
+#endif
+
+#endif //M_CUSTOM_FOLDERS_H
\ No newline at end of file diff --git a/plugins/VersionInfo/sdk/m_updater.h b/plugins/VersionInfo/sdk/m_updater.h new file mode 100644 index 0000000000..371b7437a0 --- /dev/null +++ b/plugins/VersionInfo/sdk/m_updater.h @@ -0,0 +1,146 @@ +#ifndef _M_UPDATER_H
+#define _M_UPDATER_H
+
+// NOTES:
+// - For langpack updates, include a string of the following format in the langpack text file:
+// ";FLID: <file listing name> <version>"
+// version must be four numbers seperated by '.', in the range 0-255 inclusive
+// - Updater will disable plugins that are downloaded but were not active prior to the update (this is so that, if an archive contains e.g. ansi and
+// unicode versions, the correct plugin will be the only one active after the new version is installed)...so if you add a support plugin, you may need
+// to install an ini file to make the plugin activate when miranda restarts after the update
+// - Updater will replace all dlls that have the same internal shortName as a downloaded update dll (this is so that msn1.dll and msn2.dll, for example,
+// will both be updated) - so if you have a unicode and a non-unicode version of a plugin in your archive, you should make the internal names different (which will break automatic
+// updates from the file listing if there is only one file listing entry for both versions, unless you use the 'MS_UPDATE_REGISTER' service below)
+// - Updater will install all files in the root of the archive into the plugins folder, except for langpack files that contain the FLID string which go into the root folder (same
+// folder as miranda32.exe)...all folders in the archive will also be copied to miranda's root folder, and their contents transferred into the new folders. The only exception is a
+// special folder called 'root_files' - if there is a folder by that name in the archive, it's contents will also be copied into miranda's root folder - this is intended to be used
+// to install additional dlls etc that a plugin may require)
+
+// if you set Update.szUpdateURL to the following value when registering, as well as setting your beta site and version data,
+// Updater will ignore szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's from the backend XML data.
+// for this to work, the plugin name in pluginInfo.shortName must match the file listing exactly (except for case)
+#define UPDATER_AUTOREGISTER "UpdaterAUTOREGISTER"
+// Updater will also use the backend xml data if you provide URL's that reference the miranda file listing for updates (so you can use that method
+// if e.g. your plugin shortName does not match the file listing) - it will grab the file listing id from the end of these URLs
+
+typedef struct Update_tag {
+ int cbSize;
+ char *szComponentName; // component name as it will appear in the UI (will be translated before displaying)
+
+ char *szVersionURL; // URL where the current version can be found (NULL to disable)
+ BYTE *pbVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ // (note that this URL could point at a binary file - dunno why, but it could :)
+ int cpbVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szUpdateURL; // URL where dll/zip is located
+ // set to UPDATER_AUTOREGISTER if you want Updater to find the file listing URLs (ensure plugin shortName matches file listing!)
+
+ char *szBetaVersionURL; // URL where the beta version can be found (NULL to disable betas)
+ BYTE *pbBetaVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ int cpbBetaVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szBetaUpdateURL; // URL where dll/zip is located
+
+ BYTE *pbVersion; // bytes of current version, used for comparison with those in VersionURL
+ int cpbVersion; // number of bytes pointed to by pbVersion
+
+ char *szBetaChangelogURL; // url for displaying changelog for beta versions
+} Update;
+
+// register a comonent with Updater
+//
+// wparam = 0
+// lparam = (LPARAM)&Update
+#define MS_UPDATE_REGISTER "Update/Register"
+
+// utility functions to create a version string from a DWORD or from pluginInfo
+// point buf at a buffer at least 16 chars wide - but note the version string returned may be shorter
+//
+__inline static char *CreateVersionString(DWORD version, char *buf) {
+ mir_snprintf(buf, 16, "%d.%d.%d.%d", (version >> 24) & 0xFF, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);
+ return buf;
+}
+
+__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) {
+ return CreateVersionString(pluginInfo->version, buf);
+}
+
+
+// register the 'easy' way - use this method if you have no beta URL and the plugin is on the miranda file listing
+// NOTE: the plugin version string on the file listing must be the string version of the version in pluginInfo (i.e. 0.0.0.1,
+// four numbers between 0 and 255 inclusivem, so no letters, brackets, etc.)
+//
+// wParam = (int)fileID - this is the file ID from the file listing (i.e. the number at the end of the download link)
+// lParam = (PLUGININFO*)&pluginInfo
+#define MS_UPDATE_REGISTERFL "Update/RegisterFL"
+
+// this function can be used to 'unregister' components - useful for plugins that register non-plugin/langpack components and
+// may need to change those components on the fly
+// lParam = (char *)szComponentName
+#define MS_UPDATE_UNREGISTER "Update/Unregister"
+
+// this event is fired when the startup process is complete, but NOT if a restart is imminent
+// it is designed for status managment plugins to use as a trigger for beggining their own startup process
+// wParam = lParam = 0 (unused)
+// (added in version 0.1.6.0)
+#define ME_UPDATE_STARTUPDONE "Update/StartupDone"
+
+// this service can be used to enable/disable Updater's global status control
+// it can be called from the StartupDone event handler
+// wParam = (BOOL)enable
+// lParam = 0
+// (added in version 0.1.6.0)
+#define MS_UPDATE_ENABLESTATUSCONTROL "Update/EnableStatusControl"
+
+// An description of usage of the above service and event:
+// Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler.
+// In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function,
+// say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service.
+// If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may
+// also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature.
+
+// this service can be used to determine whether updates are possible for a component with the given name
+// wParam = 0
+// lParam = (char *)szComponentName
+// returns TRUE if updates are supported, FALSE otherwise
+#define MS_UPDATE_ISUPDATESUPPORTED "Update/IsUpdateSupported"
+
+#endif
+
+
+/////////////// Usage Example ///////////////
+
+#ifdef EXAMPLE_CODE
+
+// you need to #include "m_updater.h" and HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded) in your Load function...
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
+
+ Update update = {0}; // for c you'd use memset or ZeroMemory...
+ char szVersion[16];
+
+ update.cbSize = sizeof(Update);
+
+ update.szComponentName = pluginInfo.shortName;
+ update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion);
+ update.cpbVersion = strlen((char *)update.pbVersion);
+
+ // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
+ // before the version that we use to locate it on the page
+ // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
+ // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
+ update.szUpdateURL = "http://scottellis.com.au:81/test/updater.zip";
+ update.szVersionURL = "http://scottellis.com.au:81/test/updater_test.html";
+ update.pbVersionPrefix = (BYTE *)"Updater version ";
+
+ update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
+
+ // do the same for the beta versions of the above struct members if you wish to allow beta updates from another URL
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+
+ // Alternatively, to register a plugin with e.g. file ID 2254 on the file listing...
+ // CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo);
+
+ return 0;
+}
+
+#endif
diff --git a/plugins/VersionInfo/services.cpp b/plugins/VersionInfo/services.cpp new file mode 100644 index 0000000000..3e137abf7c --- /dev/null +++ b/plugins/VersionInfo/services.cpp @@ -0,0 +1,80 @@ +/*
+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 "services.h"
+
+HANDLE hsMenuCommand;
+HANDLE hsGetInfo;
+HANDLE hsServiceMode;
+
+int bServiceMode = 0; //true only if plugin is running in service mode
+
+int InitServices()
+{
+ hsMenuCommand = CreateServiceFunction(MS_VERSIONINFO_MENU_COMMAND, PluginMenuCommand);
+ hsGetInfo = CreateServiceFunction(MS_VERSIONINFO_GETINFO, GetInfoService);
+ hsServiceMode = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeService);
+ return 0;
+}
+
+int DestroyServices()
+{
+ DestroyServiceFunction(hsMenuCommand);
+ DestroyServiceFunction(hsGetInfo);
+ DestroyServiceFunction(hsServiceMode);
+ return 0;
+}
+
+INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam)
+{
+ int debugTo = DBGetContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ DoDebugTo(debugTo);
+ if (verbose) PUShowMessage("I have printed the information.", SM_NOTIFY);
+/* char *data;
+ CallService(MS_VERSIONINFO_GETINFO, 1, (LPARAM) &data); */
+ return 0;
+}
+
+INT_PTR GetInfoService(WPARAM wParam, LPARAM lParam)
+{
+ int result = 1; //failure
+ if (lParam != NULL)
+ {
+ CVersionInfo myInfo;
+ myInfo.Initialize();
+ std::string VI = myInfo.GetInformationsAsString(wParam);
+ char **retData = (char **) lParam;
+ (*retData) = (char *) MirandaMalloc(VI.size() + 1);
+ if (retData)
+ {
+ strcpy(*retData, VI.c_str());
+ result = 0; //success
+ }
+ }
+ return result;
+}
+
+INT_PTR ServiceModeService(WPARAM wParam, LPARAM lParam)
+{
+ bServiceMode = 1;
+ DoDebugTo(TO_ASK);
+
+ return 0;
+}
diff --git a/plugins/VersionInfo/services.h b/plugins/VersionInfo/services.h new file mode 100644 index 0000000000..00bb262acd --- /dev/null +++ b/plugins/VersionInfo/services.h @@ -0,0 +1,33 @@ +/*
+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
+
+#include "common.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/VersionInfo/utils.cpp b/plugins/VersionInfo/utils.cpp new file mode 100644 index 0000000000..182ea441c1 --- /dev/null +++ b/plugins/VersionInfo/utils.cpp @@ -0,0 +1,606 @@ +/*
+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.
+*/
+
+//#define USE_LOG_FUNCTIONS
+
+#define STRICT
+#define WIN32_LEAN_AND_MEAN
+
+#include "utils.h"
+
+/*
+My usual MessageBoxes :-)
+*/
+void MB(char* message) {
+ if (verbose) MessageBox(NULL, message, ModuleName, MB_OK | MB_ICONEXCLAMATION);
+}
+
+void Log(char* message) {
+ if (ServiceExists(MS_POPUP_ADDPOPUP))
+ {
+ POPUPDATA pu = {0};
+ pu.lchIcon = hiVIIcon;
+ strncpy(pu.lptzContactName, Translate("Version Information"), MAX_CONTACTNAME);
+ strncpy(pu.lptzText, message, MAX_SECONDLINE);
+ PUAddPopUp(&pu);
+ }
+ else {
+ MessageBox(NULL, message, ModuleName, MB_OK | MB_ICONINFORMATION);
+ }
+}
+
+int SplitStringInfo(const char *szWholeText, char *szStartText, char *szEndText)
+{
+ const char *pos = strchr(szWholeText, '|');
+ if (pos)
+ {
+ size_t index = pos - szWholeText;
+ memmove(szStartText, szWholeText, index);
+ szStartText[index] = '\0';
+ StrTrim(szStartText, " ");
+ memmove(szEndText, pos + 1, strlen(pos)); //copies the \0 as well ... :)
+ StrTrim(szEndText, " ");
+ }
+ else{
+ szStartText[0] = szEndText[0] = '\0';
+ }
+ return 0;
+}
+
+int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size)
+{
+ DBVARIANT dbv = {0};
+ int res = 1;
+ size_t len;
+ dbv.type = DBVT_ASCIIZ;
+ if (DBGetContactSetting(NULL, ModuleName, szSettingName, &dbv) == 0)
+ {
+ res = 0;
+ size_t tmp = strlen(dbv.pszVal);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ strncpy(szResult, dbv.pszVal, len);
+ szResult[len] = '\0';
+ MirandaFree(dbv.pszVal);
+ }
+ else{
+ res = 1;
+ size_t tmp = strlen(szError);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ strncpy(szResult, szError, len);
+ szResult[len] = '\0';
+ }
+ return res;
+}
+
+char *RelativePathToAbsolute(char *szRelative, char *szAbsolute, size_t size)
+{
+ size_t len;
+
+ if (size < MAX_PATH)
+ {
+ char buffer[MAX_PATH]; //new path should be at least MAX_PATH chars
+ len = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) szRelative, (LPARAM) buffer);
+ strncpy(szAbsolute, buffer, size);
+ }
+ else{
+ len = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) szRelative, (LPARAM) szAbsolute);
+ }
+
+ return szAbsolute;
+}
+
+char *AbsolutePathToRelative(char *szAbsolute, char *szRelative, size_t size)
+{
+ size_t len;
+
+ if (size < MAX_PATH)
+ {
+ char buffer[MAX_PATH];
+ len = CallService(MS_UTILS_PATHTORELATIVE, (WPARAM) szAbsolute, (LPARAM) szRelative);
+ strncpy(szRelative, buffer, size);
+ }
+ else{
+ len = CallService(MS_UTILS_PATHTORELATIVE, (WPARAM) szAbsolute, (LPARAM) szRelative);
+ }
+
+ return szRelative;
+}
+
+void LogToFileInit()
+{
+#ifdef USE_LOG_FUNCTIONS
+ DeleteFile("versioninfo.log");
+#endif
+}
+
+void LogToFile(char *format, ...)
+{
+#ifdef USE_LOG_FUNCTIONS
+ char str[4096];
+ va_list vararg;
+ int tBytes;
+ FILE *fout = fopen("versioninfo.log", "at");
+ if (!fout)
+ {
+ Log("Can't open file versioninfo.log ...");
+ }
+ time_t currentTime = time(NULL);
+ tm *timp = localtime(¤tTime);
+ strftime(str, sizeof(str), "%d %b @ %H:%M:%S -> ", timp);
+ fputs(str, fout);
+
+ va_start(vararg, format);
+
+ tBytes = _vsnprintf(str, sizeof(str), format, vararg);
+ if (tBytes > 0)
+ {
+ str[tBytes] = 0;
+ }
+
+ va_end(vararg);
+ if (str[strlen(str) - 1] != '\n')
+ {
+ strcat(str, "\n");
+ }
+
+ fputs(str, fout);
+ fclose(fout);
+#endif
+}
+
+
+#define GetFacility(dwError) (HIWORD(dwError) && 0x0000111111111111)
+#define GetErrorCode(dwError) (LOWORD(dwError))
+
+void NotifyError(DWORD dwError, char* szSetting, int iLine) {
+ char str[1024];
+ mir_snprintf(str, sizeof(str), Translate("Ok, 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);
+}
+
+char *StrTrim(char *szText, const char *szTrimChars)
+{
+ size_t i = strlen(szText) - 1;
+ while ((i >= 0) && (strchr(szTrimChars, szText[i])))
+ {
+ szText[i--] = '\0';
+ }
+ i = 0;
+ while (((unsigned int )i < strlen(szText)) && (strchr(szTrimChars, szText[i])))
+ {
+ i++;
+ }
+ if (i)
+ {
+ size_t size = strlen(szText);
+ size_t j;
+ for (j = i; j <= size; j++) //shift the \0 as well
+ {
+ szText[j - i] = szText[j];
+ }
+// memmove(szText, szText + i, size - i + 1); //copy the string without the first i characters
+ }
+ return szText;
+}
+
+bool DoesDllExist(char *dllName)
+{
+ HMODULE dllHandle;
+ dllHandle = LoadLibraryEx(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ if (dllHandle)
+ {
+ FreeLibrary(dllHandle);
+ return true;
+ }
+ return false;
+}
+
+//========== From Cyreve ==========
+PLUGININFOEX *GetPluginInfo(const char *filename,HINSTANCE *hPlugin)
+{
+ char szMirandaPath[MAX_PATH],szPluginPath[MAX_PATH];
+ char *str2;
+ PLUGININFOEX *(*MirandaPluginInfo)(DWORD);
+ PLUGININFOEX *pPlugInfo;
+ HMODULE hLoadedModule;
+ DWORD mirandaVersion = CallService(MS_SYSTEM_GETVERSION,0,0);
+
+ GetModuleFileName(GetModuleHandle(NULL),szMirandaPath,sizeof(szMirandaPath));
+ str2=strrchr(szMirandaPath,'\\');
+ if(str2!=NULL) *str2=0;
+
+ hLoadedModule=GetModuleHandle(filename);
+ if(hLoadedModule!=NULL) {
+ *hPlugin=NULL;
+ MirandaPluginInfo=(PLUGININFOEX *(*)(DWORD))GetProcAddress(hLoadedModule,"MirandaPluginInfo");
+ return MirandaPluginInfo(mirandaVersion);
+ }
+ wsprintf(szPluginPath,"%s\\Plugins\\%s",szMirandaPath,filename);
+ *hPlugin=LoadLibrary(szPluginPath);
+ if(*hPlugin==NULL) return NULL;
+ MirandaPluginInfo=(PLUGININFOEX *(*)(DWORD))GetProcAddress(*hPlugin,"MirandaPluginInfo");
+ if(MirandaPluginInfo==NULL) {FreeLibrary(*hPlugin); *hPlugin=NULL; return NULL;}
+ pPlugInfo=MirandaPluginInfo(mirandaVersion);
+ if(pPlugInfo==NULL) {FreeLibrary(*hPlugin); *hPlugin=NULL; return NULL;}
+ if(pPlugInfo->cbSize!=sizeof(PLUGININFOEX)) {FreeLibrary(*hPlugin); *hPlugin=NULL; return NULL;}
+ return pPlugInfo;
+}
+
+//========== from Frank Cheng (wintime98) ==========
+// I've changed something to suit VersionInfo :-)
+#include <imagehlp.h>
+
+void TimeStampToSysTime(DWORD Unix,SYSTEMTIME* SysTime)
+{
+ SYSTEMTIME S;
+ DWORDLONG FileReal,UnixReal;
+ S.wYear=1970;
+ S.wMonth=1;
+ S.wDay=1;
+ S.wHour=0;
+ S.wMinute=0;
+ S.wSecond=0;
+ S.wMilliseconds=0;
+ SystemTimeToFileTime(&S,(FILETIME*)&FileReal);
+ UnixReal = Unix;
+ UnixReal*=10000000;
+ FileReal+=UnixReal;
+ FileTimeToSystemTime((FILETIME*)&FileReal,SysTime);
+}
+
+void GetModuleTimeStamp(char* pszDate, char* pszTime)
+{
+ char date[128],time[128],szModule[MAX_PATH];
+ HANDLE mapfile,file;
+ DWORD timestamp,filesize;
+ LPVOID mapmem;
+ SYSTEMTIME systime;
+ GetModuleFileName(NULL,szModule,MAX_PATH);
+ file = CreateFile(szModule,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+ filesize = GetFileSize(file,NULL);
+ mapfile = CreateFileMapping(file, NULL, PAGE_READONLY, 0, filesize, NULL);
+ mapmem = MapViewOfFile(mapfile, FILE_MAP_READ, 0, 0, 0);
+ timestamp = GetTimestampForLoadedLibrary((HINSTANCE)mapmem);
+ TimeStampToSysTime(timestamp,&systime);
+ GetTimeFormat(LOCALE_USER_DEFAULT,0,&systime,"HH':'mm':'ss",time,128);
+ GetDateFormat(EnglishLocale,0,&systime,"dd' 'MMMM' 'yyyy",date,128);
+ //MessageBox(NULL,date,time,0);
+ lstrcpy(pszTime, time);
+ lstrcpy(pszDate, date);
+ UnmapViewOfFile(mapmem);
+ CloseHandle(mapfile);
+ CloseHandle(file);
+}
+
+//From Egodust or Cyreve... I don't really know.
+PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *piSrc)
+{
+ PLUGININFOEX *pi;
+ if(piSrc==NULL) return NULL;
+ pi=(PLUGININFOEX *)malloc(sizeof(PLUGININFOEX));
+
+ *pi=*piSrc;
+ pi->uuid = UUID_NULL;
+
+ if (piSrc->cbSize >= sizeof(PLUGININFOEX))
+ {
+ pi->uuid = piSrc->uuid;
+ }
+
+ if (piSrc->cbSize >= sizeof(PLUGININFO))
+ {
+ 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(char *shellPath, size_t shSize)
+{
+ OSVERSIONINFO vi = {0};
+ vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&vi);
+
+ char szShell[1024] = {0};
+ DWORD size = sizeof(szShell);
+
+ if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ {
+ HKEY hKey;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\system.ini\\boot", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ RegQueryValueEx(hKey, "Shell", NULL, NULL, (LPBYTE) szShell, &size);
+ _strlwr(szShell);
+ HKEY hRootKey = (strstr(szShell, "sys:") == szShell) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ RegCloseKey(hKey);
+
+ strcpy(szShell, "<unknown>");
+ if (RegOpenKeyEx(hRootKey, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ size = sizeof(szShell);
+ RegQueryValueEx(hKey, "Shell", NULL, NULL, (LPBYTE) szShell, &size);
+ RegCloseKey(hKey);
+ }
+ }
+ }
+ else{
+ char szSystemIniPath[2048];
+ GetWindowsDirectory(szSystemIniPath, sizeof(szSystemIniPath));
+ size_t len = strlen(szSystemIniPath);
+ if (len > 0)
+ {
+ if (szSystemIniPath[len - 1] == '\\') { szSystemIniPath[--len] = '\0'; }
+ strcat(szSystemIniPath, "\\system.ini");
+ GetPrivateProfileString("boot", "shell", "<unknown>", szShell, size, szSystemIniPath);
+ }
+ }
+
+ char *pos = strrchr(szShell, '\\');
+ char *res = (pos) ? pos + 1 : szShell;
+ strncpy(shellPath, res, shSize);
+
+ return TRUE;
+}
+
+BOOL GetInternetExplorerVersion(char *ieVersion, size_t ieSize)
+{
+ HKEY hKey;
+ char ieVer[1024];
+ DWORD size = sizeof(ieVer);
+ char ieBuild[64] = {0};
+
+ strncpy(ieVer, "<not installed>", size);
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Internet Explorer", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ if (RegQueryValueEx(hKey, "Version", NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
+ {
+ char *pos = strchr(ieVer, '.');
+ if (pos)
+ {
+ pos = strchr(pos + 1, '.');
+ if (pos) { *pos = 0; }
+ strncpy(ieBuild, pos + 1, sizeof(ieBuild));
+ pos = strchr(ieBuild, '.');
+ if (pos) { *pos = 0; }
+ }
+ }
+ else{
+ size = sizeof(ieVer);
+ if (RegQueryValueEx(hKey, "Build", NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
+ {
+ char *pos = ieVer + 1;
+ strncpy(ieBuild, pos, sizeof(ieBuild));
+ *pos = 0;
+ pos = strchr(ieBuild, '.');
+ if (pos) { *pos = 0; }
+ }
+ else{
+ strncpy(ieVer, "<unknown version>", size);
+ }
+ }
+ RegCloseKey(hKey);
+ }
+
+ strncpy(ieVersion, ieVer, ieSize);
+ if (strlen(ieBuild) > 0)
+ {
+ strncat(ieVersion, ".", ieSize);
+ strncat(ieVersion, ieBuild, ieSize);
+ //strncat(ieVersion, ")", ieSize);
+ }
+
+ return TRUE;
+}
+
+
+char *GetLanguageName(LANGID language)
+{
+
+ LCID lc = MAKELCID(language, SORT_DEFAULT);
+
+ return GetLanguageName(lc);
+}
+
+extern char *GetLanguageName(LCID locale)
+{
+ static char name[1024];
+
+ GetLocaleInfo(locale, LOCALE_SENGLANGUAGE, name, sizeof(name));
+
+ return name;
+}
+
+BOOL UUIDToString(MUUID uuid, char *str, size_t len)
+{
+ if ((len < sizeof(MUUID)) || (!str))
+ {
+ return 0;
+ }
+
+ mir_snprintf(str, len, "{%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/VersionInfo/utils.h b/plugins/VersionInfo/utils.h new file mode 100644 index 0000000000..ef2b29ba59 --- /dev/null +++ b/plugins/VersionInfo/utils.h @@ -0,0 +1,54 @@ +#ifndef _M_VERSIONINFO_UTILS_H
+#define _M_VERSIONINFO_UTILS_H
+
+#include "common.h"
+
+//utils.cpp
+void MB(char*);
+void Log(char*);
+char *StrTrim(char *, const char *);
+
+//logging functions
+//utils.cpp
+void LogToFileInit();
+void LogToFile(char *format, ...);
+
+//utils.cpp
+char *RelativePathToAbsolute(char *szRelative, char *szAbsolute, size_t size);
+char *AbsolutePathToRelative(char *szAbsolute, char *szRelative, size_t size);
+
+//returns a string from the database and uses MirandaFree to deallocate the string, leaving only the local copy
+//utils.cpp
+int GetStringFromDatabase(char *szSettingName, char *szError, char *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 char *szWholeText, char *szStartText, char *szEndText);
+
+//utils.cpp
+bool DoesDllExist(char *dllName);
+
+//utils.cpp
+void GetModuleTimeStamp(char*, char*);
+void NotifyError(DWORD, char*, int);
+
+//utils.cpp
+PLUGININFOEX *GetPluginInfo(const char *,HINSTANCE *);
+PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *);
+void FreePluginInfo(PLUGININFOEX *);
+
+//utils.cpp
+
+BOOL IsCurrentUserLocalAdministrator();
+
+char *GetLanguageName(LANGID language);
+char *GetLanguageName(LCID locale);
+
+BOOL GetWindowsShell(char *shellPath, size_t shSize);
+BOOL GetInternetExplorerVersion(char *ieVersion, size_t ieSize);
+
+BOOL UUIDToString(MUUID uuid, char *str, size_t len);
+
+BOOL IsUUIDNull(MUUID uuid);
+
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/version.h b/plugins/VersionInfo/version.h new file mode 100644 index 0000000000..b5653f869f --- /dev/null +++ b/plugins/VersionInfo/version.h @@ -0,0 +1,49 @@ +/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2005 Luca Santarelli, © 2005-2008 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_VERSION_H
+#define M_VERSIONINFO_VERSION_H
+
+#define __MAJOR_VERSION 1
+#define __MINOR_VERSION 4
+#define __RELEASE_NUM 3
+#define __BUILD_NUM 4
+
+#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM)
+
+#define __PLUGINVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __PLUGINVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
+#define __STRINGIFY_(x) #x
+#define __STRINGIFY(x) __STRINGIFY_(x)
+#define __VERSION_STRING __STRINGIFY(__PLUGINVERSION_STRING_DOTS)
+
+#define __DESC "Collects and prints information related to Miranda, the plugins and the OS."
+#define __AUTHOR "Luca Santarelli, Cristian Libotean"
+#define __AUTHOREMAIL "hrk@users.sourceforge.net, eblis102@yahoo.com"
+#define __COPYRIGHT "© 2002-2005 Luca Santarelli, © 2005-2009 Cristian Libotean"
+#define __AUTHORWEB "http://www.miranda-im.org/"
+
+#if defined(WIN64) || defined(_WIN64)
+#define __PLUGIN_DISPLAY_NAME "Version Information (x64)"
+#else
+#define __PLUGIN_DISPLAY_NAME "Version Information"
+#endif
+
+#endif //M_VERSIONINFO_VERSION_H
diff --git a/plugins/VersionInfo/version.rc b/plugins/VersionInfo/version.rc new file mode 100644 index 0000000000..0f8fea03fc --- /dev/null +++ b/plugins/VersionInfo/version.rc @@ -0,0 +1,100 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+#include "version.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource1.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __PLUGINVERSION_STRING
+ PRODUCTVERSION __PLUGINVERSION_STRING
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Author", __AUTHOR
+ VALUE "FileDescription", __DESC
+ VALUE "FileVersion", __VERSION_STRING
+ VALUE "InternalName", __PLUGIN_DISPLAY_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
|