summaryrefslogtreecommitdiff
path: root/plugins/Svc_vi
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-05-26 14:47:04 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-05-26 14:47:04 +0000
commit1d9dd615e5f1a43d3b78f37b5aaae836dfac1c4d (patch)
treedd3dd64e8c60cccb072e5acae857c9c55203e86d /plugins/Svc_vi
parent32abe163ec316671ec5a0a3bbec68ec13f71cb92 (diff)
- plugin converted to Unicode
- old bug fixed with the profile path git-svn-id: http://svn.miranda-ng.org/main/trunk@182 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Svc_vi')
-rw-r--r--plugins/Svc_vi/CPlugin.cpp82
-rw-r--r--plugins/Svc_vi/CPlugin.h30
-rw-r--r--plugins/Svc_vi/CVersionInfo.cpp1187
-rw-r--r--plugins/Svc_vi/CVersionInfo.h52
-rw-r--r--plugins/Svc_vi/VersionInfo_10.vcxproj34
-rw-r--r--plugins/Svc_vi/VersionInfo_10.vcxproj.filters6
-rw-r--r--plugins/Svc_vi/common.h20
-rw-r--r--plugins/Svc_vi/dlgHandlers.cpp234
-rw-r--r--plugins/Svc_vi/dlgHandlers.h1
-rw-r--r--plugins/Svc_vi/hooked_events.cpp5
-rw-r--r--plugins/Svc_vi/hooked_events.h2
-rw-r--r--plugins/Svc_vi/main.cpp37
-rw-r--r--plugins/Svc_vi/services.cpp24
-rw-r--r--plugins/Svc_vi/services.h2
-rw-r--r--plugins/Svc_vi/utils.cpp269
-rw-r--r--plugins/Svc_vi/utils.h22
16 files changed, 910 insertions, 1097 deletions
diff --git a/plugins/Svc_vi/CPlugin.cpp b/plugins/Svc_vi/CPlugin.cpp
index 8d87457cf1..56dc3e994a 100644
--- a/plugins/Svc_vi/CPlugin.cpp
+++ b/plugins/Svc_vi/CPlugin.cpp
@@ -24,31 +24,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
const int cPLUGIN_UUID_MARK = 4;
-char PLUGIN_UUID_MARK[cPLUGIN_UUID_MARK];
+TCHAR PLUGIN_UUID_MARK[cPLUGIN_UUID_MARK];
#define PLUGIN_UNCERTAIN_MARK "?"
#define RJUST 70
CPlugin::CPlugin() {
- lpzFileName = "";
- lpzShortName = "";
- lpzVersion = "";
- lpzTimestamp = "";
- lpzLinkedModules = "";
pluginID = UUID_NULL;
-};
+}
-CPlugin::CPlugin(std::string eFileName, std::string eShortName, MUUID pluginID, std::string eUnicodeInfo, DWORD eVersion, std::string eTimestamp, std::string eLinkedModules) {
- lpzFileName = std::string(eFileName);
- lpzShortName = std::string(eShortName);
- lpzUnicodeInfo = std::string(eUnicodeInfo);
- lpzTimestamp = std::string(eTimestamp);
- lpzLinkedModules = std::string(eLinkedModules);
+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;
- char aux[128];
- wsprintf(aux,"%d.%d.%d.%d", (eVersion>>24)&0xFF, (eVersion>>16)&0xFF, (eVersion>>8)&0xFF, (eVersion)&0xFF);
- lpzVersion = std::string(aux);
+ 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;
};
@@ -76,16 +71,17 @@ CPlugin::~CPlugin() {
lpzLinkedModules.~basic_string();
}
-void CPlugin::SetErrorMessage(std::string error)
+void CPlugin::SetErrorMessage(LPCTSTR error)
{
lpzLinkedModules = error;
}
-bool CPlugin::operator<(CPlugin &anotherPlugin) {
- std::string anotherFileName = anotherPlugin.getFileName();
+bool CPlugin::operator<(CPlugin &anotherPlugin)
+{
+ std::tstring anotherFileName = anotherPlugin.getFileName();
- char szThis[MAX_PATH]; lstrcpy(szThis, lpzFileName.c_str());
- char szThat[MAX_PATH]; lstrcpy(szThat, anotherFileName.c_str());
+ 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;
@@ -93,50 +89,48 @@ bool CPlugin::operator<(CPlugin &anotherPlugin) {
return FALSE;
}
-bool CPlugin::operator>(CPlugin &anotherPlugin) {
+bool CPlugin::operator>(CPlugin &anotherPlugin)
+{
return !((*this) < anotherPlugin);
}
-bool CPlugin::operator==(CPlugin &anotherPlugin) {
+bool CPlugin::operator==(CPlugin &anotherPlugin)
+{
return !((*this) < anotherPlugin || (*this) > anotherPlugin);
}
-std::string CPlugin::getFileName() {
+std::tstring CPlugin::getFileName()
+{
return this->lpzFileName;
}
-std::string CPlugin::getInformations(DWORD flags, char *szHighlightHeader, char *szHighlightFooter) {
-// std::string lpzInformations = std::string(lpzFileName + "\t\t" + lpzVersion + "\r\n");
-// std::string lpzInformations = std::string(lpzFileName + " - " + lpzShortName + " [" + lpzTimestamp + "], version: " + lpzVersion +"\r\n");
-// std::string lpzInformations = std::string(lpzShortName + " [" + lpzFileName + " · " + lpzTimestamp + "] - version " + lpzVersion + "\r\n");
-// std::string lpzInformations = std::string(lpzFileName + " [" + lpzShortName + " · " + lpzTimestamp + "] - version: " + lpzVersion +"\r\n");
- std::string lpzInformations;
+std::tstring CPlugin::getInformations(DWORD flags, TCHAR *szHighlightHeader, TCHAR *szHighlightFooter)
+{
+ std::tstring lpzInformations;
if (flags & VISF_SHOWUUID)
{
- char aux[128];
- UUIDToString(pluginID, aux, sizeof(aux));
- lpzInformations = std::string(aux);
- }
- else{
- lpzInformations = (IsUUIDNull(pluginID)) ? " " : PLUGIN_UUID_MARK;
+ TCHAR aux[128];
+ UUIDToString(pluginID, aux, SIZEOF(aux));
+ lpzInformations = aux;
}
- lpzInformations += std::string(" " + lpzFileName + " v." + szHighlightHeader + lpzVersion + szHighlightFooter + " [" + lpzTimestamp + "] - " + lpzShortName);
+ 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)
{
- char *lwr = _strlwr(_strdup(lpzShortName.c_str()));
- if ((strstr(lwr, "unicode") == NULL) && (strstr(lwr, "2in1") == NULL))
- {
- lpzInformations.append(" |" + lpzUnicodeInfo + "|");
- }
+ 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("\r\n");
+ lpzInformations.append( _T("\r\n"));
if (lpzLinkedModules.size() > 0)
{
lpzInformations.append(lpzLinkedModules);
- lpzInformations.append("\r\n");
+ lpzInformations.append( _T("\r\n"));
}
// std::string lpzInformations = std::string(lpzFileName + " - " + lpzShortName + " [" + lpzTimestamp + " · " + lpzVersion +"]\r\n");
return lpzInformations;
diff --git a/plugins/Svc_vi/CPlugin.h b/plugins/Svc_vi/CPlugin.h
index 4eb1adc69a..46528b8511 100644
--- a/plugins/Svc_vi/CPlugin.h
+++ b/plugins/Svc_vi/CPlugin.h
@@ -31,35 +31,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <string>
#ifndef M_NEWPLUGINAPI_H__
-#include "../../include/newpluginapi.h"
+ #include "newpluginapi.h"
#endif
#define DEF_UUID_CHARMARK "¤"
extern const int cPLUGIN_UUID_MARK;
-extern char PLUGIN_UUID_MARK[];
+extern TCHAR PLUGIN_UUID_MARK[];
//using namespace std;
+#if defined( _UNICODE )
+ #define tstring wstring
+#else
+ #define tstring string
+#endif
+
class CPlugin {
private:
- std::string lpzFileName;
- std::string lpzShortName;
- std::string lpzVersion;
- std::string lpzUnicodeInfo; //aditional info, Unicode aware ...
- std::string lpzTimestamp; //to show the last modified timestamp
- std::string lpzLinkedModules; //to show linked modules that aren't found
+ 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(std::string fileName, std::string shortName, MUUID pluginID, std::string unicodeInfo, DWORD version, std::string timestamp, std::string linkedModules);
+ CPlugin(LPCTSTR fileName, LPCTSTR shortName, MUUID pluginID, LPCTSTR unicodeInfo, DWORD version, LPCTSTR timestamp, LPCTSTR linkedModules);
CPlugin(const CPlugin&);
~CPlugin();
- std::string getFileName();
- std::string getInformations(DWORD, char *, char *);
+ std::tstring getFileName();
+ std::tstring getInformations(DWORD, TCHAR *, TCHAR *);
- void SetErrorMessage(std::string error);
+ void SetErrorMessage(LPCTSTR error);
//Operators
bool operator<(CPlugin&);
diff --git a/plugins/Svc_vi/CVersionInfo.cpp b/plugins/Svc_vi/CVersionInfo.cpp
index 43087c3837..b68c5c1832 100644
--- a/plugins/Svc_vi/CVersionInfo.cpp
+++ b/plugins/Svc_vi/CVersionInfo.cpp
@@ -34,12 +34,12 @@ BOOL (WINAPI *MyGlobalMemoryStatusEx)(LPMEMORYSTATUSEX lpBuffer) = NULL;
LANGID (WINAPI *MyGetUserDefaultUILanguage)() = NULL;
LANGID (WINAPI *MyGetSystemDefaultUILanguage)() = NULL;
-static int ValidExtension(char *fileName, char *extension)
+static int ValidExtension(TCHAR *fileName, TCHAR *extension)
{
- char *dot = strrchr(fileName, '.');
- if ((dot != NULL) && (lstrcmpiA(dot + 1, extension) == 0))
+ TCHAR *dot = _tcschr(fileName, '.');
+ if ((dot != NULL) && (lstrcmpi(dot + 1, extension) == 0))
{
- if (dot[strlen(extension) + 1] == 0)
+ if (dot[lstrlen(extension) + 1] == 0)
{
return 1;
}
@@ -94,54 +94,53 @@ int IsPluginDisabled(char *fileName)
}
*/
-void FillLocalTime(std::string &output, FILETIME *fileTime)
+void FillLocalTime(std::tstring &output, FILETIME *fileTime)
{
TIME_ZONE_INFORMATION tzInfo = {0};
FILETIME local = {0};
SYSTEMTIME sysTime;
- char date[1024];
- char time[256];
-
- FileTimeToLocalFileTime(fileTime, &local);
- FileTimeToSystemTime(&local, &sysTime);
+ 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);
- GetDateFormat(EnglishLocale, 0, &sysTime, "dd' 'MMM' 'yyyy", date, sizeof(date));
- GetTimeFormat(NULL, TIME_FORCE24HOURFORMAT, &sysTime, "HH':'mm':'ss", time, sizeof(time)); //americans love 24hour format ;)
- output = std::string(date) + " at " + std::string(time);
-
int res = GetTimeZoneInformation(&tzInfo);
char tzName[32] = {0};
- char tzOffset[64] = {0};
+ TCHAR tzOffset[64] = {0};
int offset = 0;
- switch (res)
- {
- case TIME_ZONE_ID_DAYLIGHT:
+ switch (res) {
+ case TIME_ZONE_ID_DAYLIGHT:
{
offset = -(tzInfo.Bias + tzInfo.DaylightBias);
- WideCharToMultiByte(CP_ACP, 0, tzInfo.DaylightName, -1, tzName, sizeof(tzName), NULL, NULL);
-
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.DaylightName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+
break;
}
-
- case TIME_ZONE_ID_STANDARD:
+
+ case TIME_ZONE_ID_STANDARD:
{
- WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, sizeof(tzName), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
offset = -(tzInfo.Bias + tzInfo.StandardBias);
-
+
break;
}
-
- case TIME_ZONE_ID_UNKNOWN:
+
+ case TIME_ZONE_ID_UNKNOWN:
{
- WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, sizeof(tzName), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
offset = -tzInfo.Bias;
-
+
break;
}
}
-
- sprintf(tzOffset, "UTC %+02d:%02d", offset / 60, offset % 60);
- output += " (" /*+ std::string(tzName) + ", " */ + std::string(tzOffset) + ")";
+
+ wsprintf(tzOffset, _T("UTC %+02d:%02d"), offset / 60, offset % 60);
+ output += _T(" (") + std::tstring(tzOffset) + _T(")");
}
CVersionInfo::CVersionInfo() {
@@ -202,179 +201,145 @@ void CVersionInfo::Initialize() {
#endif
}
-bool CVersionInfo::GetMirandaVersion() {
+bool CVersionInfo::GetMirandaVersion()
+{
+ //Miranda version
const BYTE str_size = 64;
char str[str_size];
- //Miranda version
-
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)str_size, (LPARAM)(char*)str);
- this->lpzMirandaVersion = std::string(str);
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)str_size, (LPARAM)str);
+ this->lpzMirandaVersion = _A2T(str);
//Is it a nightly?
- if (lpzMirandaVersion.find("alpha",0) != std::string::npos)
- lpzNightly = "Yes";
+ if (lpzMirandaVersion.find( _T("alpha"),0) != std::string::npos)
+ lpzNightly = _T("Yes");
else
- lpzNightly = "No";
- if (lpzMirandaVersion.find("Unicode", 0) != std::string::npos)
- {
- lpzUnicodeBuild = "Yes";
- }
- else{
- lpzUnicodeBuild = "No";
- }
- char time[128], date[128];
+ 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::string(time) + " on " + std::string(date);
+ lpzBuildTime = std::tstring(time) + _T(" on ") + std::tstring(date);
return TRUE;
}
-bool CVersionInfo::GetOSVersion() {
+bool CVersionInfo::GetOSVersion()
+{
//Operating system informations
- OSVERSIONINFO osvi;
- ZeroMemory(&osvi, sizeof(osvi));
+ OSVERSIONINFO osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(osvi);
GetVersionEx(&osvi);
+
//Now fill the private members.
- char aux[256];
- wsprintf(aux, "%d.%d.%d %s", osvi.dwMajorVersion, osvi.dwMinorVersion, LOWORD(osvi.dwBuildNumber), osvi.szCSDVersion);
- lpzOSVersion = std::string(aux);
+ 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;
- char szKey[MAX_PATH], szValue[MAX_PATH];
+ 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(), "RegQueryValueEx()", __LINE__);
+ lpzCPUIdentifier = _T("<Error in RegQueryValueEx()>");
+ }
- lstrcpyn(szKey, "Hardware\\Description\\System\\CentralProcessor\\0", MAX_PATH);
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
- {
- DWORD type, size, result;
+ lstrcpyn(szValue, _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';
+ #endif
- lstrcpyn(szValue, "Identifier", MAX_PATH);
- result = RegQueryValueEx(hKey, szValue, 0, &type, NULL, &size);
- if (result == ERROR_SUCCESS)
- {
- char *aux = (char *) malloc(size);
- result = RegQueryValueEx(hKey, szValue, 0, &type, (LPBYTE) aux, &size);
- lpzCPUIdentifier = std::string(aux);
- free(aux);
- }
- else{
- NotifyError(GetLastError(), "RegQueryValueEx()", __LINE__);
- lpzCPUIdentifier = "<Error in RegQueryValueEx()>";
- }
- lstrcpyn(szValue, "ProcessorNameString", MAX_PATH);
- result = RegQueryValueEx(hKey, szValue, 0, &type, NULL, &size); //get the size
- if (result == ERROR_SUCCESS)
- {
-// MessageBox(0, "ProcessorNameString available in the registry", "Info", 0);
- char *aux = (char *) malloc(size);
- result = RegQueryValueEx(hKey, szValue, 0, &type, (LPBYTE) aux, &size);
- lpzCPUName = std::string(aux);
- free(aux);
- }
- else{ //else try to use cpuid instruction to get the proc name
- char szName[49] = "<cpuid extension N/A>";
- #if (!defined(WIN64) && !defined(_WIN64))
- __asm
- {
- push eax //save the registers
- push ebx
- push ecx
- push edx
-
- xor eax, eax //get simple name
- cpuid
- mov DWORD PTR szName[0], ebx
- mov DWORD PTR szName[4], edx
- mov DWORD PTR szName[8], ecx
- mov DWORD PTR szName[12], 0
-
- mov eax, 0x80000000 //try to get pretty name
- cpuid
-
- cmp eax, 0x80000004
- jb end //if we don't have the extension end the check
-
- mov DWORD PTR szName[0], 0 //make the string null
-
- mov eax, 0x80000002 //first part of the string
- cpuid
- mov DWORD PTR szName[0], eax
- mov DWORD PTR szName[4], ebx
- mov DWORD PTR szName[8], ecx
- mov DWORD PTR szName[12], edx
-
- mov eax, 0x80000003 //second part of the string
- cpuid
- mov DWORD PTR szName[16], eax
- mov DWORD PTR szName[20], ebx
- mov DWORD PTR szName[24], ecx
- mov DWORD PTR szName[28], edx
-
- mov eax, 0x80000004 //third part of the string
- cpuid
- mov DWORD PTR szName[32], eax
- mov DWORD PTR szName[36], ebx
- mov DWORD PTR szName[40], ecx
- mov DWORD PTR szName[44], edx
-
- end:
- pop edx //load them back
- pop ecx
- pop ebx
- pop eax
- }
- szName[sizeof(szName) - 1] = '\0';
- #endif
- if (strlen(szName) == 0)
- {
- lpzCPUName = "<name N/A>";
- }
- else{
- lpzCPUName = std::string(szName);
- }
- }
+ if ( !szName[0] )
+ lpzCPUName = _T("<name N/A>");
+ else
+ lpzCPUName = _A2T(szName);
}
+ }
bDEPEnabled = IsProcessorFeaturePresent(PF_NX_ENABLED);
- /*
- if (!bDEPEnabled)
- {
- int x = 0;
- __asm
- {
- push eax
- push ebx
- push ecx
- push edx
-
- mov eax, 0x80000001
- cpuid
- mov eax, 1
- shl eax, 20
- xor edx, eax
- cmp edx, 0
- je end_DEP
- mov x, 1
-
- end_DEP:
- pop edx
- pop ecx
- pop ebx
- pop eax
- }
- bDEPEnabled = x;
- }
- */
- switch (osvi.dwPlatformId) {
- case VER_PLATFORM_WIN32_WINDOWS:
- lstrcpyn(szKey, "Software\\Microsoft\\Windows\\CurrentVersion", MAX_PATH);
- lstrcpyn(szValue, "Version", MAX_PATH);
- break;
- case VER_PLATFORM_WIN32_NT:
- lstrcpyn(szKey, "Software\\Microsoft\\Windows NT\\CurrentVersion", MAX_PATH);
- lstrcpyn(szValue, "ProductName", MAX_PATH);
- break;
+ 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);
@@ -385,38 +350,38 @@ bool CVersionInfo::GetOSVersion() {
(LPDWORD)&size);
if (result == ERROR_SUCCESS) {
//Read it.
- char *aux = (char*)malloc(size);
+ TCHAR *aux = new TCHAR[size+1];
result = RegQueryValueEx((HKEY)hKey,szValue,(LPDWORD)NULL, (LPDWORD)&type,(LPBYTE)aux,(LPDWORD)&size);
- lpzOSName = std::string(aux);
- free(aux);
+ lpzOSName = aux;
+ delete[] aux;
}
else {
NotifyError(GetLastError(), "RegQueryValueEx()", __LINE__);
- lpzOSName = "<Error in RegQueryValueEx()>";
+ lpzOSName = _T("<Error in RegQueryValueEx()>");
}
}
else {
NotifyError(GetLastError(), "RegOpenKeyEx()", __LINE__);
- lpzOSName = "<Error in RegOpenKeyEx()>";
+ lpzOSName = _T("<Error in RegOpenKeyEx()>");
}
//Now we can improve it if we can.
switch (LOWORD(osvi.dwBuildNumber)) {
- case 950: lpzOSName = "Microsoft Windows 95"; break;
- case 1111: lpzOSName = "Microsoft Windows 95 OSR2"; break;
- case 1998: lpzOSName = "Microsoft Windows 98"; break;
- case 2222: lpzOSName = "Microsoft Windows 98 SE"; break;
- case 3000: lpzOSName = "Microsoft Windows ME"; break; //Even if this is wrong, we have already read it in the registry.
- case 1381: lpzOSName = "Microsoft Windows NT"; break; //What about service packs?
- case 2195: lpzOSName = "Microsoft Windows 2000"; break; //What about service packs?
- case 2600: lpzOSName = "Microsoft Windows XP"; break;
+ case 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 = "Microsoft Windows 2003 R2";
+ lpzOSName = _T("Microsoft Windows 2003 R2");
}
else{
- lpzOSName = "Microsoft Windows 2003";
+ lpzOSName = _T("Microsoft Windows 2003");
}
break; //added windows 2003 info
@@ -428,16 +393,21 @@ bool CVersionInfo::GetOSVersion() {
bool CVersionInfo::GetHWSettings() {
//Free space on Miranda Partition.
- char szMirandaPath[MAX_PATH] = { 0 };
- { char *str2;
- GetModuleFileName(GetModuleHandle(NULL),szMirandaPath,sizeof(szMirandaPath));
- str2=strrchr(szMirandaPath,'\\');
- if(str2!=NULL) *str2=0;
+ TCHAR szMirandaPath[MAX_PATH] = { 0 };
+ {
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
+ if ( str2 != NULL) *str2=0;
}
HMODULE hKernel32;
- hKernel32 = LoadLibrary("kernel32.dll");
+ hKernel32 = LoadLibraryA("kernel32.dll");
if (hKernel32) {
- MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExA");
+ #if defined( _UNICODE )
+ MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExW");
+ #else
+ MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExA");
+ #endif
+
MyIsWow64Process = (BOOL (WINAPI *) (HANDLE, PBOOL)) GetProcAddress(hKernel32, "IsWow64Process");
MyGetSystemInfo = (void (WINAPI *) (LPSYSTEM_INFO)) GetProcAddress(hKernel32, "GetNativeSystemInfo");
MyGlobalMemoryStatusEx = (BOOL (WINAPI *) (LPMEMORYSTATUSEX)) GetProcAddress(hKernel32, "GlobalMemoryStatusEx");
@@ -460,23 +430,19 @@ bool CVersionInfo::GetHWSettings() {
luiFreeDiskSpace = 0;
}
- char szInfo[1024];
- GetWindowsShell(szInfo, sizeof(szInfo));
+ TCHAR szInfo[1024];
+ GetWindowsShell(szInfo, SIZEOF(szInfo));
lpzShell = szInfo;
- GetInternetExplorerVersion(szInfo, sizeof(szInfo));
+ GetInternetExplorerVersion(szInfo, SIZEOF(szInfo));
lpzIEVersion = szInfo;
- lpzAdministratorPrivileges = (IsCurrentUserLocalAdministrator()) ? "Yes" : "No";
+ lpzAdministratorPrivileges = (IsCurrentUserLocalAdministrator()) ? _T("Yes") : _T("No");
bIsWOW64 = 0;
if (MyIsWow64Process)
- {
if (!MyIsWow64Process(GetCurrentProcess(), &bIsWOW64))
- {
bIsWOW64 = 0;
- }
- }
SYSTEM_INFO sysInfo = {0};
GetSystemInfo(&sysInfo);
@@ -492,7 +458,6 @@ bool CVersionInfo::GetHWSettings() {
}
else{
MEMORYSTATUS ms = {0};
- ZeroMemory(&ms, sizeof(ms));
ms.dwLength = sizeof(ms);
GlobalMemoryStatus(&ms);
luiRAM = (ms.dwTotalPhys/(1024*1024))+1; //Ugly hack!!!!
@@ -503,58 +468,41 @@ bool CVersionInfo::GetHWSettings() {
bool CVersionInfo::GetProfileSettings()
{
- char profileName[MAX_PATH] = {0};
- char profilePath[MAX_PATH] = {0};
- ServiceExists(MS_DB_GETPROFILEPATH_BASIC) ? CallService(MS_DB_GETPROFILEPATH_BASIC, MAX_PATH, (LPARAM) profilePath) : CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM) profilePath); //get the profile path
- CallService(MS_DB_GETPROFILENAME, MAX_PATH, (LPARAM) profileName); //get the profile name
-// strcat(profileName, ".dat"); //add the .dat extension to the profile name
- lpzProfilePath = std::string(profilePath); //save the profile path
-
- strcat(profilePath, "\\"); //add the last \\ to the path
- strcat(profilePath, profileName); //now profilePath is drive:\path\profilename.dat
- HANDLE fin = CreateFile(profilePath, FILE_READ_ATTRIBUTES | FILE_READ_EA | STANDARD_RIGHTS_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fin == INVALID_HANDLE_VALUE) { fin = CreateFile(profilePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); }
- if (fin != INVALID_HANDLE_VALUE)
- {
- DWORD size;
- FILETIME creation, modified, accessed;
- size = GetFileSize(fin, NULL);
- TCHAR number[1024];
- char tmp[1024];
- double fileSize = (double) size / 1024;
-
- sprintf(tmp, "%f", fileSize);
- GetNumberFormat(EnglishLocale, NULL, tmp, NULL, number, 1024);
-
- lpzProfileSize = std::string(number) + " KBytes";
- GetFileTime(fin, &creation, &accessed, &modified);
- FillLocalTime(lpzProfileCreationDate, &creation);
-
- CloseHandle(fin);
- }
- else{
- DWORD error = GetLastError();
- char tmp[1024];
- sprintf(tmp, "%d", error);
- lpzProfileCreationDate = "<error " + std::string(tmp) + " at FileOpen>" + std::string(profilePath);
- lpzProfileSize = "<error " + std::string(tmp) + " at FileOpen>" + std::string(profilePath);
- }
-
+ 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 char szSystemLocales[4096] = {0};
+static TCHAR szSystemLocales[4096] = {0};
static WORD systemLangID;
#define US_LANG_ID 0x00000409
-BOOL CALLBACK EnumSystemLocalesProc(char *szLocale)
+BOOL CALLBACK EnumSystemLocalesProc(TCHAR *szLocale)
{
- DWORD locale = atoi(szLocale);
- char *name = GetLanguageName(locale);
- if (!strstr(szSystemLocales, name))
+ DWORD locale = _ttoi(szLocale);
+ TCHAR *name = GetLanguageName(locale);
+ if (!_tcsstr(szSystemLocales, name))
{
- strcat(szSystemLocales, name);
- strcat(szSystemLocales, ", ");
+ _tcscat(szSystemLocales, name);
+ _tcscat(szSystemLocales, _T(", "));
}
return TRUE;
@@ -573,7 +521,7 @@ BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszNam
bool CVersionInfo::GetOSLanguages()
{
- lpzOSLanguages = "(UI | Locale (User/System)) : ";
+ lpzOSLanguages = _T("(UI | Locale (User/System)) : ");
LANGID UILang;
@@ -586,7 +534,7 @@ bool CVersionInfo::GetOSLanguages()
{
if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) //Win NT
{
- HMODULE hLib = LoadLibrary("ntdll.dll");
+ HMODULE hLib = LoadLibraryA("ntdll.dll");
if (hLib)
{
@@ -621,25 +569,25 @@ bool CVersionInfo::GetOSLanguages()
}
else{ //Win 95-Me
HKEY hKey = NULL;
- char szLangID[128] = "0x";
- DWORD size = sizeof(szLangID) - 2;
- char err[512];
+ TCHAR szLangID[128] = _T("0x");
+ DWORD size = SIZEOF(szLangID) - 2;
+ TCHAR err[512];
- if (RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop\\ResourceLocale", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop\\ResourceLocale"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
- if (RegQueryValueEx(hKey, "", 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, _T(""), 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
{
- sscanf(szLangID, "%lx", &systemLangID);
+ _tscanf(szLangID, _T("%lx"), &systemLangID);
}
else{
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
- MessageBox(0, err, "Error at RegQueryValueEx()", MB_OK);
+ 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, "Error at RegOpenKeyEx()", MB_OK);
+ MessageBox(0, err, _T("Error at RegOpenKeyEx()"), MB_OK);
}
}
@@ -651,7 +599,7 @@ bool CVersionInfo::GetOSLanguages()
case 5: //Win 2000, XP
default:
{
- HMODULE hKernel32 = LoadLibrary("kernel32.dll");
+ HMODULE hKernel32 = LoadLibraryA("kernel32.dll");
if (hKernel32)
{
MyGetUserDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetUserDefaultUILanguage");
@@ -664,46 +612,45 @@ bool CVersionInfo::GetOSLanguages()
{
UILang = MyGetUserDefaultUILanguage();
lpzOSLanguages += GetLanguageName(UILang);
- lpzOSLanguages += "/";
+ lpzOSLanguages += _T("/");
UILang = MyGetSystemDefaultUILanguage();
lpzOSLanguages += GetLanguageName(UILang);
}
else{
- lpzOSLanguages += "Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)";
+ lpzOSLanguages += _T("Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)");
}
break;
}
}
- lpzOSLanguages += " | ";
+ lpzOSLanguages += _T(" | ");
lpzOSLanguages += GetLanguageName(LOCALE_USER_DEFAULT);
- lpzOSLanguages += "/";
+ lpzOSLanguages += _T("/");
lpzOSLanguages += GetLanguageName(LOCALE_SYSTEM_DEFAULT);
if (DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", 0))
{
szSystemLocales[0] = '\0';
- lpzOSLanguages += " [";
+ lpzOSLanguages += _T(" [");
EnumSystemLocales(EnumSystemLocalesProc, LCID_INSTALLED);
- if (strlen(szSystemLocales) > 2)
- {
- szSystemLocales[strlen(szSystemLocales) - 2] = '\0';
- }
+ if (_tcslen(szSystemLocales) > 2)
+ szSystemLocales[ _tcslen(szSystemLocales) - 2] = '\0';
+
lpzOSLanguages += szSystemLocales;
- lpzOSLanguages += "]";
+ lpzOSLanguages += _T("]");
}
return true;
}
-int SaveInfo(const char *data, const char *lwrData, const char *search, char *dest, int size)
+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)
{
- strncpy(dest, &data[strlen(search)], size);
+ _tcsncpy(dest, _A2T(&data[strlen(search)]), size);
res = 0;
}
@@ -712,57 +659,51 @@ int SaveInfo(const char *data, const char *lwrData, const char *search, char *de
bool CVersionInfo::GetLangpackInfo()
{
- char langpackPath[MAX_PATH] = {0};
- char search[MAX_PATH] = {0};
- char *p;
- lpzLangpackModifiedDate = "";
- GetModuleFileName(GetModuleHandle(NULL), langpackPath, sizeof(langpackPath));
- p = strrchr(langpackPath, '\\');
+ 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';
- strcpy(search, langpackPath);
- strcat(search, "langpack_*.txt");
+ _tcscpy(search, langpackPath);
+ _tcscat(search, _T("langpack_*.txt"));
hLangpack = FindFirstFile(search, &data);
if (hLangpack != INVALID_HANDLE_VALUE)
{
char buffer[1024];
char temp[1024];
- //FILETIME localWriteTime;
- //SYSTEMTIME sysTime;
FillLocalTime(lpzLangpackModifiedDate, &data.ftLastWriteTime);
- char locale[128] = {0};
- char language[128] = {0};
- char version[128] = {0};
- strcpy(version, "N/A");
- char *p;
- strncpy(temp, data.cFileName, sizeof(temp));
- p = strrchr(temp, '.');
- p[0] = '\0';
- strncpy(language, strchr(temp, '_') + 1, sizeof(language));
+ TCHAR locale[128] = {0};
+ TCHAR language[128] = {0};
+ TCHAR version[128] = {0};
+ _tcscpy(version, _T("N/A"));
- strcat(langpackPath, data.cFileName);
- FILE *fin = fopen(langpackPath, "rt");
+ _tcsncpy(language, data.cFileName, SIZEOF(language));
+ p = _tcsrchr(language, '.');
+ p[0] = '\0';
- if (fin)
- {
+ _tcscat(langpackPath, data.cFileName);
+ FILE *fin = _tfopen(langpackPath, _T("rt"));
+ if (fin) {
size_t len;
- while (!feof(fin))
- {
- fgets(buffer, sizeof(buffer), fin);
+ 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));
+ strncpy(temp, buffer, SIZEOF(temp));
_strlwr(temp);
- if (SaveInfo(buffer, temp, "language: ", language, sizeof(language)))
+ if (SaveInfo(buffer, temp, "language: ", language, SIZEOF(language)))
{
- if (SaveInfo(buffer, temp, "locale: ", locale, sizeof(locale)))
+ if (SaveInfo(buffer, temp, "locale: ", locale, SIZEOF(locale)))
{
- p = strstr(buffer, "; FLID: ");
+ char* p = strstr(buffer, "; FLID: ");
if (p)
{
int ok = 1;
@@ -781,55 +722,51 @@ bool CVersionInfo::GetLangpackInfo()
p = strrchr(temp, ' ');
if ((ok) && (p))
{
- strncpy(version, &buffer[p - temp + 1], sizeof(version));
+ _tcsncpy(version, _A2T(&buffer[p - temp + 1]), SIZEOF(version));
}
else{
- strncpy(version, "<unknown>", sizeof(version));
+ _tcsncpy(version, _T("<unknown>"), SIZEOF(version));
}
}
}
}
}
- lpzLangpackInfo = std::string(language) + " [" + std::string(locale) + "]";
- if (strlen(version) > 0)
- {
- lpzLangpackInfo += " v. " + std::string(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 = "<error> Could not open file " + std::string(data.cFileName);
+ lpzLangpackInfo = _T("<error> Could not open file " + std::tstring(data.cFileName));
}
FindClose(hLangpack);
}
- else{
- lpzLangpackInfo = "No language pack installed";
- }
+ else lpzLangpackInfo = _T("No language pack installed");
}
return true;
}
-std::string GetPluginTimestamp(FILETIME *fileTime)
+std::tstring GetPluginTimestamp(FILETIME *fileTime)
{
SYSTEMTIME sysTime;
FileTimeToSystemTime(fileTime, &sysTime); //convert the file tyme to system time
+
//char time[256];
- char date[256]; //lovely
- GetDateFormat(EnglishLocale, 0, &sysTime, "dd' 'MMM' 'yyyy", date, sizeof(date));
- //GetTimeFormat(NULL, TIME_FORCE24HOURFORMAT, &sysTime, "HH':'mm':'ss", time, sizeof(time)); //americans love 24hour format :)
- std::string timedate(date);
- return timedate;
+ TCHAR date[256]; //lovely
+ GetDateFormat(EnglishLocale, 0, &sysTime, _T("dd' 'MMM' 'yyyy"), date, SIZEOF(date));
+ return date;
}
-bool CVersionInfo::GetPluginLists() {
-
+bool CVersionInfo::GetPluginLists()
+{
HANDLE hFind;
- char szMirandaPath[MAX_PATH] = { 0 }, szSearchPath[MAX_PATH] = { 0 }; //For search purpose
+ TCHAR szMirandaPath[MAX_PATH] = { 0 }, szSearchPath[MAX_PATH] = { 0 }; //For search purpose
WIN32_FIND_DATA fd;
- char szMirandaPluginsPath[MAX_PATH] = { 0 }, szPluginPath[MAX_PATH] = { 0 }; //For info reading purpose
+ 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.
@@ -837,101 +774,79 @@ bool CVersionInfo::GetPluginLists() {
DWORD mirandaVersion = 0;
BOOL asmCheckOK = FALSE;
DWORD loadError;
-// SYSTEMTIME sysTime; //for timestamp
+ // SYSTEMTIME sysTime; //for timestamp
mirandaVersion=(DWORD)CallService(MS_SYSTEM_GETVERSION,0,0);
-
- { char *str2;
- GetModuleFileName(GetModuleHandle(NULL),szMirandaPath,sizeof(szMirandaPath));
- str2=strrchr(szMirandaPath,'\\');
+ {
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
if(str2!=NULL) *str2=0;
}
- lpzMirandaPath = std::string(szMirandaPath);
+ 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,"\\Plugins\\*.dll");
-
+ lstrcat(szSearchPath, _T("\\Plugins\\*.dll"));
+
lstrcpyn(szMirandaPluginsPath, szMirandaPath, MAX_PATH);
- lstrcat(szMirandaPluginsPath,"\\Plugins\\");
-
+ lstrcat(szMirandaPluginsPath, _T("\\Plugins\\"));
+
hFind=FindFirstFile(szSearchPath,&fd);
LogToFile("Starting to load plugins");
if(hFind != INVALID_HANDLE_VALUE) {
do {
- if (verbose) PUShowMessage(fd.cFileName, SM_NOTIFY);
- if (!ValidExtension(fd.cFileName, "dll"))
- {
+ 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;
- LogToFile("Plugin '%s' is enabled and loaded", fd.cFileName);
- }
- else{
- PluginIsEnabled = 0;
- LogToFile("Plugin '%s' is not loaded, going to load it", fd.cFileName);
- lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
- lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
- hInstPlugin = LoadLibrary(szPluginPath);
-/*
- PluginIsEnabled = !(
- DBGetContactSettingByte(NULL, "PluginDisable", fd.cFileName, FALSE)
- || DBGetContactSettingByte(NULL, "PluginDisable", CharUpper(fd.cFileName), FALSE)
- || DBGetContactSettingByte(NULL, "PluginDisable", CharLower(fd.cFileName), FALSE)
-
- }; //If the DB does not contain that value, the plugin is enabled => default: FALSE; action: !read
-*/
- //Let's read the informations.
-/*
- }
- if (PluginIsEnabled) {
- hInstPlugin = GetModuleHandle(fd.cFileName);
+ {
+ PluginIsEnabled = 1;
+ LogToFile("Plugin '%s' is enabled and loaded", fd.cFileName);
}
- else{
+ else{
+ PluginIsEnabled = 0;
+ LogToFile("Plugin '%s' is not loaded, going to load it", fd.cFileName);
lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
hInstPlugin = LoadLibrary(szPluginPath);
}
-*/
- }
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::string linkedModules = "";
-
- lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
- lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
- if (GetLinkedModulesInfo(szPluginPath, linkedModules))
- {
- LogToFile("Plugin %s has unresolved dependencies, adding to unloadable list", szPluginPath);
- std::string time = GetPluginTimestamp(&fd.ftLastWriteTime);
- CPlugin thePlugin = CPlugin(std::string(fd.cFileName), "<unknown>", UUID_NULL, "", 0, time, linkedModules);
- AddPlugin(thePlugin, listUnloadablePlugins);
- bUnknownError = 0; //we know why the plugin didn't load
- }
- }
- if (bUnknownError) //if cause is unknown then report it
- {
- LogToFile("Plugin %s doesn't load", szPluginPath);
- std::string time = GetPluginTimestamp(&fd.ftLastWriteTime);
- char buffer[4096];
- char error[2048];
- //DWORD_PTR arguments[2] = {loadError, 0};
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, loadError, 0, error, sizeof(error), NULL);
- sprintf(buffer, " Error %ld - %s", loadError, error);
- CPlugin thePlugin = CPlugin(std::string(fd.cFileName), "<unknown>", UUID_NULL, "", 0, time, buffer);
+ LogToFile("Plugin %s has unresolved dependencies, adding to unloadable list", szPluginPath);
+ 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
+ {
+ LogToFile("Plugin %s doesn't load", szPluginPath);
+ 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.
LogToFile("Plugin '%s' was loaded successfully", fd.cFileName);
@@ -944,7 +859,7 @@ bool CVersionInfo::GetPluginLists() {
continue;
}
else {
- //It's a valid plugin, since we could find MirandaPluginInfo
+ //It's a valid plugin, since we could find MirandaPluginInfo
#if (!defined(WIN64) && !defined(_WIN64))
asmCheckOK = FALSE;
__asm {
@@ -956,9 +871,7 @@ bool CVersionInfo::GetPluginLists() {
cmp eax, mirandaVersion
jne a1
mov asmCheckOK, 0xffffffff
- // jmp a2
- a1:
- // a2:
+ a1:
}
#else
asmCheckOK = TRUE;
@@ -967,7 +880,7 @@ bool CVersionInfo::GetPluginLists() {
pluginInfo = CopyPluginInfo(MirandaPluginInfo(mirandaVersion));
else {
ZeroMemory(&pluginInfo, sizeof(pluginInfo));
- MessageBox(NULL, fd.cFileName, "Invalid plugin", MB_OK);
+ MessageBox(NULL, fd.cFileName, _T("Invalid plugin"), MB_OK);
}
}
}
@@ -976,17 +889,15 @@ bool CVersionInfo::GetPluginLists() {
if (pluginInfo != NULL) {
LogToFile("Plugin '%s' is a miranda plugin", fd.cFileName);
//We have loaded the informations into pluginInfo.
- std::string timedate = GetPluginTimestamp(&fd.ftLastWriteTime);
- CPlugin thePlugin = CPlugin(std::string(fd.cFileName),std::string(pluginInfo->shortName), pluginInfo->uuid, std::string((pluginInfo->flags & 1) ? "Unicode aware" : ""), (DWORD) pluginInfo->version, timedate, "");
+ 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(" Plugin does not have an UUID and will not work with Miranda 0.8.\r\n");
+ thePlugin.SetErrorMessage( _T(" Plugin does not have an UUID and will not work with Miranda 0.8.\r\n"));
AddPlugin(thePlugin, listUnloadablePlugins);
}
else{
@@ -996,29 +907,28 @@ bool CVersionInfo::GetPluginLists() {
}
FreePluginInfo(pluginInfo);
MirandaPluginInfo = NULL;
-#ifdef _DEBUG
- if (verbose)
- {
- char szMsg[4096] = { 0 };
- wsprintf(szMsg, "Done with: %s", fd.cFileName);
- PUShowMessage(szMsg, SM_NOTIFY);
- }
-#endif
+ #ifdef _DEBUG
+ if (verbose)
+ {
+ TCHAR szMsg[4096] = { 0 };
+ wsprintf(szMsg, _T("Done with: %s"), fd.cFileName);
+ PUShowMessageT(szMsg, SM_NOTIFY);
+ }
+ #endif
}
else{//pluginINFO == NULL
LogToFile("Plugin '%s' refuses to load", fd.cFileName);
pluginInfo = CopyPluginInfo(MirandaPluginInfo(PLUGIN_MAKE_VERSION(9, 9, 9, 9))); //let's see if the plugin likes this miranda version
char *szShortName = "<unknown>";
- std::string time = GetPluginTimestamp(&fd.ftLastWriteTime); //get the plugin timestamp;
+ std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime); //get the plugin timestamp;
DWORD version = 0;
- if (pluginInfo)
- {
+ if (pluginInfo) {
szShortName = pluginInfo->shortName;
version = pluginInfo->version;
}
- CPlugin thePlugin = CPlugin(std::string(fd.cFileName), std::string(szShortName), (pluginInfo) ? (pluginInfo->uuid) : UUID_NULL, std::string(((pluginInfo) && (pluginInfo->flags & 1)) ? "Unicode aware" : ""), version, time, " Plugin refuses to load. Miranda version too old.");
-
+ 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)
{
@@ -1067,81 +977,78 @@ static char *GetStringFromRVA(DWORD RVA, const LOADED_IMAGE *image)
return moduleName;
}
-bool CVersionInfo::GetLinkedModulesInfo(char *moduleName, std::string &linkedModules)
+bool CVersionInfo::GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules)
{
LogToFile("Checking dll %s for unresolved dll dependencies ...", moduleName);
LOADED_IMAGE image;
ULONG importTableSize;
IMAGE_IMPORT_DESCRIPTOR *importData;
//HMODULE dllModule;
- linkedModules = "";
+ linkedModules = _T("");
bool result = false;
-// LogToFile(" Before LoadLibraryEx", moduleName);
-// dllModule = LoadLibraryEx(moduleName, NULL, DONT_RESOLVE_DLL_REFERENCES);
- //dllModule = 0;
- //LogToFile(" Before MapAndLoad (dll handle %ld)", moduleName, dllModule);
- if (MapAndLoad(moduleName, NULL, &image, TRUE, TRUE) == FALSE)
- {
- char tmp[20];
- sprintf(tmp, "%d", GetLastError());
- LogToFile(" MapAndLoad failed with error %s", tmp);
- linkedModules = "<error " + std::string(tmp) + " at MapAndLoad()>\r\n";
-// FreeLibrary(dllModule);
- return result;
- }
+ TCHAR szError[20];
+ char* szModuleName = mir_t2a(moduleName);
+ if (MapAndLoad(szModuleName, NULL, &image, TRUE, TRUE) == FALSE)
+ {
+ wsprintf(szError, _T("%d"), GetLastError());
+ LogToFile(" MapAndLoad failed with error %S", szError);
+ mir_free( szModuleName );
+ linkedModules = _T("<error ") + std::tstring(szError) + _T(" at MapAndLoad()>\r\n");
+ return result;
+ }
+ mir_free( szModuleName );
LogToFile(" Before ImageDirectoryEntryToData (base address %ld)", image.MappedAddress);
importData = (IMAGE_IMPORT_DESCRIPTOR *) ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &importTableSize);
if (!importData)
+ {
+ wsprintf(szError, _T("%d"), GetLastError());
+ LogToFile(" ImageDirectoryEntryToData failed with error %s", szError);
+ linkedModules = _T("<error ") + std::tstring(szError) + _T(" at ImageDirectoryEntryToDataEx()>\r\n");
+ }
+ else{
+ LogToFile(" Checking dll dependencies");
+ while (importData->Name)
{
- char tmp[20];
- sprintf(tmp, "%d", GetLastError());
- LogToFile(" ImageDirectoryEntryToData failed with error %s", tmp);
- linkedModules = "<error " + std::string(tmp) + " at ImageDirectoryEntryToDataEx()>\r\n";
- }
- else{
- LogToFile(" Checking dll dependencies");
- while (importData->Name)
- {
- char *moduleName;
- moduleName = GetStringFromRVA(importData->Name, &image);
- LogToFile(" Checking link to dll %s", moduleName);
- if (!DoesDllExist(moduleName))
- {
- LogToFile(" Dll %s not found, adding to list", moduleName);
- linkedModules.append(" Plugin statically links to missing dll file: " + std::string(moduleName) + "\r\n");
- result = true;
- }
- else{
- LogToFile(" Dll %s found", moduleName);
- }
- LogToFile(" Moving to next import entry");
- importData++; //go to next record
- }
+ char *moduleName;
+ moduleName = GetStringFromRVA(importData->Name, &image);
+ LogToFile(" Checking link to dll %s", moduleName);
+ if (!DoesDllExist(moduleName))
+ {
+ LogToFile(" Dll %s not found, adding to list", moduleName);
+ linkedModules.append( _T(" Plugin statically links to missing dll file: ") + std::tstring(_A2T(moduleName)) + _T("\r\n"));
+ result = true;
+ }
+ else{
+ LogToFile(" Dll %s found", moduleName);
+ }
+ LogToFile(" Moving to next import entry");
+ importData++; //go to next record
}
+ }
LogToFile(" Done checking dependencies");
LogToFile(" Cleaning up; before {FreeLibrary()} and UnMapAndLoad");
-// FreeLibrary(dllModule);
+ // FreeLibrary(dllModule);
UnMapAndLoad(&image); //unload the image
return result;
}
-std::string CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flags, int beautify) {
+std::tstring CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flags, int beautify) {
std::list<CPlugin>::iterator pos = aList.begin();
- std::string out = "";
+ std::tstring out = _T("");
#ifdef _DEBUG
if (verbose) PUShowMessage("CVersionInfo::GetListAsString, begin.", SM_NOTIFY);
#endif
- char szHeader[32] = {0};
- char szFooter[32] = {0};
+ TCHAR szHeader[32] = {0};
+ TCHAR szFooter[32] = {0};
if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE)))
{
- GetStringFromDatabase("BoldBegin", "[b]", szHeader, sizeof(szHeader));
- GetStringFromDatabase("BoldEnd", "[/b]", szFooter, sizeof(szFooter));
+ GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
}
while (pos != aList.end()) {
- out.append(std::string((*pos).getInformations(flags, szHeader, szFooter)));
+ out.append(std::tstring((*pos).getInformations(flags, szHeader, szFooter)));
pos++;
}
#ifdef _DEBUG
@@ -1150,159 +1057,140 @@ std::string CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flags
return out;
};
-void CVersionInfo::BeautifyReport(int beautify, char *szBeautifyText, char *szNonBeautifyText, std::string &out)
+void CVersionInfo::BeautifyReport(int beautify, LPCTSTR szBeautifyText, LPCTSTR szNonBeautifyText, std::tstring &out)
{
if (beautify)
- {
- out.append(szBeautifyText);
- }
- else{
- out.append(szNonBeautifyText);
- }
+ out.append(szBeautifyText);
+ else
+ out.append(szNonBeautifyText);
}
-void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautify, std::string &out)
+void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautify, std::tstring &out)
{
if (forumStyle) //forum style
- {
- char szSize[256];
- char szQuote[256];
+ {
+ 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("");
- GetStringFromDatabase("SizeBegin", "[size=1]", szSize, sizeof(szSize));
- GetStringFromDatabase("QuoteBegin", "[quote]", szQuote, sizeof(szQuote));
- out.append(szQuote);
- out.append(szSize);
- }
- else{
- out = "";
- }
if (!suppressHeader)
+ {
+ out.append( _T("Miranda IM - VersionInformation plugin by Hrk, modified by Eblis\r\n"));
+ if (!forumStyle)
{
- out.append("Miranda IM - VersionInformation plugin by Hrk, modified by Eblis\r\n");
- if (!forumStyle)
- {
- out.append("Miranda's homepage: http://www.miranda-im.org/\r\n"); //changed homepage
- out.append("Miranda tools: http://miranda-im.org/download/\r\n\r\n"); //was missing a / before download
- }
+ 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
}
- char buffer[1024]; //for beautification
- GetStringFromDatabase("BeautifyHorizLine", "<hr />", buffer, sizeof(buffer));
- BeautifyReport(beautify, buffer, "", out);
- GetStringFromDatabase("BeautifyBlockStart", "<blockquote>", buffer, sizeof(buffer));
- BeautifyReport(beautify, buffer, "", out);
+ }
+
+ 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:
- char lpzTime[12]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,"HH':'mm':'ss",lpzTime, sizeof(lpzTime));
- char lpzDate[32]; GetDateFormat(EnglishLocale, 0, NULL,"dd' 'MMMM' 'yyyy",lpzDate, sizeof(lpzDate));
- out.append("Report generated at: " + std::string(lpzTime) + " on " + std::string(lpzDate) + "\r\n\r\n");
+ 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("CPU: " + lpzCPUName + " [" + lpzCPUIdentifier + "]");
+ out.append(_T("CPU: ") + lpzCPUName + _T(" [") + lpzCPUIdentifier + _T("]"));
if (bDEPEnabled)
- {
- out.append(" [DEP enabled]");
- }
- if (luiProcessors > 1)
- {
- char noProcs[128];
- sprintf(noProcs, " [%d CPUs]", luiProcessors);
- out.append(noProcs);
- }
- out.append("\r\n");
+ 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
- char szRAM[64]; wsprintf(szRAM, "%d", luiRAM);
- out.append("Installed RAM: " + std::string(szRAM) + " MBytes\r\n");
+ TCHAR szRAM[64]; wsprintf(szRAM, _T("%d"), luiRAM);
+ out.append( _T("Installed RAM: ") + std::tstring(szRAM) + _T(" MBytes\r\n"));
//operating system
- out.append("Operating System: " + lpzOSName + " [version: " + lpzOSVersion + "]\r\n");
+ out.append( _T("Operating System: ") + lpzOSName + _T(" [version: ") + lpzOSVersion + _T("]\r\n"));
//shell, IE, administrator
- out.append("Shell: " + lpzShell + ", Internet Explorer " + lpzIEVersion + "\r\n");
- out.append("Administrator privileges: " + lpzAdministratorPrivileges + "\r\n");
+ out.append( _T("Shell: ") + lpzShell + _T(", Internet Explorer ") + lpzIEVersion + _T("\r\n"));
+ out.append( _T("Administrator privileges: ") + lpzAdministratorPrivileges + _T("\r\n"));
//languages
- out.append("OS Languages: " + lpzOSLanguages + "\r\n");
+ out.append( _T("OS Languages: ") + lpzOSLanguages + _T("\r\n"));
//FreeDiskSpace
if (luiFreeDiskSpace) {
- char szDiskSpace[64]; wsprintf(szDiskSpace, "%d", luiFreeDiskSpace);
- out.append("Free disk space on Miranda partition: " + std::string(szDiskSpace) + " MBytes\r\n");
+ 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("Miranda path: " + lpzMirandaPath + "\r\n");
-
- out.append("Miranda IM version: " + lpzMirandaVersion);
+ out.append( _T("Miranda path: ") + lpzMirandaPath + _T("\r\n"));
+ out.append( _T("Miranda IM version: ") + lpzMirandaVersion);
if (bIsWOW64)
- {
- out.append(" [running inside WOW64]");
- }
+ out.append( _T(" [running inside WOW64]"));
if (bServiceMode)
- {
- out.append(" [service mode]");
- }
- out.append("\r\nBuild time: " + lpzBuildTime + "\r\n");
- out.append("Profile path: " + lpzProfilePath + "\r\n");
- //if (lpzProfileSize.find("error", 0) == std::string::npos) //only show the profile size of no error occured
- //{
- out.append("Profile size: " + lpzProfileSize + "\r\n");
- out.append("Profile creation date: " + lpzProfileCreationDate + "\r\n");
- //}
- out.append("Language pack: " + lpzLangpackInfo);
- out.append((lpzLangpackModifiedDate.size() > 0) ? ", modified: " + lpzLangpackModifiedDate : "");
- out.append("\r\n");
+ out.append( _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("Nightly: " + lpzNightly + "\r\n");
- out.append("Unicode core: " + lpzUnicodeBuild);
+ out.append( _T("Nightly: ") + lpzNightly + _T("\r\n"));
+ out.append( _T("Unicode core: ") + lpzUnicodeBuild);
- GetStringFromDatabase("BeautifyBlockEnd", "</blockquote>", buffer, sizeof(buffer));
- BeautifyReport(beautify, buffer, "\r\n", out);
- //out.append("\r\n");
+ GetStringFromDatabase("BeautifyBlockEnd", _T("</blockquote>"), buffer, SIZEOF(buffer));
+ BeautifyReport(beautify, buffer, _T("\r\n"), out);
}
-void CVersionInfo::AddInfoFooter(int suppressFooter, int forumStyle, int beautify, std::string &out)
+void CVersionInfo::AddInfoFooter(int suppressFooter, int forumStyle, int beautify, std::tstring &out)
{
//End of report
- char buffer[1024]; //for beautification purposes
- GetStringFromDatabase("BeautifyHorizLine", "<hr />", buffer, sizeof(buffer));
- if (!suppressFooter)
- {
- BeautifyReport(beautify, buffer, "\r\n", out);
- out.append("\r\nEnd of report.\r\n");
- }
- if (!forumStyle)
- {
- if (!suppressFooter)
- {
- out.append(Translate("If you are going to use this report to submit a bug, remember to check the website for questions or help the developers may need.\r\nIf you don't check your bug report and give feedback, it will not be fixed!"));
- }
- }
- else{
- char szSize[256];
- char szQuote[256];
+ 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"));
+ }
- GetStringFromDatabase("SizeEnd", "[/size]", szSize, sizeof(szSize));
- GetStringFromDatabase("QuoteEnd", "[/quote]", szQuote, sizeof(szQuote));
- out.append(szSize);
- out.append(szQuote);
- }
+ 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, char *listText, std::string &out)
+static void AddSectionAndCount(std::list<CPlugin> list, LPCTSTR listText, std::tstring &out)
{
- char tmp[64];
- sprintf(tmp, " (%u)", list.size());
+ TCHAR tmp[64];
+ wsprintf(tmp, _T(" (%u)"), list.size());
out.append(listText);
- out.append(tmp);
- out.append(":");
+ out.append( tmp );
+ out.append( _T(":"));
}
-std::string CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
+std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
//Begin of report
- std::string out;
+ 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);
@@ -1311,96 +1199,91 @@ std::string CVersionInfo::GetInformationsAsString(int bDisableForumStyle) {
DWORD flags = (forumStyle) | (showUUID << 1);
AddInfoHeader(suppressHeader, forumStyle, beautify, out);
- char normalPluginsStart[1024]; //for beautification purposes, for normal plugins text (start)
- char normalPluginsEnd[1024]; //for beautification purposes, for normal plugins text (end)
- char horizLine[1024]; //for beautification purposes
- char buffer[1024]; //for beautification purposes
-
- char headerHighlightStart[10] = "";
- char headerHighlightEnd[10] = "";
- if (forumStyle)
- {
- char start[128], end[128];
- GetStringFromDatabase("BoldBegin", "[b]", start, sizeof(start));
- GetStringFromDatabase("BoldEnd", "[/b]", end, sizeof(end));
- strncpy(headerHighlightStart, start, sizeof(headerHighlightStart));
- strncpy(headerHighlightEnd, end, sizeof(headerHighlightEnd));
- }
+ 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", "<hr />", horizLine, sizeof(horizLine));
- BeautifyReport(beautify, horizLine, "\r\n", out);
- GetStringFromDatabase("BeautifyActiveHeaderBegin", "<b><font size=\"-1\" color=\"DarkGreen\">", buffer, sizeof(buffer));
+ 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, "Active Plugins", out);
- GetStringFromDatabase("BeautifyActiveHeaderEnd", "</font></b>", buffer, sizeof(buffer));
+ AddSectionAndCount(listActivePlugins, _T("Active Plugins"), out);
+ GetStringFromDatabase("BeautifyActiveHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, headerHighlightEnd, out);
- out.append("\r\n");
-
- GetStringFromDatabase("BeautifyPluginsBegin", "<font size=\"-2\" color=\"black\">", normalPluginsStart, sizeof(normalPluginsStart));
- BeautifyReport(beautify, normalPluginsStart, "", out);
+ out.append( _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", "</font>", normalPluginsEnd, sizeof(normalPluginsEnd));
- BeautifyReport(beautify, normalPluginsEnd, "", out);
+ 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, "\r\n", out);
- GetStringFromDatabase("BeautifyInactiveHeaderBegin", "<b><font size=\"-1\" color=\"DarkRed\">", buffer, sizeof(buffer));
+ 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, "Inactive Plugins", out);
- GetStringFromDatabase("BeautifyInactiveHeaderEnd", "</font></b>", buffer, sizeof(buffer));
+ AddSectionAndCount(listInactivePlugins, _T("Inactive Plugins"), out);
+ GetStringFromDatabase("BeautifyInactiveHeaderEnd", _T("</font></b>"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, headerHighlightEnd, out);
- out.append("\r\n");
- BeautifyReport(beautify, normalPluginsStart, "", out);
+ out.append( _T("\r\n"));
+ BeautifyReport(beautify, normalPluginsStart, _T(""), out);
out.append(GetListAsString(listInactivePlugins, flags, beautify));
- BeautifyReport(beautify, normalPluginsEnd, "", out);
+ 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);
}
- if (listUnloadablePlugins.size() > 0)
- {
- //out.append("\r\n");
- BeautifyReport(beautify, horizLine, "\r\n", out);
- GetStringFromDatabase("BeautifyUnloadableHeaderBegin", "<b><font size=\"-1\"><font color=\"Red\">", buffer, sizeof(buffer));
- BeautifyReport(beautify, buffer, headerHighlightStart, out);
- AddSectionAndCount(listUnloadablePlugins, "Unloadable Plugins", out);
- GetStringFromDatabase("BeautifyUnloadableHeaderEnd", "</font></b>", buffer, sizeof(buffer));
- BeautifyReport(beautify, buffer, headerHighlightEnd, out);
- out.append("\r\n");
- BeautifyReport(beautify, normalPluginsStart, "", out);
- out.append(GetListAsString(listUnloadablePlugins, flags, beautify));
- BeautifyReport(beautify, normalPluginsEnd, "", out);
- }
AddInfoFooter(suppressHeader, forumStyle, beautify, out);
return out;
}
//========== Print functions =====
-void CVersionInfo::PrintInformationsToFile(const char *info)
+void CVersionInfo::PrintInformationsToFile(const TCHAR *info)
{
- char buffer[MAX_PATH];
- char outputFileName[MAX_PATH];
- if (bFoldersAvailable)
- {
- FoldersGetCustomPath(hOutputLocation, buffer, sizeof(buffer), "%miranda_path%");
- strcat(buffer, "\\VersionInfo.txt");
- }
- else{
- GetStringFromDatabase("OutputFile", "VersionInfo.txt", buffer, sizeof(buffer));
+ 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));
+ RelativePathToAbsolute(buffer, outputFileName, SIZEOF(buffer));
- FILE *fp = fopen(outputFileName, "wb");
- if (fp != NULL) {
- fprintf(fp, info);
+ FILE *fp = _tfopen(outputFileName, _T("wb"));
+ if ( fp != NULL ) {
+ char* utf = mir_utf8encodeT( info );
+ fputs( "\xEF\xBB\xBF", fp);
+ fputs( utf, fp );
fclose(fp);
char mex[512];
- mir_snprintf(mex, sizeof(mex), Translate("Information successfully written to file: \"%s\"."), outputFileName);
+ mir_snprintf(mex, SIZEOF(mex), Translate("Information successfully written to file: \"%s\"."), outputFileName);
Log(mex);
}
else {
char mex[512];
- mir_snprintf(mex, sizeof(mex), Translate("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
+ mir_snprintf(mex, SIZEOF(mex), Translate("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
Log(mex);
}
}
@@ -1410,7 +1293,7 @@ void CVersionInfo::PrintInformationsToFile() {
}
void CVersionInfo::PrintInformationsToMessageBox() {
- MessageBox(NULL, (*this).GetInformationsAsString().c_str(), ModuleName, MB_OK);
+ MessageBox(NULL, (*this).GetInformationsAsString().c_str(), _T("VersionInfo"), MB_OK);
return;
}
@@ -1444,12 +1327,12 @@ void CVersionInfo::PrintInformationsToClipboard(bool showLog) {
EmptyClipboard();
//Storage data we'll use.
LPTSTR lptstrCopy;
- std::string aux = (*this).GetInformationsAsString();
+ std::tstring aux = GetInformationsAsString();
size_t length = aux.length() + 1;
- HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length + 5);
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length*sizeof(TCHAR) + 5);
//Lock memory, copy it, release it.
lptstrCopy = (LPTSTR)GlobalLock(hData);
- memcpy(lptstrCopy, aux.c_str(), length);
+ lstrcpy(lptstrCopy, aux.c_str());
lptstrCopy[length] = '\0';
GlobalUnlock(hData);
//Now set the clipboard data.
@@ -1563,26 +1446,20 @@ DWORD WINAPI UploadWorkerTread(LPVOID param)
return 0;
}
-void CVersionInfo::UploadToSite(char *text){
-
+void CVersionInfo::UploadToSite(LPTSTR text)
+{
DWORD threadID;
HANDLE thread;
char *data = NULL;
if (!text)
- {
- data = _strdup(GetInformationsAsString().c_str());
- }
- else{
- data = _strdup(text);
- }
-
+ data = mir_utf8encodeT( GetInformationsAsString().c_str());
+ else
+ data = mir_utf8encodeT( text );
+
thread = CreateThread(NULL, NULL, UploadWorkerTread, data, 0, &threadID); //the thread will free the buffer
if (!thread)
- {
- MB("Upload worker thread could not be created");
- }
- if ((thread != NULL) && (thread != INVALID_HANDLE_VALUE))
- {
+ MB("Upload worker thread could not be created");
+
+ if ( thread != NULL && thread != INVALID_HANDLE_VALUE)
CloseHandle(thread);
- }
-} \ No newline at end of file
+}
diff --git a/plugins/Svc_vi/CVersionInfo.h b/plugins/Svc_vi/CVersionInfo.h
index e97eee09cb..aef6eb3256 100644
--- a/plugins/Svc_vi/CVersionInfo.h
+++ b/plugins/Svc_vi/CVersionInfo.h
@@ -41,29 +41,29 @@ class CVersionInfo
{
private:
//Informations related to Miranda: main informations.
- std::string lpzMirandaVersion;
- std::string lpzMirandaPath;
- std::string lpzProfilePath;
- std::string lpzProfileSize;
- std::string lpzProfileCreationDate;
- std::string lpzNightly;
- std::string lpzUnicodeBuild;
- std::string lpzCPUName;
- std::string lpzCPUIdentifier;
- std::string lpzBuildTime;
- std::string lpzShell;
- std::string lpzIEVersion;
- std::string lpzAdministratorPrivileges;
- std::string lpzOSLanguages;
- std::string lpzLangpackInfo;
- std::string lpzLangpackModifiedDate;
+ 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::string lpzOSVersion;
- std::string lpzOSName;
+ std::tstring lpzOSVersion;
+ std::tstring lpzOSName;
unsigned int luiProcessors;
unsigned int luiRAM;
unsigned int luiFreeDiskSpace;
@@ -77,7 +77,7 @@ class CVersionInfo
bool bExpertSettingsOn;
//Configuration
- bool GetLinkedModulesInfo(char *moduleName, std::string &linkedModules);
+ bool GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules);
public:
//Constructor/Destructor
@@ -99,18 +99,18 @@ class CVersionInfo
//Prints
void PrintInformationsToFile();
- void PrintInformationsToFile(const char *info);
+ void PrintInformationsToFile(const TCHAR *info);
void PrintInformationsToDialogBox();
void PrintInformationsToMessageBox();
void PrintInformationsToOutputDebugString();
void PrintInformationsToClipboard(bool);
- void UploadToSite(char *text = NULL);
+ void UploadToSite(TCHAR *text = NULL);
- std::string GetListAsString(std::list<CPlugin>&, DWORD flags, int beautify);
- std::string GetInformationsAsString(int bDisableForumStyle = 0);
- void BeautifyReport(int, char *, char *, std::string &);
- void AddInfoHeader(int, int, int, std::string &);
- void AddInfoFooter(int, int, int, std::string &);
+ 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/Svc_vi/VersionInfo_10.vcxproj b/plugins/Svc_vi/VersionInfo_10.vcxproj
index 32f4deb18e..a7da9f1557 100644
--- a/plugins/Svc_vi/VersionInfo_10.vcxproj
+++ b/plugins/Svc_vi/VersionInfo_10.vcxproj
@@ -27,20 +27,22 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
+ <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">
@@ -94,6 +96,8 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -133,13 +137,13 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader>
- </PrecompiledHeader>
+ <PrecompiledHeader>Use</PrecompiledHeader>
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -167,6 +171,8 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<Optimization>Disabled</Optimization>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
@@ -179,6 +185,8 @@
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>false</OmitFramePointers>
+ <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
@@ -187,44 +195,38 @@
<ItemGroup>
<ClCompile Include="CPlugin.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
- <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="CVersionInfo.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
- <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="dlgHandlers.cpp" />
<ClCompile Include="hooked_events.cpp" />
<ClCompile Include="main.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
- <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="services.cpp" />
<ClCompile Include="utils.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
- <BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MinSpace</Optimization>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;VERSIONINFO_EXPORTS</PreprocessorDefinitions>
</ClCompile>
</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" />
diff --git a/plugins/Svc_vi/VersionInfo_10.vcxproj.filters b/plugins/Svc_vi/VersionInfo_10.vcxproj.filters
index 46d44f7f4e..e0c4f5db2e 100644
--- a/plugins/Svc_vi/VersionInfo_10.vcxproj.filters
+++ b/plugins/Svc_vi/VersionInfo_10.vcxproj.filters
@@ -47,6 +47,12 @@
<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">
diff --git a/plugins/Svc_vi/common.h b/plugins/Svc_vi/common.h
index 84dc24a55b..0d2b22a711 100644
--- a/plugins/Svc_vi/common.h
+++ b/plugins/Svc_vi/common.h
@@ -62,6 +62,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "m_utils.h"
#include "m_updater.h"
#include "m_folders.h"
+#include "win2k.h"
#include "utils.h"
@@ -93,11 +94,20 @@ extern BOOL verbose;
const MUUID UUID_NULL = {0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }};
-//miranda [re]alloc and free functions
-//main.cpp
-extern void * (* MirandaMalloc)(size_t);
-extern void * (* MirandaRealloc)(void *, size_t);
-extern void (* MirandaFree)(void *);
+///////////////////////////////////////////////////////////////////////
+class _A2T
+{
+ TCHAR* buf;
+
+public:
+ _A2T( const char* s ) : buf( mir_a2t( s )) {}
+ _A2T( const char* s, int cp ) : buf( mir_a2t_cp( s, cp )) {}
+ ~_A2T() { mir_free(buf); }
+
+ __forceinline operator TCHAR*() const
+ { return buf;
+ }
+};
#define OLD_MIRANDAPLUGININFO_SUPPORT PLUGININFO oldPluginInfo = { \
sizeof(PLUGININFO), \
diff --git a/plugins/Svc_vi/dlgHandlers.cpp b/plugins/Svc_vi/dlgHandlers.cpp
index d7f36d3f83..5d8e512854 100644
--- a/plugins/Svc_vi/dlgHandlers.cpp
+++ b/plugins/Svc_vi/dlgHandlers.cpp
@@ -18,14 +18,15 @@ 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) / sizeof(szQuoteStrings[0]); //get the number of quote strings
-const int nSizeCount = sizeof(szSizeStrings) / sizeof(szSizeStrings[0]); //get the number of size strings
-const int nBoldCount = sizeof(szBoldStrings) / sizeof(szBoldStrings[0]); //get the number of bold strings
+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
@@ -33,17 +34,14 @@ int AddInfoToComboboxes(HWND hWnd, int nQuotesComboBox, int nSizesComboBox, int
{
int i;
for (i = 0; i < nQuoteCount; i++)
- {
- SendDlgItemMessage(hWnd, nQuotesComboBox, CB_ADDSTRING, 0, (LPARAM) szQuoteStrings[i]);
- }
+ SendDlgItemMessageA(hWnd, nQuotesComboBox, CB_ADDSTRING, 0, (LPARAM) szQuoteStrings[i]);
+
for (i = 0; i < nSizeCount; i++)
- {
- SendDlgItemMessage(hWnd, nSizesComboBox, CB_ADDSTRING, 0, (LPARAM) szSizeStrings[i]);
- }
+ SendDlgItemMessageA(hWnd, nSizesComboBox, CB_ADDSTRING, 0, (LPARAM) szSizeStrings[i]);
+
for (i = 0; i < nBoldCount; i++)
- {
- SendDlgItemMessage(hWnd, nBoldComboBox, CB_ADDSTRING, 0, (LPARAM) szBoldStrings[i]);
- }
+ SendDlgItemMessageA(hWnd, nBoldComboBox, CB_ADDSTRING, 0, (LPARAM) szBoldStrings[i]);
+
return 0;
}
@@ -58,14 +56,14 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
const int MAX_SIZE = 128;
static int oldFSFValue;
- static char oldQuoteBegin[MAX_SIZE], oldQuoteEnd[MAX_SIZE];
- static char oldSizeBegin[MAX_SIZE], oldSizeEnd[MAX_SIZE];
- static char oldBoldBegin[MAX_SIZE], oldBoldEnd[MAX_SIZE];
+ 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:
- char buffer[1024];
+ TCHAR buffer[1024];
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
@@ -80,19 +78,19 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
CheckDlgButton(hWnd, IDC_ASK_FORUMSTYLE, (oldFSFValue) ? BST_CHECKED : BST_UNCHECKED);
EnableAskComboboxes(hWnd, oldFSFValue);
- GetStringFromDatabase("QuoteBegin", "[quote]", oldQuoteBegin, MAX_SIZE);
- GetStringFromDatabase("QuoteEnd", "[/quote]", oldQuoteEnd, MAX_SIZE);
- sprintf(buffer, "%s | %s", oldQuoteBegin, oldQuoteEnd);
+ 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", "[size=1]", oldSizeBegin, MAX_SIZE);
- GetStringFromDatabase("SizeEnd", "[/size]", oldSizeEnd, MAX_SIZE);
- sprintf(buffer, "%s | %s", oldSizeBegin, oldSizeEnd);
+ 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", "[b]", oldBoldBegin, MAX_SIZE);
- GetStringFromDatabase("BoldEnd", "[/b]", oldBoldEnd, MAX_SIZE);
- sprintf(buffer, "%s | %s", oldBoldBegin, oldBoldEnd);
+ 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;
@@ -119,33 +117,31 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_ASK_OK:
int debugTo = TO_DIALOGBOX; //just to be safe
int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
- char quoteBegin[MAX_SIZE], quoteEnd[MAX_SIZE];
- char sizeBegin[MAX_SIZE], sizeEnd[MAX_SIZE];
- char boldBegin[MAX_SIZE], boldEnd[MAX_SIZE];
- char buffer[1024];
+ 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);
+ 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);
+ 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);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, boldBegin, boldEnd);
if (newFSFValue != oldFSFValue)
- {
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
- }
- if (newFSFValue)
- {
- DBWriteContactSettingString(NULL, ModuleName, "QuoteBegin", quoteBegin);
- DBWriteContactSettingString(NULL, ModuleName, "QuoteEnd", quoteEnd);
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
+
+ if (newFSFValue) {
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", quoteBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", quoteEnd);
- DBWriteContactSettingString(NULL, ModuleName, "SizeBegin", sizeBegin);
- DBWriteContactSettingString(NULL, ModuleName, "SizeEnd", sizeEnd);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", sizeBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", sizeEnd);
- DBWriteContactSettingString(NULL, ModuleName, "BoldBegin", boldBegin);
- DBWriteContactSettingString(NULL, ModuleName, "BoldEnd", boldEnd);
- }
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", boldBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", boldEnd);
+ }
if (IsDlgButtonChecked(hWnd, IDC_ASK_TOFILE))
debugTo = TO_FILE;
@@ -168,14 +164,14 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
if (newFSFValue)
{
- DBWriteContactSettingString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
- DBWriteContactSettingString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
- DBWriteContactSettingString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
- DBWriteContactSettingString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
- DBWriteContactSettingString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
- DBWriteContactSettingString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
}
DestroyWindow(hWnd);
@@ -291,88 +287,74 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
SetFocus(GetDlgItem(hWnd, IDC_FORUMSTYLE));
{
DBVARIANT dbv = { 0 };
- dbv.type = DBVT_ASCIIZ;
bOptionsInitializing = 1;
- char buffer[1024];
- char notFound[1024];
+ TCHAR buffer[1024];
+ TCHAR notFound[1024];
- if (DBGetContactSetting(NULL, ModuleName, "OutputFile", &dbv) == 0)
- {
- RelativePathToAbsolute(dbv.pszVal, notFound, sizeof(notFound));
- }
- else{
- RelativePathToAbsolute("VersionInfo.txt", notFound, sizeof(notFound));
- }
+ if (DBGetContactSettingTString(NULL, ModuleName, "OutputFile", &dbv) == 0)
+ RelativePathToAbsolute(dbv.ptszVal, notFound, SIZEOF(notFound));
+ else
+ RelativePathToAbsolute( _T("VersionInfo.txt"), notFound, SIZEOF(notFound));
if (bFoldersAvailable)
- {
- //FoldersGetCustomPath(hOutputLocation, buffer, sizeof(buffer), "%miranda_path%");
- //strcat(buffer, "\\VersionInfo.txt");
- strcpy(buffer, TranslateTS("Customize using folders plugin"));
- }
- else{
- strncpy(buffer, notFound, sizeof(notFound));
- }
+ _tcscpy(buffer, TranslateT("Customize using folders plugin"));
+ else
+ _tcsncpy(buffer, notFound, SIZEOF(notFound));
SetDlgItemText(hWnd, IDC_FILENAME, buffer);
- char start[256], end[256];
- GetStringFromDatabase("QuoteBegin", "[quote]", start, sizeof(start));
- GetStringFromDatabase("QuoteEnd", "[/quote]", end, sizeof(end));
- sprintf(buffer, "%s | %s", start, end);
+ 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", "[size=1]", start, sizeof(start));
- GetStringFromDatabase("SizeEnd", "[/size]", end, sizeof(end));
- sprintf(buffer, "%s | %s", start, end);
+ 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", "[b]", start, sizeof(start));
- GetStringFromDatabase("BoldEnd", "[/b]", end, sizeof(end));
- sprintf(buffer, "%s | %s", start, end);
+ 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", "vi.cass.cz", buffer, sizeof(buffer));
+ 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);
- _itoa(port, buffer, 10);
+ _itot(port, buffer, 10);
SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
- GetStringFromDatabase("UploadUser", "", buffer, sizeof(buffer));
+ GetStringFromDatabase("UploadUser", _T(""), buffer, SIZEOF(buffer));
SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), buffer);
- GetStringFromDatabase("UploadPassword", "", buffer, sizeof(buffer));
- CallService(MS_DB_CRYPT_DECODESTRING, sizeof(buffer), (LPARAM) 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:
@@ -381,12 +363,10 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case TO_ASK:
CheckDlgButton(hWnd, IDC_ASKEVERYTIME, BST_CHECKED);
-
break;
default:
CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
-
break;
}
@@ -400,21 +380,18 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
- OSVERSIONINFO osvi;
- ZeroMemory(&osvi, sizeof(osvi));
+ OSVERSIONINFO osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(osvi);
GetVersionEx(&osvi);
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
+ 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;
}
@@ -440,7 +417,9 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
case IDC_SHOWUUIDS:
- if (IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) && MessageBox(hWnd, Translate("Are you sure you want to enable this option ?\nPlease only enable this option if you really know what you're doing and what the option is for or if someone asked you to do it."), Translate("Show plugin UUIDs ?"), MB_YESNO | MB_ICONWARNING) == IDNO)
+ 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);
@@ -505,36 +484,22 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case PSN_APPLY:
{
{
- char buffer[1024];
- char start[256], end[256];
- SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ TCHAR buffer[1024];
+ TCHAR start[256], end[256];
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, start, end);
- DBWriteContactSettingString(NULL, ModuleName, "QuoteBegin", start);
- DBWriteContactSettingString(NULL, ModuleName, "QuoteEnd", end);
- SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, start, end);
- DBWriteContactSettingString(NULL, ModuleName, "SizeBegin", start);
- DBWriteContactSettingString(NULL, ModuleName, "SizeEnd", end);
- SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
SplitStringInfo(buffer, start, end);
- DBWriteContactSettingString(NULL, ModuleName, "BoldBegin", start);
- DBWriteContactSettingString(NULL, ModuleName, "BoldEnd", end);
-
- /*//upload server settings
- SendDlgItemMessage(hWnd, IDC_UPLOAD_SERVER, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
- DBWriteContactSettingString(NULL, ModuleName, "UploadServer", buffer);
-
- SendDlgItemMessage(hWnd, IDC_UPLOAD_PORT, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
- int port = atoi(buffer);
- DBWriteContactSettingWord(NULL, ModuleName, "UploadPort", port);
-
- SendDlgItemMessage(hWnd, IDC_UPLOAD_USERNAME, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
- DBWriteContactSettingString(NULL, ModuleName, "UploadUser", buffer);
-
- SendDlgItemMessage(hWnd, IDC_UPLOAD_PASSWORD, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
- CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(buffer), (LPARAM) buffer);
- DBWriteContactSettingString(NULL, ModuleName, "UploadPassword", buffer);*/
+ 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);
@@ -543,14 +508,14 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
DBWriteContactSettingByte(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
DBWriteContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
- char fileName[MAX_PATH]; //absolute
- char filePath[MAX_PATH]; //relative
+ TCHAR fileName[MAX_PATH]; //absolute
+ TCHAR filePath[MAX_PATH]; //relative
if (!bFoldersAvailable)
{
GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
- AbsolutePathToRelative(fileName, filePath, sizeof(filePath));
+ AbsolutePathToRelative(fileName, filePath, SIZEOF(filePath));
- DBWriteContactSettingString(NULL, ModuleName, "OutputFile", filePath); //store relative path
+ DBWriteContactSettingTString(NULL, ModuleName, "OutputFile", filePath); //store relative path
}
DBWriteContactSettingByte(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
//Debug to:
@@ -573,7 +538,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
//Disabled plugins too?
DBWriteContactSettingByte(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
- GetStringFromDatabase("UUIDCharMark", DEF_UUID_CHARMARK, PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+ GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
}
}
}
@@ -612,8 +577,7 @@ INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
lf=*(LOGFONT*)dbv.pbVal;
}
else {
- HFONT hFont;
- hFont=(HFONT)SendDlgItemMessage(hWnd,IDC_CLOSE,WM_GETFONT,0,0);
+ 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);
@@ -643,14 +607,14 @@ INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
//Ok, let's begin, then.
EmptyClipboard();
//Storage data we'll use.
- char text[MAX_TEXT];
+ 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);
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (length + 5)*sizeof( TCHAR ));
//Lock memory, copy it, release it.
lptstrCopy = (LPTSTR)GlobalLock(hData);
- memmove(lptstrCopy, text, length);
+ lstrcpyn(lptstrCopy, text, length);
lptstrCopy[length] = '\0';
GlobalUnlock(hData);
//Now set the clipboard data.
@@ -662,17 +626,15 @@ INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
break;
case IDC_SAVETOFILE:
- char text[MAX_TEXT];
+ TCHAR text[MAX_TEXT];
GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
-
myInfo->PrintInformationsToFile(text);
-
break;
case IDC_UPLOAD:
if (myInfo)
{
- char text[MAX_TEXT];
+ TCHAR text[MAX_TEXT];
GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
myInfo->UploadToSite(text);
}
diff --git a/plugins/Svc_vi/dlgHandlers.h b/plugins/Svc_vi/dlgHandlers.h
index 1c531c231a..bab1876ea2 100644
--- a/plugins/Svc_vi/dlgHandlers.h
+++ b/plugins/Svc_vi/dlgHandlers.h
@@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_VERSIONINFO_DLGHEADERS_H
#define M_VERSIONINFO_DLGHEADERS_H
-#include "common.h"
#include "resource.h"
#include "CVersionInfo.h"
diff --git a/plugins/Svc_vi/hooked_events.cpp b/plugins/Svc_vi/hooked_events.cpp
index b87fa355df..960147bbb9 100644
--- a/plugins/Svc_vi/hooked_events.cpp
+++ b/plugins/Svc_vi/hooked_events.cpp
@@ -18,6 +18,7 @@ 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;
@@ -67,7 +68,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
bFoldersAvailable = ServiceExists(MS_FOLDERS_REGISTER_PATH);
hOutputLocation = FoldersRegisterCustomPath("VersionInfo", "Output folder", "%miranda_path%");
- GetStringFromDatabase("UUIDCharMark", DEF_UUID_CHARMARK, PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+ GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
return 0;
}
@@ -82,7 +83,7 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam)
odp.cbSize = sizeof(odp);
odp.position = 100000000;
odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_VERSIONINFO);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VERSIONINFO);
odp.pszTitle = Translate("Version Information");
odp.pszGroup = Translate("Services");
odp.groupPosition = 910000000;
diff --git a/plugins/Svc_vi/hooked_events.h b/plugins/Svc_vi/hooked_events.h
index 3c972fe014..b75b5e59a8 100644
--- a/plugins/Svc_vi/hooked_events.h
+++ b/plugins/Svc_vi/hooked_events.h
@@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_VERSIONINFO_HOOKED_EVENTS_H
#define M_VERSIONINFO_HOOKED_EVENTS_H
-#include "common.h"
-
extern HANDLE hModulesLoaded;
extern HANDLE hOptionsInitialise;
diff --git a/plugins/Svc_vi/main.cpp b/plugins/Svc_vi/main.cpp
index 8de6b6ef2c..530b6fe487 100644
--- a/plugins/Svc_vi/main.cpp
+++ b/plugins/Svc_vi/main.cpp
@@ -30,7 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HINSTANCE hInst;
PLUGINLINK *pluginLink;
int hLangpack;
-struct MM_INTERFACE mmi;
+MM_INTERFACE mmi;
+UTF8_INTERFACE utfi;
HICON hiVIIcon;
@@ -98,6 +99,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
pluginLink=link;
mir_getLP(&pluginInfo);
mir_getMMI(&mmi);
+ mir_getUTFI(&utfi);
LogToFile("Initialising services ...");
InitServices();
@@ -107,11 +109,11 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
hiVIIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
//get the name of the dll itself
- char filePath[512] = {0};
- GetModuleFileName(hInst, filePath, sizeof(filePath));
- char *fileName = NULL;
- size_t i = strlen(filePath) - 1;
- _strlwr(filePath);
+ 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--; }
@@ -120,11 +122,11 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
filePath[i] = 0;
fileName = filePath + i + 1;
- if (strstr(fileName, "svc_") != fileName)
+ if (_tcsstr(fileName, _T("svc_")) != fileName)
{
- char buffer[1024];
- mir_snprintf(buffer, sizeof(buffer), "Please rename the plugin '%s' to 'svc_vi.dll' to enable service mode functionality.", fileName);
- MessageBox(NULL, TranslateTS(buffer), Translate("Version Information"), MB_OK | MB_ICONEXCLAMATION);
+ 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);
}
}
@@ -133,7 +135,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
LogToFile("creating menu item ...");
CLISTMENUITEM mi = { 0 };
-
mi.cbSize = sizeof(mi);
mi.position = mi.popupPosition = 2000089999;
mi.flags = 0;
@@ -147,18 +148,8 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
// CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
}
LogToFile("Check riched32.dll ...");
- if (LoadLibrary("RichEd32.dll") == NULL) {
- MessageBox(NULL, "d'oh", "d'oh", MB_OK);
- }
-
- //get miranda's malloc, realloc and free functions
- LogToFile("Get miranda memory functions ...");
- MM_INTERFACE mmInterface;
- mmInterface.cbSize = sizeof(MM_INTERFACE);
- CallService(MS_SYSTEM_GET_MMI, 0, (LPARAM) &mmInterface);
- MirandaFree = mmInterface.mmi_free;
- MirandaMalloc = mmInterface.mmi_malloc;
- MirandaRealloc = mmInterface.mmi_realloc;
+ if (LoadLibraryA("RichEd32.dll") == NULL)
+ MessageBoxA(NULL, "d'oh", "d'oh", MB_OK);
LogToFile("Leaving %s", __FUNCTION__);
return 0;
diff --git a/plugins/Svc_vi/services.cpp b/plugins/Svc_vi/services.cpp
index 3e137abf7c..4efa482404 100644
--- a/plugins/Svc_vi/services.cpp
+++ b/plugins/Svc_vi/services.cpp
@@ -18,6 +18,7 @@ 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;
@@ -55,19 +56,15 @@ INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam)
INT_PTR GetInfoService(WPARAM wParam, LPARAM lParam)
{
int result = 1; //failure
- if (lParam != NULL)
- {
- CVersionInfo myInfo;
- myInfo.Initialize();
- std::string VI = myInfo.GetInformationsAsString(wParam);
- char **retData = (char **) lParam;
- (*retData) = (char *) MirandaMalloc(VI.size() + 1);
- if (retData)
- {
- strcpy(*retData, VI.c_str());
- result = 0; //success
- }
- }
+ 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;
}
@@ -75,6 +72,5 @@ INT_PTR ServiceModeService(WPARAM wParam, LPARAM lParam)
{
bServiceMode = 1;
DoDebugTo(TO_ASK);
-
return 0;
}
diff --git a/plugins/Svc_vi/services.h b/plugins/Svc_vi/services.h
index 00bb262acd..38acbc7731 100644
--- a/plugins/Svc_vi/services.h
+++ b/plugins/Svc_vi/services.h
@@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_VERSIONINFO_SERVICES_H
#define M_VERSIONINFO_SERVICES_H
-#include "common.h"
-
int InitServices();
int DestroyServices();
diff --git a/plugins/Svc_vi/utils.cpp b/plugins/Svc_vi/utils.cpp
index 182ea441c1..4e74f9ee13 100644
--- a/plugins/Svc_vi/utils.cpp
+++ b/plugins/Svc_vi/utils.cpp
@@ -23,13 +23,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define STRICT
#define WIN32_LEAN_AND_MEAN
+#include "common.h"
#include "utils.h"
/*
My usual MessageBoxes :-)
*/
void MB(char* message) {
- if (verbose) MessageBox(NULL, message, ModuleName, MB_OK | MB_ICONEXCLAMATION);
+ if (verbose) MessageBoxA(NULL, message, ModuleName, MB_OK | MB_ICONEXCLAMATION);
}
void Log(char* message) {
@@ -42,83 +43,69 @@ void Log(char* message) {
PUAddPopUp(&pu);
}
else {
- MessageBox(NULL, message, ModuleName, MB_OK | MB_ICONINFORMATION);
+ MessageBoxA(NULL, message, ModuleName, MB_OK | MB_ICONINFORMATION);
}
}
-int SplitStringInfo(const char *szWholeText, char *szStartText, char *szEndText)
+int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText)
{
- const char *pos = strchr(szWholeText, '|');
- if (pos)
- {
- size_t index = pos - szWholeText;
- memmove(szStartText, szWholeText, index);
- szStartText[index] = '\0';
- StrTrim(szStartText, " ");
- memmove(szEndText, pos + 1, strlen(pos)); //copies the \0 as well ... :)
- StrTrim(szEndText, " ");
- }
- else{
- szStartText[0] = szEndText[0] = '\0';
- }
+ const TCHAR *pos = _tcschr(szWholeText, '|');
+ if (pos) {
+ size_t index = pos - szWholeText;
+ lstrcpyn(szStartText, szWholeText, index);
+ szStartText[index] = '\0';
+ StrTrim(szStartText, _T(" "));
+ lstrcpyn(szEndText, pos + 1, _tcslen(pos)); //copies the \0 as well ... :)
+ StrTrim(szEndText, _T(" "));
+ }
+ else szStartText[0] = szEndText[0] = '\0';
+
return 0;
}
-int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size)
+int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, size_t size)
{
DBVARIANT dbv = {0};
int res = 1;
size_t len;
- dbv.type = DBVT_ASCIIZ;
- if (DBGetContactSetting(NULL, ModuleName, szSettingName, &dbv) == 0)
- {
- res = 0;
- size_t tmp = strlen(dbv.pszVal);
- len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, dbv.pszVal, len);
- szResult[len] = '\0';
- MirandaFree(dbv.pszVal);
- }
- else{
- res = 1;
- size_t tmp = strlen(szError);
- len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, szError, len);
- szResult[len] = '\0';
- }
+ 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;
}
-char *RelativePathToAbsolute(char *szRelative, char *szAbsolute, size_t size)
+TCHAR *RelativePathToAbsolute(TCHAR *szRelative, TCHAR *szAbsolute, size_t size)
{
- size_t len;
-
- if (size < MAX_PATH)
- {
- char buffer[MAX_PATH]; //new path should be at least MAX_PATH chars
- len = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) szRelative, (LPARAM) buffer);
- strncpy(szAbsolute, buffer, size);
- }
- else{
- len = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) szRelative, (LPARAM) szAbsolute);
- }
+ 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;
}
-char *AbsolutePathToRelative(char *szAbsolute, char *szRelative, size_t size)
+TCHAR *AbsolutePathToRelative(TCHAR *szAbsolute, TCHAR *szRelative, size_t size)
{
- size_t len;
-
- if (size < MAX_PATH)
- {
- char buffer[MAX_PATH];
- len = CallService(MS_UTILS_PATHTORELATIVE, (WPARAM) szAbsolute, (LPARAM) szRelative);
- strncpy(szRelative, buffer, size);
- }
- else{
- len = CallService(MS_UTILS_PATHTORELATIVE, (WPARAM) szAbsolute, (LPARAM) szRelative);
- }
+ 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;
}
@@ -169,41 +156,36 @@ void LogToFile(char *format, ...)
#define GetFacility(dwError) (HIWORD(dwError) && 0x0000111111111111)
#define GetErrorCode(dwError) (LOWORD(dwError))
-void NotifyError(DWORD dwError, char* szSetting, int iLine) {
+void NotifyError(DWORD dwError, char* szSetting, int iLine)
+{
char str[1024];
- mir_snprintf(str, sizeof(str), Translate("Ok, something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d"), szSetting, GetFacility(dwError), GetErrorCode(dwError), iLine);
+ mir_snprintf(str, SIZEOF(str), Translate("Ok, something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d"), szSetting, GetFacility(dwError), GetErrorCode(dwError), iLine);
Log(str);
}
-char *StrTrim(char *szText, const char *szTrimChars)
+TCHAR *StrTrim(TCHAR *szText, const TCHAR *szTrimChars)
{
- size_t i = strlen(szText) - 1;
- while ((i >= 0) && (strchr(szTrimChars, szText[i])))
- {
- szText[i--] = '\0';
- }
+ size_t i = _tcslen(szText) - 1;
+ while (i >= 0 && _tcschr(szTrimChars, szText[i]))
+ szText[i--] = '\0';
+
i = 0;
- while (((unsigned int )i < strlen(szText)) && (strchr(szTrimChars, szText[i])))
- {
- i++;
- }
- if (i)
- {
- size_t size = strlen(szText);
- size_t j;
- for (j = i; j <= size; j++) //shift the \0 as well
- {
- szText[j - i] = szText[j];
- }
-// memmove(szText, szText + i, size - i + 1); //copy the string without the first i characters
- }
+ 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 = LoadLibraryEx(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ dllHandle = LoadLibraryExA(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES);
if (dllHandle)
{
FreeLibrary(dllHandle);
@@ -213,33 +195,32 @@ bool DoesDllExist(char *dllName)
}
//========== From Cyreve ==========
-PLUGININFOEX *GetPluginInfo(const char *filename,HINSTANCE *hPlugin)
+PLUGININFOEX *GetPluginInfo(const TCHAR *filename,HINSTANCE *hPlugin)
{
- char szMirandaPath[MAX_PATH],szPluginPath[MAX_PATH];
- char *str2;
+ 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));
- str2=strrchr(szMirandaPath,'\\');
+ GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
+ TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
if(str2!=NULL) *str2=0;
- hLoadedModule=GetModuleHandle(filename);
+ hLoadedModule = GetModuleHandle(filename);
if(hLoadedModule!=NULL) {
*hPlugin=NULL;
MirandaPluginInfo=(PLUGININFOEX *(*)(DWORD))GetProcAddress(hLoadedModule,"MirandaPluginInfo");
return MirandaPluginInfo(mirandaVersion);
}
- wsprintf(szPluginPath,"%s\\Plugins\\%s",szMirandaPath,filename);
+ 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;}
+ if(pPlugInfo->cbSize != sizeof(PLUGININFOEX)) {FreeLibrary(*hPlugin); *hPlugin=NULL; return NULL;}
return pPlugInfo;
}
@@ -265,9 +246,9 @@ void TimeStampToSysTime(DWORD Unix,SYSTEMTIME* SysTime)
FileTimeToSystemTime((FILETIME*)&FileReal,SysTime);
}
-void GetModuleTimeStamp(char* pszDate, char* pszTime)
+void GetModuleTimeStamp(TCHAR* pszDate, TCHAR* pszTime)
{
- char date[128],time[128],szModule[MAX_PATH];
+ TCHAR date[128],time[128],szModule[MAX_PATH];
HANDLE mapfile,file;
DWORD timestamp,filesize;
LPVOID mapmem;
@@ -279,8 +260,8 @@ void GetModuleTimeStamp(char* pszDate, char* pszTime)
mapmem = MapViewOfFile(mapfile, FILE_MAP_READ, 0, 0, 0);
timestamp = GetTimestampForLoadedLibrary((HINSTANCE)mapmem);
TimeStampToSysTime(timestamp,&systime);
- GetTimeFormat(LOCALE_USER_DEFAULT,0,&systime,"HH':'mm':'ss",time,128);
- GetDateFormat(EnglishLocale,0,&systime,"dd' 'MMMM' 'yyyy",date,128);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, _T("HH':'mm':'ss"), time, 128);
+ GetDateFormat(EnglishLocale, 0, &systime, _T("dd' 'MMMM' 'yyyy"), date, 128);
//MessageBox(NULL,date,time,0);
lstrcpy(pszTime, time);
lstrcpy(pszDate, date);
@@ -463,131 +444,123 @@ BOOL IsCurrentUserLocalAdministrator(void)
return fReturn;
}
-BOOL GetWindowsShell(char *shellPath, size_t shSize)
+BOOL GetWindowsShell(TCHAR *shellPath, size_t shSize)
{
OSVERSIONINFO vi = {0};
vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&vi);
- char szShell[1024] = {0};
- DWORD size = sizeof(szShell);
+ TCHAR szShell[1024] = {0};
+ DWORD size = SIZEOF(szShell);
if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
HKEY hKey;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\system.ini\\boot", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\system.ini\\boot"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
- RegQueryValueEx(hKey, "Shell", NULL, NULL, (LPBYTE) szShell, &size);
- _strlwr(szShell);
- HKEY hRootKey = (strstr(szShell, "sys:") == szShell) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ 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);
- strcpy(szShell, "<unknown>");
- if (RegOpenKeyEx(hRootKey, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ _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, "Shell", NULL, NULL, (LPBYTE) szShell, &size);
+ size = SIZEOF(szShell);
+ RegQueryValueEx(hKey, _T("Shell"), NULL, NULL, (LPBYTE) szShell, &size);
RegCloseKey(hKey);
}
}
}
else{
- char szSystemIniPath[2048];
- GetWindowsDirectory(szSystemIniPath, sizeof(szSystemIniPath));
- size_t len = strlen(szSystemIniPath);
+ TCHAR szSystemIniPath[2048];
+ GetWindowsDirectory(szSystemIniPath, SIZEOF(szSystemIniPath));
+ size_t len = lstrlen(szSystemIniPath);
if (len > 0)
{
if (szSystemIniPath[len - 1] == '\\') { szSystemIniPath[--len] = '\0'; }
- strcat(szSystemIniPath, "\\system.ini");
- GetPrivateProfileString("boot", "shell", "<unknown>", szShell, size, szSystemIniPath);
+ _tcscat(szSystemIniPath, _T("\\system.ini"));
+ GetPrivateProfileString( _T("boot"), _T("shell"), _T("<unknown>"), szShell, size, szSystemIniPath);
}
}
- char *pos = strrchr(szShell, '\\');
- char *res = (pos) ? pos + 1 : szShell;
- strncpy(shellPath, res, shSize);
+ TCHAR *pos = _tcsrchr(szShell, '\\');
+ TCHAR *res = (pos) ? pos + 1 : szShell;
+ _tcsncpy(shellPath, res, shSize);
return TRUE;
}
-BOOL GetInternetExplorerVersion(char *ieVersion, size_t ieSize)
+BOOL GetInternetExplorerVersion(TCHAR *ieVersion, size_t ieSize)
{
HKEY hKey;
- char ieVer[1024];
- DWORD size = sizeof(ieVer);
- char ieBuild[64] = {0};
+ TCHAR ieVer[1024];
+ DWORD size = SIZEOF(ieVer);
+ TCHAR ieBuild[64] = {0};
- strncpy(ieVer, "<not installed>", size);
+ _tcsncpy(ieVer, _T("<not installed>"), size);
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Internet Explorer", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Internet Explorer"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
- if (RegQueryValueEx(hKey, "Version", NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
+ if (RegQueryValueEx(hKey, _T("Version"), NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
{
- char *pos = strchr(ieVer, '.');
+ TCHAR *pos = _tcschr(ieVer, '.');
if (pos)
{
- pos = strchr(pos + 1, '.');
+ pos = _tcschr(pos + 1, '.');
if (pos) { *pos = 0; }
- strncpy(ieBuild, pos + 1, sizeof(ieBuild));
- pos = strchr(ieBuild, '.');
+ _tcsncpy(ieBuild, pos + 1, SIZEOF(ieBuild));
+ pos = _tcschr(ieBuild, '.');
if (pos) { *pos = 0; }
}
}
else{
- size = sizeof(ieVer);
- if (RegQueryValueEx(hKey, "Build", NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
+ size = SIZEOF(ieVer);
+ if (RegQueryValueEx(hKey, _T("Build"), NULL, NULL, (LPBYTE) ieVer, &size) == ERROR_SUCCESS)
{
- char *pos = ieVer + 1;
- strncpy(ieBuild, pos, sizeof(ieBuild));
+ TCHAR *pos = ieVer + 1;
+ _tcsncpy(ieBuild, pos, SIZEOF(ieBuild));
*pos = 0;
- pos = strchr(ieBuild, '.');
+ pos = _tcschr(ieBuild, '.');
if (pos) { *pos = 0; }
}
else{
- strncpy(ieVer, "<unknown version>", size);
+ _tcsncpy(ieVer, _T("<unknown version>"), size);
}
}
RegCloseKey(hKey);
}
- strncpy(ieVersion, ieVer, ieSize);
- if (strlen(ieBuild) > 0)
+ _tcsncpy(ieVersion, ieVer, ieSize);
+ if ( ieBuild[0] )
{
- strncat(ieVersion, ".", ieSize);
- strncat(ieVersion, ieBuild, ieSize);
- //strncat(ieVersion, ")", ieSize);
+ _tcsncat(ieVersion, _T("."), ieSize);
+ _tcsncat(ieVersion, ieBuild, ieSize);
}
return TRUE;
}
-char *GetLanguageName(LANGID language)
+TCHAR *GetLanguageName(LANGID language)
{
-
LCID lc = MAKELCID(language, SORT_DEFAULT);
-
return GetLanguageName(lc);
}
-extern char *GetLanguageName(LCID locale)
+extern TCHAR *GetLanguageName(LCID locale)
{
- static char name[1024];
-
- GetLocaleInfo(locale, LOCALE_SENGLANGUAGE, name, sizeof(name));
-
+ static TCHAR name[1024];
+ GetLocaleInfo(locale, LOCALE_SENGLANGUAGE, name, SIZEOF(name));
return name;
}
-BOOL UUIDToString(MUUID uuid, char *str, size_t len)
+BOOL UUIDToString(MUUID uuid, TCHAR *str, size_t len)
{
- if ((len < sizeof(MUUID)) || (!str))
- {
+ if ( len < sizeof(MUUID) || !str )
return 0;
- }
-
- mir_snprintf(str, len, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", uuid.a, uuid.b, uuid.c, uuid.d[0], uuid.d[1], uuid.d[2], uuid.d[3], uuid.d[4], uuid.d[5], uuid.d[6], uuid.d[7]);
+ 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;
}
diff --git a/plugins/Svc_vi/utils.h b/plugins/Svc_vi/utils.h
index ef2b29ba59..eb28ce6146 100644
--- a/plugins/Svc_vi/utils.h
+++ b/plugins/Svc_vi/utils.h
@@ -6,7 +6,7 @@
//utils.cpp
void MB(char*);
void Log(char*);
-char *StrTrim(char *, const char *);
+TCHAR *StrTrim(TCHAR *, const TCHAR *);
//logging functions
//utils.cpp
@@ -14,22 +14,22 @@ void LogToFileInit();
void LogToFile(char *format, ...);
//utils.cpp
-char *RelativePathToAbsolute(char *szRelative, char *szAbsolute, size_t size);
-char *AbsolutePathToRelative(char *szAbsolute, char *szRelative, size_t size);
+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, char *szError, char *szResult, size_t size);
+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 char *szWholeText, char *szStartText, char *szEndText);
+int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText);
//utils.cpp
bool DoesDllExist(char *dllName);
//utils.cpp
-void GetModuleTimeStamp(char*, char*);
+void GetModuleTimeStamp(TCHAR*, TCHAR*);
void NotifyError(DWORD, char*, int);
//utils.cpp
@@ -41,13 +41,13 @@ void FreePluginInfo(PLUGININFOEX *);
BOOL IsCurrentUserLocalAdministrator();
-char *GetLanguageName(LANGID language);
-char *GetLanguageName(LCID locale);
+TCHAR *GetLanguageName(LANGID language);
+TCHAR *GetLanguageName(LCID locale);
-BOOL GetWindowsShell(char *shellPath, size_t shSize);
-BOOL GetInternetExplorerVersion(char *ieVersion, size_t ieSize);
+BOOL GetWindowsShell(TCHAR *shellPath, size_t shSize);
+BOOL GetInternetExplorerVersion(TCHAR *ieVersion, size_t ieSize);
-BOOL UUIDToString(MUUID uuid, char *str, size_t len);
+BOOL UUIDToString(MUUID uuid, TCHAR *str, size_t len);
BOOL IsUUIDNull(MUUID uuid);