summaryrefslogtreecommitdiff
path: root/updater
diff options
context:
space:
mode:
Diffstat (limited to 'updater')
-rw-r--r--updater/common.h3
-rw-r--r--updater/icons.cpp119
-rw-r--r--updater/icons.h10
-rw-r--r--updater/options.cpp13
-rw-r--r--updater/popups.cpp41
-rw-r--r--updater/progress_dialog.cpp6
-rw-r--r--updater/resource.h1
-rw-r--r--updater/services.cpp4
-rw-r--r--updater/updater.rc3
-rw-r--r--updater/version.h2
10 files changed, 134 insertions, 68 deletions
diff --git a/updater/common.h b/updater/common.h
index b62bab7..3672961 100644
--- a/updater/common.h
+++ b/updater/common.h
@@ -37,12 +37,12 @@
#include <m_netlib.h>
#include <m_utils.h>
#include <m_clist.h>
+#include <m_icoLib.h>
//#include "../mwclist/m_clist.h"
//#include <m_genmenu.h>
#include <m_updater.h>
#include <m_trigger.h>
-#include "IcoLib.h"
#include <m_folders.h>
@@ -183,3 +183,4 @@ static int __inline NLog(char *msg) {
#endif
+
diff --git a/updater/icons.cpp b/updater/icons.cpp
index 345e948..398303f 100644
--- a/updater/icons.cpp
+++ b/updater/icons.cpp
@@ -1,61 +1,94 @@
#include "common.h"
#include "icons.h"
-HICON hIconCheck, hIconRestart, hIconCheckExit;
-HANDLE hIcoLibIconsChanged = 0;
+HANDLE hIcoLibIconsChanged = NULL;
-int ReloadIcons(WPARAM wParam, LPARAM lParam) {
- hIconCheck = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"updater_check");
- hIconRestart = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"updater_restart");
- hIconCheckExit = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)"updater_checkexit");
+extern HANDLE hMainMenuItem, hMainMenuItemRestart, hMainMenuItemUpdateAndExit;
- return 0;
+typedef struct
+{
+ char* szDescr;
+ char* szName;
+ int defIconID;
+} IconStruct;
+
+static IconStruct iconList[] =
+{
+ { "Check for Updates", "updater_check", IDI_MAINMENU },
+ { "Restart", "updater_restart", IDI_RESTART },
+ { "Update and Exit", "updater_checkexit", IDI_UPDATEANDEXIT },
+};
+
+
+HICON LoadIconEx(IconIndex i)
+{
+ HICON hIcon;
+
+ if (hIcoLibIconsChanged)
+ hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconList[(int)i].szName);
+ else
+ hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(iconList[(int)i].defIconID),
+ IMAGE_ICON, 0, 0, 0);
+
+ return hIcon;
+}
+
+void ReleaseIconEx(HICON hIcon)
+{
+ if (hIcoLibIconsChanged)
+ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
+ else
+ DestroyIcon(hIcon);
}
-void InitIcons() {
- if(ServiceExists(MS_SKIN2_ADDICON)) {
- SKINICONDESC2 sid;
- sid.cbSize = sizeof(SKINICONDESC2);
- sid.pszSection = "Updater";
+int ReloadIcons(WPARAM wParam, LPARAM lParam)
+{
+ // fix menu icons
+ CLISTMENUITEM menu = {0};
- sid.pszDescription = Translate("Check for Updates");
- sid.pszName = "updater_check";
- sid.pszDefaultFile = "updater.dll";
- sid.iDefaultIndex = 0;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 0, 0, 0);
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ menu.cbSize = sizeof(menu);
+ menu.flags = CMIM_ICON;
- sid.pszDescription = Translate("Restart");
- sid.pszName = "updater_restart";
- sid.pszDefaultFile = "updater.dll";
- sid.iDefaultIndex = 1;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RESTART), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ menu.hIcon = LoadIconEx(I_CHKUPD);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItem, (LPARAM)&menu);
+ ReleaseIconEx(menu.hIcon);
- sid.pszDescription = Translate("Update and Exit");
- sid.pszName = "updater_checkexit";
- sid.pszDefaultFile = "updater.dll";
- sid.iDefaultIndex = 2;
- sid.hDefaultIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_UPDATEANDEXIT), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
- CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ menu.hIcon = LoadIconEx(I_RSTRT);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItemRestart, (LPARAM)&menu);
+ ReleaseIconEx(menu.hIcon);
+
+ menu.hIcon = LoadIconEx(I_CHKUPDEXT);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMainMenuItemUpdateAndExit, (LPARAM)&menu);
+ ReleaseIconEx(menu.hIcon);
+
+ return 0;
+}
- ReloadIcons(0, 0);
+void InitIcons(void)
+{
+ SKINICONDESC sid = {0};
+ char path[MAX_PATH];
+ int i;
+
+ sid.cbSize = sizeof(SKINICONDESC);
+ sid.pszSection = MODULE;
+ sid.pszDefaultFile = path;
+ GetModuleFileNameA(hInst, path, sizeof(path));
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
- } else {
- hIconCheck = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MAINMENU), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
- hIconRestart = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RESTART), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
- hIconCheckExit = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_UPDATEANDEXIT), IMAGE_ICON, 0, 0, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
+ for (i = 0; i < sizeof(iconList) / sizeof(IconStruct); ++i)
+ {
+ sid.pszDescription = Translate(iconList[i].szDescr);
+ sid.pszName = iconList[i].szName;
+ sid.iDefaultIndex = -iconList[i].defIconID;
+ CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
}
+ hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
-void DeinitIcons() {
- if(hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged);
- else {
- DestroyIcon(hIconCheck);
- DestroyIcon(hIconRestart);
- DestroyIcon(hIconCheckExit);
- }
+
+void DeinitIcons(void)
+{
+ if (hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged);
}
diff --git a/updater/icons.h b/updater/icons.h
index 79d2f3a..76389d9 100644
--- a/updater/icons.h
+++ b/updater/icons.h
@@ -1,9 +1,13 @@
#ifndef _ICONS_INC
#define _ICONS_INC
-extern HICON hIconCheck, hIconRestart, hIconCheckExit;
+void InitIcons(void);
+void DeinitIcons(void);
+
+typedef enum {I_CHKUPD, I_RSTRT, I_CHKUPDEXT} IconIndex;
+
+HICON LoadIconEx(IconIndex i);
+void ReleaseIconEx(HICON hIcon);
-void InitIcons();
-void DeinitIcons();
#endif
diff --git a/updater/options.cpp b/updater/options.cpp
index f1f3077..8522b87 100644
--- a/updater/options.cpp
+++ b/updater/options.cpp
@@ -15,12 +15,13 @@ void add_restart_menu_item() {
menu.cbSize=sizeof(menu);
menu.flags = CMIM_ALL;
- menu.hIcon = hIconRestart;
+ menu.hIcon = LoadIconEx(I_RSTRT);
menu.pszName = Translate("Restart");
menu.pszService= MS_UPDATE_MENURESTART;
menu.position = 2000099900;
hMainMenuItemRestart = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ ReleaseIconEx(menu.hIcon);
}
void add_update_and_exit_menu_item() {
@@ -28,12 +29,13 @@ void add_update_and_exit_menu_item() {
menu.cbSize=sizeof(menu);
menu.flags = CMIM_ALL;
- menu.hIcon = hIconCheckExit;
+ menu.hIcon = LoadIconEx(I_CHKUPDEXT);
menu.pszName = Translate("Update and Exit");
menu.pszService= MS_UPDATE_MENUUPDATEANDEXIT;
menu.position = 2000099901;
hMainMenuItemUpdateAndExit = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ ReleaseIconEx(menu.hIcon);
}
void remove_restart_menu_item() {
@@ -157,8 +159,8 @@ static BOOL CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
//SendDlgItemMessage(hwndDlg, IDC_BTN_CHECK, WM_SETICON, ICON_SMALL, (LPARAM)hIconCheck);
//SendDlgItemMessage(hwndDlg, IDC_BTN_CHECKNORESTART, WM_SETICON, ICON_SMALL, (LPARAM)hIconCheckExit);
- SendDlgItemMessage(hwndDlg, IDC_BTN_CHECK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconCheck);
- SendDlgItemMessage(hwndDlg, IDC_BTN_CHECKNORESTART, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconCheckExit);
+ SendDlgItemMessage(hwndDlg, IDC_BTN_CHECK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(I_CHKUPD));
+ SendDlgItemMessage(hwndDlg, IDC_BTN_CHECKNORESTART, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(I_CHKUPDEXT));
return FALSE;
@@ -353,6 +355,8 @@ static BOOL CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
}
break;
case WM_DESTROY:
+ ReleaseIconEx((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_CHECK, BM_SETIMAGE, IMAGE_ICON, 0));
+ ReleaseIconEx((HICON)SendDlgItemMessage(hwndDlg, IDC_BTN_CHECKNORESTART, BM_SETIMAGE, IMAGE_ICON, 0));
hwndOptions = 0;
break;
}
@@ -673,3 +677,4 @@ void SaveOptions() {
}
+
diff --git a/updater/popups.cpp b/updater/popups.cpp
index cbf1529..addcf60 100644
--- a/updater/popups.cpp
+++ b/updater/popups.cpp
@@ -8,13 +8,20 @@ HWND hwndPop = 0;
HANDLE hEventPop;
bool pop_cancelled;
+typedef struct
+{
+ unsigned flags;
+ HICON hIcon;
+} PopupDataType;
+
+
LRESULT CALLBACK NullWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message ) {
case UM_INITPOPUP:
{
- int flags = CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
- if(flags & POPFLAG_SAVEHWND) hwndPop = hWnd;
+ PopupDataType* popup = (PopupDataType*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
+ if(popup->flags & POPFLAG_SAVEHWND) hwndPop = hWnd;
}
return 0;
case WMU_CLOSEPOP:
@@ -24,8 +31,8 @@ LRESULT CALLBACK NullWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM
case WM_COMMAND:
{
- int flags = CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
- if(flags & POPFLAG_SAVEHWND) pop_cancelled = false;
+ PopupDataType* popup = (PopupDataType*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
+ if(popup->flags & POPFLAG_SAVEHWND) pop_cancelled = false;
}
SetEvent(hEventPop);
PUDeletePopUp( hWnd );
@@ -33,16 +40,21 @@ LRESULT CALLBACK NullWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM
case WM_CONTEXTMENU:
{
- int flags = CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
- if(flags & POPFLAG_SAVEHWND) pop_cancelled = true;
+ PopupDataType* popup = (PopupDataType*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
+ if(popup->flags & POPFLAG_SAVEHWND) pop_cancelled = true;
}
SetEvent(hEventPop);
PUDeletePopUp( hWnd );
return TRUE;
case UM_FREEPLUGINDATA: {
- int flags = CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
- if(flags & POPFLAG_SAVEHWND) hwndPop = 0;
+ PopupDataType* popup = (PopupDataType*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
+ if ((unsigned)popup != CALLSERVICE_NOTFOUND)
+ {
+ if (popup->flags & POPFLAG_SAVEHWND) hwndPop = 0;
+ ReleaseIconEx(popup->hIcon);
+ free(popup);
+ }
return TRUE;
}
}
@@ -101,7 +113,7 @@ void ShowPopupA( HANDLE hContact, const char* line1, const char* line2, int flag
memset((void *)ppd, 0, sizeof(POPUPDATAEX));
ppd->lchContact = hContact;
- ppd->lchIcon = hIconCheck;
+ ppd->lchIcon = LoadIconEx(I_CHKUPD);
if(line1 && line2) {
strcpy( ppd->lpzContactName, line1 );
@@ -128,7 +140,9 @@ void ShowPopupA( HANDLE hContact, const char* line1, const char* line2, int flag
ppd->iSeconds = timeout;
ppd->PluginWindowProc = ( WNDPROC )NullWindowProc;
- ppd->PluginData = (void *)flags;
+ ppd->PluginData = malloc(sizeof(PopupDataType));
+ ((PopupDataType*)ppd->PluginData)->flags = flags;
+ ((PopupDataType*)ppd->PluginData)->hIcon = ppd->lchIcon;
QueueUserAPC( sttPopupProcA , mainThread, ( ULONG )ppd );
}
@@ -161,7 +175,7 @@ void ShowPopupW( HANDLE hContact, const wchar_t* line1, const wchar_t* line2, in
memset((void *)ppd, 0, sizeof(POPUPDATAW));
ppd->lchContact = hContact;
- ppd->lchIcon = hIconCheck;
+ ppd->lchIcon = LoadIconEx(I_CHKUPD);
if(line1 && line2) {
wcscpy( ppd->lpwzContactName, line1 );
@@ -188,7 +202,9 @@ void ShowPopupW( HANDLE hContact, const wchar_t* line1, const wchar_t* line2, in
ppd->iSeconds = timeout;
ppd->PluginWindowProc = ( WNDPROC )NullWindowProc;
- ppd->PluginData = (void *)flags;
+ ppd->PluginData = malloc(sizeof(PopupDataType));
+ ((PopupDataType*)ppd->PluginData)->flags = flags;
+ ((PopupDataType*)ppd->PluginData)->hIcon = ppd->lchIcon;
QueueUserAPC( sttPopupProcW , mainThread, ( ULONG )ppd );
@@ -279,3 +295,4 @@ void DeinitPopups() {
CloseHandle(hEventPop);
}
+
diff --git a/updater/progress_dialog.cpp b/updater/progress_dialog.cpp
index bdcb922..886ba76 100644
--- a/updater/progress_dialog.cpp
+++ b/updater/progress_dialog.cpp
@@ -20,8 +20,8 @@ BOOL CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
// these change icons for all system dialogs!
//SetClassLong(hwndDlg, GCL_HICON, (LONG)hIconCheck);
//SetClassLong(hwndDlg, GCL_HICONSM, (LONG)hIconCheck);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconCheck);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIconCheck);
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(I_CHKUPD));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(I_CHKUPD));
SAVEWINDOWPOS swp;
swp.hwnd=hwndDlg; swp.hContact=0; swp.szModule=MODULE; swp.szNamePrefix="ProgressWindow";
@@ -73,6 +73,8 @@ BOOL CALLBACK DlgProcProgress(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
case WM_DESTROY:
KillTimer(hwndDlg, ID_PROGTIMER);
Utils_SaveWindowPosition(hwndDlg,0,MODULE,"ProgressWindow");
+ ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)0));
+ ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)0));
break;
}
return FALSE;
diff --git a/updater/resource.h b/updater/resource.h
index d746d0c..4796e8a 100644
--- a/updater/resource.h
+++ b/updater/resource.h
@@ -48,6 +48,7 @@
#define IDC_BTN_SELECTDLLS2 1030
#define IDC_BTN_SELECTINV 1030
#define IDC_BTN_SELECTALL 1031
+#define IDC_STATIC -1
// Next default values for new objects
//
diff --git a/updater/services.cpp b/updater/services.cpp
index 8ba9de3..ac604a0 100644
--- a/updater/services.cpp
+++ b/updater/services.cpp
@@ -741,7 +741,7 @@ int ServicesModulesLoaded(WPARAM wParam, LPARAM lParam) {
menu.cbSize=sizeof(menu);
menu.flags = CMIM_ALL;
- menu.hIcon = hIconCheck;
+ menu.hIcon = LoadIconEx(I_CHKUPD);
menu.pszName = Translate("Check for updates");
menu.pszService= MS_UPDATE_CHECKFORUPDATES;
@@ -753,6 +753,7 @@ int ServicesModulesLoaded(WPARAM wParam, LPARAM lParam) {
}
#endif
hMainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu);
+ ReleaseIconEx(menu.hIcon);
hEventServicesModulesLoaded2 = HookEvent(ME_SYSTEM_MODULESLOADED, ServicesModulesLoaded2);
startup_timer_id = SetTimer(0, 0, 5000, StartupTimerProc);
@@ -840,3 +841,4 @@ void DeinitServices() {
update_list.clear();
}
+
diff --git a/updater/updater.rc b/updater/updater.rc
index 452dcfd..8ca3b22 100644
--- a/updater/updater.rc
+++ b/updater/updater.rc
@@ -7,7 +7,7 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
+#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -232,3 +232,4 @@ IDI_UPDATEANDEXIT ICON "ue.ico"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+
diff --git a/updater/version.h b/updater/version.h
index 37ce3fc..582de18 100644
--- a/updater/version.h
+++ b/updater/version.h
@@ -5,7 +5,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 4
#define __RELEASE_NUM 12
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM