summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-29 15:45:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-29 15:45:48 +0300
commit43fc37b844a3c9f32a2fda3fda751bbfdaa6a911 (patch)
tree4d99ad9523921fbc9af0f6ddfca63ad17bc06449 /src
parentac0c248abd4fa4befdbf4b44fb1c8483cadaefa4 (diff)
fixes #1224 (Crash when launch in service mode)
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/clistcore.cpp273
-rw-r--r--src/mir_app/src/modules.cpp32
-rw-r--r--src/mir_app/src/utils.cpp5
3 files changed, 154 insertions, 156 deletions
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp
index 800bc4c0c6..99e4af117f 100644
--- a/src/mir_app/src/clistcore.cpp
+++ b/src/mir_app/src/clistcore.cpp
@@ -36,8 +36,6 @@ static wchar_t szTip[MAX_TIP_SIZE+1];
void BuildProtoMenus(void);
-static int interfaceInited = 0;
-
static void fnPaintClc(HWND, ClcData*, HDC, RECT*)
{
}
@@ -69,144 +67,143 @@ static void fnReloadProtoMenus(void)
cli.pfnCluiProtocolStatusChanged(0, nullptr);
}
-MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void)
+void InitClistCore()
{
- if (interfaceInited == 0) {
- cli.version = 6;
- cli.bDisplayLocked = TRUE;
-
- cli.pfnClcOptionsChanged = fnClcOptionsChanged;
- cli.pfnContactListControlWndProc = fnContactListControlWndProc;
-
- cli.pfnRegisterFileDropping = fnRegisterFileDropping;
- cli.pfnUnregisterFileDropping = fnUnregisterFileDropping;
-
- cli.pfnGetRowsPriorTo = fnGetRowsPriorTo;
- cli.pfnFindItem = fnFindItem;
- cli.pfnGetRowByIndex = fnGetRowByIndex;
- cli.pfnGetContactHiddenStatus = fnGetContactHiddenStatus;
-
-
- cli.pfnAddGroup = fnAddGroup;
- cli.pfnAddItemToGroup = fnAddItemToGroup;
- cli.pfnCreateClcContact = fnCreateClcContact;
- cli.pfnRemoveItemFromGroup = fnRemoveItemFromGroup;
- cli.pfnFreeContact = fnFreeContact;
- cli.pfnFreeGroup = fnFreeGroup;
- cli.pfnAddInfoItemToGroup = fnAddInfoItemToGroup;
- cli.pfnAddContactToGroup = fnAddContactToGroup;
- cli.pfnAddContactToTree = fnAddContactToTree;
- cli.pfnDeleteItemFromTree = fnDeleteItemFromTree;
- cli.pfnRebuildEntireList = fnRebuildEntireList;
- cli.pfnGetGroupContentsCount = fnGetGroupContentsCount;
- cli.pfnSortCLC = fnSortCLC;
- cli.pfnSaveStateAndRebuildList = fnSaveStateAndRebuildList;
-
- cli.pfnProcessExternalMessages = fnProcessExternalMessages;
-
- cli.pfnPaintClc = fnPaintClc;
-
- cli.pfnGetGroupCountsText = fnGetGroupCountsText;
- cli.pfnHitTest = fnHitTest;
- cli.pfnScrollTo = fnScrollTo;
- cli.pfnEnsureVisible = fnEnsureVisible;
- cli.pfnRecalcScrollBar = fnRecalcScrollBar;
- cli.pfnSetGroupExpand = fnSetGroupExpand;
- cli.pfnDoSelectionDefaultAction = fnDoSelectionDefaultAction;
- cli.pfnFindRowByText = fnFindRowByText;
- cli.pfnEndRename = fnEndRename;
- cli.pfnDeleteFromContactList = fnDeleteFromContactList;
- cli.pfnBeginRenameSelection = fnBeginRenameSelection;
- cli.pfnCalcEipPosition = fnCalcEipPosition;
- cli.pfnGetDropTargetInformation = fnGetDropTargetInformation;
- cli.pfnClcStatusToPf2 = fnClcStatusToPf2;
- cli.pfnIsHiddenMode = fnIsHiddenMode;
- cli.pfnIsVisibleContact = fnIsVisibleContact;
- cli.pfnHideInfoTip = fnHideInfoTip;
- cli.pfnNotifyNewContact = fnNotifyNewContact;
- cli.pfnGetDefaultExStyle = fnGetDefaultExStyle;
- cli.pfnGetDefaultFontSetting = fnGetDefaultFontSetting;
- cli.pfnGetFontSetting = fnGetFontSetting;
- cli.pfnLoadClcOptions = fnLoadClcOptions;
- cli.pfnRecalculateGroupCheckboxes = fnRecalculateGroupCheckboxes;
- cli.pfnSetGroupChildCheckboxes = fnSetGroupChildCheckboxes;
- cli.pfnSetContactCheckboxes = fnSetContactCheckboxes;
- cli.pfnInvalidateItem = fnInvalidateItem;
- cli.pfnGetRowBottomY = fnGetRowBottomY;
- cli.pfnGetRowHeight = fnGetRowHeight;
- cli.pfnGetRowTopY = fnGetRowTopY;
- cli.pfnGetRowTotalHeight = fnGetRowTotalHeight;
- cli.pfnRowHitTest = fnRowHitTest;
-
- cli.pfnAddEvent = fnAddEvent;
- cli.pfnEventsProcessContactDoubleClick = fnEventsProcessContactDoubleClick;
- cli.pfnEventsProcessTrayDoubleClick = fnEventsProcessTrayDoubleClick;
- cli.pfnGetEvent = fnGetEvent;
- cli.pfnGetImlIconIndex = fnGetImlIconIndex;
- cli.pfnRemoveEvent = fnRemoveEvent;
-
- cli.pfnGetContactDisplayName = fnGetContactDisplayName;
- cli.pfnInvalidateDisplayNameCacheEntry = fnInvalidateDisplayNameCacheEntry;
- cli.pfnCreateCacheItem = fnCreateCacheItem;
- cli.pfnCheckCacheItem = fnCheckCacheItem;
- cli.pfnFreeCacheItem = fnFreeCacheItem;
- cli.pfnGetCacheEntry = fnGetCacheEntry;
-
- cli.szTip = szTip;
- cli.pfnInitTray = fnInitTray;
- cli.pfnUninitTray = fnUninitTray;
-
- cli.pfnTrayCycleTimerProc = fnTrayCycleTimerProc;
- cli.pfnTrayIconAdd = fnTrayIconAdd;
- cli.pfnTrayIconDestroy = fnTrayIconDestroy;
- cli.pfnTrayIconIconsChanged = fnTrayIconIconsChanged;
- cli.pfnTrayIconInit = fnTrayIconInit;
- cli.pfnTrayIconMakeTooltip = fnTrayIconMakeTooltip;
- cli.pfnTrayIconPauseAutoHide = fnTrayIconPauseAutoHide;
- cli.pfnTrayIconProcessMessage = fnTrayIconProcessMessage;
- cli.pfnTrayIconRemove = fnTrayIconRemove;
- cli.pfnTrayIconSetBaseInfo = fnTrayIconSetBaseInfo;
- cli.pfnTrayIconSetToBase = fnTrayIconSetToBase;
- cli.pfnTrayIconTaskbarCreated = fnTrayIconTaskbarCreated;
- cli.pfnTrayIconUpdate = fnTrayIconUpdate;
- cli.pfnTrayIconUpdateBase = fnTrayIconUpdateBase;
- cli.pfnTrayCalcChanged = fnTrayCalcChanged;
- cli.pfnTrayIconUpdateWithImageList = fnTrayIconUpdateWithImageList;
-
- cli.pfnContactListWndProc = fnContactListWndProc;
- cli.pfnLoadCluiGlobalOpts = fnLoadCluiGlobalOpts;
- cli.pfnCluiProtocolStatusChanged = fnCluiProtocolStatusChanged;
- cli.pfnDrawMenuItem = fnDrawMenuItem;
- cli.pfnInvalidateRect = fnInvalidateRect;
- cli.pfnOnCreateClc = fnOnCreateClc;
-
- cli.pfnChangeContactIcon = fnChangeContactIcon;
- cli.pfnLoadContactTree = fnLoadContactTree;
- cli.pfnSetHideOffline = fnSetHideOffline;
-
- cli.pfnDocking_ProcessWindowMessage = fnDocking_ProcessWindowMessage;
-
- cli.pfnGetIconFromStatusMode = fnGetIconFromStatusMode;
- cli.pfnGetWindowVisibleState = fnGetWindowVisibleState;
- cli.pfnIconFromStatusMode = fnIconFromStatusMode;
- cli.pfnShowHide = fnShowHide;
- cli.pfnGetStatusModeDescription = fnGetStatusModeDescription;
-
- cli.pfnGetProtocolVisibility = fnGetProtocolVisibility;
- cli.pfnGetProtoIndexByPos = fnGetProtoIndexByPos;
- cli.pfnReloadProtoMenus = fnReloadProtoMenus;
- cli.pfnGetAccountIndexByPos = fnGetAccountIndexByPos;
- cli.pfnGetProtocolMenu = fnGetProtocolMenu;
-
- cli.pfnReloadExtraIcons = fnReloadExtraIcons;
- cli.pfnSetAllExtraIcons = fnSetAllExtraIcons;
-
- cli.pfnGetContactIcon = fnGetContactIcon;
- cli.pfnGetAverageMode = fnGetAverageMode;
- cli.pfnInitAutoRebuild = fnInitAutoRebuild;
- interfaceInited = 1;
- }
+ cli.version = 6;
+ cli.bDisplayLocked = TRUE;
+
+ cli.pfnClcOptionsChanged = fnClcOptionsChanged;
+ cli.pfnContactListControlWndProc = fnContactListControlWndProc;
+
+ cli.pfnRegisterFileDropping = fnRegisterFileDropping;
+ cli.pfnUnregisterFileDropping = fnUnregisterFileDropping;
+
+ cli.pfnGetRowsPriorTo = fnGetRowsPriorTo;
+ cli.pfnFindItem = fnFindItem;
+ cli.pfnGetRowByIndex = fnGetRowByIndex;
+ cli.pfnGetContactHiddenStatus = fnGetContactHiddenStatus;
+
+ cli.pfnAddGroup = fnAddGroup;
+ cli.pfnAddItemToGroup = fnAddItemToGroup;
+ cli.pfnCreateClcContact = fnCreateClcContact;
+ cli.pfnRemoveItemFromGroup = fnRemoveItemFromGroup;
+ cli.pfnFreeContact = fnFreeContact;
+ cli.pfnFreeGroup = fnFreeGroup;
+ cli.pfnAddInfoItemToGroup = fnAddInfoItemToGroup;
+ cli.pfnAddContactToGroup = fnAddContactToGroup;
+ cli.pfnAddContactToTree = fnAddContactToTree;
+ cli.pfnDeleteItemFromTree = fnDeleteItemFromTree;
+ cli.pfnRebuildEntireList = fnRebuildEntireList;
+ cli.pfnGetGroupContentsCount = fnGetGroupContentsCount;
+ cli.pfnSortCLC = fnSortCLC;
+ cli.pfnSaveStateAndRebuildList = fnSaveStateAndRebuildList;
+
+ cli.pfnProcessExternalMessages = fnProcessExternalMessages;
+
+ cli.pfnPaintClc = fnPaintClc;
+
+ cli.pfnGetGroupCountsText = fnGetGroupCountsText;
+ cli.pfnHitTest = fnHitTest;
+ cli.pfnScrollTo = fnScrollTo;
+ cli.pfnEnsureVisible = fnEnsureVisible;
+ cli.pfnRecalcScrollBar = fnRecalcScrollBar;
+ cli.pfnSetGroupExpand = fnSetGroupExpand;
+ cli.pfnDoSelectionDefaultAction = fnDoSelectionDefaultAction;
+ cli.pfnFindRowByText = fnFindRowByText;
+ cli.pfnEndRename = fnEndRename;
+ cli.pfnDeleteFromContactList = fnDeleteFromContactList;
+ cli.pfnBeginRenameSelection = fnBeginRenameSelection;
+ cli.pfnCalcEipPosition = fnCalcEipPosition;
+ cli.pfnGetDropTargetInformation = fnGetDropTargetInformation;
+ cli.pfnClcStatusToPf2 = fnClcStatusToPf2;
+ cli.pfnIsHiddenMode = fnIsHiddenMode;
+ cli.pfnIsVisibleContact = fnIsVisibleContact;
+ cli.pfnHideInfoTip = fnHideInfoTip;
+ cli.pfnNotifyNewContact = fnNotifyNewContact;
+ cli.pfnGetDefaultExStyle = fnGetDefaultExStyle;
+ cli.pfnGetDefaultFontSetting = fnGetDefaultFontSetting;
+ cli.pfnGetFontSetting = fnGetFontSetting;
+ cli.pfnLoadClcOptions = fnLoadClcOptions;
+ cli.pfnRecalculateGroupCheckboxes = fnRecalculateGroupCheckboxes;
+ cli.pfnSetGroupChildCheckboxes = fnSetGroupChildCheckboxes;
+ cli.pfnSetContactCheckboxes = fnSetContactCheckboxes;
+ cli.pfnInvalidateItem = fnInvalidateItem;
+ cli.pfnGetRowBottomY = fnGetRowBottomY;
+ cli.pfnGetRowHeight = fnGetRowHeight;
+ cli.pfnGetRowTopY = fnGetRowTopY;
+ cli.pfnGetRowTotalHeight = fnGetRowTotalHeight;
+ cli.pfnRowHitTest = fnRowHitTest;
+
+ cli.pfnAddEvent = fnAddEvent;
+ cli.pfnEventsProcessContactDoubleClick = fnEventsProcessContactDoubleClick;
+ cli.pfnEventsProcessTrayDoubleClick = fnEventsProcessTrayDoubleClick;
+ cli.pfnGetEvent = fnGetEvent;
+ cli.pfnGetImlIconIndex = fnGetImlIconIndex;
+ cli.pfnRemoveEvent = fnRemoveEvent;
+
+ cli.pfnGetContactDisplayName = fnGetContactDisplayName;
+ cli.pfnInvalidateDisplayNameCacheEntry = fnInvalidateDisplayNameCacheEntry;
+ cli.pfnCreateCacheItem = fnCreateCacheItem;
+ cli.pfnCheckCacheItem = fnCheckCacheItem;
+ cli.pfnFreeCacheItem = fnFreeCacheItem;
+ cli.pfnGetCacheEntry = fnGetCacheEntry;
+
+ cli.szTip = szTip;
+ cli.pfnInitTray = fnInitTray;
+ cli.pfnUninitTray = fnUninitTray;
+
+ cli.pfnTrayCycleTimerProc = fnTrayCycleTimerProc;
+ cli.pfnTrayIconAdd = fnTrayIconAdd;
+ cli.pfnTrayIconDestroy = fnTrayIconDestroy;
+ cli.pfnTrayIconIconsChanged = fnTrayIconIconsChanged;
+ cli.pfnTrayIconInit = fnTrayIconInit;
+ cli.pfnTrayIconMakeTooltip = fnTrayIconMakeTooltip;
+ cli.pfnTrayIconPauseAutoHide = fnTrayIconPauseAutoHide;
+ cli.pfnTrayIconProcessMessage = fnTrayIconProcessMessage;
+ cli.pfnTrayIconRemove = fnTrayIconRemove;
+ cli.pfnTrayIconSetBaseInfo = fnTrayIconSetBaseInfo;
+ cli.pfnTrayIconSetToBase = fnTrayIconSetToBase;
+ cli.pfnTrayIconTaskbarCreated = fnTrayIconTaskbarCreated;
+ cli.pfnTrayIconUpdate = fnTrayIconUpdate;
+ cli.pfnTrayIconUpdateBase = fnTrayIconUpdateBase;
+ cli.pfnTrayCalcChanged = fnTrayCalcChanged;
+ cli.pfnTrayIconUpdateWithImageList = fnTrayIconUpdateWithImageList;
+
+ cli.pfnContactListWndProc = fnContactListWndProc;
+ cli.pfnLoadCluiGlobalOpts = fnLoadCluiGlobalOpts;
+ cli.pfnCluiProtocolStatusChanged = fnCluiProtocolStatusChanged;
+ cli.pfnDrawMenuItem = fnDrawMenuItem;
+ cli.pfnInvalidateRect = fnInvalidateRect;
+ cli.pfnOnCreateClc = fnOnCreateClc;
+
+ cli.pfnChangeContactIcon = fnChangeContactIcon;
+ cli.pfnLoadContactTree = fnLoadContactTree;
+ cli.pfnSetHideOffline = fnSetHideOffline;
+
+ cli.pfnDocking_ProcessWindowMessage = fnDocking_ProcessWindowMessage;
+
+ cli.pfnGetIconFromStatusMode = fnGetIconFromStatusMode;
+ cli.pfnGetWindowVisibleState = fnGetWindowVisibleState;
+ cli.pfnIconFromStatusMode = fnIconFromStatusMode;
+ cli.pfnShowHide = fnShowHide;
+ cli.pfnGetStatusModeDescription = fnGetStatusModeDescription;
+
+ cli.pfnGetProtocolVisibility = fnGetProtocolVisibility;
+ cli.pfnGetProtoIndexByPos = fnGetProtoIndexByPos;
+ cli.pfnReloadProtoMenus = fnReloadProtoMenus;
+ cli.pfnGetAccountIndexByPos = fnGetAccountIndexByPos;
+ cli.pfnGetProtocolMenu = fnGetProtocolMenu;
+
+ cli.pfnReloadExtraIcons = fnReloadExtraIcons;
+ cli.pfnSetAllExtraIcons = fnSetAllExtraIcons;
+
+ cli.pfnGetContactIcon = fnGetContactIcon;
+ cli.pfnGetAverageMode = fnGetAverageMode;
+ cli.pfnInitAutoRebuild = fnInitAutoRebuild;
+}
+MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void)
+{
if (g_bReadyToInitClist) {
LoadContactListModule2();
LoadCLCModule();
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp
index a8abaac4c9..a4730df8a6 100644
--- a/src/mir_app/src/modules.cpp
+++ b/src/mir_app/src/modules.cpp
@@ -84,9 +84,9 @@ int LoadDefaultModules(void)
{
// load order is very important for these
if (LoadSystemModule()) return 1;
- if (LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
+ if (LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
if (CheckRestart()) return 1;
- if (LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
+ if (LoadUtilsModule()) return 1;
if (LoadIcoTabsModule()) return 1;
if (LoadHeaderbarModule()) return 1;
if (LoadDbintfModule()) return 1;
@@ -119,18 +119,6 @@ int LoadDefaultModules(void)
if (LoadIcoLibModule()) return 1;
if (LoadSkinIcons()) return 1;
- if (LoadSkinSounds()) return 1;
- if (LoadSkinHotkeys()) return 1;
- if (LoadFontserviceModule()) return 1;
- if (LoadSrmmModule()) return 1;
- if (LoadChatModule()) return 1;
- if (LoadSendRecvAuthModule()) return 1;
- if (LoadDescButtonModule()) return 1;
- if (LoadOptionsModule()) return 1;
- if (LoadNetlibModule()) return 1;
- if (LoadSslModule()) return 1;
- if (LoadProtocolsModule()) return 1;
-
// check if a service plugin is scheduled to execution
if (plugin_service != nullptr) {
if (LoadProtocolPlugins()) return 1;
@@ -146,10 +134,22 @@ int LoadDefaultModules(void)
default: // smth went wrong, terminating
return 1;
}
-
+
plugin_service = nullptr;
}
+ if (LoadSkinSounds()) return 1;
+ if (LoadSkinHotkeys()) return 1;
+ if (LoadFontserviceModule()) return 1;
+ if (LoadSrmmModule()) return 1;
+ if (LoadChatModule()) return 1;
+ if (LoadSendRecvAuthModule()) return 1;
+ if (LoadDescButtonModule()) return 1;
+ if (LoadOptionsModule()) return 1;
+ if (LoadNetlibModule()) return 1;
+ if (LoadSslModule()) return 1;
+ if (LoadProtocolsModule()) return 1;
+
LoadDbAccounts(); // retrieves the account array from a database
if (LoadContactsModule()) return 1;
if (LoadMetacontacts()) return 1;
@@ -161,7 +161,7 @@ int LoadDefaultModules(void)
if (LoadAccountsModule()) return 1;
- //order becomes less important below here
+ // order becomes less important below here
if (LoadFindAddModule()) return 1;
if (LoadIgnoreModule()) return 1;
if (LoadVisibilityModule()) return 1;
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp
index 170c7db7c2..f70c00c22d 100644
--- a/src/mir_app/src/utils.cpp
+++ b/src/mir_app/src/utils.cpp
@@ -26,11 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_SYSTEM_GET_MD5I "Miranda/System/GetMD5I"
-INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam);
-
int InitCrypt(void);
void UninitCrypt(void);
+void InitClistCore(void);
+
INT_PTR __cdecl svcEnterString(WPARAM, LPARAM lParam);
static BOOL bModuleInitialized = FALSE;
@@ -328,6 +328,7 @@ int LoadUtilsModule(void)
CreateServiceFunction(MS_UTILS_ENTERSTRING, svcEnterString);
InitCrypt();
+ InitClistCore();
return 0;
}