diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-25 20:07:10 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-25 20:07:10 +0000 |
commit | 7325c10a7921fb043253a339ab5b5c3c803bfb14 (patch) | |
tree | aee9caf5c14c7b8c36540cba14642a453c61919f /plugins | |
parent | 58ac4567a402d383c3edb0749b9f2fb88b8422d6 (diff) |
- Unload Msftedit.dll after use
git-svn-id: http://svn.miranda-ng.org/main/trunk@11907 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CrashDumper/src/crshdmp.cpp | 5 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 27 | ||||
-rw-r--r-- | plugins/Scriver/src/msgoptions.cpp | 5 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 21 |
4 files changed, 32 insertions, 26 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index e66d7796ae..253d28612e 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -25,6 +25,7 @@ DWORD mirandaVersion; LCID packlcid;
//HANDLE hCrashLogFolder, hVerInfoFolder;
HANDLE hVerInfoFolder;
+HMODULE hMsftedit;
TCHAR* vertxt;
TCHAR* profname;
@@ -362,7 +363,8 @@ static int PreShutdown(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void)
{
- if (LoadLibraryA("Msftedit.dll") == NULL)
+ hMsftedit = LoadLibrary(_T("Msftedit.dll"));
+ if (hMsftedit == NULL)
return 1;
clsdates = db_get_b(NULL, PluginName, "ClassicDates", 1) != 0;
@@ -410,6 +412,7 @@ extern "C" int __declspec(dllexport) Unload(void) mir_free(profpath);
mir_free(profname);
mir_free(vertxt);
+ FreeLibrary(hMsftedit);
return 0;
}
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 31a3413a90..3ee6777259 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -138,15 +138,20 @@ void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) mwe.szModule = SRMMMOD;
mwe.uType = type;
mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- BOOL bChat = (WindowList_Find(g_dat.hMessageWindowList, hContact) == NULL);
- mwe.hwndInput = GetDlgItem(hwnd, bChat ? IDC_CHAT_MESSAGE : IDC_MESSAGE);
- mwe.hwndLog = GetDlgItem(hwnd, bChat ? IDC_CHAT_LOG : IDC_LOG);
+ if (WindowList_Find(g_dat.hMessageWindowList, hContact)) {
+ mwe.hwndInput = GetDlgItem(hwnd, IDC_MESSAGE);
+ mwe.hwndLog = GetDlgItem(hwnd, IDC_LOG);
+ }
+ else {
+ mwe.hwndInput = GetDlgItem(hwnd, IDC_CHAT_MESSAGE);
+ mwe.hwndLog = GetDlgItem(hwnd, IDC_CHAT_LOG);
+ }
NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe);
}
static BOOL IsUtfSendAvailable(MCONTACT hContact)
{
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto == NULL)
return FALSE;
@@ -180,16 +185,13 @@ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR* szFil if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
- HANDLE hFind;
TCHAR szPath[MAX_PATH];
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, _T("\\*"));
- if ((hFind = FindFirstFile(szPath, &fd)) != INVALID_HANDLE_VALUE) {
+ mir_sntprintf(szPath, SIZEOF(szPath), _T("%s\\*"),szFilename);
+ HANDLE hFind = FindFirstFile(szPath, &fd);
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
if (!mir_tstrcmp(fd.cFileName, _T(".")) || !mir_tstrcmp(fd.cFileName, _T(".."))) continue;
- mir_tstrcpy(szPath, szFilename);
- mir_tstrcat(szPath, _T("\\"));
- mir_tstrcat(szPath, fd.cFileName);
+ mir_sntprintf(szPath, SIZEOF(szPath),_T("%s\\%s"), szFilename, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
@@ -597,14 +599,13 @@ void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat) static BOOL IsTypingNotificationSupported(SrmmWindowData *dat)
{
- DWORD typeCaps;
if (!dat->hContact)
return FALSE;
if (!dat->szProto)
return FALSE;
- typeCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ DWORD typeCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (!(typeCaps & PF4_SUPPORTTYPING))
return FALSE;
return TRUE;
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index e476d5a419..89b837e0bc 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -105,13 +105,12 @@ int FontServiceFontsChanged(WPARAM, LPARAM) void RegisterFontServiceFonts()
{
- int i;
FontIDT fid = { sizeof(fid) };
_tcsncpy_s(fid.group, LPGENT("Messaging"), _TRUNCATE);
_tcsncpy_s(fid.backgroundGroup, LPGENT("Messaging"), _TRUNCATE);
strncpy(fid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID | FIDF_DEFAULTVALID;
- for (i = 0; i < SIZEOF(fontOptionsList); i++) {
+ for (int i = 0; i < SIZEOF(fontOptionsList); i++) {
fid.order = i;
char szTemp[100];
@@ -131,7 +130,7 @@ void RegisterFontServiceFonts() _tcsncpy_s(cid.group, LPGENT("Messaging"), _TRUNCATE);
strncpy(cid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
cid.flags = 0;
- for (i = 0; i < SIZEOF(colourOptionsList); i++) {
+ for (int i = 0; i < SIZEOF(colourOptionsList); i++) {
cid.order = i;
_tcsncpy(cid.name, colourOptionsList[i].szName, SIZEOF(cid.name));
if (colourOptionsList[i].systemColor != -1)
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index e4a6022401..1bd21e47dd 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand, hDragCursor;
HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite;
HGENMENU hMsgMenuItem;
+HMODULE hMsftEdit;
extern HWND GetParentWindow(MCONTACT hContact, BOOL bChat);
@@ -207,7 +208,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) {
TCHAR szTip[256];
- mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
if ( ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2 & SMF2_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn;
tn.szProto = NULL;
@@ -244,8 +245,8 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) static int ContactDeleted(WPARAM wParam, LPARAM)
{
- HWND hwnd;
- if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam)))
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam);
+ if (hwnd)
SendMessage(hwnd, WM_CLOSE, 0, 0);
return 0;
}
@@ -305,12 +306,12 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
MessageWindowInputData *mwid = (MessageWindowInputData*)wParam;
- MessageWindowData *mwd = (MessageWindowData*)lParam;
+ if (mwid == NULL || mwid->cbSize != sizeof(MessageWindowInputData) || mwid->hContact == NULL || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)
+ return 1;
- if (mwid == NULL || mwd == NULL) return 1;
- if (mwid->cbSize != sizeof(MessageWindowInputData) || mwd->cbSize != sizeof(MessageWindowData)) return 1;
- if (mwid->hContact == NULL) return 1;
- if (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH) return 1;
+ MessageWindowData *mwd = (MessageWindowData*)lParam;
+ if (mwd == NULL || mwd->cbSize != sizeof(MessageWindowData))
+ return 1;
HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, mwid->hContact);
if (hwnd == NULL)
@@ -514,12 +515,14 @@ int OnUnloadModule(void) FreeLibrary(GetModuleHandleA("Msftedit.dll"));
RichUtil_Unload();
FreeGlobals();
+ FreeLibrary(hMsftEdit);
return 0;
}
int OnLoadModule(void)
{
- if (LoadLibraryA("Msftedit.dll") == NULL) {
+ hMsftEdit = LoadLibrary(_T("Msftedit.dll"));
+ if (hMsftEdit == NULL) {
if (IDYES != MessageBox(0,
TranslateT
("Miranda could not load the built-in message module, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."),
|