summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-29 15:16:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-29 15:16:55 +0000
commit1efd80007f65b4676c6c84dc8212d43ec190a311 (patch)
tree7e4675007a474c08fde6d8889f6324614872cd6b
parent90f539947aa80022249fd73cc6d72f568803e80b (diff)
adaptation for Miranda IM
git-svn-id: http://svn.miranda-ng.org/main/trunk@1723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--tools/IM-NG Updater/PluginUpdater_10.vcxproj93
-rw-r--r--tools/IM-NG Updater/src/Common.h84
-rw-r--r--tools/IM-NG Updater/src/PluginUpdater.cpp29
-rw-r--r--tools/IM-NG Updater/src/Utils.cpp36
4 files changed, 181 insertions, 61 deletions
diff --git a/tools/IM-NG Updater/PluginUpdater_10.vcxproj b/tools/IM-NG Updater/PluginUpdater_10.vcxproj
index 01e66fce75..4ae049ce61 100644
--- a/tools/IM-NG Updater/PluginUpdater_10.vcxproj
+++ b/tools/IM-NG Updater/PluginUpdater_10.vcxproj
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
+ <ProjectConfiguration Include="Debug Unicode|Win32">
+ <Configuration>Debug Unicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
+ <ProjectConfiguration Include="Debug Unicode|x64">
+ <Configuration>Debug Unicode</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
+ <ProjectConfiguration Include="Release Unicode|Win32">
+ <Configuration>Release Unicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
+ <ProjectConfiguration Include="Release Unicode|x64">
+ <Configuration>Release Unicode</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
@@ -23,53 +23,53 @@
<ProjectGuid>{21F6C0E4-DD1A-49E6-82FD-64574BB902BD}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;.\src\Minizip;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -92,7 +92,7 @@
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;.\Minizip;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -114,7 +114,7 @@
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
@@ -123,6 +123,7 @@
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>Common.h</PrecompiledHeaderFile>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -132,14 +133,13 @@
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
- <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">
<ClCompile>
<Optimization>Full</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
@@ -157,7 +157,6 @@
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)\lib</AdditionalLibraryDirectories>
- <AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
@@ -185,22 +184,22 @@
<ClCompile Include="src\checksum.cpp" />
<ClCompile Include="src\Events.cpp" />
<ClCompile Include="src\Minizip\ioapi.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\Minizip\iowin32.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\Minizip\unzip.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|Win32'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Unicode|x64'">NotUsing</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\Notifications.cpp" />
<ClCompile Include="src\Options.cpp" />
@@ -212,16 +211,16 @@
<ClCompile Include="src\Utils.cpp" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Zlib\zlib_10.vcxproj">
- <Project>{e2a369cd-eda3-414f-8ad0-e732cd7ee68c}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<None Include="res\btnClose.ico" />
<None Include="res\btnOk.ico" />
<None Include="res\delete.ico" />
<None Include="res\menu.ico" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\zlib\zlib_10.vcxproj">
+ <Project>{e2a369cd-eda3-414f-8ad0-e732cd7ee68c}</Project>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/tools/IM-NG Updater/src/Common.h b/tools/IM-NG Updater/src/Common.h
index 9efa4740be..9d7c310c1d 100644
--- a/tools/IM-NG Updater/src/Common.h
+++ b/tools/IM-NG Updater/src/Common.h
@@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA.
#define _CRT_SECURE_NO_WARNINGS
-#define MIRANDA_VER 0x0A00
+#define MIRANDA_VER 0x0800
// Windows Header Files:
#include <time.h>
@@ -138,7 +138,6 @@ int OptInit(WPARAM, LPARAM);
void DoCheck(int iFlag);
BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal);
void ShowPopup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType);
-void __stdcall ExitMe(void*);
void __stdcall RestartMe(void*);
BOOL AllowUpdateOnStartup();
void InitTimer();
@@ -150,3 +149,84 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
bool unzip(const TCHAR* ptszZipFile, TCHAR* ptszDestPath, TCHAR* ptszBackPath);
+
+template<class T> class mir_ptr
+{
+ T* data;
+
+public:
+ __inline mir_ptr() : data((T*)mir_calloc(sizeof(T))) {}
+ __inline mir_ptr(T* _p) : data(_p) {}
+ __inline ~mir_ptr() { mir_free(data); }
+ __inline T* operator = (T* _p) { if (data) mir_free(data); data = _p; return data; }
+ __inline T* operator->() const { return data; }
+ __inline operator T*() const { return data; }
+ __inline operator INT_PTR() const { return (INT_PTR)data; }
+};
+
+class _A2T
+{
+ TCHAR* buf;
+
+public:
+ __forceinline _A2T(const char* s) : buf(mir_a2t(s)) {}
+ __forceinline _A2T(const char* s, int cp) : buf(mir_a2t_cp(s, cp)) {}
+ ~_A2T() { mir_free(buf); }
+
+ __forceinline operator TCHAR*() const
+ { return buf;
+ }
+};
+
+class _T2A
+{
+ char* buf;
+
+public:
+ __forceinline _T2A(const TCHAR* s) : buf(mir_t2a(s)) {}
+ __forceinline _T2A(const TCHAR* s, int cp) : buf(mir_t2a_cp(s, cp)) {}
+ __forceinline ~_T2A() { mir_free(buf); }
+
+ __forceinline operator char*() const
+ { return buf;
+ }
+};
+
+__forceinline INT_PTR Options_Open(OPENOPTIONSDIALOG *ood)
+{
+ return CallService("Opt/OpenOptions", 0, (LPARAM)ood);
+}
+
+__forceinline INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE* odp)
+{
+ return CallService("Opt/AddPage", wParam, (LPARAM)odp);
+}
+
+char* rtrim(char* str);
+void CreatePathToFileT(TCHAR* szFilePath);
+
+#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1)* sizeof(TCHAR)), A)
+
+__forceinline HANDLE Skin_GetIconHandle(const char* szIconName)
+{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
+}
+
+__forceinline HICON Skin_GetIcon(const char* szIconName, int size=0)
+{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
+}
+
+__forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi)
+{ return (HGENMENU)CallService("CList/AddMainMenuItem", 0, (LPARAM)mi);
+}
+
+__forceinline INT_PTR Hotkey_Register(HOTKEYDESC *hk)
+{ return CallService("CoreHotkeys/Register", 0, (LPARAM)hk);
+}
+
+__forceinline INT_PTR CreateDirectoryTreeT(const TCHAR* ptszPath)
+{ return CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)ptszPath);
+}
+
+__forceinline HANDLE Skin_AddIcon(SKINICONDESC* si)
+{ return (HANDLE)CallService("Skin2/Icons/AddIcon", 0, (LPARAM)si);
+}
diff --git a/tools/IM-NG Updater/src/PluginUpdater.cpp b/tools/IM-NG Updater/src/PluginUpdater.cpp
index 1206f87ea8..f24a192bc5 100644
--- a/tools/IM-NG Updater/src/PluginUpdater.cpp
+++ b/tools/IM-NG Updater/src/PluginUpdater.cpp
@@ -19,11 +19,18 @@ Boston, MA 02111-1307, USA.
#include "common.h"
+#define MIID_UPDATER {0x4a47b19b, 0xde5a, 0x4436, { 0xab, 0x4b, 0xe1, 0xf3, 0xa0, 0x22, 0x5d, 0xe7}}
+
HINSTANCE hInst = NULL;
+MM_INTERFACE mmi;
+LIST_INTERFACE li;
+MD5_INTERFACE md5i;
+UTF8_INTERFACE utfi;
-HANDLE hPluginUpdaterFolder = NULL, hCheckUpdates = NULL;
+HANDLE hPluginUpdaterFolder = NULL, hCheckUpdates = NULL, hEmptyFolder = NULL;
TCHAR tszRoot[MAX_PATH] = {0};
int hLangpack;
+PLUGINLINK* pluginLink;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -46,14 +53,25 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
+static const MUUID interfaces[] = {MIID_UPDATER, MIID_LAST};
+
+extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
+{
+ return interfaces;
+}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfoEx;
}
-extern "C" __declspec(dllexport) int Load(void)
+extern "C" __declspec(dllexport) int Load(PLUGINLINK* link)
{
- mir_getLP(&pluginInfoEx);
+ pluginLink = link;
+ mir_getMMI(&mmi);
+ mir_getLI(&li);
+ mir_getMD5I(&md5i);
+ mir_getUTFI(&utfi);
if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
hPluginUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, "Plugin Updater", MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
@@ -85,10 +103,9 @@ extern "C" __declspec(dllexport) int Load(void)
// Add hotkey
HOTKEYDESC hkd = {0};
hkd.cbSize = sizeof(hkd);
- hkd.dwFlags = HKD_TCHAR;
hkd.pszName = "Check for plugin updates";
- hkd.ptszDescription = _T("Check for plugin updates");
- hkd.ptszSection = _T("Plugin Updater");
+ hkd.pszDescription = "Check for plugin updates";
+ hkd.pszSection = "Plugin Updater";
hkd.pszService = MODNAME"/CheckUpdates";
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
hkd.lParam = FALSE;
diff --git a/tools/IM-NG Updater/src/Utils.cpp b/tools/IM-NG Updater/src/Utils.cpp
index 1886d02c01..be22f745e4 100644
--- a/tools/IM-NG Updater/src/Utils.cpp
+++ b/tools/IM-NG Updater/src/Utils.cpp
@@ -128,7 +128,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
DWORD dwBytes;
NETLIBHTTPREQUEST nlhr = {0};
- nlhr.cbSize = sizeof(nlhr);
+ nlhr.cbSize = NETLIBHTTPREQUEST_V1_SIZE;
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
char* szUrl = mir_t2a(tszURL);
@@ -164,13 +164,9 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
return ret;
}
-void __stdcall ExitMe(void*)
-{
- CallService("CloseAction", 0, 0);
-}
-
void __stdcall RestartMe(void*)
{
+ CallService("CloseAction", 0, 0);
CallService(MS_SYSTEM_RESTART, 0, 0);
}
@@ -227,3 +223,31 @@ void InitTimer()
SetWaitableTimer(Timer, &li, interval, TimerAPCProc, NULL, 0);
}
}
+
+char* rtrim(char* str)
+{
+ if (str == NULL)
+ return NULL;
+
+ char* p = strchr(str, 0);
+ while (--p >= str) {
+ switch (*p) {
+ case ' ': case '\t': case '\n': case '\r':
+ *p = 0; break;
+ default:
+ return str;
+ }
+ }
+ return str;
+}
+
+void CreatePathToFileT(TCHAR* szFilePath)
+{
+ TCHAR* pszLastBackslash = _tcsrchr(szFilePath, '\\');
+ if (pszLastBackslash == NULL)
+ return;
+
+ *pszLastBackslash = '\0';
+ CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)szFilePath);
+ *pszLastBackslash = '\\';
+}