summaryrefslogtreecommitdiff
path: root/plugins/YAMN
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/YAMN')
-rw-r--r--plugins/YAMN/src/main.cpp26
-rw-r--r--plugins/YAMN/src/main.h12
2 files changed, 18 insertions, 20 deletions
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp
index ed0ea35794..65aee18a87 100644
--- a/plugins/YAMN/src/main.cpp
+++ b/plugins/YAMN/src/main.cpp
@@ -258,17 +258,14 @@ void WINAPI g_ReleaseIcon( HICON hIcon )
static void LoadPlugins()
{
- HANDLE hFind;
- WIN32_FIND_DATA fd;
TCHAR szSearchPath[MAX_PATH];
- TCHAR szPluginPath[MAX_PATH];
- lstrcpy(szSearchPath, szMirandaDir);
- lstrcat(szSearchPath, _T("\\Plugins\\YAMN\\*.dll"));
- typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
+ mir_sntprintf(szSearchPath, MAX_PATH, _T("%s\\Plugins\\YAMN\\*.dll"), szMirandaDir);
hDllPlugins = NULL;
- if (INVALID_HANDLE_VALUE != (hFind = FindFirstFile(szSearchPath, &fd))) {
+ WIN32_FIND_DATA fd;
+ HANDLE hFind = FindFirstFile(szSearchPath, &fd);
+ if (hFind != INVALID_HANDLE_VALUE) {
do {
//rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too
TCHAR *dot = _tcsrchr(fd.cFileName, '.');
@@ -276,21 +273,20 @@ static void LoadPlugins()
continue;
// we have a dot
- int len = (int)lstrlen(fd.cFileName); // find the length of the string
+ int len = lstrlen(fd.cFileName); // find the length of the string
TCHAR* end = fd.cFileName+len; // get a pointer to the NULL
int safe = (end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL
if ((safe != 3) || (lstrcmpi(dot+1, _T("dll")) != 0)) //not bound, however the "dll" string should mean only 3 chars are compared
continue;
- HINSTANCE hDll;
- LOADFILTERFCN LoadFilter;
+ TCHAR szPluginPath[MAX_PATH];
+ mir_sntprintf(szPluginPath, MAX_PATH,_T("%s\\Plugins\\YAMN\\%s"), szMirandaDir, fd.cFileName);
+ HINSTANCE hDll = LoadLibrary(szPluginPath);
+ if (hDll == NULL)
+ continue;
- lstrcpy(szPluginPath, szMirandaDir);
- lstrcat(szPluginPath, _T("\\Plugins\\YAMN\\"));
- lstrcat(szPluginPath, fd.cFileName);
- if ((hDll = LoadLibrary(szPluginPath)) == NULL) continue;
- LoadFilter = (LOADFILTERFCN)GetProcAddress(hDll, "LoadFilter");
+ LOADFILTERFCN LoadFilter = (LOADFILTERFCN) GetProcAddress(hDll, "LoadFilter");
if (NULL == LoadFilter) {
FreeLibrary(hDll);
hDll = NULL;
diff --git a/plugins/YAMN/src/main.h b/plugins/YAMN/src/main.h
index 7f909df2ca..eacb470e69 100644
--- a/plugins/YAMN/src/main.h
+++ b/plugins/YAMN/src/main.h
@@ -1,11 +1,11 @@
#ifndef __MAIN_H
#define __MAIN_H
-#define YAMN_NEWMAILSNDDESC LPGEN("YAMN: new mail message")
-#define YAMN_CONNECTFAILSNDDESC LPGEN("YAMN: connect failed")
-#define YAMN_CONNECTFAILSOUND "YAMN/Sound/ConnectFail"
-#define YAMN_NEWMAILSOUND "YAMN/Sound/NewMail"
-
+#define YAMN_NEWMAILSNDDESC LPGEN("YAMN: new mail message")
+#define YAMN_CONNECTFAILSNDDESC LPGEN("YAMN: connect failed")
+#define YAMN_CONNECTFAILSOUND "YAMN/Sound/ConnectFail"
+#define YAMN_NEWMAILSOUND "YAMN/Sound/NewMail"
+
#define YAMN_DBMODULE "YAMN"
#define YAMN_DBPOSX "MailBrowserWinX"
#define YAMN_DBPOSY "MailBrowserWinY"
@@ -33,5 +33,7 @@ extern unsigned char optDateTime;
// Loading Icon and checking for icolib
void LoadIcons();
+typedef INT_PTR (*LOADFILTERFCN)(MIRANDASERVICE GetYAMNFcn);
+
#endif