diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CSList/src/cslist.cpp | 17 | ||||
-rw-r--r-- | plugins/ContactsPlus/src/main.cpp | 29 | ||||
-rw-r--r-- | plugins/Popup/src/main.cpp | 7 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 39 | ||||
-rw-r--r-- | plugins/SecureIM/src/main.cpp | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Utils.cpp | 15 | ||||
-rw-r--r-- | plugins/SmileyAdd/src/main.cpp | 33 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/init.cpp | 9 | ||||
-rw-r--r-- | plugins/Utils/mir_memory.h | 11 | ||||
-rw-r--r-- | plugins/VersionInfo/src/CVersionInfo.cpp | 109 | ||||
-rw-r--r-- | plugins/helpers/gen_helpers.cpp | 39 |
11 files changed, 117 insertions, 197 deletions
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index b8078ae1be..f4ff862e9c 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -29,7 +29,7 @@ Last change on : $Date$
Last change by : $Author$
- ============================================================================
+ ============================================================================
DESCRIPTION:
@@ -98,14 +98,7 @@ extern "C" __declspec( dllexport ) int Load( ) CSList::bAccountsSupported = ( CSList::dwMirandaVersion >= PLUGIN_MAKE_VERSION( 0, 8, 0, 9 ));
// are we running under Unicode core?
- {
- char szVer[MAX_PATH];
-
- CallService( MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, ( LPARAM )szVer );
- _strlwr( szVer ); // make sure it is lowercase
-
- CSList::bUnicodeCore = ( strstr( szVer, "unicode" ) != NULL );
- }
+ CSList::bUnicodeCore = true;
// TODO: Alerts with wrong combination of ANSI/Unicode Windows/core/plugin
@@ -682,7 +675,7 @@ CSAMWindow::CSAMWindow( WORD action, CSWindow* parent ) this->parent = parent;
this->bChanged = FALSE;
this->hCombo = this->hMessage = NULL;
-
+
if ( this->action == IDC_ADD )
this->item = new StatusItem( );
else
@@ -1185,8 +1178,8 @@ INT_PTR CALLBACK CSWindowProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp csw->listview->reinitItems( csw->itemslist->list->getListHead( ));
break;
- case IDCLOSE: // close and save, no custom status
- case IDCANCEL: // close and save, no custom status
+ case IDCLOSE: // close and save, no custom status
+ case IDCANCEL: // close and save, no custom status
case IDC_CANCEL: // close and save, cancel custom status
case IDOK: // close and save, set selected custom status
if ( LOWORD( wparam ) == IDOK && csw->toggleButtons( ))
diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index a053bb26cf..f115e79b2b 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -1,20 +1,20 @@ // --------------------------------------------------------------------------
// Contacts+ for Miranda Instant Messenger
// _______________________________________
-//
-// Copyright © 2002 Dominus Procellarum
+//
+// Copyright © 2002 Dominus Procellarum
// Copyright © 2004-2008 Joe Kucera
-//
+//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -113,15 +113,15 @@ static void ProcessUnreadEvents(void) dbei.cbSize = sizeof(dbei);
hContact = SRCFindFirstContact();
- while (hContact)
+ while (hContact)
{
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD,(WPARAM)hContact,0);
- while (hDbEvent)
+ while (hDbEvent)
{
dbei.cbBlob=0;
CallService(MS_DB_EVENT_GET,(WPARAM)hDbEvent,(LPARAM)&dbei);
- if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_CONTACTS)
+ if (!(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType==EVENTTYPE_CONTACTS)
{ //process the event
HookDBEventAdded((WPARAM)hContact, (LPARAM)hDbEvent);
}
@@ -196,7 +196,7 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) mi.flags = CMIF_KEEPUNTRANSLATED;
if (g_UnicodeCore)
mi.flags |= CMIF_UNICODE;
- mi.pszService = MS_CONTACTS_SEND;
+ mi.pszService = MS_CONTACTS_SEND;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS));
hContactMenuItem = Menu_AddContactMenuItem(&mi);
@@ -229,7 +229,7 @@ static int HookContactDeleted(WPARAM wParam, LPARAM lParam) { // if our contact gets deleted close his window
HWND h = WindowList_Find(ghSendWindowList,(HANDLE)wParam);
- if (h)
+ if (h)
{
SendMessageT(h,WM_CLOSE,0,0);
}
@@ -269,7 +269,7 @@ static INT_PTR ServiceReceiveCommand(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- return &pluginInfo;
+ return &pluginInfo;
}
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SRCONTACTS, MIID_LAST};
@@ -280,13 +280,8 @@ extern "C" __declspec(dllexport) int Load(void) InitCommonControls();
InitI18N();
- { // Are we running under unicode Miranda core ?
- char szVer[MAX_PATH];
+ g_UnicodeCore = true;
- CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVer);
- _strlwr(szVer);
- g_UnicodeCore = (strstr(szVer, "unicode") != NULL);
- }
//init hooks
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, HookModulesLoaded);
hHookDBEventAdded = HookEvent(ME_DB_EVENT_ADDED, HookDBEventAdded);
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index ea60c4dd7e..1c4e90b13c 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -425,13 +425,8 @@ static int OkToExit(WPARAM wParam, LPARAM lParam) //Called when the plugin is loaded into Miranda
MIRAPI int Load(void)
{
- char ver[1024];
-
-
g_popup.isOsUnicode = (GetVersion() & 0x80000000) == 0;
-
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver);
- g_popup.isMirUnicode = strstr(ver, "Unicode") != NULL;
+ g_popup.isMirUnicode = true;
hGetStatus = CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus);
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 3551119adc..6c7de9de2b 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -148,15 +148,10 @@ enum MIMFLAGS { };
int IsUnicodeMIM() {
- if (!(mimFlags & MIM_CHECKED)) {
- char str[512];
- mimFlags = MIM_CHECKED;
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)500, (LPARAM)(char*)str);
- if (strstr(str, "Unicode")) {
- mimFlags |= MIM_UNICODE;
- }
- }
- return (mimFlags & MIM_UNICODE) != 0;
+ if (!(mimFlags & MIM_CHECKED))
+ mimFlags = MIM_CHECKED | MIM_UNICODE;
+
+ return TRUE;
}
const char *filename = "scriver.log";
@@ -283,7 +278,7 @@ char* GetRichTextRTF(HWND hwnd) return pszText; // pszText contains the text
}
-void rtrimText(TCHAR *text)
+void rtrimText(TCHAR *text)
{
static TCHAR szTrimString[] = _T(":;,.!?\'\"><()[]- \r\n");
int iLen = lstrlen(text)-1;
@@ -296,7 +291,7 @@ void rtrimText(TCHAR *text) TCHAR *limitText(TCHAR *text, int limit)
{
int len = lstrlen(text);
- if (len > g_dat->limitNamesLength)
+ if (len > g_dat->limitNamesLength)
{
TCHAR *ptszTemp = (TCHAR *)mir_alloc(sizeof(TCHAR) * (limit + 4));
_tcsncpy(ptszTemp, text, limit + 1);
@@ -312,11 +307,11 @@ TCHAR *GetRichTextWord(HWND hwnd, POINTL *ptl) pszWord = GetRichEditSelection(hwnd);
if (pszWord == NULL) {
iCharIndex = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)ptl);
- if (iCharIndex >= 0)
+ if (iCharIndex >= 0)
{
start = SendMessage(hwnd, EM_FINDWORDBREAK, WB_LEFT, iCharIndex);//-iChars;
end = SendMessage(hwnd, EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);//-iChars;
- if (end - start > 0)
+ if (end - start > 0)
{
TEXTRANGE tr;
CHARRANGE cr;
@@ -327,7 +322,7 @@ TCHAR *GetRichTextWord(HWND hwnd, POINTL *ptl) tr.chrg = cr;
tr.lpstrText = pszWord;
iRes = SendMessage(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- if (iRes <= 0)
+ if (iRes <= 0)
{
mir_free(pszWord);
pszWord = NULL;
@@ -335,7 +330,7 @@ TCHAR *GetRichTextWord(HWND hwnd, POINTL *ptl) }
}
}
- if (pszWord != NULL)
+ if (pszWord != NULL)
{
rtrimText(pszWord);
}
@@ -353,7 +348,7 @@ static DWORD CALLBACK StreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG return 0;
}
-TCHAR *GetRichEditSelection(HWND hwnd)
+TCHAR *GetRichEditSelection(HWND hwnd)
{
CHARRANGE sel;
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
@@ -467,11 +462,11 @@ char *url_encode(char *str) { if ( (48 <= *pstr && *pstr <= 57) ||//0-9
(65 <= *pstr && *pstr <= 90) ||//ABC...XYZ
(97 <= *pstr && *pstr <= 122) ||//abc...xyz
- *pstr == '-' || *pstr == '_' || *pstr == '.')
+ *pstr == '-' || *pstr == '_' || *pstr == '.')
*pbuf++ = *pstr;
- else if (*pstr == ' ')
+ else if (*pstr == ' ')
*pbuf++ = '+';
- else
+ else
*pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15);
pstr++;
}
@@ -560,7 +555,7 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT* rec HWND hwndTT;
hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX,
+ WS_POPUP | TTS_NOPREFIX,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwndParent, NULL, g_hInst, NULL);
@@ -575,7 +570,7 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT* rec SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
SendMessage(hwndTT, TTM_SETTITLE, TTI_NONE, (LPARAM)ptszTitle);
return hwndTT;
-}
+}
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle) {
TOOLINFO ti = { 0 };
@@ -595,7 +590,7 @@ void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect) ti.hwnd = hwndParent;
ti.rect = *rect;
SendMessage(hwndTT, TTM_NEWTOOLRECT, 0, (LPARAM) (LPTOOLINFO) &ti);
-}
+}
/* toolbar-related stuff, to be moved to a separate file */
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 205a025ffe..f867591b3b 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -114,11 +114,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) if (bIsComCtl6) iBmpDepth = ILC_COLOR32 | ILC_MASK; // 32-bit images are supported
else iBmpDepth = ILC_COLOR24 | ILC_MASK;
-// iBmpDepth = ILC_COLOR32 | ILC_MASK;
-
- char version[512];
- CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(version), (LPARAM)&version);
- bCoreUnicode = strstr(version, "Unicode")!=0;
+ bCoreUnicode = true;
iCoreVersion = CallService(MS_SYSTEM_GETVERSION,0,0);
// load crypo++ dll
diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index f1b7251fd7..12fa58d369 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -1,7 +1,7 @@ /*
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
This file is part of Send Screenshot Plus, a Miranda IM plugin.
Copyright (c) 2010 Ing.U.Horn
@@ -176,7 +176,7 @@ FIBITMAP* CaptureScreen (HDC hDC, SIZE size, HWND hCapture) { }
dib = FIP->FI_CreateDIBFromHBITMAP(hBitmap);
-
+
//alpha channel from window is always wrong,
//coz GDI do not draw all in alpha mode.
//we have to create our own new alpha channel.
@@ -309,7 +309,7 @@ FIBITMAP* CaptureDesktop/*emulate print screen*/() { int i = 0;
keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
- do {//Clipboard need time to get bitmap from keybd_event,
+ do {//Clipboard need time to get bitmap from keybd_event,
i++; //we use a counter to get this time.
bBitmap = IsClipboardFormatAvailable(CF_BITMAP);
if(i == 500) return (FIBITMAP*)0; //emergency exit if something go wrong
@@ -410,9 +410,7 @@ BOOL GetLmouse() { //---------------------------------------------------------------------------
//is miranda unicode
BOOL mir_is_unicode() {
- char ver[1024];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver);
- return strstr(ver, "Unicode") != NULL;
+ return TRUE;
}
//---------------------------------------------------------------------------
@@ -544,11 +542,11 @@ INT_PTR SaveTIF(HBITMAP hBmp, LPTSTR szFilename) { EncParams->Count = 2 ;
EncParams->Parameter[0].Guid = Gdiplus::EncoderCompression ;
EncParams->Parameter[0].Type = Gdiplus::EncoderParameterValueTypeLong ;
- EncParams->Parameter[0].NumberOfValues = 1 ;
+ EncParams->Parameter[0].NumberOfValues = 1 ;
EncParams->Parameter[0].Value = &ulCompression ;
EncParams->Parameter[1].Guid = Gdiplus::EncoderColorDepth ;
EncParams->Parameter[1].Type = Gdiplus::EncoderParameterValueTypeLong ;
- EncParams->Parameter[1].NumberOfValues = 1 ;
+ EncParams->Parameter[1].NumberOfValues = 1 ;
EncParams->Parameter[1].Value = &ulColorDepth ;
LPWSTR pswFile = mir_t2u(szFilename);
@@ -576,4 +574,3 @@ void ShowPopUp(char *title, char *text) { CallService(MS_POPUP_ADDPOPUP, (WPARAM)&pude, 0);
}*/
-
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index d4be17b804..4165553cad 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -41,9 +41,9 @@ static HANDLE hService[13]; int hLangpack;
-static const PLUGININFOEX pluginInfoEx =
+static const PLUGININFOEX pluginInfoEx =
{
- sizeof(PLUGININFOEX),
+ sizeof(PLUGININFOEX),
"SmileyAdd",
__VERSION_DWORD,
"Smiley support for Miranda Instant Messanger",
@@ -57,14 +57,14 @@ static const PLUGININFOEX pluginInfoEx = { 0xbd542bb4, 0x5ae4, 0x4d0e, { 0xa4, 0x35, 0xba, 0x8d, 0xbe, 0x39, 0x60, 0x7f } }
};
-static SKINICONDESC skinDesc =
-{
- sizeof(SKINICONDESC), "SmileyAdd", NULL,
- "SmileyAdd_ButtonSmiley", NULL, -IDI_SMILINGICON
+static SKINICONDESC skinDesc =
+{
+ sizeof(SKINICONDESC), "SmileyAdd", NULL,
+ "SmileyAdd_ButtonSmiley", NULL, -IDI_SMILINGICON
};
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /* mirandaVersion */)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /* mirandaVersion */)
{
return (PLUGININFOEX*)&pluginInfoEx;
}
@@ -82,7 +82,7 @@ static int ModulesLoaded(WPARAM, LPARAM) HANDLE hSkinIcon = Skin_AddIcon(&skinDesc);
INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp);
+ metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp);
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
@@ -97,7 +97,7 @@ static int ModulesLoaded(WPARAM, LPARAM) DownloadInit();
//install hooks if enabled
- InstallDialogBoxHook();
+ InstallDialogBoxHook();
g_SmileyCategories.AddAllProtocolsAsCategory();
g_SmileyCategories.ClearAndLoadAll();
@@ -119,23 +119,12 @@ extern "C" __declspec(dllexport) int Load(void) if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS))
{
static const TCHAR errmsg[] = _T("Only one instance of SmileyAdd could be executed.\n")
- _T("Remove duplicate instances from 'Plugins' directory");
+ _T("Remove duplicate instances from 'Plugins' directory");
ReportError(TranslateTS(errmsg));
return 1;
}
- char temp[80];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(temp), (LPARAM)temp);
-
-
- if (strstr(temp, "Unicode") == NULL)
- {
- ReportError(TranslateT("Please update SmileyAdd to ANSI Version"));
- return 1;
- }
-
-
InitImageCache();
g_SmileyCategories.SetSmileyPackStore(&g_SmileyPacks);
@@ -165,7 +154,7 @@ extern "C" __declspec(dllexport) int Load(void) hService[8] = CreateServiceFunction(MS_SMILEYADD_BATCHFREE, FreeTextBatch);
hService[9] = CreateServiceFunction(MS_SMILEYADD_CUSTOMCATMENU, CustomCatMenu);
hService[10] = CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack);
- hService[11] = CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys);
+ hService[11] = CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys);
hService[12] = CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW);
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 3b7b0b8249..71c88a53ca 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -164,19 +164,12 @@ static INT OnShutdown(WPARAM wParam, LPARAM lParam) static BOOL CoreCheck()
{
BOOL bOk = TRUE;
- CHAR szVer[260];
- TCHAR tszExePath[1024];
+ TCHAR tszExePath[1024];
GetModuleFileName(GetModuleHandle(NULL), tszExePath, SIZEOF(tszExePath));
- CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(szVer), (LPARAM)szVer);
-
- strlwr(szVer);
_tcslwr(tszExePath);
-
bOk *= (GetVersion() & 0x80000000) == 0;
- bOk *= strstr(szVer, "unicode") != 0;
-
bOk *= _tcsstr(_tcsrchr(tszExePath, '\\'), _T("miranda")) != 0;
bOk *= !strstr(szVer, "coffee") && strncmp(szVer, "1.", 2) && !strstr(szVer, " 1.");
diff --git a/plugins/Utils/mir_memory.h b/plugins/Utils/mir_memory.h index 678972805c..d62f4833f3 100644 --- a/plugins/Utils/mir_memory.h +++ b/plugins/Utils/mir_memory.h @@ -27,18 +27,11 @@ Boston, MA 02111-1307, USA. static BOOL mir_is_unicode()
{
- static int is_unicode = -1;
- if (is_unicode == -1)
- {
- char ver[1024];
- CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver);
- is_unicode = (strstr(ver, "Unicode") != NULL ? 1 : 0);
- }
- return is_unicode;
+ return TRUE;
}
-static void * mir_alloc0(size_t size)
+static void * mir_alloc0(size_t size)
{
void * ptr = mir_alloc(size);
diff --git a/plugins/VersionInfo/src/CVersionInfo.cpp b/plugins/VersionInfo/src/CVersionInfo.cpp index 6796387a35..9b41342a3c 100644 --- a/plugins/VersionInfo/src/CVersionInfo.cpp +++ b/plugins/VersionInfo/src/CVersionInfo.cpp @@ -96,7 +96,7 @@ CVersionInfo::~CVersionInfo() listInactivePlugins.clear();
listActivePlugins.clear();
listUnloadablePlugins.clear();
-
+
lpzMirandaVersion.~basic_string();
lpzNightly.~basic_string();
lpzUnicodeBuild.~basic_string();
@@ -118,7 +118,7 @@ void CVersionInfo::Initialize() if (verbose) PUShowMessage("Before GetProfileSettings().", SM_NOTIFY);
#endif
GetProfileSettings();
-
+
#ifdef _DEBUG
if (verbose) PUShowMessage("Before GetLangpackInfo().", SM_NOTIFY);
#endif
@@ -158,10 +158,7 @@ bool CVersionInfo::GetMirandaVersion() else
lpzNightly = _T("No");
- if (lpzMirandaVersion.find( _T("Unicode"), 0) != std::string::npos)
- lpzUnicodeBuild = _T("Yes");
- else
- lpzUnicodeBuild = _T("No");
+ lpzUnicodeBuild = _T("Yes");
TCHAR time[128], date[128];
GetModuleTimeStamp(date, time);
@@ -310,7 +307,7 @@ end: NotifyError(GetLastError(), _T("RegOpenKeyEx()"), __LINE__);
lpzOSName = _T("<Error in RegOpenKeyEx()>");
}
-
+
//Now we can improve it if we can.
switch (LOWORD(osvi.dwBuildNumber)) {
case 950: lpzOSName = _T("Microsoft Windows 95"); break;
@@ -326,7 +323,7 @@ end: lpzOSName = _T("Microsoft Windows 2003 R2");
else
lpzOSName = _T("Microsoft Windows 2003");
-
+
break; //added windows 2003 info
}
@@ -336,7 +333,7 @@ end: bool CVersionInfo::GetHWSettings() {
//Free space on Miranda Partition.
TCHAR szMirandaPath[MAX_PATH] = { 0 };
- {
+ {
GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
if ( str2 != NULL) *str2=0;
@@ -344,16 +341,16 @@ bool CVersionInfo::GetHWSettings() { HMODULE hKernel32;
hKernel32 = LoadLibraryA("kernel32.dll");
if (hKernel32) {
-
+
MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExW");
-
+
MyIsWow64Process = (BOOL (WINAPI *) (HANDLE, PBOOL)) GetProcAddress(hKernel32, "IsWow64Process");
MyGetSystemInfo = (void (WINAPI *) (LPSYSTEM_INFO)) GetProcAddress(hKernel32, "GetNativeSystemInfo");
MyGlobalMemoryStatusEx = (BOOL (WINAPI *) (LPMEMORYSTATUSEX)) GetProcAddress(hKernel32, "GlobalMemoryStatusEx");
if ( !MyGetSystemInfo )
MyGetSystemInfo = GetSystemInfo;
-
+
FreeLibrary(hKernel32);
}
if ( MyGetDiskFreeSpaceEx ) {
@@ -365,25 +362,25 @@ bool CVersionInfo::GetHWSettings() { luiFreeDiskSpace = (unsigned long int)aux;
}
else luiFreeDiskSpace = 0;
-
+
TCHAR szInfo[1024];
GetWindowsShell(szInfo, SIZEOF(szInfo));
lpzShell = szInfo;
GetInternetExplorerVersion(szInfo, SIZEOF(szInfo));
lpzIEVersion = szInfo;
-
-
+
+
lpzAdministratorPrivileges = (IsCurrentUserLocalAdministrator()) ? _T("Yes") : _T("No");
-
+
bIsWOW64 = 0;
if (MyIsWow64Process)
if (!MyIsWow64Process(GetCurrentProcess(), &bIsWOW64))
bIsWOW64 = 0;
-
+
SYSTEM_INFO sysInfo = {0};
GetSystemInfo(&sysInfo);
luiProcessors = sysInfo.dwNumberOfProcessors;
-
+
//Installed RAM
if (MyGlobalMemoryStatusEx) { //windows 2000+
MEMORYSTATUSEX ms = {0};
@@ -438,7 +435,7 @@ BOOL CALLBACK EnumSystemLocalesProc(TCHAR *szLocale) _tcscat(szSystemLocales, name);
_tcscat(szSystemLocales, _T(", "));
}
-
+
return TRUE;
}
@@ -456,14 +453,14 @@ BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszNam bool CVersionInfo::GetOSLanguages()
{
lpzOSLanguages = _T("(UI | Locale (User/System)) : ");
-
+
LANGID UILang;
-
+
OSVERSIONINFO os = {0};
os.dwOSVersionInfoSize = sizeof(os);
GetVersionEx(&os);
if (os.dwMajorVersion == 4) {
- if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) { //Win NT
+ if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) { //Win NT
HMODULE hLib = LoadLibraryA("ntdll.dll");
if (hLib) {
@@ -488,7 +485,7 @@ bool CVersionInfo::GetOSLanguages() case 1256: // Arabic code page activated, it's a Arabic enabled system
systemLangID = MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA);
break;
-
+
default:
break;
}
@@ -500,7 +497,7 @@ bool CVersionInfo::GetOSLanguages() TCHAR szLangID[128] = _T("0x");
DWORD size = SIZEOF(szLangID) - 2;
TCHAR err[512];
-
+
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop\\ResourceLocale"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueEx(hKey, _T(""), 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
_tscanf(szLangID, _T("%lx"), &systemLangID);
@@ -523,10 +520,10 @@ bool CVersionInfo::GetOSLanguages() if (hKernel32) {
MyGetUserDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetUserDefaultUILanguage");
MyGetSystemDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetSystemDefaultUILanguage");
-
+
FreeLibrary(hKernel32);
}
-
+
if ((MyGetUserDefaultUILanguage) && (MyGetSystemDefaultUILanguage)) {
UILang = MyGetUserDefaultUILanguage();
lpzOSLanguages += GetLanguageName(UILang);
@@ -536,7 +533,7 @@ bool CVersionInfo::GetOSLanguages() }
else lpzOSLanguages += _T("Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)");
}
-
+
lpzOSLanguages += _T(" | ");
lpzOSLanguages += GetLanguageName(LOCALE_USER_DEFAULT);
lpzOSLanguages += _T("/");
@@ -552,7 +549,7 @@ bool CVersionInfo::GetOSLanguages() lpzOSLanguages += szSystemLocales;
lpzOSLanguages += _T("]");
}
-
+
return true;
}
@@ -564,7 +561,7 @@ int SaveInfo(const char *data, const char *lwrData, const char *search, TCHAR *d _tcsncpy(dest, _A2T(&data[strlen(search)]), size);
res = 0;
}
-
+
return res;
}
@@ -573,13 +570,13 @@ bool CVersionInfo::GetLangpackInfo() TCHAR langpackPath[MAX_PATH] = {0};
TCHAR search[MAX_PATH] = {0};
- lpzLangpackModifiedDate = _T("");
+ lpzLangpackModifiedDate = _T("");
GetModuleFileName(GetModuleHandle(NULL), langpackPath, SIZEOF(langpackPath));
TCHAR* p = _tcsrchr(langpackPath, '\\');
if (p) {
WIN32_FIND_DATA data = {0};
HANDLE hLangpack;
-
+
p[1] = '\0';
_tcscpy(search, langpackPath);
_tcscat(search, _T("langpack_*.txt"));
@@ -588,16 +585,16 @@ bool CVersionInfo::GetLangpackInfo() char buffer[1024];
char temp[1024];
FillLocalTime(lpzLangpackModifiedDate, &data.ftLastWriteTime);
-
+
TCHAR locale[128] = {0};
TCHAR language[128] = {0};
TCHAR version[128] = {0};
_tcscpy(version, _T("N/A"));
-
+
_tcsncpy(language, data.cFileName, SIZEOF(language));
p = _tcsrchr(language, '.');
p[0] = '\0';
-
+
_tcscat(langpackPath, data.cFileName);
FILE *fin = _tfopen(langpackPath, _T("rt"));
if (fin) {
@@ -627,7 +624,7 @@ bool CVersionInfo::GetLangpackInfo() else
_tcsncpy(version, _T("<unknown>"), SIZEOF(version));
} } } }
-
+
lpzLangpackInfo = std::tstring(language) + _T(" [") + std::tstring(locale) + _T("]");
if ( version[0] )
lpzLangpackInfo += _T(" v. ") + std::tstring(version);
@@ -641,8 +638,8 @@ bool CVersionInfo::GetLangpackInfo() FindClose(hLangpack);
}
else lpzLangpackInfo = _T("No language pack installed");
- }
-
+ }
+
return true;
}
@@ -673,7 +670,7 @@ bool CVersionInfo::GetPluginLists() // SYSTEMTIME sysTime; //for timestamp
mirandaVersion=(DWORD)CallService(MS_SYSTEM_GETVERSION,0,0);
- {
+ {
GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath));
TCHAR* str2 = _tcsrchr(szMirandaPath,'\\');
if(str2!=NULL) *str2=0;
@@ -710,7 +707,7 @@ bool CVersionInfo::GetPluginLists() 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
+ //get the dlls the plugin statically links to
if (DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE))
{
std::tstring linkedModules;
@@ -738,7 +735,7 @@ bool CVersionInfo::GetPluginLists() else { //It was successfully loaded.
MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfoEx");
if (!MirandaPluginInfo)
- MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfo");
+ MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfo");
if (!MirandaPluginInfo) //There is no function: it's not a valid plugin. Let's move on to the next file.
continue;
@@ -904,7 +901,7 @@ std::tstring CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flag GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
}
-
+
while (pos != aList.end()) {
out.append(std::tstring((*pos).getInformations(flags, szHeader, szFooter)));
pos++;
@@ -943,7 +940,7 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif } }
TCHAR buffer[1024]; //for beautification
- GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
+ GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, _T(""), out);
GetStringFromDatabase("BeautifyBlockStart", _T("<blockquote>"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, _T(""), out);
@@ -965,27 +962,27 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif out.append(noProcs);
}
out.append( _T("\r\n"));
-
+
//RAM
TCHAR szRAM[64]; wsprintf(szRAM, _T("%d"), luiRAM);
out.append( _T("Installed RAM: ") + std::tstring(szRAM) + _T(" MBytes\r\n"));
-
+
//operating system
out.append( _T("Operating System: ") + lpzOSName + _T(" [version: ") + lpzOSVersion + _T("]\r\n"));
-
+
//shell, IE, administrator
out.append( _T("Shell: ") + lpzShell + _T(", Internet Explorer ") + lpzIEVersion + _T("\r\n"));
out.append( _T("Administrator privileges: ") + lpzAdministratorPrivileges + _T("\r\n"));
-
+
//languages
out.append( _T("OS Languages: ") + lpzOSLanguages + _T("\r\n"));
-
+
//FreeDiskSpace
if (luiFreeDiskSpace) {
TCHAR szDiskSpace[64]; wsprintf(szDiskSpace, _T("%d"), luiFreeDiskSpace);
out.append( _T("Free disk space on Miranda partition: ") + std::tstring(szDiskSpace) + _T(" MBytes\r\n"));
}
-
+
//Miranda
out.append( _T("Miranda path: ") + lpzMirandaPath + _T("\r\n"));
out.append( _T("Miranda NG version: ") + lpzMirandaVersion);
@@ -1001,10 +998,10 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif out.append( _T("Language pack: ") + lpzLangpackInfo);
out.append((lpzLangpackModifiedDate.size() > 0) ? _T(", modified: ") + lpzLangpackModifiedDate : _T(""));
out.append( _T("\r\n"));
-
+
out.append( _T("Nightly: ") + lpzNightly + _T("\r\n"));
out.append( _T("Unicode core: ") + lpzUnicodeBuild);
-
+
GetStringFromDatabase("BeautifyBlockEnd", _T("</blockquote>"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, _T("\r\n"), out);
}
@@ -1056,7 +1053,7 @@ std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) { 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) {
@@ -1105,7 +1102,7 @@ std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) { out.append( _T("\r\n"));
BeautifyReport(beautify, normalPluginsStart, _T(""), out);
out.append(GetListAsString(listUnloadablePlugins, flags, beautify));
- BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
+ BeautifyReport(beautify, normalPluginsEnd, _T(""), out);
}
AddInfoFooter(suppressHeader, forumStyle, beautify, out);
return out;
@@ -1123,7 +1120,7 @@ void CVersionInfo::PrintInformationsToFile(const TCHAR *info) else GetStringFromDatabase("OutputFile", _T("VersionInfo.txt"), buffer, SIZEOF(buffer));
RelativePathToAbsolute(buffer, outputFileName, SIZEOF(buffer));
-
+
FILE *fp = _tfopen(outputFileName, _T("wb"));
if ( fp != NULL ) {
char* utf = mir_utf8encodeT( info );
@@ -1163,7 +1160,7 @@ void CVersionInfo::PrintInformationsToDialogBox() HWND DialogBox = CreateDialogParam(hInst,
MAKEINTRESOURCE(IDD_DIALOGINFO),
NULL, DialogBoxProc, (LPARAM) this);
-
+
SetDlgItemText(DialogBox, IDC_TEXT, GetInformationsAsString().c_str());
}
@@ -1173,7 +1170,7 @@ void CVersionInfo::PrintInformationsToClipboard(bool showLog) Log( TranslateT("The clipboard is not available, retry."));
return;
}
-
+
OpenClipboard(NULL);
//Ok, let's begin, then.
EmptyClipboard();
@@ -1188,7 +1185,7 @@ void CVersionInfo::PrintInformationsToClipboard(bool showLog) lptstrCopy[length] = '\0';
GlobalUnlock(hData);
//Now set the clipboard data.
-
+
SetClipboardData(CF_UNICODETEXT, hData);
//Remove the lock on the clipboard.
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index 7c55d9509b..30b012f785 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -112,16 +112,16 @@ static int WriteToDebugLogA(const char *szMsg) { OutputDebugStringA(szMsg);
OutputDebugStringA("\r\n");
}
-
+
return res;
}
int AddDebugLogMessageA(const char* fmt, ...)
-{
+{
int res;
char szText[MAX_DEBUG], szFinal[MAX_DEBUG];
va_list va;
-
+
va_start(va,fmt);
_vsnprintf(szText, sizeof(szText), fmt, va);
va_end(va);
@@ -165,7 +165,7 @@ int AddErrorLogMessageA(const char* fmt, ...) { int res;
char szText[MAX_DEBUG], szFinal[MAX_DEBUG];
va_list va;
-
+
va_start(va,fmt);
_vsnprintf(szText, sizeof(szText), fmt, va);
va_end(va);
@@ -181,7 +181,7 @@ int AddErrorLogMessageA(const char* fmt, ...) { }
int AddErrorLogMessage(const TCHAR* fmt, ...) {
-
+
int res;
TCHAR tszText[MAX_DEBUG], tszFinal[MAX_DEBUG];
char *szFinal;
@@ -228,30 +228,7 @@ TCHAR *itot(int num) { // Helper functions that need MODULENAME
#define SETTING_NOENCODINGCHECK "NoEncodingCheck"
-int Hlp_UnicodeCheck(char *szPluginName, BOOL bForce, const char *szModule) {
-
-#ifndef _DEBUG
- char *ptr;
- char szVersionText[256];
-
- if (!CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVersionText), (LPARAM)szVersionText)) {
- ptr = strstr(szVersionText, "Unicode");
-
- if ((ptr == NULL) && (!DBGetContactSettingByte(NULL, szModule, SETTING_NOENCODINGCHECK, 0))) {
- if (bForce) {
- MessageBoxA(NULL, "You are running the ANSI version Miranda. Please use the ANSI build of this plugin.", szPluginName, MB_OK);
-
- return -1;
- }
- else {
- MessageBoxA(NULL, "You are running the ANSI version Miranda. It's recommened to use the ANSI build of this plugin.", szPluginName, MB_OK);
- DBWriteContactSettingByte(NULL, szModule, SETTING_NOENCODINGCHECK, 1);
-
- return 0;
- }
- }
- }
-#endif
-
+int Hlp_UnicodeCheck(char *szPluginName, BOOL bForce, const char *szModule)
+{
return 0;
-}
\ No newline at end of file +}
|