diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-16 20:35:50 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-07-16 20:35:50 +0000 |
commit | a089c8f17cca1cdf688e91be38ec315803168ed8 (patch) | |
tree | b05f66848c3715fd964ab3b810fa43de58175419 /plugins/VersionInfo | |
parent | a473ff2857a9ad01b05f2f43923dbfd8352ee52a (diff) |
Svc_dbepp is renamed to DbeditorPP
Svc_crshdmp is renamed to CrashDumper
Svc_vi is renamed to VersionInfo
git-svn-id: http://svn.miranda-ng.org/main/trunk@992 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/VersionInfo')
27 files changed, 4493 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..56dc3e994a --- /dev/null +++ b/plugins/VersionInfo/CPlugin.cpp @@ -0,0 +1,137 @@ +/*
+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;
+TCHAR PLUGIN_UUID_MARK[cPLUGIN_UUID_MARK];
+
+#define PLUGIN_UNCERTAIN_MARK "?"
+
+#define RJUST 70
+
+CPlugin::CPlugin() {
+ pluginID = UUID_NULL;
+}
+
+CPlugin::CPlugin(LPCTSTR eFileName, LPCTSTR eShortName, MUUID pluginID, LPCTSTR eUnicodeInfo, DWORD eVersion, LPCTSTR eTimestamp, LPCTSTR eLinkedModules) {
+ lpzFileName = eFileName;
+ lpzShortName = eShortName;
+ lpzUnicodeInfo = eUnicodeInfo;
+ lpzTimestamp = eTimestamp;
+ lpzLinkedModules = eLinkedModules;
+
+ TCHAR aux[128];
+ mir_sntprintf(aux, SIZEOF(aux), _T("%d.%d.%d.%d"), (eVersion>>24)&0xFF, (eVersion>>16)&0xFF, (eVersion>>8)&0xFF, (eVersion)&0xFF);
+ lpzVersion = aux;
+
+ this->pluginID = pluginID;
+};
+
+CPlugin::CPlugin(const CPlugin& other) {
+ lpzFileName = other.lpzFileName;
+ lpzShortName = other.lpzShortName;
+ lpzUnicodeInfo = other.lpzUnicodeInfo;
+ lpzVersion = other.lpzVersion;
+ lpzTimestamp = other.lpzTimestamp;
+ lpzLinkedModules = other.lpzLinkedModules;
+ pluginID = other.pluginID;
+}
+
+CPlugin::~CPlugin() {
+ //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(LPCTSTR error)
+{
+ lpzLinkedModules = error;
+}
+
+bool CPlugin::operator<(CPlugin &anotherPlugin)
+{
+ std::tstring anotherFileName = anotherPlugin.getFileName();
+
+ TCHAR szThis[MAX_PATH]; lstrcpy(szThis, lpzFileName.c_str());
+ TCHAR szThat[MAX_PATH]; lstrcpy(szThat, anotherFileName.c_str());
+
+ if (lstrcmpi(szThis, szThat) < 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+bool CPlugin::operator>(CPlugin &anotherPlugin)
+{
+ return !((*this) < anotherPlugin);
+}
+bool CPlugin::operator==(CPlugin &anotherPlugin)
+{
+ return !((*this) < anotherPlugin || (*this) > anotherPlugin);
+}
+
+std::tstring CPlugin::getFileName()
+{
+ return this->lpzFileName;
+}
+
+std::tstring CPlugin::getInformations(DWORD flags, TCHAR *szHighlightHeader, TCHAR *szHighlightFooter)
+{
+ std::tstring lpzInformations;
+ if (flags & VISF_SHOWUUID)
+ {
+ TCHAR aux[128];
+ UUIDToString(pluginID, aux, SIZEOF(aux));
+ lpzInformations = aux;
+ }
+ else lpzInformations = (IsUUIDNull(pluginID)) ? _T(" ") : PLUGIN_UUID_MARK;
+
+ lpzInformations += std::tstring(_T(" ") + lpzFileName + _T(" v.") + szHighlightHeader + lpzVersion + szHighlightFooter + _T(" [") + lpzTimestamp + _T("] - ") + lpzShortName);
+ if (lpzUnicodeInfo.size() > 0)
+ {
+ TCHAR *lwr = _tcslwr(_tcsdup(lpzShortName.c_str()));
+ if ( !_tcsstr(lwr, _T("unicode")) && !_tcsstr(lwr, _T("2in1")))
+ lpzInformations.append( _T(" |") + lpzUnicodeInfo + _T("|"));
+
+ free(lwr);
+ }
+ //lpzInformations.append("\t");
+ //lpzInformations.append(lpzPluginID);
+ lpzInformations.append( _T("\r\n"));
+
+ if (lpzLinkedModules.size() > 0)
+ {
+ lpzInformations.append(lpzLinkedModules);
+ lpzInformations.append( _T("\r\n"));
+ }
+// std::string lpzInformations = std::string(lpzFileName + " - " + lpzShortName + " [" + lpzTimestamp + " · " + lpzVersion +"]\r\n");
+ return lpzInformations;
+};
\ No newline at end of file diff --git a/plugins/VersionInfo/CPlugin.h b/plugins/VersionInfo/CPlugin.h new file mode 100644 index 0000000000..5da1b1dc6b --- /dev/null +++ b/plugins/VersionInfo/CPlugin.h @@ -0,0 +1,73 @@ +/*
+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 "newpluginapi.h"
+#endif
+
+#define DEF_UUID_CHARMARK "¤"
+
+extern const int cPLUGIN_UUID_MARK;
+extern TCHAR PLUGIN_UUID_MARK[];
+
+//using namespace std;
+
+
+ #define tstring wstring
+
+
+class CPlugin {
+ private:
+ std::tstring lpzFileName;
+ std::tstring lpzShortName;
+ std::tstring lpzVersion;
+ std::tstring lpzUnicodeInfo; //aditional info, Unicode aware ...
+ std::tstring lpzTimestamp; //to show the last modified timestamp
+ std::tstring lpzLinkedModules; //to show linked modules that aren't found
+ MUUID pluginID;
+
+ public:
+ CPlugin();
+ CPlugin(LPCTSTR fileName, LPCTSTR shortName, MUUID pluginID, LPCTSTR unicodeInfo, DWORD version, LPCTSTR timestamp, LPCTSTR linkedModules);
+ CPlugin(const CPlugin&);
+ ~CPlugin();
+ std::tstring getFileName();
+ std::tstring getInformations(DWORD, TCHAR *, TCHAR *);
+
+ void SetErrorMessage(LPCTSTR error);
+
+ //Operators
+ bool operator<(CPlugin&);
+ bool operator>(CPlugin&);
+ bool operator==(CPlugin&);
+};
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/CVersionInfo.cpp b/plugins/VersionInfo/CVersionInfo.cpp new file mode 100644 index 0000000000..d35c0c5c01 --- /dev/null +++ b/plugins/VersionInfo/CVersionInfo.cpp @@ -0,0 +1,1198 @@ +/*
+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"
+#include "resource.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(TCHAR *fileName, TCHAR *extension)
+{
+ TCHAR *dot = _tcschr(fileName, '.');
+ if ( dot != NULL && !lstrcmpi(dot + 1, extension))
+ if (dot[lstrlen(extension) + 1] == 0)
+ return 1;
+
+ return 0;
+}
+
+void FillLocalTime(std::tstring &output, FILETIME *fileTime)
+{
+ TIME_ZONE_INFORMATION tzInfo = {0};
+ FILETIME local = {0};
+ SYSTEMTIME sysTime;
+ TCHAR date[1024];
+ TCHAR time[256];
+
+ FileTimeToLocalFileTime(fileTime, &local);
+ FileTimeToSystemTime(&local, &sysTime);
+
+ GetDateFormat(EnglishLocale, 0, &sysTime, _T("dd' 'MMM' 'yyyy"), date, SIZEOF(date));
+ GetTimeFormat(NULL, TIME_FORCE24HOURFORMAT, &sysTime, _T("HH':'mm':'ss"), time, SIZEOF(time)); //americans love 24hour format ;)
+ output = std::tstring(date) + _T(" at ") + std::tstring(time);
+
+ int res = GetTimeZoneInformation(&tzInfo);
+ char tzName[32] = {0};
+ TCHAR tzOffset[64] = {0};
+ int offset = 0;
+ switch (res) {
+ case TIME_ZONE_ID_DAYLIGHT:
+ offset = -(tzInfo.Bias + tzInfo.DaylightBias);
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.DaylightName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ break;
+
+ case TIME_ZONE_ID_STANDARD:
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ offset = -(tzInfo.Bias + tzInfo.StandardBias);
+ break;
+
+ case TIME_ZONE_ID_UNKNOWN:
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ offset = -tzInfo.Bias;
+ break;
+ }
+
+ mir_sntprintf(tzOffset, SIZEOF(tzOffset), _T("UTC %+02d:%02d"), offset / 60, offset % 60);
+ output += _T(" (") + std::tstring(tzOffset) + _T(")");
+}
+
+CVersionInfo::CVersionInfo()
+{
+ luiFreeDiskSpace = 0;
+ bDEPEnabled = 0;
+}
+
+CVersionInfo::~CVersionInfo()
+{
+ listInactivePlugins.clear();
+ listActivePlugins.clear();
+ listUnloadablePlugins.clear();
+
+ lpzMirandaVersion.~basic_string();
+ lpzNightly.~basic_string();
+ lpzUnicodeBuild.~basic_string();
+ lpzBuildTime.~basic_string();
+ 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()
+{
+ //Miranda version
+ const BYTE str_size = 64;
+ char str[str_size];
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)str_size, (LPARAM)str);
+ this->lpzMirandaVersion = _A2T(str);
+ //Is it a nightly?
+ if (lpzMirandaVersion.find( _T("alpha"),0) != std::string::npos)
+ lpzNightly = _T("Yes");
+ else
+ lpzNightly = _T("No");
+
+ if (lpzMirandaVersion.find( _T("Unicode"), 0) != std::string::npos)
+ lpzUnicodeBuild = _T("Yes");
+ else
+ lpzUnicodeBuild = _T("No");
+
+ TCHAR time[128], date[128];
+ GetModuleTimeStamp(date, time);
+ lpzBuildTime = std::tstring(time) + _T(" (UTC) on ") + std::tstring(date);
+ return TRUE;
+}
+
+bool CVersionInfo::GetOSVersion()
+{
+ //Operating system informations
+ OSVERSIONINFO osvi = { 0 };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ //Now fill the private members.
+ TCHAR aux[256];
+ wsprintf(aux, _T("%d.%d.%d %s"), osvi.dwMajorVersion, osvi.dwMinorVersion, LOWORD(osvi.dwBuildNumber), osvi.szCSDVersion);
+ lpzOSVersion = aux;
+
+ //OSName
+ //Let's read the registry.
+ HKEY hKey;
+ TCHAR szKey[MAX_PATH], szValue[MAX_PATH];
+ lstrcpyn(szKey, _T("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, _T("Identifier"), MAX_PATH);
+ result = RegQueryValueEx(hKey, szValue, 0, &type, NULL, &size);
+ if (result == ERROR_SUCCESS) {
+ TCHAR *aux = new TCHAR[size+1];
+ result = RegQueryValueEx(hKey, szValue, 0, &type, (LPBYTE) aux, &size);
+ lpzCPUIdentifier = aux;
+ delete[] aux;
+ }
+ else {
+ NotifyError(GetLastError(), _T("RegQueryValueEx()"), __LINE__);
+ lpzCPUIdentifier = _T("<Error in RegQueryValueEx()>");
+ }
+
+ lstrcpyn(szValue, _T("ProcessorNameString"), MAX_PATH);
+ result = RegQueryValueEx(hKey, szValue, 0, &type, NULL, &size); //get the size
+ if (result == ERROR_SUCCESS) {
+ TCHAR *aux = new TCHAR[size+1];
+ result = RegQueryValueEx(hKey, szValue, 0, &type, (LPBYTE) aux, &size);
+ lpzCPUName = aux;
+ delete[] aux;
+ }
+ else { //else try to use cpuid instruction to get the proc name
+ char szName[50];
+ #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';
+ #else
+ szName[0] = 0;
+ #endif
+
+ if ( !szName[0] )
+ lpzCPUName = _T("<name N/A>");
+ else
+ lpzCPUName = _A2T(szName);
+ }
+ }
+
+ bDEPEnabled = IsProcessorFeaturePresent(PF_NX_ENABLED);
+
+ switch (osvi.dwPlatformId) {
+ case VER_PLATFORM_WIN32_WINDOWS:
+ lstrcpyn(szKey, _T("Software\\Microsoft\\Windows\\CurrentVersion"), MAX_PATH);
+ lstrcpyn(szValue, _T("Version"), MAX_PATH);
+ break;
+ case VER_PLATFORM_WIN32_NT:
+
+ lstrcpyn(szKey, _T("Software\\Microsoft\\Windows NT\\CurrentVersion"), MAX_PATH);
+ lstrcpyn(szValue, _T("ProductName"), MAX_PATH);
+ break;
+ }
+
+ 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.
+ TCHAR *aux = new TCHAR[size+1];
+ result = RegQueryValueEx((HKEY)hKey,szValue,(LPDWORD)NULL, (LPDWORD)&type,(LPBYTE)aux,(LPDWORD)&size);
+ lpzOSName = aux;
+ delete[] aux;
+ }
+ else {
+ NotifyError(GetLastError(), _T("RegQueryValueEx()"), __LINE__);
+ lpzOSName = _T("<Error in RegQueryValueEx()>");
+ }
+ }
+ else {
+ NotifyError(GetLastError(), _T("RegOpenKeyEx()"), __LINE__);
+ lpzOSName = _T("<Error in RegOpenKeyEx()>");
+ }
+
+ //Now we can improve it if we can.
+ switch (LOWORD(osvi.dwBuildNumber)) {
+ case 950: lpzOSName = _T("Microsoft Windows 95"); break;
+ case 1111: lpzOSName = _T("Microsoft Windows 95 OSR2"); break;
+ case 1998: lpzOSName = _T("Microsoft Windows 98"); break;
+ case 2222: lpzOSName = _T("Microsoft Windows 98 SE"); break;
+ case 3000: lpzOSName = _T("Microsoft Windows ME"); break; //Even if this is wrong, we have already read it in the registry.
+ case 1381: lpzOSName = _T("Microsoft Windows NT"); break; //What about service packs?
+ case 2195: lpzOSName = _T("Microsoft Windows 2000"); break; //What about service packs?
+ case 2600: lpzOSName = _T("Microsoft Windows XP"); break;
+ case 3790:
+ if ( GetSystemMetrics( 89 )) //R2 ?
+ lpzOSName = _T("Microsoft Windows 2003 R2");
+ else
+ lpzOSName = _T("Microsoft Windows 2003");
+
+ break; //added windows 2003 info
+ }
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetHWSettings() {
+ //Free space on Miranda Partition.
+ TCHAR szMirandaPath[MAX_PATH] = { 0 };
+ {
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
+ if ( str2 != NULL) *str2=0;
+ }
+ HMODULE hKernel32;
+ hKernel32 = LoadLibraryA("kernel32.dll");
+ if (hKernel32) {
+
+ MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExW");
+
+
+ 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;
+
+ TCHAR szInfo[1024];
+ GetWindowsShell(szInfo, SIZEOF(szInfo));
+ lpzShell = szInfo;
+ GetInternetExplorerVersion(szInfo, SIZEOF(szInfo));
+ lpzIEVersion = szInfo;
+
+
+ lpzAdministratorPrivileges = (IsCurrentUserLocalAdministrator()) ? _T("Yes") : _T("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};
+ ms.dwLength = sizeof(ms);
+ GlobalMemoryStatus(&ms);
+ luiRAM = (ms.dwTotalPhys/(1024*1024))+1; //Ugly hack!!!!
+ }
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetProfileSettings()
+{
+ TCHAR* tszProfileName = Utils_ReplaceVarsT(_T("%miranda_userdata%\\%miranda_profilename%.dat"));
+ lpzProfilePath = tszProfileName;
+
+ WIN32_FIND_DATA fd;
+ if ( FindFirstFile(tszProfileName, &fd) != INVALID_HANDLE_VALUE ) {
+ TCHAR number[40];
+ mir_sntprintf( number, SIZEOF(number), _T("%.2f KBytes"), double(fd.nFileSizeLow) / 1024 );
+ lpzProfileSize = number;
+
+ FillLocalTime(lpzProfileCreationDate, &fd.ftCreationTime);
+ }
+ else {
+ DWORD error = GetLastError();
+ TCHAR tmp[1024];
+ wsprintf(tmp, _T("%d"), error);
+ lpzProfileCreationDate = _T("<error ") + std::tstring(tmp) + _T(" at FileOpen>") + std::tstring(tszProfileName);
+ lpzProfileSize = _T("<error ") + std::tstring(tmp) + _T(" at FileOpen>") + std::tstring(tszProfileName);
+ }
+
+ mir_free( tszProfileName );
+ return true;
+}
+
+static TCHAR szSystemLocales[4096] = {0};
+static WORD systemLangID;
+#define US_LANG_ID 0x00000409
+
+BOOL CALLBACK EnumSystemLocalesProc(TCHAR *szLocale)
+{
+ DWORD locale = _ttoi(szLocale);
+ TCHAR *name = GetLanguageName(locale);
+ if ( !_tcsstr(szSystemLocales, name)) {
+ _tcscat(szSystemLocales, name);
+ _tcscat(szSystemLocales, _T(", "));
+ }
+
+ return TRUE;
+}
+
+BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam)
+{
+ if (!lpszName)
+ return FALSE;
+
+ if (wIDLanguage != US_LANG_ID)
+ systemLangID = wIDLanguage;
+
+ return TRUE;
+}
+
+bool CVersionInfo::GetOSLanguages()
+{
+ lpzOSLanguages = _T("(UI | Locale (User/System)) : ");
+
+ LANGID UILang;
+
+ OSVERSIONINFO os = {0};
+ os.dwOSVersionInfoSize = sizeof(os);
+ GetVersionEx(&os);
+ if (os.dwMajorVersion == 4) {
+ if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) { //Win NT
+ HMODULE hLib = LoadLibraryA("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;
+ TCHAR szLangID[128] = _T("0x");
+ DWORD size = SIZEOF(szLangID) - 2;
+ TCHAR err[512];
+
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop\\ResourceLocale"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey, _T(""), 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
+ _tscanf(szLangID, _T("%lx"), &systemLangID);
+ else {
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
+ MessageBox(0, err, _T("Error at RegQueryValueEx()"), MB_OK);
+ }
+ RegCloseKey(hKey);
+ }
+ else {
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
+ MessageBox(0, err, _T("Error at RegOpenKeyEx()"), MB_OK);
+ }
+ }
+
+ lpzOSLanguages += GetLanguageName(systemLangID);
+ }
+ else {
+ HMODULE hKernel32 = LoadLibraryA("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 += _T("/");
+ UILang = MyGetSystemDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
+ }
+ else lpzOSLanguages += _T("Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)");
+ }
+
+ lpzOSLanguages += _T(" | ");
+ lpzOSLanguages += GetLanguageName(LOCALE_USER_DEFAULT);
+ lpzOSLanguages += _T("/");
+ lpzOSLanguages += GetLanguageName(LOCALE_SYSTEM_DEFAULT);
+
+ if (DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", 0)) {
+ szSystemLocales[0] = '\0';
+ lpzOSLanguages += _T(" [");
+ EnumSystemLocales(EnumSystemLocalesProc, LCID_INSTALLED);
+ if (_tcslen(szSystemLocales) > 2)
+ szSystemLocales[ _tcslen(szSystemLocales) - 2] = '\0';
+
+ lpzOSLanguages += szSystemLocales;
+ lpzOSLanguages += _T("]");
+ }
+
+ return true;
+}
+
+int SaveInfo(const char *data, const char *lwrData, const char *search, TCHAR *dest, int size)
+{
+ const char *pos = strstr(lwrData, search);
+ int res = 1;
+ if (pos == lwrData) {
+ _tcsncpy(dest, _A2T(&data[strlen(search)]), size);
+ res = 0;
+ }
+
+ return res;
+}
+
+bool CVersionInfo::GetLangpackInfo()
+{
+ TCHAR langpackPath[MAX_PATH] = {0};
+ TCHAR search[MAX_PATH] = {0};
+
+ lpzLangpackModifiedDate = _T("");
+ GetModuleFileName(GetModuleHandle(NULL), langpackPath, SIZEOF(langpackPath));
+ TCHAR* p = _tcsrchr(langpackPath, '\\');
+ if (p) {
+ WIN32_FIND_DATA data = {0};
+ HANDLE hLangpack;
+
+ p[1] = '\0';
+ _tcscpy(search, langpackPath);
+ _tcscat(search, _T("langpack_*.txt"));
+ hLangpack = FindFirstFile(search, &data);
+ if (hLangpack != INVALID_HANDLE_VALUE) {
+ char buffer[1024];
+ char temp[1024];
+ FillLocalTime(lpzLangpackModifiedDate, &data.ftLastWriteTime);
+
+ TCHAR locale[128] = {0};
+ TCHAR language[128] = {0};
+ TCHAR version[128] = {0};
+ _tcscpy(version, _T("N/A"));
+
+ _tcsncpy(language, data.cFileName, SIZEOF(language));
+ p = _tcsrchr(language, '.');
+ p[0] = '\0';
+
+ _tcscat(langpackPath, data.cFileName);
+ FILE *fin = _tfopen(langpackPath, _T("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))) {
+ char* 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))
+ _tcsncpy(version, _A2T(&buffer[p - temp + 1]), SIZEOF(version));
+ else
+ _tcsncpy(version, _T("<unknown>"), SIZEOF(version));
+ } } } }
+
+ lpzLangpackInfo = std::tstring(language) + _T(" [") + std::tstring(locale) + _T("]");
+ if ( version[0] )
+ lpzLangpackInfo += _T(" v. ") + std::tstring(version);
+
+ fclose(fin);
+ }
+ else {
+ int err = GetLastError();
+ lpzLangpackInfo = _T("<error> Could not open file " + std::tstring(data.cFileName));
+ }
+ FindClose(hLangpack);
+ }
+ else lpzLangpackInfo = _T("No language pack installed");
+ }
+
+ return true;
+}
+
+std::tstring GetPluginTimestamp(FILETIME *fileTime)
+{
+ SYSTEMTIME sysTime;
+ FileTimeToSystemTime(fileTime, &sysTime); //convert the file tyme to system time
+
+ //char time[256];
+ TCHAR date[256]; //lovely
+ GetDateFormat(EnglishLocale, 0, &sysTime, _T("dd' 'MMM' 'yyyy"), date, SIZEOF(date));
+ return date;
+}
+
+bool CVersionInfo::GetPluginLists()
+{
+ HANDLE hFind;
+ TCHAR szMirandaPath[MAX_PATH] = { 0 }, szSearchPath[MAX_PATH] = { 0 }; //For search purpose
+ WIN32_FIND_DATA fd;
+ TCHAR szMirandaPluginsPath[MAX_PATH] = { 0 }, szPluginPath[MAX_PATH] = { 0 }; //For info reading purpose
+ BYTE PluginIsEnabled = 0;
+ HINSTANCE hInstPlugin = NULL;
+ PLUGININFOEX *(*MirandaPluginInfo)(DWORD); //These two are used to get informations from the plugin.
+ PLUGININFOEX *pluginInfo = NULL; //Read above.
+ DWORD mirandaVersion = 0;
+ BOOL asmCheckOK = FALSE;
+ DWORD loadError;
+ // SYSTEMTIME sysTime; //for timestamp
+
+ mirandaVersion=(DWORD)CallService(MS_SYSTEM_GETVERSION,0,0);
+ {
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
+ if(str2!=NULL) *str2=0;
+ }
+ lpzMirandaPath = szMirandaPath;
+
+ //We got Miranda path, now we'll use it for two different purposes.
+ //1) finding plugins.
+ //2) Reading plugin infos
+ lstrcpyn(szSearchPath,szMirandaPath, MAX_PATH); //We got the path, now we copy it into szSearchPath. We'll use szSearchPath as am auxiliary variable, while szMirandaPath will keep a "fixed" value.
+ lstrcat(szSearchPath, _T("\\Plugins\\*.dll"));
+
+ lstrcpyn(szMirandaPluginsPath, szMirandaPath, MAX_PATH);
+ lstrcat(szMirandaPluginsPath, _T("\\Plugins\\"));
+
+ hFind=FindFirstFile(szSearchPath,&fd);
+ if ( hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (verbose) PUShowMessageT(fd.cFileName, SM_NOTIFY);
+ if (!ValidExtension(fd.cFileName, _T("dll")))
+ continue; //do not report plugins that do not have extension .dll
+
+ hInstPlugin = GetModuleHandle(fd.cFileName); //try to get the handle of the module
+
+ if (hInstPlugin) //if we got it then the dll is loaded (enabled)
+ PluginIsEnabled = 1;
+ else {
+ PluginIsEnabled = 0;
+ lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
+ lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
+ hInstPlugin = LoadLibrary(szPluginPath);
+ }
+ if (!hInstPlugin) { //It wasn't loaded.
+ loadError = GetLastError();
+ int bUnknownError = 1; //assume plugin didn't load because of unknown error
+ //Some error messages.
+ //get the dlls the plugin statically links to
+ if (DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE))
+ {
+ std::tstring linkedModules;
+
+ lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
+ lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
+ if (GetLinkedModulesInfo(szPluginPath, linkedModules)) {
+ std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime);
+ CPlugin thePlugin(fd.cFileName, _T("<unknown>"), UUID_NULL, _T(""), 0, time.c_str(), linkedModules.c_str());
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ bUnknownError = 0; //we know why the plugin didn't load
+ }
+ }
+ if (bUnknownError) { //if cause is unknown then report it
+ std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime);
+ TCHAR buffer[4096];
+ TCHAR error[2048];
+ //DWORD_PTR arguments[2] = {loadError, 0};
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, loadError, 0, error, SIZEOF(error), NULL);
+ wsprintf(buffer, _T(" Error %ld - %s"), loadError, error);
+ CPlugin thePlugin( fd.cFileName, _T("<unknown>"), UUID_NULL, _T(""), 0, time.c_str(), buffer);
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ }
+ }
+ else { //It was successfully loaded.
+ MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfoEx");
+ if (!MirandaPluginInfo)
+ MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfo");
+
+ if (!MirandaPluginInfo) //There is no function: it's not a valid plugin. Let's move on to the next file.
+ continue;
+
+ //It's a valid plugin, since we could find MirandaPluginInfo
+ #if (!defined(WIN64) && !defined(_WIN64))
+ asmCheckOK = FALSE;
+ __asm {
+ push mirandaVersion
+ push mirandaVersion
+ call MirandaPluginInfo
+ pop eax
+ pop eax
+ cmp eax, mirandaVersion
+ jne a1
+ mov asmCheckOK, 0xffffffff
+ a1:
+ }
+ #else
+ asmCheckOK = TRUE;
+ #endif
+ if (asmCheckOK)
+ pluginInfo = CopyPluginInfo(MirandaPluginInfo(mirandaVersion));
+ else {
+ ZeroMemory(&pluginInfo, sizeof(pluginInfo));
+ MessageBox(NULL, fd.cFileName, _T("Invalid plugin"), MB_OK);
+ } }
+
+ //Let's get the info.
+ if (MirandaPluginInfo != NULL) {//a valid miranda plugin
+ if (pluginInfo != NULL) {
+ //We have loaded the informations into pluginInfo.
+ std::tstring timedate = GetPluginTimestamp(&fd.ftLastWriteTime);
+ CPlugin thePlugin(fd.cFileName, _A2T(pluginInfo->shortName), pluginInfo->uuid, (pluginInfo->flags & 1) ? _T("Unicode aware") : _T(""), (DWORD) pluginInfo->version, timedate.c_str(), _T(""));
+
+ if (PluginIsEnabled)
+ AddPlugin(thePlugin, listActivePlugins);
+ else {
+ if ((IsUUIDNull(pluginInfo->uuid)) && (mirandaVersion >= PLUGIN_MAKE_VERSION(0,8,0,9))) {
+ thePlugin.SetErrorMessage( _T(" 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) {
+ TCHAR szMsg[4096] = { 0 };
+ wsprintf(szMsg, _T("Done with: %s"), fd.cFileName);
+ PUShowMessageT(szMsg, SM_NOTIFY);
+ }
+ #endif
+ }
+ else { //pluginINFO == NULL
+ pluginInfo = CopyPluginInfo(MirandaPluginInfo(PLUGIN_MAKE_VERSION(9, 9, 9, 9))); //let's see if the plugin likes this miranda version
+ char *szShortName = "<unknown>";
+ std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime); //get the plugin timestamp;
+ DWORD version = 0;
+ if (pluginInfo) {
+ szShortName = pluginInfo->shortName;
+ version = pluginInfo->version;
+ }
+
+ CPlugin thePlugin(fd.cFileName, _A2T(szShortName), (pluginInfo) ? pluginInfo->uuid : UUID_NULL, (((pluginInfo) && (pluginInfo->flags & 1)) ? _T("Unicode aware") : _T("")), version, time.c_str(), _T(" Plugin refuses to load. Miranda version too old."));
+
+ AddPlugin(thePlugin, listUnloadablePlugins);
+ if (pluginInfo)
+ FreePluginInfo(pluginInfo);
+ } }
+ }
+ while (FindNextFile(hFind,&fd));
+ FindClose(hFind);
+ }
+ return TRUE;
+}
+
+bool CVersionInfo::AddPlugin(CPlugin &aPlugin, std::list<CPlugin> &aList) {
+ std::list<CPlugin>::iterator pos = aList.begin();
+ bool inserted = FALSE;
+
+ if (aList.begin() == aList.end()) { //It's empty
+ aList.push_back(aPlugin);
+ return TRUE;
+ }
+ else { //It's not empty
+ while (pos != aList.end()) {
+ //It can be either < or >, not equal.
+ if (aPlugin < (*pos)) {
+ aList.insert(pos, aPlugin);
+ return TRUE;
+ }
+
+ //It's greater: we need to insert it.
+ pos++;
+ } }
+
+ if (inserted == FALSE) {
+ aList.push_back(aPlugin);
+ return TRUE;
+ }
+ return TRUE;
+};
+
+static char *GetStringFromRVA(DWORD RVA, const LOADED_IMAGE *image)
+{
+ char *moduleName;
+ moduleName = (char *) ImageRvaToVa(image->FileHeader, image->MappedAddress, RVA, NULL);
+ return moduleName;
+}
+
+bool CVersionInfo::GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules)
+{
+ LOADED_IMAGE image;
+ ULONG importTableSize;
+ IMAGE_IMPORT_DESCRIPTOR *importData;
+ //HMODULE dllModule;
+ linkedModules = _T("");
+ bool result = false;
+ TCHAR szError[20];
+ char* szModuleName = mir_t2a(moduleName);
+ if (MapAndLoad(szModuleName, NULL, &image, TRUE, TRUE) == FALSE) {
+ wsprintf(szError, _T("%d"), GetLastError());
+ mir_free( szModuleName );
+ linkedModules = _T("<error ") + std::tstring(szError) + _T(" at MapAndLoad()>\r\n");
+ return result;
+ }
+ mir_free( szModuleName );
+ importData = (IMAGE_IMPORT_DESCRIPTOR *) ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &importTableSize);
+ if (!importData) {
+ wsprintf(szError, _T("%d"), GetLastError());
+ linkedModules = _T("<error ") + std::tstring(szError) + _T(" at ImageDirectoryEntryToDataEx()>\r\n");
+ }
+ else {
+ while (importData->Name) {
+ char *moduleName;
+ moduleName = GetStringFromRVA(importData->Name, &image);
+ if (!DoesDllExist(moduleName)) {
+ linkedModules.append( _T(" Plugin statically links to missing dll file: ") + std::tstring(_A2T(moduleName)) + _T("\r\n"));
+ result = true;
+ }
+
+ importData++; //go to next record
+ } }
+
+ // FreeLibrary(dllModule);
+ UnMapAndLoad(&image); //unload the image
+ return result;
+}
+
+std::tstring CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flags, int beautify) {
+ std::list<CPlugin>::iterator pos = aList.begin();
+ std::tstring out = _T("");
+#ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, begin.", SM_NOTIFY);
+#endif
+
+ TCHAR szHeader[32] = {0};
+ TCHAR szFooter[32] = {0};
+ if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE))) {
+ GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
+ }
+
+ while (pos != aList.end()) {
+ out.append(std::tstring((*pos).getInformations(flags, szHeader, szFooter)));
+ pos++;
+ }
+ #ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, end.", SM_NOTIFY);
+ #endif
+ return out;
+};
+
+void CVersionInfo::BeautifyReport(int beautify, LPCTSTR szBeautifyText, LPCTSTR szNonBeautifyText, std::tstring &out)
+{
+ if (beautify)
+ out.append(szBeautifyText);
+ else
+ out.append(szNonBeautifyText);
+}
+
+void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautify, std::tstring &out)
+{
+ if (forumStyle) { //forum style
+ TCHAR szSize[256], szQuote[256];
+
+ GetStringFromDatabase("SizeBegin", _T("[size=1]"), szSize, SIZEOF(szSize));
+ GetStringFromDatabase("QuoteBegin", _T("[quote]"), szQuote, SIZEOF(szQuote));
+ out.append(szQuote);
+ out.append(szSize);
+ }
+ else out = _T("");
+
+ if (!suppressHeader) {
+ out.append( _T("Miranda IM - VersionInformation plugin by Hrk, modified by Eblis\r\n"));
+ if (!forumStyle) {
+ out.append( _T("Miranda's homepage: http://www.miranda-im.org/\r\n")); //changed homepage
+ out.append( _T("Miranda tools: http://miranda-im.org/download/\r\n\r\n")); //was missing a / before download
+ } }
+
+ TCHAR buffer[1024]; //for beautification
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T(""), out);
+ GetStringFromDatabase("BeautifyBlockStart", _T("<blockquote>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T(""), out);
+ if (!suppressHeader) {
+ //Time of report:
+ TCHAR lpzTime[12]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm':'ss"), lpzTime, SIZEOF(lpzTime));
+ TCHAR lpzDate[32]; GetDateFormat(EnglishLocale, 0, NULL, _T("dd' 'MMMM' 'yyyy"), lpzDate, SIZEOF(lpzDate));
+ out.append( _T("Report generated at: ") + std::tstring(lpzTime) + _T(" on ") + std::tstring(lpzDate) + _T("\r\n\r\n"));
+ }
+
+ //Operating system
+ out.append(_T("CPU: ") + lpzCPUName + _T(" [") + lpzCPUIdentifier + _T("]"));
+ if (bDEPEnabled)
+ out.append(_T(" [DEP enabled]"));
+
+ if (luiProcessors > 1) {
+ TCHAR noProcs[128];
+ wsprintf(noProcs, _T(" [%d CPUs]"), luiProcessors);
+ out.append(noProcs);
+ }
+ out.append( _T("\r\n"));
+
+ //RAM
+ TCHAR szRAM[64]; wsprintf(szRAM, _T("%d"), luiRAM);
+ out.append( _T("Installed RAM: ") + std::tstring(szRAM) + _T(" MBytes\r\n"));
+
+ //operating system
+ out.append( _T("Operating System: ") + lpzOSName + _T(" [version: ") + lpzOSVersion + _T("]\r\n"));
+
+ //shell, IE, administrator
+ out.append( _T("Shell: ") + lpzShell + _T(", Internet Explorer ") + lpzIEVersion + _T("\r\n"));
+ out.append( _T("Administrator privileges: ") + lpzAdministratorPrivileges + _T("\r\n"));
+
+ //languages
+ out.append( _T("OS Languages: ") + lpzOSLanguages + _T("\r\n"));
+
+ //FreeDiskSpace
+ if (luiFreeDiskSpace) {
+ TCHAR szDiskSpace[64]; wsprintf(szDiskSpace, _T("%d"), luiFreeDiskSpace);
+ out.append( _T("Free disk space on Miranda partition: ") + std::tstring(szDiskSpace) + _T(" MBytes\r\n"));
+ }
+
+ //Miranda
+ out.append( _T("Miranda path: ") + lpzMirandaPath + _T("\r\n"));
+ out.append( _T("Miranda IM version: ") + lpzMirandaVersion);
+ if (bIsWOW64)
+ out.append( _T(" [running inside WOW64]"));
+ if (bServiceMode)
+ out.append( _T(" [service mode]"));
+
+ out.append( _T("\r\nBuild time: ") + lpzBuildTime + _T("\r\n"));
+ out.append( _T("Profile path: ") + lpzProfilePath + _T("\r\n"));
+ out.append( _T("Profile size: ") + lpzProfileSize + _T("\r\n"));
+ out.append( _T("Profile creation date: ") + lpzProfileCreationDate + _T("\r\n"));
+ out.append( _T("Language pack: ") + lpzLangpackInfo);
+ out.append((lpzLangpackModifiedDate.size() > 0) ? _T(", modified: ") + lpzLangpackModifiedDate : _T(""));
+ out.append( _T("\r\n"));
+
+ out.append( _T("Nightly: ") + lpzNightly + _T("\r\n"));
+ out.append( _T("Unicode core: ") + lpzUnicodeBuild);
+
+ GetStringFromDatabase("BeautifyBlockEnd", _T("</blockquote>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T("\r\n"), out);
+}
+
+void CVersionInfo::AddInfoFooter(int suppressFooter, int forumStyle, int beautify, std::tstring &out)
+{
+ //End of report
+ TCHAR buffer[1024]; //for beautification purposes
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
+ if (!suppressFooter) {
+ BeautifyReport(beautify, buffer, _T("\r\n"), out);
+ out.append( _T("\r\nEnd of report.\r\n"));
+ }
+
+ if (!forumStyle) {
+ if (!suppressFooter)
+ out.append( TranslateT("If you are going to use this report to submit a bug, remember to check the website for questions or help the developers may need.\r\nIf you don't check your bug report and give feedback, it will not be fixed!"));
+ }
+ else {
+ TCHAR szSize[256], szQuote[256];
+ GetStringFromDatabase("SizeEnd", _T("[/size]"), szSize, SIZEOF(szSize));
+ GetStringFromDatabase("QuoteEnd", _T("[/quote]"), szQuote, SIZEOF(szQuote));
+ out.append(szSize);
+ out.append(szQuote);
+ }
+}
+
+static void AddSectionAndCount(std::list<CPlugin> list, LPCTSTR listText, std::tstring &out)
+{
+ TCHAR tmp[64];
+ wsprintf(tmp, _T(" (%u)"), list.size());
+ out.append(listText);
+ out.append( tmp );
+ out.append( _T(":"));
+}
+
+std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
+ //Begin of report
+ std::tstring out;
+ int forumStyle = (bDisableForumStyle) ? 0 : 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);
+ TCHAR normalPluginsStart[1024]; //for beautification purposes, for normal plugins text (start)
+ TCHAR normalPluginsEnd[1024]; //for beautification purposes, for normal plugins text (end)
+ TCHAR horizLine[1024]; //for beautification purposes
+ TCHAR buffer[1024]; //for beautification purposes
+
+ TCHAR headerHighlightStart[10] = _T("");
+ TCHAR headerHighlightEnd[10] = _T("");
+ if (forumStyle) {
+ TCHAR start[128], end[128];
+ GetStringFromDatabase("BoldBegin", _T("[b]"), start, SIZEOF(start));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), end, SIZEOF(end));
+ _tcsncpy(headerHighlightStart, start, SIZEOF(headerHighlightStart));
+ _tcsncpy(headerHighlightEnd, end, SIZEOF(headerHighlightEnd));
+ }
+
+ //Plugins: list of active (enabled) plugins.
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), horizLine, SIZEOF(horizLine));
+ BeautifyReport(beautify, horizLine, _T("\r\n"), out);
+ GetStringFromDatabase("BeautifyActiveHeaderBegin", _T("<b><font size=\"-1\" color=\"DarkGreen\">"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listActivePlugins, _T("Active Plugins"), out);
+ GetStringFromDatabase("BeautifyActiveHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append( _T("\r\n"));
+
+ GetStringFromDatabase("BeautifyPluginsBegin", _T("<font size=\"-2\" color=\"black\">"), normalPluginsStart, SIZEOF(normalPluginsStart));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
+ out.append(GetListAsString(listActivePlugins, flags, beautify));
+ GetStringFromDatabase("BeautifyPluginsEnd", _T("</font>"), normalPluginsEnd, SIZEOF(normalPluginsEnd));
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ //Plugins: list of inactive (disabled) plugins.
+ if ((!forumStyle) && ((DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE)) || (bServiceMode))) {
+ BeautifyReport(beautify, horizLine, _T("\r\n"), out);
+ GetStringFromDatabase("BeautifyInactiveHeaderBegin", _T("<b><font size=\"-1\" color=\"DarkRed\">"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listInactivePlugins, _T("Inactive Plugins"), out);
+ GetStringFromDatabase("BeautifyInactiveHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append( _T("\r\n"));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
+ out.append(GetListAsString(listInactivePlugins, flags, beautify));
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ }
+ if (listUnloadablePlugins.size() > 0) {
+ BeautifyReport(beautify, horizLine, _T("\r\n"), out);
+ GetStringFromDatabase("BeautifyUnloadableHeaderBegin", _T("<b><font size=\"-1\"><font color=\"Red\">"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightStart, out);
+ AddSectionAndCount(listUnloadablePlugins, _T("Unloadable Plugins"), out);
+ GetStringFromDatabase("BeautifyUnloadableHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, headerHighlightEnd, out);
+ out.append( _T("\r\n"));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
+ out.append(GetListAsString(listUnloadablePlugins, flags, beautify));
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ }
+ AddInfoFooter(suppressHeader, forumStyle, beautify, out);
+ return out;
+}
+
+//========== Print functions =====
+
+void CVersionInfo::PrintInformationsToFile(const TCHAR *info)
+{
+ TCHAR buffer[MAX_PATH], outputFileName[MAX_PATH];
+ if (bFoldersAvailable) {
+ FoldersGetCustomPathT(hOutputLocation, buffer, SIZEOF(buffer), _T("%miranda_path%"));
+ _tcscat(buffer, _T("\\VersionInfo.txt"));
+ }
+ else GetStringFromDatabase("OutputFile", _T("VersionInfo.txt"), buffer, SIZEOF(buffer));
+
+ RelativePathToAbsolute(buffer, outputFileName, SIZEOF(buffer));
+
+ FILE *fp = _tfopen(outputFileName, _T("wb"));
+ if ( fp != NULL ) {
+ char* utf = mir_utf8encodeT( info );
+ fputs( "\xEF\xBB\xBF", fp);
+ fputs( utf, fp );
+ fclose(fp);
+
+ TCHAR mex[512];
+ mir_sntprintf(mex, SIZEOF(mex), TranslateT("Information successfully written to file: \"%s\"."), outputFileName);
+ Log(mex);
+ }
+ else {
+ TCHAR mex[512];
+ mir_sntprintf(mex, SIZEOF(mex), TranslateT("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
+ Log(mex);
+ }
+}
+
+void CVersionInfo::PrintInformationsToFile()
+{
+ PrintInformationsToFile( GetInformationsAsString().c_str());
+}
+
+void CVersionInfo::PrintInformationsToMessageBox()
+{
+ MessageBox(NULL, GetInformationsAsString().c_str(), _T("VersionInfo"), MB_OK);
+}
+
+void CVersionInfo::PrintInformationsToOutputDebugString()
+{
+ OutputDebugString( GetInformationsAsString().c_str());
+}
+
+
+void CVersionInfo::PrintInformationsToDialogBox()
+{
+ HWND DialogBox = CreateDialogParam(hInst,
+ MAKEINTRESOURCE(IDD_DIALOGINFO),
+ NULL, DialogBoxProc, (LPARAM) this);
+
+ SetDlgItemText(DialogBox, IDC_TEXT, GetInformationsAsString().c_str());
+}
+
+void CVersionInfo::PrintInformationsToClipboard(bool showLog)
+{
+ if (GetOpenClipboardWindow()) {
+ Log( TranslateT("The clipboard is not available, retry."));
+ return;
+ }
+
+ OpenClipboard(NULL);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ LPTSTR lptstrCopy;
+ std::tstring aux = GetInformationsAsString();
+ size_t length = aux.length() + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length*sizeof(TCHAR) + 5);
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ lstrcpy(lptstrCopy, aux.c_str());
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+
+ SetClipboardData(CF_UNICODETEXT, hData);
+
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ if (showLog)
+ Log( TranslateT("Information successfully copied into clipboard."));
+}
diff --git a/plugins/VersionInfo/CVersionInfo.h b/plugins/VersionInfo/CVersionInfo.h new file mode 100644 index 0000000000..eb55b808fc --- /dev/null +++ b/plugins/VersionInfo/CVersionInfo.h @@ -0,0 +1,115 @@ +/*
+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::tstring lpzMirandaVersion;
+ std::tstring lpzMirandaPath;
+ std::tstring lpzProfilePath;
+ std::tstring lpzProfileSize;
+ std::tstring lpzProfileCreationDate;
+ std::tstring lpzNightly;
+ std::tstring lpzUnicodeBuild;
+ std::tstring lpzCPUName;
+ std::tstring lpzCPUIdentifier;
+ std::tstring lpzBuildTime;
+ std::tstring lpzShell;
+ std::tstring lpzIEVersion;
+ std::tstring lpzAdministratorPrivileges;
+ std::tstring lpzOSLanguages;
+ std::tstring lpzLangpackInfo;
+ std::tstring lpzLangpackModifiedDate;
+ //Informations related to plugins
+ std::list<CPlugin> listActivePlugins;
+ std::list<CPlugin> listInactivePlugins;
+ std::list<CPlugin> listUnloadablePlugins;
+ //OS and hardware informations.
+ std::tstring lpzOSVersion;
+ std::tstring lpzOSName;
+ unsigned int luiProcessors;
+ unsigned int luiRAM;
+ unsigned int luiFreeDiskSpace;
+ int bDEPEnabled;
+ BOOL bIsWOW64;
+ //Additional Miranda informations.
+ unsigned int luiContacts;
+ unsigned int luiEvents;
+ unsigned int luiUnreadEvents;
+ unsigned int luiDBSize;
+ bool bExpertSettingsOn;
+ //Configuration
+
+ bool GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules);
+
+ public:
+ //Constructor/Destructor
+ CVersionInfo();
+ ~CVersionInfo();
+ void Initialize();
+ //Miranda informations
+ bool GetMirandaVersion();
+ bool GetProfileSettings();
+ bool GetOSLanguages();
+ bool GetLangpackInfo();
+ bool GetPluginLists();
+ bool GetEventCount(); //TODO
+ //OSInformations
+ bool GetOSVersion();
+ bool GetHWSettings();
+ //Plugins
+ bool AddPlugin(CPlugin&, std::list<CPlugin>&);
+ //Prints
+
+ void PrintInformationsToFile();
+ void PrintInformationsToFile(const TCHAR *info);
+ void PrintInformationsToDialogBox();
+ void PrintInformationsToMessageBox();
+ void PrintInformationsToOutputDebugString();
+ void PrintInformationsToClipboard(bool);
+
+ std::tstring GetListAsString(std::list<CPlugin>&, DWORD flags, int beautify);
+ std::tstring GetInformationsAsString(int bDisableForumStyle = 0);
+ void BeautifyReport(int, LPCTSTR, LPCTSTR, std::tstring &);
+ void AddInfoHeader(int, int, int, std::tstring &);
+ void AddInfoFooter(int, int, int, std::tstring &);
+};
+
+#endif
\ No newline at end of file diff --git a/plugins/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..89490b37fa --- /dev/null +++ b/plugins/VersionInfo/VersionInfo_10.vcxproj @@ -0,0 +1,210 @@ +<?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|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</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>Svc_vi</ProjectName>
+ <ProjectGuid>{3CE5572B-B7B0-4D1C-9D10-4622FBA6198E}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </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|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>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary>true</IgnoreImportLibrary>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <SubSystem>Windows</SubSystem>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <SubSystem>Windows</SubSystem>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <Optimization>Disabled</Optimization>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
+ <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ </ClCompile>
+ <Link>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <AdditionalDependencies>imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
+ <PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;VERSIONINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <WarningLevel>Level3</WarningLevel>
+ <StringPooling>true</StringPooling>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ </ClCompile>
+ <Link>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <AdditionalDependencies>imagehlp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <BaseAddress>0x25040000</BaseAddress>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="CPlugin.cpp" />
+ <ClCompile Include="CVersionInfo.cpp" />
+ <ClCompile Include="dlgHandlers.cpp" />
+ <ClCompile Include="hooked_events.cpp" />
+ <ClCompile Include="main.cpp">
+ <PrecompiledHeader>Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="services.cpp" />
+ <ClCompile Include="utils.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="common.h" />
+ <ClInclude Include="CPlugin.h" />
+ <ClInclude Include="CVersionInfo.h" />
+ <ClInclude Include="hooked_events.h" />
+ <ClInclude Include="utils.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..e0c4f5db2e --- /dev/null +++ b/plugins/VersionInfo/VersionInfo_10.vcxproj.filters @@ -0,0 +1,67 @@ +<?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>
+ <ClInclude Include="common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="utils.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..3182abc660 --- /dev/null +++ b/plugins/VersionInfo/common.h @@ -0,0 +1,96 @@ +/*
+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 "newpluginapi.h"
+#include "m_system.h"
+#include "m_langpack.h"
+#include "m_database.h"
+#include "m_skin.h"
+#include "m_clist.h"
+#include "m_options.h"
+#include "m_popup.h"
+
+#include "m_utils.h"
+#include "m_folders.h"
+#include "win2k.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 }};
+
+#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..a1a81e6a51 --- /dev/null +++ b/plugins/VersionInfo/dlgHandlers.cpp @@ -0,0 +1,589 @@ +/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+#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); //get the number of quote strings
+const int nSizeCount = SIZEOF(szSizeStrings); //get the number of size strings
+const int nBoldCount = SIZEOF(szBoldStrings); //get the number of bold strings
+
+#define MAX_TEXT 4096*4
+
+int AddInfoToComboboxes(HWND hWnd, int nQuotesComboBox, int nSizesComboBox, int nBoldComboBox)
+{
+ int i;
+ for (i = 0; i < nQuoteCount; i++)
+ SendDlgItemMessageA(hWnd, nQuotesComboBox, CB_ADDSTRING, 0, (LPARAM) szQuoteStrings[i]);
+
+ for (i = 0; i < nSizeCount; i++)
+ SendDlgItemMessageA(hWnd, nSizesComboBox, CB_ADDSTRING, 0, (LPARAM) szSizeStrings[i]);
+
+ for (i = 0; i < nBoldCount; i++)
+ SendDlgItemMessageA(hWnd, nBoldComboBox, CB_ADDSTRING, 0, (LPARAM) szBoldStrings[i]);
+
+ return 0;
+}
+
+void EnableAskComboboxes(HWND hWnd, int bEnable)
+{
+ EnableWindow(GetDlgItem(hWnd, IDC_ASK_BOLDCOMBOBOX), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_ASK_QUOTECOMBOBOX), bEnable);
+ EnableWindow(GetDlgItem(hWnd, IDC_ASK_SIZECOMBOBOX), bEnable);
+}
+
+INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ const int MAX_SIZE = 128;
+ static int oldFSFValue;
+ static TCHAR oldQuoteBegin[MAX_SIZE], oldQuoteEnd[MAX_SIZE];
+ static TCHAR oldSizeBegin[MAX_SIZE], oldSizeEnd[MAX_SIZE];
+ static TCHAR oldBoldBegin[MAX_SIZE], oldBoldEnd[MAX_SIZE];
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
+
+ TranslateDialogDefault(hWnd);
+
+ oldFSFValue = 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);
+ {
+ TCHAR buffer[1024];
+ GetStringFromDatabase("QuoteBegin", _T("[quote]"), oldQuoteBegin, MAX_SIZE);
+ GetStringFromDatabase("QuoteEnd", _T("[/quote]"), oldQuoteEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldQuoteBegin, oldQuoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", _T("[size=1]"), oldSizeBegin, MAX_SIZE);
+ GetStringFromDatabase("SizeEnd", _T("[/size]"), oldSizeEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldSizeBegin, oldSizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", _T("[b]"), oldBoldBegin, MAX_SIZE);
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), oldBoldEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldBoldBegin, oldBoldEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+ }
+
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ASK_FORUMSTYLE:
+ EnableAskComboboxes(hWnd, IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE));
+ break;
+
+ case IDC_ASK_CANCEL:
+ DestroyWindow(hWnd);
+ break;
+
+ case IDC_ASK_OK:
+ TCHAR quoteBegin[MAX_SIZE], quoteEnd[MAX_SIZE];
+ TCHAR sizeBegin[MAX_SIZE], sizeEnd[MAX_SIZE];
+ TCHAR boldBegin[MAX_SIZE], boldEnd[MAX_SIZE];
+ TCHAR buffer[1024];
+
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, quoteBegin, quoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, sizeBegin, sizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, boldBegin, boldEnd);
+
+ int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
+ if (newFSFValue != oldFSFValue)
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
+
+ if (newFSFValue) {
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", quoteBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", quoteEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", sizeBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", sizeEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", boldBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", boldEnd);
+ }
+
+ int debugTo = TO_DIALOGBOX; //just to be safe
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOFILE))
+ debugTo = TO_FILE;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOMESSAGEBOX))
+ debugTo = TO_MESSAGEBOX;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TODIALOGBOX))
+ debugTo = TO_DIALOGBOX;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOOUTPUTDEBUGSTRING))
+ debugTo = TO_DEBUGSTRING;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOCLIPBOARD))
+ debugTo = TO_CLIPBOARD;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOUPLOAD))
+ debugTo = TO_UPLOAD;
+
+ DoDebugTo(debugTo);
+
+ if (newFSFValue != oldFSFValue)
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", oldFSFValue);
+
+ if (newFSFValue) {
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
+ }
+
+ DestroyWindow(hWnd);
+ break;
+ }
+ break;
+ }
+ return 0;
+}
+
+int DoDebugTo(int debugTo)
+{
+ HWND parent = NULL;
+ HWND askDialog;
+ CVersionInfo myInfo;// = CVersionInfo();
+ if (verbose) PUShowMessage("I am going to read the information.", SM_NOTIFY);
+ if (debugTo != TO_ASK)
+ myInfo.Initialize();
+
+ if (verbose) PUShowMessage("I have read the information, I will now print them.", SM_NOTIFY);
+
+ switch(debugTo) {
+ case TO_ASK:
+ askDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ASKDIALOG), parent, AskDlgProc);
+ ShowWindow(askDialog, SW_SHOW);
+ break;
+
+ case TO_FILE:
+ myInfo.PrintInformationsToFile();
+ break;
+
+ case TO_MESSAGEBOX:
+ myInfo.PrintInformationsToMessageBox();
+ break;
+
+ case TO_DIALOGBOX:
+ myInfo.PrintInformationsToDialogBox();
+ break;
+
+ case TO_DEBUGSTRING:
+ myInfo.PrintInformationsToOutputDebugString();
+ break;
+
+ case TO_CLIPBOARD:
+ myInfo.PrintInformationsToClipboard(true);
+ break;
+
+ default:
+ myInfo.PrintInformationsToFile();
+ break;
+ }
+
+ if ((debugTo != TO_CLIPBOARD) && (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 };
+ bOptionsInitializing = 1;
+ TCHAR buffer[1024];
+ TCHAR notFound[1024];
+
+ if (DBGetContactSettingTString(NULL, ModuleName, "OutputFile", &dbv) == 0)
+ RelativePathToAbsolute(dbv.ptszVal, notFound, SIZEOF(notFound));
+ else
+ RelativePathToAbsolute( _T("VersionInfo.txt"), notFound, SIZEOF(notFound));
+
+ if (bFoldersAvailable)
+ _tcscpy(buffer, TranslateT("Customize using folders plugin"));
+ else
+ _tcsncpy(buffer, notFound, SIZEOF(notFound));
+
+ SetDlgItemText(hWnd, IDC_FILENAME, buffer);
+
+ TCHAR start[256], end[256];
+ GetStringFromDatabase("QuoteBegin", _T("[quote]"), start, SIZEOF(start));
+ GetStringFromDatabase("QuoteEnd", _T("[/quote]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", _T("[size=1]"), start, SIZEOF(start));
+ GetStringFromDatabase("SizeEnd", _T("[/size]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", _T("[b]"), start, SIZEOF(start));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+ //to add stuff
+
+ //upload server settings
+ GetStringFromDatabase("UploadServer", _T("vi.cass.cz"), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), buffer);
+
+ int port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
+ _itot(port, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
+
+ GetStringFromDatabase("UploadUser", _T(""), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), buffer);
+
+ GetStringFromDatabase("UploadPassword", _T(""), buffer, SIZEOF(buffer));
+ 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 = { 0 };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+ EnableWindow(GetDlgItem(hWnd, IDC_CHECKUNLOADABLE), FALSE);
+ }
+
+ CheckDlgButton(hWnd, IDC_DEBUG, (BOOL) verbose == TRUE ? BST_CHECKED : BST_UNCHECKED);
+
+ SetFocus(GetDlgItem(hWnd, IDC_GETINFONOW));
+
+ bOptionsInitializing = 0;
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_ASKEVERYTIME:
+ case IDC_TOFILE:
+ case IDC_TOMESSAGEBOX:
+ case IDC_TODIALOGBOX:
+ case IDC_TODEBUGSTRING:
+ case IDC_TOCLIPBOARD:
+ case IDC_TOUPLOAD:
+ case IDC_FORUMSTYLE:
+ case IDC_BOLDVERSION:
+ EnableWindow(GetDlgItem(hWnd, IDC_QUOTECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE); //both forum style and bold version checked
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!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,
+ TranslateT("Are you sure you want to enable this option ?\nPlease only enable this option if you really know what you're doing and what the option is for or if someone asked you to do it."),
+ TranslateT("Show plugin UUIDs ?"), MB_YESNO | MB_ICONWARNING) == IDNO)
+ {
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, FALSE);
+
+ break;
+ }//else fallthrough
+ case IDC_DISABLEDTOO:
+ case IDC_SHOWINTASKBAR:
+ case IDC_CLIPBOARDALSO:
+ case IDC_CHECKUNLOADABLE:
+ case IDC_SUPPRESSHEADER:
+ case IDC_SHOWINSTALLEDLANGUAGES:
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
+
+ case IDC_QUOTECOMBOBOX:
+ case IDC_SIZECOMBOBOX:
+ case IDC_BOLDCOMBOBOX:
+ if (!bOptionsInitializing)
+ SendMessage(GetParent(hWnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_FILENAME:
+ case IDC_UPLOAD_USERNAME:
+ case IDC_UPLOAD_PASSWORD:
+ case IDC_UPLOAD_PORT:
+ case IDC_UPLOAD_SERVER:
+ if ( HIWORD(wParam) == EN_CHANGE && !bOptionsInitializing) {
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
+ }
+ break;
+
+ case IDC_GETINFONOW:
+ //Call the plugin menu command routine.
+ PluginMenuCommand(0,0);
+ break;
+
+ case IDC_DEBUG:
+ verbose = !verbose;
+ break;
+ }
+
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
+ TCHAR buffer[1024];
+ TCHAR start[256], end[256];
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", end);
+ }
+
+ 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);
+
+ if (!bFoldersAvailable) {
+ TCHAR filePath[MAX_PATH], fileName[MAX_PATH];
+ GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
+ AbsolutePathToRelative(fileName, filePath, SIZEOF(filePath));
+
+ DBWriteContactSettingTString(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", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+ } }
+
+ 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 = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
+ SetWindowLongPtr(hWnd, GWL_EXSTYLE, ws | WS_EX_APPWINDOW);
+ //SetWindowLongPtr(hWnd, GWL_STYLE, ws | WS_DLGFRAME | WS_POPUPWINDOW);
+ }
+
+ TranslateDialogDefault(hWnd);
+ {
+ DBVARIANT dbv = { 0 };
+ LOGFONT lf = { 0 };
+
+ dbv.type = DBVT_BLOB;
+ if (DBGetContactSetting(NULL, "OptionFont", "Font", &dbv) == 0)
+ lf=*(LOGFONT*)dbv.pbVal;
+ else {
+ HFONT hFont = (HFONT)SendDlgItemMessage(hWnd,IDC_CLOSE,WM_GETFONT,0,0);
+ GetObject(hFont,sizeof(lf),&lf);
+ }
+ SendDlgItemMessage(hWnd,IDC_TEXT,WM_SETFONT,(WPARAM)CreateFontIndirect(&lf),0);
+ }
+
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case WM_COMMAND: {
+ switch(LOWORD(wParam)) {
+ case IDC_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case IDC_COPYTEXT:
+ SetLastError(0);
+ if (GetOpenClipboardWindow())
+ Log( TranslateT("The clipboard is not available, retry."));
+ else {
+ OpenClipboard(hWnd);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ TCHAR text[MAX_TEXT];
+ LPTSTR lptstrCopy;
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ int length = lstrlen(text) + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (length + 5)*sizeof( TCHAR ));
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ lstrcpyn(lptstrCopy, text, length);
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+
+ SetClipboardData(CF_UNICODETEXT, hData);
+
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ }
+
+ break;
+
+ case IDC_SAVETOFILE:
+ TCHAR text[MAX_TEXT];
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ myInfo->PrintInformationsToFile(text);
+ break;
+ }
+
+ break;
+ }
+ case WM_DESTROY:
+ DeleteObject((HFONT)SendDlgItemMessage(hWnd,IDC_TEXT,WM_GETFONT,0,0));
+ myInfo = NULL;
+ if (bServiceMode) //close miranda if in service mode
+ PostQuitMessage(0);
+
+ break;
+ }
+ return 0;
+}
diff --git a/plugins/VersionInfo/dlgHandlers.h b/plugins/VersionInfo/dlgHandlers.h new file mode 100644 index 0000000000..bab1876ea2 --- /dev/null +++ b/plugins/VersionInfo/dlgHandlers.h @@ -0,0 +1,43 @@ +/*
+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 "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/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/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..77d72e6a97 --- /dev/null +++ b/plugins/VersionInfo/hooked_events.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 "common.h"
+#include "hooked_events.h"
+
+HANDLE hModulesLoaded;
+HANDLE hOptionsInitialize;
+
+#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)
+{
+
+ bFoldersAvailable = ServiceExists(MS_FOLDERS_REGISTER_PATH);
+ hOutputLocation = FoldersRegisterCustomPathT("VersionInfo", "Output folder", _T("%miranda_path%"));
+
+ GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+ return 0;
+}
+
+static UINT uiExpertOnlyControls[] = { IDC_SHOWUUIDS, IDC_SHOWINSTALLEDLANGUAGES };
+
+int OnOptionsInitialise(WPARAM wParam, LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.cbSize = sizeof(odp);
+ odp.position = 100000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VERSIONINFO);
+ odp.pszTitle = LPGEN("Version Information");
+ odp.pszGroup = LPGEN("Services");
+ odp.groupPosition = 910000000;
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcOpts;
+ odp.expertOnlyControls = uiExpertOnlyControls;
+ odp.nExpertOnlyControls = SIZEOF(uiExpertOnlyControls);
+
+ Options_AddPage(wParam, &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..b75b5e59a8 --- /dev/null +++ b/plugins/VersionInfo/hooked_events.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_HOOKED_EVENTS_H
+#define M_VERSIONINFO_HOOKED_EVENTS_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/main.cpp b/plugins/VersionInfo/main.cpp new file mode 100644 index 0000000000..c244ba2db6 --- /dev/null +++ b/plugins/VersionInfo/main.cpp @@ -0,0 +1,135 @@ +/*
+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;
+
+int hLangpack;
+
+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,
+ UNICODE_AWARE,
+ // {2f174488-489c-4fe1-940d-596cf0f35e65}
+ {0x2f174488, 0x489c, 0x4fe1, {0x94, 0x0d, 0x59, 0x6c, 0xf0, 0xf3, 0x5e, 0x65}}
+};
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_VERSIONINFO, MIID_SERVICEMODE, MIID_LAST};
+
+bool WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ 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
+ return TRUE;
+}
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+extern "C" int __declspec(dllexport) Load(void)
+{
+
+ mir_getLP(&pluginInfo);
+
+ InitServices();
+ HookEvents();
+
+ hiVIIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
+
+ //get the name of the dll itself
+ TCHAR filePath[512] = {0};
+ GetModuleFileName(hInst, filePath, SIZEOF(filePath));
+ TCHAR *fileName = NULL;
+ size_t i = _tcslen(filePath) - 1;
+ _tcslwr(filePath);
+
+ //check that the name begins with svc_
+ while ((i > 0) && (filePath[i] != '\\')) { i--; }
+ if (i > 0)
+ {
+ filePath[i] = 0;
+ fileName = filePath + i + 1;
+
+ if (_tcsstr(fileName, _T("svc_")) != fileName)
+ {
+ TCHAR buffer[1024];
+ mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Please rename the plugin '%s' to 'svc_vi.dll' to enable service mode functionality."), fileName);
+ MessageBox(NULL, buffer, TranslateT("Version Information"), MB_OK | MB_ICONEXCLAMATION);
+ }
+ }
+
+ //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;
+ Menu_AddMainMenuItem(&mi);
+
+ if (LoadLibraryA("RichEd32.dll") == NULL)
+ MessageBoxA(NULL, "d'oh", "d'oh", MB_OK);
+
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ UnhookEvents();
+ DestroyServices();
+ 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/services.cpp b/plugins/VersionInfo/services.cpp new file mode 100644 index 0000000000..4efa482404 --- /dev/null +++ b/plugins/VersionInfo/services.cpp @@ -0,0 +1,76 @@ +/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "common.h"
+#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::tstring VI = myInfo.GetInformationsAsString(wParam);
+ char **retData = (char **) lParam;
+ *retData = mir_utf8encodeT( VI.c_str());
+ if (*retData)
+ result = 0; //success
+ }
+ return result;
+}
+
+INT_PTR ServiceModeService(WPARAM wParam, LPARAM lParam)
+{
+ bServiceMode = 1;
+ DoDebugTo(TO_ASK);
+ return 0;
+}
diff --git a/plugins/VersionInfo/services.h b/plugins/VersionInfo/services.h new file mode 100644 index 0000000000..38acbc7731 --- /dev/null +++ b/plugins/VersionInfo/services.h @@ -0,0 +1,31 @@ +/*
+Version information plugin for Miranda IM
+
+Copyright © 2002-2006 Luca Santarelli, Cristian Libotean
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef M_VERSIONINFO_SERVICES_H
+#define M_VERSIONINFO_SERVICES_H
+
+int InitServices();
+int DestroyServices();
+
+INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam);
+INT_PTR GetInfoService(WPARAM wParam, LPARAM lParam);
+INT_PTR ServiceModeService(WPARAM wParam, LPARAM lParam);
+
+#endif //M_VERSIONINFO_SERVICES_H
\ No newline at end of file diff --git a/plugins/VersionInfo/svc_vi-translation.txt b/plugins/VersionInfo/svc_vi-translation.txt new file mode 100644 index 0000000000..719f0beb2c --- /dev/null +++ b/plugins/VersionInfo/svc_vi-translation.txt @@ -0,0 +1,56 @@ +; Common strings that belong to many files
+;[The clipboard is not available, retry.]
+;[Version Information]
+
+; ../../plugins/Svc_vi/CVersionInfo.cpp
+;[Error during the creation of file \"%s\". Disk may be full or write protected.]
+;[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 copied into clipboard.]
+;[Information successfully written to file: \"%s\".]
+
+; ../../plugins/Svc_vi/dlgHandlers.cpp
+;[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.]
+;[Customize using folders plugin]
+;[Show plugin UUIDs ?]
+
+; ../../plugins/Svc_vi/hooked_events.cpp
+;[Services]
+
+; ../../plugins/Svc_vi/main.cpp
+;[Please rename the plugin '%s' to 'svc_vi.dll' to enable service mode functionality.]
+
+; ../../plugins/Svc_vi/resource.rc
+;[&Copy text]
+;[&Save to file]
+;[Aditional options:]
+;[Also copy info to clipboard]
+;[Ask every time]
+;[Attempt to find unloadable plugins (doesn't work on Windows 98)]
+;[Cancel]
+;[Clipboard]
+;[Close]
+;[DialogBox]
+;[Do it now]
+;[Enable debug messages]
+;[Forum style formatting]
+;[Highlight version number using]
+;[MessageBox()]
+;[Miranda Version Information]
+;[OK]
+;[Output to:]
+;[OutputDebugString()]
+;[Password]
+;[Select output:]
+;[Show disabled plugins too]
+;[Show installed languages]
+;[Show plugin UUIDs]
+;[Show window in taskbar]
+;[Suppress header information]
+;[Text file]
+;[Upload]
+;[Upload site settings]
+;[Upload to site]
+;[Username]
+
+; ../../plugins/Svc_vi/utils.cpp
+;[Ok, something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d]
diff --git a/plugins/VersionInfo/utils.cpp b/plugins/VersionInfo/utils.cpp new file mode 100644 index 0000000000..9be552c8cc --- /dev/null +++ b/plugins/VersionInfo/utils.cpp @@ -0,0 +1,526 @@ +/*
+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 "common.h"
+#include "utils.h"
+
+/*
+My usual MessageBoxes :-)
+*/
+void MB(const TCHAR* message)
+{
+ if (verbose) MessageBox(NULL, message, _T("VersionInfo"), MB_OK | MB_ICONEXCLAMATION);
+}
+
+void Log(const TCHAR* message)
+{
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ POPUPDATAT pu = {0};
+ pu.lchIcon = hiVIIcon;
+ _tcsncpy(pu.lptzContactName, TranslateT("Version Information"), MAX_CONTACTNAME);
+ _tcsncpy(pu.lptzText, message, MAX_SECONDLINE);
+ PUAddPopUpT(&pu);
+ }
+ else MessageBox(NULL, message, _T("VersionInfo"), MB_OK | MB_ICONINFORMATION);
+}
+
+int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText)
+{
+ const TCHAR *pos = _tcschr(szWholeText, '|');
+ if (pos) {
+ size_t index = pos - szWholeText;
+ lstrcpyn(szStartText, szWholeText, (int)index);
+ szStartText[index] = '\0';
+ StrTrim(szStartText, _T(" "));
+ lstrcpyn(szEndText, pos + 1, (int)_tcslen(pos)); //copies the \0 as well ... :)
+ StrTrim(szEndText, _T(" "));
+ }
+ else szStartText[0] = szEndText[0] = '\0';
+
+ return 0;
+}
+
+int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, size_t size)
+{
+ DBVARIANT dbv = {0};
+ int res = 1;
+ size_t len;
+ if ( DBGetContactSettingTString(NULL, ModuleName, szSettingName, &dbv) == 0) {
+ res = 0;
+ size_t tmp = _tcslen(dbv.ptszVal);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ _tcsncpy(szResult, dbv.ptszVal, len);
+ szResult[len] = '\0';
+ mir_free(dbv.ptszVal);
+ }
+ else {
+ res = 1;
+ size_t tmp = _tcslen(szError);
+ len = (tmp < size - 1) ? tmp : size - 1;
+ _tcsncpy(szResult, szError, len);
+ szResult[len] = '\0';
+ }
+ return res;
+}
+
+TCHAR *RelativePathToAbsolute(TCHAR *szRelative, TCHAR *szAbsolute, size_t size)
+{
+ if (size < MAX_PATH) {
+ TCHAR buffer[MAX_PATH]; //new path should be at least MAX_PATH chars
+ CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM) szRelative, (LPARAM) buffer);
+ _tcsncpy(szAbsolute, buffer, size);
+ }
+ else CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM) szRelative, (LPARAM) szAbsolute);
+
+ return szAbsolute;
+}
+
+TCHAR *AbsolutePathToRelative(TCHAR *szAbsolute, TCHAR *szRelative, size_t size)
+{
+ if (size < MAX_PATH) {
+ TCHAR buffer[MAX_PATH];
+ CallService(MS_UTILS_PATHTORELATIVET, (WPARAM) szAbsolute, (LPARAM) szRelative);
+ _tcsncpy(szRelative, buffer, size);
+ }
+ else CallService(MS_UTILS_PATHTORELATIVET, (WPARAM) szAbsolute, (LPARAM) szRelative);
+
+ return szRelative;
+}
+
+#define GetFacility(dwError) (HIWORD(dwError) && 0x0000111111111111)
+#define GetErrorCode(dwError) (LOWORD(dwError))
+
+void NotifyError(DWORD dwError, const TCHAR* szSetting, int iLine)
+{
+ TCHAR str[1024];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("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);
+}
+
+TCHAR *StrTrim(TCHAR *szText, const TCHAR *szTrimChars)
+{
+ size_t i = _tcslen(szText) - 1;
+ while (i >= 0 && _tcschr(szTrimChars, szText[i]))
+ szText[i--] = '\0';
+
+ i = 0;
+ while (((unsigned int )i < _tcslen(szText)) && _tcschr(szTrimChars, szText[i]))
+ i++;
+
+ if (i) {
+ size_t size = _tcslen(szText);
+ size_t j;
+ for (j = i; j <= size; j++) //shift the \0 as well
+ szText[j - i] = szText[j];
+ }
+ return szText;
+}
+
+bool DoesDllExist(char *dllName)
+{
+ HMODULE dllHandle;
+ dllHandle = LoadLibraryExA(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ if (dllHandle)
+ {
+ FreeLibrary(dllHandle);
+ return true;
+ }
+ return false;
+}
+
+//========== From Cyreve ==========
+PLUGININFOEX *GetPluginInfo(const TCHAR *filename,HINSTANCE *hPlugin)
+{
+ TCHAR szMirandaPath[MAX_PATH], szPluginPath[MAX_PATH];
+ PLUGININFOEX *(*MirandaPluginInfo)(DWORD);
+ PLUGININFOEX *pPlugInfo;
+ HMODULE hLoadedModule;
+ DWORD mirandaVersion = CallService(MS_SYSTEM_GETVERSION,0,0);
+
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(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, _T("%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(TCHAR* ptszDate, TCHAR* ptszTime)
+{
+ TCHAR tszModule[MAX_PATH];
+ HANDLE mapfile,file;
+ DWORD timestamp,filesize;
+ LPVOID mapmem;
+ SYSTEMTIME systime;
+ GetModuleFileName(NULL,tszModule,SIZEOF(tszModule));
+ file = CreateFile(tszModule,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, _T("HH':'mm':'ss"), ptszTime, 40 );
+ GetDateFormat(EnglishLocale, 0, &systime, _T("dd' 'MMMM' 'yyyy"), ptszDate, 40);
+ UnmapViewOfFile(mapmem);
+ CloseHandle(mapfile);
+ CloseHandle(file);
+}
+
+//From Egodust or Cyreve... I don't really know.
+PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *piSrc)
+{
+ if(piSrc==NULL)
+ return NULL;
+
+ PLUGININFOEX *pi = (PLUGININFOEX *)malloc(sizeof(PLUGININFOEX));
+ *pi = *piSrc;
+
+ if (piSrc->cbSize >= sizeof(PLUGININFOEX))
+ pi->uuid = piSrc->uuid;
+ else
+ pi->uuid = UUID_NULL;
+
+ if (pi->author) pi->author = _strdup(pi->author);
+ if (pi->authorEmail) pi->authorEmail = _strdup(pi->authorEmail);
+ if (pi->copyright) pi->copyright = _strdup(pi->copyright);
+ if (pi->description) pi->description = _strdup(pi->description);
+ if (pi->homepage) pi->homepage = _strdup(pi->homepage);
+ if (pi->shortName) pi->shortName = _strdup(pi->shortName);
+ return pi;
+}
+
+void FreePluginInfo(PLUGININFOEX *pi)
+{
+ if (pi->author) free(pi->author);
+ if (pi->authorEmail) free(pi->authorEmail);
+ if (pi->copyright) free(pi->copyright);
+ if (pi->description) free(pi->description);
+ if (pi->homepage) free(pi->homepage);
+ if (pi->shortName) free(pi->shortName);
+ free(pi);
+}
+
+BOOL IsCurrentUserLocalAdministrator(void)
+{
+ BOOL fReturn = FALSE;
+ DWORD dwStatus;
+ DWORD dwAccessMask;
+ DWORD dwAccessDesired;
+ DWORD dwACLSize;
+ DWORD dwStructureSize = sizeof(PRIVILEGE_SET);
+ PACL pACL = NULL;
+ PSID psidAdmin = NULL;
+
+ HANDLE hToken = NULL;
+ HANDLE hImpersonationToken = NULL;
+
+ PRIVILEGE_SET ps;
+ GENERIC_MAPPING GenericMapping;
+
+ PSECURITY_DESCRIPTOR psdAdmin = NULL;
+ SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
+
+ /*
+ Determine if the current thread is running as a user that is a member of
+ the local admins group. To do this, create a security descriptor that
+ has a DACL which has an ACE that allows only local aministrators access.
+ Then, call AccessCheck with the current thread's token and the security
+ descriptor. It will say whether the user could access an object if it
+ had that security descriptor. Note: you do not need to actually create
+ the object. Just checking access against the security descriptor alone
+ will be sufficient.
+ */
+ const DWORD ACCESS_READ = 1;
+ const DWORD ACCESS_WRITE = 2;
+
+
+ __try
+ {
+
+ /*
+ AccessCheck() requires an impersonation token. We first get a primary
+ token and then create a duplicate impersonation token. The
+ impersonation token is not actually assigned to the thread, but is
+ used in the call to AccessCheck. Thus, this function itself never
+ impersonates, but does use the identity of the thread. If the thread
+ was impersonating already, this function uses that impersonation context.
+ */
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken))
+ {
+ if (GetLastError() != ERROR_NO_TOKEN)
+ __leave;
+
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken))
+ __leave;
+ }
+
+ if (!DuplicateToken (hToken, SecurityImpersonation, &hImpersonationToken))
+ __leave;
+
+
+ /*
+ Create the binary representation of the well-known SID that
+ represents the local administrators group. Then create the security
+ descriptor and DACL with an ACE that allows only local admins access.
+ After that, perform the access check. This will determine whether
+ the current user is a local admin.
+ */
+ if (!AllocateAndInitializeSid(&SystemSidAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdmin))
+ __leave;
+
+ psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
+ if (psdAdmin == NULL)
+ __leave;
+
+ if (!InitializeSecurityDescriptor(psdAdmin, SECURITY_DESCRIPTOR_REVISION))
+ __leave;
+
+ // Compute size needed for the ACL.
+ dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidAdmin) - sizeof(DWORD);
+
+ pACL = (PACL)LocalAlloc(LPTR, dwACLSize);
+ if (pACL == NULL)
+ __leave;
+
+ if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2))
+ __leave;
+
+ dwAccessMask= ACCESS_READ | ACCESS_WRITE;
+
+ if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask, psidAdmin))
+ __leave;
+
+ if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE))
+ __leave;
+
+ /*
+ AccessCheck validates a security descriptor somewhat; set the group
+ and owner so that enough of the security descriptor is filled out to
+ make AccessCheck happy.
+ */
+ SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE);
+ SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE);
+
+ if (!IsValidSecurityDescriptor(psdAdmin))
+ __leave;
+
+ dwAccessDesired = ACCESS_READ;
+
+ /*
+ Initialize GenericMapping structure even though you
+ do not use generic rights.
+ */
+ GenericMapping.GenericRead = ACCESS_READ;
+ GenericMapping.GenericWrite = ACCESS_WRITE;
+ GenericMapping.GenericExecute = 0;
+ GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE;
+
+ if (!AccessCheck(psdAdmin, hImpersonationToken, dwAccessDesired, &GenericMapping, &ps, &dwStructureSize, &dwStatus, &fReturn))
+ {
+ fReturn = FALSE;
+ __leave;
+ }
+ }
+ __finally
+ {
+ // Clean up.
+ if (pACL) LocalFree(pACL);
+ if (psdAdmin) LocalFree(psdAdmin);
+ if (psidAdmin) FreeSid(psidAdmin);
+ if (hImpersonationToken) CloseHandle (hImpersonationToken);
+ if (hToken) CloseHandle (hToken);
+ }
+
+ return fReturn;
+}
+
+BOOL GetWindowsShell(TCHAR *shellPath, size_t shSize)
+{
+ OSVERSIONINFO vi = {0};
+ vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&vi);
+
+ TCHAR szShell[1024] = {0};
+ DWORD size = SIZEOF(szShell);
+
+ if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ {
+ HKEY hKey;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\system.ini\\boot"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ RegQueryValueEx(hKey, _T("Shell"), NULL, NULL, (LPBYTE) szShell, &size);
+ _tcslwr(szShell);
+ HKEY hRootKey = ( _tcsstr(szShell, _T("sys:")) == szShell) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ RegCloseKey(hKey);
+
+ _tcscpy(szShell, _T("<unknown>"));
+ if (RegOpenKeyEx(hRootKey, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ size = SIZEOF(szShell);
+ RegQueryValueEx(hKey, _T("Shell"), NULL, NULL, (LPBYTE) szShell, &size);
+ RegCloseKey(hKey);
+ }
+ }
+ }
+ else{
+ TCHAR szSystemIniPath[2048];
+ GetWindowsDirectory(szSystemIniPath, SIZEOF(szSystemIniPath));
+ size_t len = lstrlen(szSystemIniPath);
+ if (len > 0)
+ {
+ if (szSystemIniPath[len - 1] == '\\') { szSystemIniPath[--len] = '\0'; }
+ _tcscat(szSystemIniPath, _T("\\system.ini"));
+ GetPrivateProfileString( _T("boot"), _T("shell"), _T("<unknown>"), szShell, size, szSystemIniPath);
+ }
+ }
+
+ TCHAR *pos = _tcsrchr(szShell, '\\');
+ TCHAR *res = (pos) ? pos + 1 : szShell;
+ _tcsncpy(shellPath, res, shSize);
+
+ return TRUE;
+}
+
+BOOL GetInternetExplorerVersion(TCHAR *ieVersion, size_t ieSize)
+{
+ HKEY hKey;
+ TCHAR ieVer[1024];
+ DWORD size = SIZEOF(ieVer);
+ TCHAR ieBuild[64] = {0};
+
+ _tcsncpy(ieVer, _T("<not installed>"), size);
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ {
+ if (RegQueryValueEx(hKey, _T("Version"), NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
+ {
+ TCHAR *pos = _tcschr(ieVer, '.');
+ if (pos)
+ {
+ pos = _tcschr(pos + 1, '.');
+ if (pos) { *pos = 0; }
+ _tcsncpy(ieBuild, pos + 1, SIZEOF(ieBuild));
+ pos = _tcschr(ieBuild, '.');
+ if (pos) { *pos = 0; }
+ }
+ }
+ else{
+ size = SIZEOF(ieVer);
+ if (RegQueryValueEx(hKey, _T("Build"), NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
+ {
+ TCHAR *pos = ieVer + 1;
+ _tcsncpy(ieBuild, pos, SIZEOF(ieBuild));
+ *pos = 0;
+ pos = _tcschr(ieBuild, '.');
+ if (pos) { *pos = 0; }
+ }
+ else{
+ _tcsncpy(ieVer, _T("<unknown version>"), size);
+ }
+ }
+ RegCloseKey(hKey);
+ }
+
+ _tcsncpy(ieVersion, ieVer, ieSize);
+ if ( ieBuild[0] )
+ {
+ _tcsncat(ieVersion, _T("."), ieSize);
+ _tcsncat(ieVersion, ieBuild, ieSize);
+ }
+
+ return TRUE;
+}
+
+
+TCHAR *GetLanguageName(LANGID language)
+{
+ LCID lc = MAKELCID(language, SORT_DEFAULT);
+ return GetLanguageName(lc);
+}
+
+extern TCHAR *GetLanguageName(LCID locale)
+{
+ static TCHAR name[1024];
+ GetLocaleInfo(locale, LOCALE_SENGLANGUAGE, name, SIZEOF(name));
+ return name;
+}
+
+BOOL UUIDToString(MUUID uuid, TCHAR *str, size_t len)
+{
+ if ( len < sizeof(MUUID) || !str )
+ return 0;
+
+ mir_sntprintf(str, len, _T("{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"), uuid.a, uuid.b, uuid.c, uuid.d[0], uuid.d[1], uuid.d[2], uuid.d[3], uuid.d[4], uuid.d[5], uuid.d[6], uuid.d[7]);
+ return 1;
+}
+
+BOOL IsUUIDNull(MUUID uuid)
+{
+ int i;
+ for (i = 0; i < sizeof(uuid.d); i++)
+ {
+ if (uuid.d[i])
+ {
+ return 0;
+ }
+ }
+
+ return ((uuid.a == 0) && (uuid.b == 0) && (uuid.c == 0));
+}
\ No newline at end of file diff --git a/plugins/VersionInfo/utils.h b/plugins/VersionInfo/utils.h new file mode 100644 index 0000000000..5db4b1a811 --- /dev/null +++ b/plugins/VersionInfo/utils.h @@ -0,0 +1,49 @@ +#ifndef _M_VERSIONINFO_UTILS_H
+#define _M_VERSIONINFO_UTILS_H
+
+#include "common.h"
+
+//utils.cpp
+void MB(const TCHAR*);
+void Log(const TCHAR*);
+TCHAR *StrTrim(TCHAR *, const TCHAR *);
+
+//utils.cpp
+TCHAR *RelativePathToAbsolute(TCHAR *szRelative, TCHAR *szAbsolute, size_t size);
+TCHAR *AbsolutePathToRelative(TCHAR *szAbsolute, TCHAR *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, TCHAR *szError, TCHAR *szResult, size_t size);
+
+//a string of the form %s(start) | %s(end) is split into the two strings (start and end)
+//utils.cpp
+int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText);
+
+//utils.cpp
+bool DoesDllExist(char *dllName);
+
+//utils.cpp
+void GetModuleTimeStamp(TCHAR*, TCHAR*);
+void NotifyError(DWORD, const TCHAR*, int);
+
+//utils.cpp
+PLUGININFOEX *GetPluginInfo(const char *,HINSTANCE *);
+PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *);
+void FreePluginInfo(PLUGININFOEX *);
+
+//utils.cpp
+
+BOOL IsCurrentUserLocalAdministrator();
+
+TCHAR *GetLanguageName(LANGID language);
+TCHAR *GetLanguageName(LCID locale);
+
+BOOL GetWindowsShell(TCHAR *shellPath, size_t shSize);
+BOOL GetInternetExplorerVersion(TCHAR *ieVersion, size_t ieSize);
+
+BOOL UUIDToString(MUUID uuid, TCHAR *str, size_t len);
+
+BOOL IsUUIDNull(MUUID uuid);
+
+#endif
\ No newline at end of file diff --git a/plugins/VersionInfo/version.h b/plugins/VersionInfo/version.h new file mode 100644 index 0000000000..200ac05349 --- /dev/null +++ b/plugins/VersionInfo/version.h @@ -0,0 +1,44 @@ +/*
+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 5
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 2
+
+#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, George Hazan"
+#define __AUTHOREMAIL "hrk@users.sourceforge.net, eblis102@yahoo.com, ghazan@miranda.im"
+#define __COPYRIGHT "© 2002-2005 Luca Santarelli, © 2005-2009 Cristian Libotean"
+#define __AUTHORWEB "http://www.miranda-im.org/"
+#define __PLUGIN_DISPLAY_NAME "Version Information"
+
+#endif //M_VERSIONINFO_VERSION_H
diff --git a/plugins/VersionInfo/version.rc b/plugins/VersionInfo/version.rc new file mode 100644 index 0000000000..cd65db2ee3 --- /dev/null +++ b/plugins/VersionInfo/version.rc @@ -0,0 +1,104 @@ +// Microsoft Visual C++ generated resource script.
+//
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+#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
+
|