summaryrefslogtreecommitdiff
path: root/updater/updater.cpp
diff options
context:
space:
mode:
author(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2010-02-21 23:00:56 +0000
committer(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2010-02-21 23:00:56 +0000
commit8f5a7b54eb953bbfc877ec915e26b3a95ec28d00 (patch)
tree827e40ab3528e10afd6fcb44f7ed5db0d7eed519 /updater/updater.cpp
parentb130e8caa16961f597ae4ac6984a6aa00de7b6c7 (diff)
New updater with 3x reduced footprint and fully W7 and x64 compatible
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@476 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'updater/updater.cpp')
-rw-r--r--updater/updater.cpp42
1 files changed, 13 insertions, 29 deletions
diff --git a/updater/updater.cpp b/updater/updater.cpp
index 1379d8d..d2ee45a 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -4,10 +4,11 @@
HINSTANCE hInst;
PLUGINLINK *pluginLink;
-HANDLE hNetlibUser = 0;
+HANDLE hNetlibUser, hNetlibHttp;
-DWORD mainThreadId;
-HANDLE mainThread;
+MM_INTERFACE mmi;
+UTF8_INTERFACE utfi;
+LIST_INTERFACE li;
bool is_idle = false;
bool unicode_system;
@@ -44,13 +45,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvRese
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
-{
- pluginInfo.cbSize = sizeof(PLUGININFO);
- return (PLUGININFO*)&pluginInfo;
+ return mirandaVersion < PLUGIN_MAKE_VERSION(0, 8, 0, 0) ? NULL :&pluginInfo;
}
static const MUUID interfaces[] = {MIID_UPDATER, MIID_LAST};
@@ -79,8 +74,7 @@ void InitNetlib() {
}
void DeinitNetlib() {
- if(hNetlibUser)
- CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);
+ Netlib_CloseHandle(hNetlibUser);
}
HANDLE hEventIdleChanged;
@@ -142,7 +136,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
update.szComponentName = pluginInfo.shortName;
update.pbVersion = (BYTE *)CreateVersionStringPluginEx(&pluginInfo, szVersion);
- update.cpbVersion = strlen((char *)update.pbVersion);
+ update.cpbVersion = (int)strlen((char *)update.pbVersion);
update.szBetaChangelogURL = "https://server.scottellis.com.au/wsvn/mim_plugs/updater/?op=log&rev=0&sc=0&isdir=1";
@@ -160,7 +154,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
update.szBetaUpdateURL = BETA_HOST_URL_PREFIX "/updater_unicode.zip";
update.szBetaVersionURL = BETA_HOST_URL_PREFIX "/ver_updater_unicode.html";
update.pbBetaVersionPrefix = (BYTE *)"Updater (Unicode) version ";
- update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
+ update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);
} else {
#ifdef REGISTER_AUTO
@@ -175,7 +169,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
update.szBetaUpdateURL = BETA_HOST_URL_PREFIX "/updater.zip";
update.szBetaVersionURL = BETA_HOST_URL_PREFIX "/ver_updater.html";
update.pbBetaVersionPrefix = (BYTE *)"Updater version ";
- update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);
+ update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);
}
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
@@ -208,15 +202,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
return 0;
}
-int Shutdown(WPARAM wParam, LPARAM lParam) {
- if(hNetlibUser) {
- SOCKET s = CallService( MS_NETLIB_GETSOCKET, (WPARAM)hNetlibUser, 0 );
- if ( s != INVALID_SOCKET ) shutdown( s, 2 );
- }
- return 0;
-}
-
-HANDLE hEventOptInit, hEventPreShutdown, hEventModulesLoaded;
+HANDLE hEventOptInit, hEventModulesLoaded;
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
@@ -246,8 +232,9 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
#endif
*/
- mainThreadId = GetCurrentThreadId();
- DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ mir_getLI( &li );
+ mir_getMMI( &mmi );
+ mir_getUTFI( &utfi );
// save global status from clist - will be restored after update check if that option is enabled, or in modules loaded if not
options.start_offline = (DBGetContactSettingByte(0, MODULE, "StartOffline", 1) == 1); // load option here - rest loading in modulesloaded
@@ -270,8 +257,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
HookEvent(ME_OPT_INITIALISE, OptInit);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
-
// do this before init services, so that InitPopups is called before startup update
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
@@ -284,7 +269,6 @@ extern "C" int __declspec(dllexport) Unload(void)
{
UnhookEvent(hEventIdleChanged);
UnhookEvent(hEventOptInit);
- UnhookEvent(hEventPreShutdown);
UnhookEvent(hEventModulesLoaded);
DeinitServices();