summaryrefslogtreecommitdiff
path: root/plugins/AssocMgr
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-06-06 20:28:25 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-06-06 20:28:25 +0000
commit6259dc6f9fcd6ee828555bdebd9a344fa62b0801 (patch)
tree5d6c92762f61132cdedb78ba1847d347e6120709 /plugins/AssocMgr
parentab92c2a5cd5427bf8a33d06afdb64b88d2d640ed (diff)
AssocMgr reverted to rev333
git-svn-id: http://svn.miranda-ng.org/main/trunk@338 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AssocMgr')
-rw-r--r--plugins/AssocMgr/assoclist.c (renamed from plugins/AssocMgr/assoclist.cpp)4
-rw-r--r--plugins/AssocMgr/assoclist.h4
-rw-r--r--plugins/AssocMgr/assocmgr.vcxproj13
-rw-r--r--plugins/AssocMgr/assocmgr.vcxproj.filters19
-rw-r--r--plugins/AssocMgr/common.h9
-rw-r--r--plugins/AssocMgr/dde.c (renamed from plugins/AssocMgr/dde.cpp)12
-rw-r--r--plugins/AssocMgr/main.c (renamed from plugins/AssocMgr/main.cpp)53
-rw-r--r--plugins/AssocMgr/reg.c (renamed from plugins/AssocMgr/reg.cpp)4
-rw-r--r--plugins/AssocMgr/test.c (renamed from plugins/AssocMgr/test.cpp)0
-rw-r--r--plugins/AssocMgr/utils.c (renamed from plugins/AssocMgr/utils.cpp)7
-rw-r--r--plugins/AssocMgr/version.h39
-rw-r--r--plugins/AssocMgr/version.rc35
12 files changed, 119 insertions, 80 deletions
diff --git a/plugins/AssocMgr/assoclist.cpp b/plugins/AssocMgr/assoclist.c
index 524bf29152..26a72a43da 100644
--- a/plugins/AssocMgr/assoclist.cpp
+++ b/plugins/AssocMgr/assoclist.c
@@ -607,7 +607,7 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const TCHAR *pszParam
return TRUE;
}
-INT_PTR InvokeFileHandler(TCHAR *pszFileName)
+INT_PTR InvokeFileHandler(const TCHAR *pszFileName)
{
char *pszClassName, *pszFileExt;
TCHAR *p;
@@ -633,7 +633,7 @@ INT_PTR InvokeFileHandler(TCHAR *pszFileName)
return res;
}
-INT_PTR InvokeUrlHandler(TCHAR *pszUrl)
+INT_PTR InvokeUrlHandler(const TCHAR *pszUrl)
{
char *pszClassName, *pszProtoPrefix, *p;
INT_PTR res = CALLSERVICE_NOTFOUND;
diff --git a/plugins/AssocMgr/assoclist.h b/plugins/AssocMgr/assoclist.h
index 44d90013e3..5e8806b828 100644
--- a/plugins/AssocMgr/assoclist.h
+++ b/plugins/AssocMgr/assoclist.h
@@ -26,8 +26,8 @@ void CleanupMimeTypeAddedSettings(void);
/* Assoc List Utils */
BOOL IsRegisteredAssocItem(const char *pszClassName);
/* Open Handler */
-INT_PTR InvokeFileHandler(TCHAR *pszFileName);
-INT_PTR InvokeUrlHandler(TCHAR *pszUrl);
+INT_PTR InvokeFileHandler(const TCHAR *pszFileName);
+INT_PTR InvokeUrlHandler(const TCHAR *pszUrl);
/* Misc */
void InitAssocList(void);
void UninitAssocList(void);
diff --git a/plugins/AssocMgr/assocmgr.vcxproj b/plugins/AssocMgr/assocmgr.vcxproj
index 44462d6eff..3c76717f49 100644
--- a/plugins/AssocMgr/assocmgr.vcxproj
+++ b/plugins/AssocMgr/assocmgr.vcxproj
@@ -182,12 +182,12 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="assoclist.cpp" />
- <ClCompile Include="dde.cpp" />
- <ClCompile Include="main.cpp" />
- <ClCompile Include="reg.cpp" />
- <ClCompile Include="test.cpp" />
- <ClCompile Include="utils.cpp" />
+ <ClCompile Include="assoclist.c" />
+ <ClCompile Include="dde.c" />
+ <ClCompile Include="main.c" />
+ <ClCompile Include="reg.c" />
+ <ClCompile Include="test.c" />
+ <ClCompile Include="utils.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="assoclist.h" />
@@ -211,7 +211,6 @@
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
- <ResourceCompile Include="version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/plugins/AssocMgr/assocmgr.vcxproj.filters b/plugins/AssocMgr/assocmgr.vcxproj.filters
index 2053a987d1..cfdb339f8c 100644
--- a/plugins/AssocMgr/assocmgr.vcxproj.filters
+++ b/plugins/AssocMgr/assocmgr.vcxproj.filters
@@ -17,24 +17,28 @@
<UniqueIdentifier>{6f8e30e0-bc03-46e7-b039-e0fbd019afb2}</UniqueIdentifier>
<Extensions>txt</Extensions>
</Filter>
+ <Filter Include="SDK">
+ <UniqueIdentifier>{cc674aae-3e65-4f1c-959f-c95acfe7111a}</UniqueIdentifier>
+ <Extensions>*.h</Extensions>
+ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="assoclist.cpp">
+ <ClCompile Include="assoclist.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="dde.cpp">
+ <ClCompile Include="dde.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="main.cpp">
+ <ClCompile Include="main.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="reg.cpp">
+ <ClCompile Include="reg.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="test.cpp">
+ <ClCompile Include="test.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="utils.cpp">
+ <ClCompile Include="utils.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
@@ -68,9 +72,6 @@
<ResourceCompile Include="resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
- <ResourceCompile Include="version.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="res\miranda.ico">
diff --git a/plugins/AssocMgr/common.h b/plugins/AssocMgr/common.h
index b4099847bf..6f5592f524 100644
--- a/plugins/AssocMgr/common.h
+++ b/plugins/AssocMgr/common.h
@@ -19,19 +19,22 @@ along with this program (AssocMgr-License.txt); if not, write to the Free Softwa
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define MIRANDA_VER 0x0A00
#define _CRT_SECURE_NO_WARNINGS
#define _WIN32_WINNT 0x0600
-
+#define __RPCASYNC_H__ /* VC6 has a mistake in there (warning) */
#include <windows.h>
+#pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union */
+#pragma warning(disable:4115) /* V6 has a mistake in there (warning) */
#include <shlobj.h> /* for SHChangeNotify() */
+#pragma warning(default:4115)
#include <commctrl.h>
+#pragma warning(default:4201)
#include <tchar.h>
#include <stdio.h> /* for mir_snprintf() */
#include <Vsstyle.h>
#include <Vssym32.h>
-#include <malloc.h>
+#define MIRANDA_VER 0x0A00
#include <newpluginapi.h>
#include <m_system.h>
#include <m_database.h>
diff --git a/plugins/AssocMgr/dde.cpp b/plugins/AssocMgr/dde.c
index d10043f22e..0804be855c 100644
--- a/plugins/AssocMgr/dde.cpp
+++ b/plugins/AssocMgr/dde.c
@@ -30,9 +30,8 @@ static HANDLE hHookModulesLoaded,hHookPreShutdown;
/************************* Open Handler ***************************/
// pszFilePath needs to be allocated using mir_alloc()
-static void __stdcall FileActionAsync(void *param)
+static void __stdcall FileActionAsync(TCHAR *pszFilePath)
{
- TCHAR *pszFilePath = (TCHAR*)param;
/* invoke main handler */
switch(InvokeFileHandler(pszFilePath)) { /* pszFilePath is always a long path name */
case 0: /* success */ break;
@@ -46,9 +45,8 @@ static void __stdcall FileActionAsync(void *param)
}
// pszUrl needs to be allocated using mir_alloc()
-static void __stdcall UrlActionAsync(void *param)
+static void __stdcall UrlActionAsync(TCHAR *pszUrl)
{
- TCHAR *pszUrl = (TCHAR*)param;
/* invoke main handler */
switch(InvokeUrlHandler(pszUrl)) {
case 0: /* success */ break;
@@ -113,7 +111,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
/* ANSI execute command can't happen for shell */
if(IsWindowUnicode((HWND)wParam)) {
#endif
- pszCommand = (TCHAR*)GlobalLock(hCommand);
+ pszCommand=GlobalLock(hCommand);
if(pszCommand!=NULL) {
TCHAR *pszAction,*pszArg;
pszAction=GetExecuteParam(&pszCommand);
@@ -122,9 +120,9 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
/* we are inside miranda here, we make it async so the shell does
* not timeout regardless what the plugins try to do. */
if (!lstrcmpi(pszAction,_T("file")))
- ack.fAck=(short)(CallFunctionAsync(FileActionAsync, pszArg)!=0);
+ ack.fAck=(short)(CallFunctionAsync(FileActionAsync,pszArg)!=0);
else if (!lstrcmpi(pszAction,_T("url")))
- ack.fAck=(short)(CallFunctionAsync(UrlActionAsync, pszArg)!=0);
+ ack.fAck=(short)(CallFunctionAsync(UrlActionAsync,pszArg)!=0);
if (!ack.fAck) mir_free(pszArg); /* otherwise freed by asyncproc */
}
GlobalUnlock(hCommand);
diff --git a/plugins/AssocMgr/main.cpp b/plugins/AssocMgr/main.c
index 2a1ad430a2..a689ad654d 100644
--- a/plugins/AssocMgr/main.cpp
+++ b/plugins/AssocMgr/main.c
@@ -31,13 +31,13 @@ int hLangpack;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
+ "File Association Manager",
+ PLUGIN_VERSION,
+ "Handles file type associations and URLs like aim, ymsgr, xmpp, wpmsg, gg, tlen.", /* autotranslated */
+ "H. Herkenrath",
+ "hrathh@users.sourceforge.net",
+ "© 2005-2007 H. Herkenrath",
+ PLUGIN_WEBSITE,
UNICODE_AWARE,
0,
// {52685CD7-0EC7-44c1-A1A6-381612418202}
@@ -45,9 +45,15 @@ PLUGININFOEX pluginInfo={
};
static const MUUID interfaces[]={MIID_ASSOCMGR,MIID_AUTORUN,MIID_LAST};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,void *pReserved)
{
- hInst = hinstDLL;
+ UNREFERENCED_PARAMETER(pReserved);
+ if(fdwReason==DLL_PROCESS_ATTACH) {
+ /* Do not call this from a DLL that is linked to the static C run-time library (CRT).
+ * The static CRT requires DLL_THREAD_ATTACH and DLL_THREAD_DETATCH notifications
+ * to function properly. */
+ DisableThreadLibraryCalls(hInst=hinstDLL);
+ }
return TRUE;
}
@@ -90,21 +96,36 @@ static int AssocMgrModulesLoaded(WPARAM wParam,LPARAM lParam)
return 0;
}
-extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+__declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+__declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
-extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
+__declspec(dllexport) int Load(PLUGINLINK *link)
{
pluginLink=link;
mir_getLP(&pluginInfo);
+ /* existance of MS_SYSTEM_GETVERSION and MS_LANGPACK_TRANSLATESTRING
+ * is checked in MirandaPluginInfo().
+ * Not placed in MirandaPluginInfo() to avoid MessageBoxes on plugin options.
+ * Using ANSI as LANG_UNICODE might not be supported. */
+ if(CallService(MS_SYSTEM_GETVERSION,0,0)<NEEDED_MIRANDA_VERSION) {
+ char szText[256];
+ mir_snprintf(szText,sizeof(szText),Translate("The File Association Manager Plugin can not be loaded. It requires Miranda IM %hs or later."),NEEDED_MIRANDA_VERSION_STR);
+ MessageBoxA(NULL,szText,Translate("File Association Manager Plugin"),MB_OK|MB_ICONINFORMATION|MB_SETFOREGROUND|MB_TOPMOST|MB_TASKMODAL);
+ return 1;
+ }
+
if (!ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) return 1; /* dbx3x v0.5.1.0 */
if(mir_getMMI(&mmi)) return 1;
if(mir_getUTFI(&utfi)) return 1;
@@ -119,11 +140,15 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
return 0;
}
-extern "C" __declspec(dllexport) int Unload(void)
+__declspec(dllexport) int Unload(void)
{
UninitTest();
UninitDde();
UninitAssocList();
UnhookEvent(hHookModulesLoaded);
return 0;
-} \ No newline at end of file
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/plugins/AssocMgr/reg.cpp b/plugins/AssocMgr/reg.c
index 6d10421493..09b58a1462 100644
--- a/plugins/AssocMgr/reg.cpp
+++ b/plugins/AssocMgr/reg.c
@@ -115,7 +115,7 @@ char *MakeUrlClassName(const char *pszUrl)
return pszClass;
}
-static BOOL IsFileClassName(char *pszClassName, char **ppszFileExt)
+static BOOL IsFileClassName(const char *pszClassName,const char **ppszFileExt)
{
*ppszFileExt=strchr(pszClassName,'.');
return *ppszFileExt!=NULL;
@@ -165,7 +165,7 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd)
{
TCHAR *buf,*pexe,*pargs;
TCHAR szFullExe[MAX_PATH],*pszFilePart;
- buf=lstrcpy((TCHAR*)_alloca((lstrlen(pszRunCmd)+1)*sizeof(TCHAR)),pszRunCmd);
+ buf=lstrcpy(_alloca((lstrlen(pszRunCmd)+1)*sizeof(TCHAR)),pszRunCmd);
/* split into executable path and arguments */
if(buf[0]==_T('\"')) {
pargs=_tcschr(&buf[1],_T('\"'));
diff --git a/plugins/AssocMgr/test.cpp b/plugins/AssocMgr/test.c
index 73112af5a5..73112af5a5 100644
--- a/plugins/AssocMgr/test.cpp
+++ b/plugins/AssocMgr/test.c
diff --git a/plugins/AssocMgr/utils.cpp b/plugins/AssocMgr/utils.c
index 08f42b9d3b..89e0867a59 100644
--- a/plugins/AssocMgr/utils.cpp
+++ b/plugins/AssocMgr/utils.c
@@ -112,7 +112,7 @@ static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam)
if (!strncmp(pszSetting,param->pszPrefix,param->nPrefixLen)) {
char **buf;
/* resize storage array */
- buf = (char **)mir_realloc(param->settings,(param->nSettingsCount+1)*sizeof(char*));
+ buf=mir_realloc(param->settings,(param->nSettingsCount+1)*sizeof(char*));
if(buf!=NULL) {
param->settings=buf;
buf[param->nSettingsCount]=mir_strdup(pszSetting);
@@ -142,9 +142,8 @@ BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,cha
/************************* Error Output ***************************/
-static void MessageBoxIndirectFree(void *param)
+static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp)
{
- MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)param;
MessageBoxIndirectA(mbp);
mir_free((char*)mbp->lpszCaption); /* does NULL check */
mir_free((char*)mbp->lpszText); /* does NULL check */
@@ -185,7 +184,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...)
case NIIF_WARNING: mbp->dwStyle|=MB_ICONWARNING; break;
case NIIF_ERROR: mbp->dwStyle|=MB_ICONERROR;
}
- mir_forkthread(MessageBoxIndirectFree, mbp);
+ mir_forkthread(MessageBoxIndirectFree,mbp);
}
// LocalFree() the return value
diff --git a/plugins/AssocMgr/version.h b/plugins/AssocMgr/version.h
index 9d68defbef..ce9485a55f 100644
--- a/plugins/AssocMgr/version.h
+++ b/plugins/AssocMgr/version.h
@@ -19,23 +19,22 @@ along with this program (AssocMgr-License.txt); if not, write to the Free Softwa
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 1
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 0
-
-#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-
-#define __STRINGIFY_IMPL(x) #x
-#define __STRINGIFY(x) __STRINGIFY_IMPL(x)
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS)
-
-#define __PLUGIN_NAME "File Association Manager"
-#define __INTERNAL_NAME "AssocMgr"
-#define __FILENAME "AssocMgr.dll"
-#define __DESCRIPTION "Handles file type associations and URLs like aim, ymsgr, xmpp, wpmsg, gg, tlen."
-#define __AUTHOR "H. Herkenrath"
-#define __AUTHOREMAIL "hrathh@users.sourceforge.net"
-#define __AUTHORWEB "http://addons.miranda-im.org/details.php?action=viewfile&id=3457"
-#define __COPYRIGHT "© 2005-2007 H. Herkenrath"
+#define NEEDED_MIRANDA_VERSION PLUGIN_MAKE_VERSION(0,6,0,0)
+#define NEEDED_MIRANDA_VERSION_STR "0.6"
+#define PLUGIN_VERSION PLUGIN_MAKE_VERSION(0,1,1,0)
+#define FILE_VERSION 0,1,1,0
+
+#if defined(_DEBUG)
+ #define FILE_VERSION_STR "0.1.1.1 alpha"
+#else
+ #define FILE_VERSION_STR "0.1.1.0"
+#endif
+
+#define PLUGIN_EMAIL "hrathh users.sourceforge.net"
+#define PLUGIN_EMAIL_ATT_POS 7 /* position of the @-sign in the email adress above */
+
+#if defined(_UNICODE)
+ #define PLUGIN_WEBSITE "http://addons.miranda-im.org/details.php?action=viewfile&id=3458"
+#else
+ #define PLUGIN_WEBSITE "http://addons.miranda-im.org/details.php?action=viewfile&id=3457"
+#endif
diff --git a/plugins/AssocMgr/version.rc b/plugins/AssocMgr/version.rc
index b052561f31..4234d8d7ec 100644
--- a/plugins/AssocMgr/version.rc
+++ b/plugins/AssocMgr/version.rc
@@ -1,3 +1,5 @@
+#ifndef _MAC
+
#include "version.h"
/////////////////////////////////////////////////////////////////////////////
@@ -6,27 +8,34 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION __FILEVERSION_STRING
- PRODUCTVERSION __FILEVERSION_STRING
- FILEFLAGSMASK 0x17L
+ FILEVERSION FILE_VERSION
+ PRODUCTVERSION FILE_VERSION
+ FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
- FILEOS 0x4L
- FILETYPE 0x0L
+ FILEOS 0x40004L
+ FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
- VALUE "FileDescription", __DESCRIPTION
- VALUE "InternalName", __PLUGIN_NAME
- VALUE "LegalCopyright", __COPYRIGHT
- VALUE "OriginalFilename", __FILENAME
- VALUE "ProductName", __PLUGIN_NAME
+ VALUE "Comments", "Licensed under the terms of the GNU General Public License"
+ VALUE "FileDescription", "File Association Manager Plugin for Miranda IM"
+ VALUE "FileVersion", FILE_VERSION_STR
+#ifdef _UNICODE
+ VALUE "InternalName", "AssocMgr (Unicode)"
+#else
+ VALUE "InternalName", "AssocMgr"
+#endif
+ VALUE "LegalCopyright", "Copyright © 2005-2007 H. Herkenrath"
+ VALUE "OriginalFilename", "assocmgr.dll"
+ VALUE "ProductName", "File Association Manager"
+ VALUE "ProductVersion", FILE_VERSION_STR
END
END
BLOCK "VarFileInfo"
@@ -34,3 +43,9 @@ BEGIN
VALUE "Translation", 0x0, 1200
END
END
+
+#endif // !_MAC
+
+
+
+