From 51d4ad5f0580a5dc001128e0ee7520e39288aca2 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 20 May 2015 09:23:09 +0000 Subject: other not used files removed too git-svn-id: http://svn.miranda-ng.org/main/trunk@13710 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/commonheaders.cpp | 2 - src/core/commonheaders.h | 107 ------------ src/core/miranda.cpp | 422 --------------------------------------------- src/core/miranda.h | 199 --------------------- src/core/modules.cpp | 184 -------------------- src/core/modules.h | 267 ---------------------------- src/core/stdafx.cpp | 19 -- 7 files changed, 1200 deletions(-) delete mode 100644 src/core/commonheaders.cpp delete mode 100644 src/core/commonheaders.h delete mode 100644 src/core/miranda.cpp delete mode 100644 src/core/miranda.h delete mode 100644 src/core/modules.cpp delete mode 100644 src/core/modules.h delete mode 100644 src/core/stdafx.cpp diff --git a/src/core/commonheaders.cpp b/src/core/commonheaders.cpp deleted file mode 100644 index 95b2201163..0000000000 --- a/src/core/commonheaders.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "commonheaders.h" - diff --git a/src/core/commonheaders.h b/src/core/commonheaders.h deleted file mode 100644 index 3c60da9b96..0000000000 --- a/src/core/commonheaders.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-12 Miranda IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#define _ALPHA_BASE_ 1 // defined for CVS builds -#define _ALPHA_FUSE_ 1 // defined for fuse powered core - -#define INCL_WINSOCK_API_TYPEDEFS 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _DEBUG -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "miranda.h" -#include "stdplug.h" - -#include -#include -#include - -typedef struct GlobalLogSettingsBase GlobalLogSettings; -#include - -#include "../resource.h" \ No newline at end of file diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp deleted file mode 100644 index b5b65f8d40..0000000000 --- a/src/core/miranda.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-12 Miranda IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#include "commonheaders.h" - -#define MMI_SIZE_V1 (4*sizeof(void*)) -#define MMI_SIZE_V2 (7*sizeof(void*)) - -int LoadDefaultModules(void); -void UnloadNewPluginsModule(void); -void UnloadDefaultModules(void); - -pfnDrawThemeTextEx drawThemeTextEx; -pfnSetWindowThemeAttribute setWindowThemeAttribute; -pfnBufferedPaintInit bufferedPaintInit; -pfnBufferedPaintUninit bufferedPaintUninit; -pfnBeginBufferedPaint beginBufferedPaint; -pfnEndBufferedPaint endBufferedPaint; -pfnGetBufferedPaintBits getBufferedPaintBits; - -pfnDwmExtendFrameIntoClientArea dwmExtendFrameIntoClientArea; -pfnDwmIsCompositionEnabled dwmIsCompositionEnabled; - -ITaskbarList3 * pTaskbarInterface; - -HANDLE hOkToExitEvent, hModulesLoadedEvent; -HANDLE hShutdownEvent, hPreShutdownEvent; -static HANDLE hWaitObjects[MAXIMUM_WAIT_OBJECTS-1]; -static char *pszWaitServices[MAXIMUM_WAIT_OBJECTS-1]; -static int waitObjectCount = 0; -HANDLE hMirandaShutdown; -HINSTANCE hInst; -DWORD hMainThreadId; -int hLangpack = 0; -bool bModulesLoadedFired = false; - -///////////////////////////////////////////////////////////////////////////////////////// -// exception handling - -static INT_PTR srvGetExceptionFilter(WPARAM, LPARAM) -{ - return (INT_PTR)GetExceptionFilter(); -} - -static INT_PTR srvSetExceptionFilter(WPARAM, LPARAM lParam) -{ - return (INT_PTR)SetExceptionFilter((pfnExceptionFilter)lParam); -} - -///////////////////////////////////////////////////////////////////////////////////////// - -typedef LONG(WINAPI *pNtQIT)(HANDLE, LONG, PVOID, ULONG, PULONG); -#define ThreadQuerySetWin32StartAddress 9 - -INT_PTR MirandaIsTerminated(WPARAM, LPARAM) -{ - return WaitForSingleObject(hMirandaShutdown, 0) == WAIT_OBJECT_0; -} - -static void __cdecl compactHeapsThread(void*) -{ - Thread_SetName("compactHeapsThread"); - - while (!Miranda_Terminated()) { - HANDLE hHeaps[256]; - DWORD hc; - SleepEx((1000 * 60) * 5, TRUE); // every 5 minutes - hc = GetProcessHeaps(255, (PHANDLE)&hHeaps); - if (hc != 0 && hc < 256) { - DWORD j; - for (j = 0; j < hc; j++) - HeapCompact(hHeaps[j], 0); - } - } //while -} - -void(*SetIdleCallback) (void) = NULL; - -static INT_PTR SystemSetIdleCallback(WPARAM, LPARAM lParam) -{ - if (lParam && SetIdleCallback == NULL) { - SetIdleCallback = (void(*)(void))lParam; - return 1; - } - return 0; -} - -static DWORD dwEventTime = 0; -void checkIdle(MSG * msg) -{ - switch (msg->message) { - case WM_MOUSEACTIVATE: - case WM_MOUSEMOVE: - case WM_CHAR: - dwEventTime = GetTickCount(); - } -} - -static INT_PTR SystemGetIdle(WPARAM, LPARAM lParam) -{ - if (lParam) *(DWORD*)lParam = dwEventTime; - return 0; -} - -static int SystemShutdownProc(WPARAM, LPARAM) -{ - UnloadDefaultModules(); - return 0; -} - -#define MIRANDA_PROCESS_WAIT_TIMEOUT 60000 -#define MIRANDA_PROCESS_WAIT_RESOLUTION 1000 -#define MIRANDA_PROCESS_WAIT_STEPS (MIRANDA_PROCESS_WAIT_TIMEOUT/MIRANDA_PROCESS_WAIT_RESOLUTION) -static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwnd); - SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); - SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETRANGE, 0, MAKELPARAM(0, MIRANDA_PROCESS_WAIT_STEPS)); - SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETSTEP, 1, 0); - SetTimer(hwnd, 1, MIRANDA_PROCESS_WAIT_RESOLUTION, NULL); - break; - - case WM_TIMER: - if (SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_STEPIT, 0, 0) == MIRANDA_PROCESS_WAIT_STEPS) - EndDialog(hwnd, 0); - if (WaitForSingleObject((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1) != WAIT_TIMEOUT) { - SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETPOS, MIRANDA_PROCESS_WAIT_STEPS, 0); - EndDialog(hwnd, 0); - } - break; - - case WM_COMMAND: - if (LOWORD(wParam) == IDCANCEL) { - SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETPOS, MIRANDA_PROCESS_WAIT_STEPS, 0); - EndDialog(hwnd, 1); - } - break; - } - return FALSE; -} - -INT_PTR CheckRestart() -{ - LPCTSTR tszPID = CmdLine_GetOption(_T("restart")); - if (tszPID) { - HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, _ttol(tszPID)); - if (hProcess) { - INT_PTR result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WAITRESTART), NULL, WaitForProcessDlgProc, (LPARAM)hProcess); - CloseHandle(hProcess); - return result; - } - } - return 0; -} - -static void crtErrorHandler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned, uintptr_t) -{} - - -int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR cmdLine, int) -{ - hInst = hInstance; - hMainThreadId = GetCurrentThreadId(); - - _set_invalid_parameter_handler(&crtErrorHandler); -#ifdef _DEBUG - _CrtSetReportMode(_CRT_ASSERT, 0); -#endif - - CmdLine_Parse(cmdLine); - setlocale(LC_ALL, ""); - -#ifdef _DEBUG - if (CmdLine_GetOption(_T("memdebug"))) - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif - - HMODULE hDwmApi, hThemeAPI; - if (IsWinVerVistaPlus()) { - hDwmApi = LoadLibrary(_T("dwmapi.dll")); - if (hDwmApi) { - dwmExtendFrameIntoClientArea = (pfnDwmExtendFrameIntoClientArea)GetProcAddress(hDwmApi, "DwmExtendFrameIntoClientArea"); - dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi, "DwmIsCompositionEnabled"); - } - hThemeAPI = LoadLibrary(_T("uxtheme.dll")); - if (hThemeAPI) { - drawThemeTextEx = (pfnDrawThemeTextEx)GetProcAddress(hThemeAPI, "DrawThemeTextEx"); - setWindowThemeAttribute = (pfnSetWindowThemeAttribute)GetProcAddress(hThemeAPI, "SetWindowThemeAttribute"); - bufferedPaintInit = (pfnBufferedPaintInit)GetProcAddress(hThemeAPI, "BufferedPaintInit"); - bufferedPaintUninit = (pfnBufferedPaintUninit)GetProcAddress(hThemeAPI, "BufferedPaintUninit"); - beginBufferedPaint = (pfnBeginBufferedPaint)GetProcAddress(hThemeAPI, "BeginBufferedPaint"); - endBufferedPaint = (pfnEndBufferedPaint)GetProcAddress(hThemeAPI, "EndBufferedPaint"); - getBufferedPaintBits = (pfnGetBufferedPaintBits)GetProcAddress(hThemeAPI, "GetBufferedPaintBits"); - } - } - else hDwmApi = hThemeAPI = 0; - - if (bufferedPaintInit) - bufferedPaintInit(); - - OleInitialize(NULL); - - if (IsWinVer7Plus()) - CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface); - - int result = 0; - if (LoadDefaultModules()) { - SetEvent(hMirandaShutdown); - NotifyEventHooks(hPreShutdownEvent, 0, 0); - NotifyEventHooks(hShutdownEvent, 0, 0); - UnloadDefaultModules(); - - result = 1; - } - else { - InitPathVar(); - NotifyEventHooks(hModulesLoadedEvent, 0, 0); - bModulesLoadedFired = true; - - // ensure that the kernel hooks the SystemShutdownProc() after all plugins - HookEvent(ME_SYSTEM_SHUTDOWN, SystemShutdownProc); - - forkthread(compactHeapsThread, 0, NULL); - CreateServiceFunction(MS_SYSTEM_SETIDLECALLBACK, SystemSetIdleCallback); - CreateServiceFunction(MS_SYSTEM_GETIDLE, SystemGetIdle); - dwEventTime = GetTickCount(); - DWORD myPid = GetCurrentProcessId(); - - bool messageloop = true; - while (messageloop) { - MSG msg; - BOOL dying = FALSE; - DWORD rc = MsgWaitForMultipleObjectsEx(waitObjectCount, hWaitObjects, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE); - if (rc < WAIT_OBJECT_0 + waitObjectCount) { - rc -= WAIT_OBJECT_0; - CallService(pszWaitServices[rc], (WPARAM)hWaitObjects[rc], 0); - } - // - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if (msg.message != WM_QUIT) { - HWND h = GetForegroundWindow(); - DWORD pid = 0; - checkIdle(&msg); - if (h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid && GetClassLongPtr(h, GCW_ATOM) == 32770) - if (h != NULL && IsDialogMessage(h, &msg)) /* Wine fix. */ - continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - if (SetIdleCallback != NULL) - SetIdleCallback(); - } - else if (!dying) { - dying++; - SetEvent(hMirandaShutdown); - NotifyEventHooks(hPreShutdownEvent, 0, 0); - - // this spins and processes the msg loop, objects and APC. - Thread_Wait(); - NotifyEventHooks(hShutdownEvent, 0, 0); - // if the hooks generated any messages, it'll get processed before the second WM_QUIT - PostQuitMessage(0); - } - else if (dying) - messageloop = false; - } - } - } - - UnloadNewPluginsModule(); - UnloadCoreModule(); - CloseHandle(hMirandaShutdown); - FreeLibrary(hDwmApi); - FreeLibrary(hThemeAPI); - - if (pTaskbarInterface) - pTaskbarInterface->Release(); - - OleUninitialize(); - - if (bufferedPaintUninit) - bufferedPaintUninit(); - return result; -} - -static INT_PTR OkToExit(WPARAM, LPARAM) -{ - return NotifyEventHooks(hOkToExitEvent, 0, 0) == 0; -} - -static INT_PTR GetMirandaVersion(WPARAM, LPARAM) -{ - TCHAR filename[MAX_PATH]; - GetModuleFileName(NULL, filename, SIZEOF(filename)); - - DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused); - PVOID pVerInfo = _alloca(verInfoSize); - GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo); - - UINT blockSize; - VS_FIXEDFILEINFO *vsffi; - VerQueryValue(pVerInfo, _T("\\"), (PVOID*)&vsffi, &blockSize); - DWORD ver = (((vsffi->dwProductVersionMS >> 16) & 0xFF) << 24) | - ((vsffi->dwProductVersionMS & 0xFF) << 16) | - (((vsffi->dwProductVersionLS >> 16) & 0xFF) << 8) | - (vsffi->dwProductVersionLS & 0xFF); - return (INT_PTR)ver; -} - -static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam) -{ - TCHAR filename[MAX_PATH]; - GetModuleFileName(NULL, filename, SIZEOF(filename)); - - DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused); - PVOID pVerInfo = _alloca(verInfoSize); - GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo); - - UINT blockSize; - VS_FIXEDFILEINFO *vsffi; - VerQueryValue(pVerInfo, _T("\\"), (PVOID*)&vsffi, &blockSize); - - WORD* p = (WORD*)lParam; - p[0] = HIWORD(vsffi->dwProductVersionMS); - p[1] = LOWORD(vsffi->dwProductVersionMS); - p[2] = HIWORD(vsffi->dwProductVersionLS); - p[3] = LOWORD(vsffi->dwProductVersionLS); - return 0; -} - -static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) -{ - TCHAR filename[MAX_PATH], *productVersion; - GetModuleFileName(NULL, filename, SIZEOF(filename)); - - DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused); - PVOID pVerInfo = _alloca(verInfoSize); - GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo); - - UINT blockSize; - VerQueryValue(pVerInfo, _T("\\StringFileInfo\\000004b0\\ProductVersion"), (LPVOID*)&productVersion, &blockSize); - strncpy((char*)lParam, _T2A(productVersion), wParam); -#if defined(_WIN64) - strcat_s((char*)lParam, wParam, " x64"); -#endif - return 0; -} - -INT_PTR WaitOnHandle(WPARAM wParam, LPARAM lParam) -{ - if (waitObjectCount >= MAXIMUM_WAIT_OBJECTS - 1) - return 1; - - hWaitObjects[waitObjectCount] = (HANDLE)wParam; - pszWaitServices[waitObjectCount] = (char*)lParam; - waitObjectCount++; - return 0; -} - -static INT_PTR RemoveWait(WPARAM wParam, LPARAM) -{ - int i; - - for (i = 0; i < waitObjectCount; i++) - if (hWaitObjects[i] == (HANDLE)wParam) - break; - - if (i == waitObjectCount) - return 1; - - waitObjectCount--; - memmove(&hWaitObjects[i], &hWaitObjects[i + 1], sizeof(HANDLE)*(waitObjectCount - i)); - memmove(&pszWaitServices[i], &pszWaitServices[i + 1], sizeof(char*)*(waitObjectCount - i)); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -int LoadSystemModule(void) -{ - hMirandaShutdown = CreateEvent(NULL, TRUE, FALSE, NULL); - - hShutdownEvent = CreateHookableEvent(ME_SYSTEM_SHUTDOWN); - hPreShutdownEvent = CreateHookableEvent(ME_SYSTEM_PRESHUTDOWN); - hModulesLoadedEvent = CreateHookableEvent(ME_SYSTEM_MODULESLOADED); - hOkToExitEvent = CreateHookableEvent(ME_SYSTEM_OKTOEXIT); - - CreateServiceFunction(MS_SYSTEM_TERMINATED, MirandaIsTerminated); - CreateServiceFunction(MS_SYSTEM_OKTOEXIT, OkToExit); - CreateServiceFunction(MS_SYSTEM_GETVERSION, GetMirandaVersion); - CreateServiceFunction(MS_SYSTEM_GETFILEVERSION, GetMirandaFileVersion); - CreateServiceFunction(MS_SYSTEM_GETVERSIONTEXT, GetMirandaVersionText); - CreateServiceFunction(MS_SYSTEM_WAITONHANDLE, WaitOnHandle); - CreateServiceFunction(MS_SYSTEM_REMOVEWAIT, RemoveWait); - CreateServiceFunction(MS_SYSTEM_GETEXCEPTFILTER, srvGetExceptionFilter); - CreateServiceFunction(MS_SYSTEM_SETEXCEPTFILTER, srvSetExceptionFilter); - return 0; -} diff --git a/src/core/miranda.h b/src/core/miranda.h deleted file mode 100644 index 2609052789..0000000000 --- a/src/core/miranda.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-12 Miranda IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeTextEx)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const struct _DTTOPTS *); -typedef HRESULT (STDAPICALLTYPE *pfnSetWindowThemeAttribute)(HWND, enum WINDOWTHEMEATTRIBUTETYPE, PVOID, DWORD); -typedef HRESULT (STDAPICALLTYPE *pfnBufferedPaintInit)(void); -typedef HRESULT (STDAPICALLTYPE *pfnBufferedPaintUninit)(void); -typedef HANDLE (STDAPICALLTYPE *pfnBeginBufferedPaint)(HDC, RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *); -typedef HRESULT (STDAPICALLTYPE *pfnEndBufferedPaint)(HANDLE, BOOL); -typedef HRESULT (STDAPICALLTYPE *pfnGetBufferedPaintBits)(HANDLE, RGBQUAD **, int *); - -extern pfnDrawThemeTextEx drawThemeTextEx; -extern pfnSetWindowThemeAttribute setWindowThemeAttribute; -extern pfnBufferedPaintInit bufferedPaintInit; -extern pfnBufferedPaintUninit bufferedPaintUninit; -extern pfnBeginBufferedPaint beginBufferedPaint; -extern pfnEndBufferedPaint endBufferedPaint; -extern pfnGetBufferedPaintBits getBufferedPaintBits; - -extern ITaskbarList3 * pTaskbarInterface; - -typedef HRESULT (STDAPICALLTYPE *pfnDwmExtendFrameIntoClientArea)(HWND hwnd, const MARGINS *margins); -typedef HRESULT (STDAPICALLTYPE *pfnDwmIsCompositionEnabled)(BOOL *); - -extern pfnDwmExtendFrameIntoClientArea dwmExtendFrameIntoClientArea; -extern pfnDwmIsCompositionEnabled dwmIsCompositionEnabled; - -/**** database.cpp *********************************************************************/ - -extern MIDatabase* currDb; -extern DATABASELINK* currDblink; -extern LIST arDbPlugins; - -int InitIni(void); -void UninitIni(void); - -/**** extraicons.cpp *******************************************************************/ - -void KillModuleExtraIcons(int hLangpack); - -/**** fontService.cpp ******************************************************************/ - -void KillModuleFonts(int hLangpack); -void KillModuleColours(int hLangpack); -void KillModuleEffects(int hLangpack); -void KillModuleHotkeys(int hLangpack); -void KillModuleSounds(int hLangpack); - -/**** miranda.cpp **********************************************************************/ - -extern HINSTANCE hInst; -extern DWORD hMainThreadId; -extern HANDLE hOkToExitEvent, hModulesLoadedEvent, hevLoadModule, hevUnloadModule; -extern TCHAR mirandabootini[MAX_PATH]; - -/**** newplugins.cpp *******************************************************************/ - -char* GetPluginNameByInstance(HINSTANCE hInstance); -int GetPluginFakeId(const MUUID &uuid, int hLangpack); -int LoadStdPlugins(void); - -/**** path.cpp *************************************************************************/ - -void InitPathVar(void); - -/**** srmm.cpp *************************************************************************/ - -void KillModuleSrmmIcons(int hLangpack); - -/**** utf.cpp **************************************************************************/ - -__forceinline char* Utf8DecodeA(const char* src) -{ - char* tmp = mir_strdup(src); - Utf8Decode(tmp, NULL); - return tmp; -} - -#pragma optimize("", on) - -/**** options.cpp **********************************************************************/ - -HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name); - -/**** skin2icons.cpp *******************************************************************/ - -void KillModuleIcons(int hLangpack); - -/**** skinicons.cpp ********************************************************************/ - -HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared); -int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource); -int ImageList_ReplaceIcon_NotShared(HIMAGELIST hIml, int iIndex, HINSTANCE hInstance, LPCTSTR szResource); - -int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId); -int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char *szProto, int iconId); -int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon); - -#define Safe_DestroyIcon(hIcon) if (hIcon) DestroyIcon(hIcon) - -/**** clistmenus.cpp ********************************************************************/ - -extern HANDLE hMainMenuObject, hContactMenuObject, hStatusMenuObject; -extern HANDLE hPreBuildMainMenuEvent, hPreBuildContactMenuEvent; -extern HANDLE hShutdownEvent, hPreShutdownEvent; - -extern const int statusModeList[ MAX_STATUS_COUNT ]; -extern const int skinIconStatusList[ MAX_STATUS_COUNT ]; -extern const int skinIconStatusFlags[ MAX_STATUS_COUNT ]; - -int TryProcessDoubleClick(MCONTACT hContact); - -void KillModuleMenus(int hLangpack); - -/**** protocols.cpp *********************************************************************/ - -#define OFFSET_PROTOPOS 200 -#define OFFSET_VISIBLE 400 -#define OFFSET_ENABLED 600 -#define OFFSET_NAME 800 - -extern LIST accounts; - -PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const TCHAR *tszAccountName); - -PROTOACCOUNT* __fastcall Proto_GetAccount(const char *accName); -PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact); - -bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT *pa); -bool __fastcall Proto_IsAccountLocked(PROTOACCOUNT *pa); - -PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName); -int FreeDefaultAccount(PROTO_INTERFACE* ppi); - -BOOL ActivateAccount(PROTOACCOUNT *pa); -void EraseAccount(const char *pszProtoName); -void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase); -void UnloadAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase); -void OpenAccountOptions(PROTOACCOUNT *pa); - -void LoadDbAccounts(void); -void WriteDbAccounts(void); - -INT_PTR CallProtoServiceInt(MCONTACT hContact, const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam); - -/**** utils.cpp ************************************************************************/ - -void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key); -WORD GetHotkeyValue(INT_PTR idHotkey); -int AssertInsideScreen(RECT &rc); - -HBITMAP ConvertIconToBitmap(HICON hIcon, HIMAGELIST hIml, int iconId); - -class StrConvA -{ -private: - char* m_body; - -public: - StrConvA(const wchar_t* pSrc) : - m_body(mir_u2a(pSrc)) {} - - ~StrConvA() { mir_free(m_body); } - operator const char* () const { return m_body; } - operator const wchar_t* () const { return (wchar_t*)m_body; } // type cast to fake the interface definition - operator const LPARAM () const { return (LPARAM)m_body; } -}; - -/////////////////////////////////////////////////////////////////////////////// - -extern "C" -{ - MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo); - MIR_CORE_DLL(int) GetSubscribersCount(HANDLE hHook); - MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db); - - MIR_CORE_DLL(PROTOCOLDESCRIPTOR*) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd); -}; diff --git a/src/core/modules.cpp b/src/core/modules.cpp deleted file mode 100644 index 21824566ed..0000000000 --- a/src/core/modules.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-12 Miranda IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#include "commonheaders.h" - -#include "../modules/plugins/plugins.h" -#include "../modules/langpack/langpack.h" -#include "../modules/chat/chat.h" - -INT_PTR CheckRestart(); // core: IDD_WAITRESTART - -int LoadSystemModule(void); // core: m_system.h services -int LoadNewPluginsModuleInfos(void); // core: preloading plugins -int LoadNewPluginsModule(void); // core: N.O. plugins -int LoadNetlibModule(void); // core: network -int LoadSslModule(void); -int LoadLangpackModule(void); // core: translation -int LoadProtocolsModule(void); // core: protocol manager -int LoadAccountsModule(void); // core: account manager -int LoadIgnoreModule(void); // protocol filter: ignore -int LoadDbintfModule(void); -int LoadEventsModule(void); -int LoadSrmmModule(void); - -int LoadContactsModule(void); -int LoadContactListModule(void);// ui: clist -int LoadDatabaseModule(void); -int LoadMetacontacts(void); -int LoadOptionsModule(void); // ui: options dialog -int LoadFindAddModule(void); // ui: search/add users -int LoadSkinIcons(void); -int LoadSkinSounds(void); -int LoadSkinHotkeys(void); -int LoadUserInfoModule(void); // ui: user info -int LoadVisibilityModule(void); // ui: visibility control - -int LoadPluginOptionsModule(void); // ui: plugin viewer -int LoadAddContactModule(void); // ui: authcontrol contacts -int LoadUtilsModule(void); // ui: utils (has a few window classes, like HyperLink) -int LoadCLCModule(void); // window class: CLC control -int LoadButtonModule(void); // window class: button class -int LoadFontserviceModule(void); // ui: font manager -int LoadIcoLibModule(void); // ui: icons manager -int LoadServiceModePlugin(void); -int LoadDefaultServiceModePlugin(void); -int LoadErrorsModule(void); - -void UnloadAccountsModule(void); -void UnloadClcModule(void); -void UnloadContactListModule(void); -void UnloadDatabase(void); -void UnloadErrorsModule(void); -void UnloadEventsModule(void); -void UnloadExtraIconsModule(void); -void UnloadIcoLibModule(void); -void UnloadMetacontacts(void); -void UnloadNetlibModule(void); -void UnloadNewPlugins(void); -void UnloadProtocolsModule(void); -void UnloadSkinSounds(void); -void UnloadSkinHotkeys(void); -void UnloadSrmmModule(void); -void UnloadUtilsModule(void); - -int LoadIcoTabsModule(); -int LoadHeaderbarModule(); -int LoadDescButtonModule(); - -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 (CheckRestart()) return 1; - if (LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising - if (LoadIcoTabsModule()) return 1; - if (LoadHeaderbarModule()) return 1; - if (LoadDbintfModule()) return 1; - if (LoadEventsModule()) return 1; - - // load database drivers & service plugins without executing their Load() - if (LoadNewPluginsModuleInfos()) return 1; - - switch (LoadDefaultServiceModePlugin()) { - case SERVICE_CONTINUE: // continue loading Miranda normally - case SERVICE_ONLYDB: // load database and go to the message cycle - break; - case SERVICE_MONOPOLY: // unload database and go to the message cycle - return 0; - default: // smth went wrong, terminating - return 1; - } - - // the database will select which db plugin to use, or fail if no profile is selected - if (LoadDatabaseModule()) return 1; - - // database is available here - if (LoadButtonModule()) return 1; - if (LoadIcoLibModule()) return 1; - if (LoadSkinIcons()) return 1; - - // if (LoadErrorsModule()) return 1; - - switch (LoadServiceModePlugin()) { - case SERVICE_CONTINUE: // continue loading Miranda normally - break; - case SERVICE_ONLYDB: // load database and go to the message cycle - return 0; - case SERVICE_MONOPOLY: // unload database and go to the message cycle - UnloadDatabase(); - return 0; - default: // smth went wrong, terminating - return 1; - } - - if (LoadSkinSounds()) return 1; - if (LoadSkinHotkeys()) return 1; - if (LoadFontserviceModule()) return 1; - if (LoadSrmmModule()) return 1; - if (LoadChatModule()) 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 (LoadContactListModule()) return 1; // prepare contact list interface - if (LoadAddContactModule()) return 1; - if (LoadMetacontacts()) return 1; - - if (LoadNewPluginsModule()) return 1; // will call Load(void) on everything, clist will load first - - Langpack_SortDuplicates(); - - if (LoadAccountsModule()) return 1; - - //order becomes less important below here - if (LoadFindAddModule()) return 1; - if (LoadIgnoreModule()) return 1; - if (LoadVisibilityModule()) return 1; - if (LoadStdPlugins()) return 1; - return 0; -} - -void UnloadDefaultModules(void) -{ - UnloadChatModule(); - UnloadAccountsModule(); - UnloadMetacontacts(); - UnloadNewPlugins(); - UnloadProtocolsModule(); - UnloadSkinSounds(); - UnloadSkinHotkeys(); - UnloadSrmmModule(); - // UnloadErrorsModule(); - UnloadIcoLibModule(); - UnloadUtilsModule(); - UnloadExtraIconsModule(); - UnloadClcModule(); - UnloadContactListModule(); - UnloadEventsModule(); - UnloadNetlibModule(); -} diff --git a/src/core/modules.h b/src/core/modules.h deleted file mode 100644 index 936dfd6618..0000000000 --- a/src/core/modules.h +++ /dev/null @@ -1,267 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-12 Miranda IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//Modules Core - Richard -#ifndef MODULES_H_ -#define MODULES_H_ - -#pragma warning(disable:4201) - -/* MAXMODULELABELLENGTH -The maximum allowed length of a 'name' parameter. Very likely to change with -restructuring modules.c for performance. -*/ -#define MAXMODULELABELLENGTH 64 - -typedef int (*MIRANDAHOOK)(WPARAM, LPARAM); -typedef int (*MIRANDAHOOKPARAM)(WPARAM, LPARAM, LPARAM); -typedef int (*MIRANDAHOOKOBJ)(void*, WPARAM, LPARAM); -typedef int (*MIRANDAHOOKOBJPARAM)(void*, WPARAM, LPARAM, LPARAM); - -typedef INT_PTR (*MIRANDASERVICE)(WPARAM, LPARAM); -typedef INT_PTR (*MIRANDASERVICEPARAM)(WPARAM, LPARAM, LPARAM); -typedef INT_PTR (*MIRANDASERVICEOBJ)(void*, LPARAM, LPARAM); -typedef INT_PTR (*MIRANDASERVICEOBJPARAM)(void*, WPARAM, LPARAM, LPARAM); - -typedef struct -{ - HINSTANCE hOwner; - int type; - union { - struct { - union { - MIRANDAHOOK pfnHook; - MIRANDAHOOKPARAM pfnHookParam; - MIRANDAHOOKOBJ pfnHookObj; - MIRANDAHOOKOBJPARAM pfnHookObjParam; - }; - void* object; - LPARAM lParam; - }; - struct { - HWND hwnd; - UINT message; - }; - }; -} - THookSubscriber; - -typedef struct -{ - char name[ MAXMODULELABELLENGTH ]; - int id; - int subscriberCount; - THookSubscriber* subscriber; - MIRANDAHOOK pfnHook; - CRITICAL_SECTION csHook; -} - THook; - -/**************************hook functions****************************/ -/* CreateHookableEvent -Adds an named event to the list and returns a handle referring to it, or NULL -on failure. Will be automatically destroyed on exit, or can be removed from the -list earlier using DestroyHookableEvent() -Will fail if the given name has already been used -*/ -HANDLE CreateHookableEvent(const char *name); - -/* DestroyHookableEvent -Removes the event hEvent from the list of events. All modules hooked to it are -automatically unhooked. NotifyEventHooks() will fail if called with this hEvent -again. hEvent must have been returned by CreateHookableEvent() -Returns 0 on success, or nonzero if hEvent is invalid -*/ -int DestroyHookableEvent(HANDLE hEvent); - -/* NotifyEventHooks -Calls every module in turn that has hooked hEvent, using the parameters wParam -and lParam. hEvent must have been returned by CreateHookableEvent() -Returns 0 on success - -1 if hEvent is invalid - If one of the hooks returned nonzero to indicate abort, returns that abort - value immediately, without calling the rest of the hooks in the chain - -Notes on calling NotifyEventHooks() from a thread other than that which owns -the main Miranda window: -It works. The call is routed to the main thread and all hook subcribers are -called in the context of the main thread. The thread which called -NotifyHookEvents() is paused until all the processing is complete at which -point it returns with the correct return value. -This procedure requires more than one wait object so naturally there are -possibilities for deadlocks, but not many. -Calling NotifyEventHooks() from other than the main thread will be -considerably slower than from the main thread, but will consume only slightly -more actual CPU time, the rest will mostly be spent waiting for the main thread -to return to the message loop so it can be interrupted neatly. -*/ -int NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam); - -/* CallHookSubscribers -Works precisely like NotifyEventHooks, but without switching to the first thread -It guarantees that the execution time for these events is always tiny -*/ - -int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam); - -/* - hEvent : a HANDLE which has been returned by CreateHookableEvent() - pfnHook: a function pointer (MIRANDAHOOK) which is called when there are no hooks. - Affect: This core service allows hooks to have a 'default' hook which is called - when no one has hooked the given event, this allows hook creators to add default - processing which is ONLY CALLED when no one else has HookEvent()'d - Notes: The return value from pfnHook() is returned to NotifyEventHooks() - Returns: 0 on success, non zero on failure - Version: 0.3.4+ (2004/09/15) -*/ -int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook); - -/* HookEvent -Adds a new hook to the chain 'name', to be called when the hook owner calls -NotifyEventHooks(). Returns NULL if name is not a valid event or a handle -referring to the hook otherwise. Note that debug builds will warn with a -MessageBoxA if a hook is attempted on an unknown event. All hooks will be -automatically destroyed when their parent event is destroyed or the programme -ends, but can be unhooked earlier using UnhookEvent(). hookProc() is defined as - int HookProc(WPARAM wParam, LPARAM lParam) -where you can substitute your own name for HookProc. wParam and lParam are -defined by the creator of the event when NotifyEventHooks() is called. -The return value is 0 to continue processing the other hooks, or nonzero -to stop immediately. This abort value is returned to the caller of -NotifyEventHooks() and should not be -1 since that is a special return code -for NotifyEventHooks() (see above) -*/ -HANDLE HookEvent(const char *name, MIRANDAHOOK hookProc); -HANDLE HookEventParam(const char *name, MIRANDAHOOKPARAM hookProc, LPARAM lParam); -HANDLE HookEventObj(const char *name, MIRANDAHOOKOBJ hookProc, void* object); -HANDLE HookEventObjParam(const char *name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam); - -/* HookEventMessage -Works as for HookEvent(), except that when the notifier is called a message is -sent to a window, rather than a function being called. -Note that SendMessage() is a decidedly slow function so please limit use of -this function to events that are not called frequently, or to hooks that are -only installed briefly -The window procedure is called with the message 'message' and the wParam and -lParam given to NotifyEventHooks(). The return value of SendMessage() is used -in the same way as the return value in HookEvent(). -*/ -HANDLE HookEventMessage(const char *name, HWND hwnd, UINT message); - -/* UnhookEvent -Removes a hook from its event chain. It will no longer receive any events. -hHook must have been returned by HookEvent() or HookEventMessage(). -Returns 0 on success or nonzero if hHook is invalid. -*/ -int UnhookEvent(HANDLE hHook); - - -/*************************service functions**************************/ -/* CreateServiceFunction -Adds a new service function called 'name' to the global list and returns a -handle referring to it. Service function handles are destroyed automatically -on exit, but can be removed from the list earlier using -DestroyServiceFunction() -Returns NULL if name has already been used. serviceProc is defined by the -caller as - int ServiceProc(WPARAM wParam, LPARAM lParam) -where the creator publishes the meanings of wParam, lParam and the return value -Service functions must not return CALLSERVICE_NOTFOUND since that would confuse -callers of CallService(). -*/ -HANDLE CreateServiceFunction(const char *name, MIRANDASERVICE serviceProc); - -/* CreateServiceFunctionParam -Same as CreateServiceFunction - adds new parameter, to pass to service handler function. -serviceProc is defined by the caller as - int ServiceProc(WPARAM wParam, LPARAM lParam, LPARAM fnParam) -where fnParam does not need to be publicly known. Gives the ability to handle multiple services -with the same function. - -added during 0.7+ (2007/04/24) -*/ -HANDLE CreateServiceFunctionParam(const char *name, MIRANDASERVICEPARAM serviceProc, LPARAM lParam); - -/* CreateServiceFunctionObj - CreateServiceFunctionObjParam -Same as CreateServiceFunction - adds new parameter, an object, to pass to service handler function. -serviceProc is defined by the caller as - int ServiceProc(void* object, WPARAM wParam, LPARAM lParam[, LPARAM fnParam]) -where fnParam does not need to be publicly known. Gives the ability to handle multiple services -with the same function. - -added during 0.7+ (2007/04/24) -*/ - -HANDLE CreateServiceFunctionObj(const char *name, MIRANDASERVICEOBJ serviceProc, void* object); -HANDLE CreateServiceFunctionObjParam(const char *name, MIRANDASERVICEOBJPARAM serviceProc, void* object, LPARAM lParam); - -/* DestroyServiceFunction -Removes the function associated with hService from the global service function -list. Modules calling CallService() will fail if they try to call this -service's name. hService must have been returned by CreateServiceFunction(). -Returns 0 on success or non-zero if hService is invalid. -*/ -int DestroyServiceFunction(HANDLE hService); - -/* CallService -Finds and calls the service function 'name' using the parameters wParam and -lParam. -Returns CALLSERVICE_NOTFOUND if no service function called 'name' has been -created, or the value the service function returned otherwise. -*/ -#ifdef _WIN64 - #define CALLSERVICE_NOTFOUND ((INT_PTR)0x8000000000000000) -#else - #define CALLSERVICE_NOTFOUND ((int)0x80000000) -#endif -INT_PTR CallService(const char *name, WPARAM wParam, LPARAM lParam); - -/* ServiceExists -Finds if a service with the given name exists -Returns nonzero if the service was found, and zero if it was not -*/ -int ServiceExists(const char *name); - -/* CallServiceSync -Calls a given service executed within the context of the main thread -only useful to multi threaded modules calling thread unsafe services! -*/ -INT_PTR CallServiceSync(const char *name, WPARAM wParam, LPARAM lParam); - -/* CallFunctionAsync -Calls a given function pointer, it doesn't go thru the core at all, it is -just a wrapper around QueueUserAPC() and other workarounds to make APC -work even if there are non APC message loops, this allows plugins who -need this feature to get it without recoding it themselves. - -The function 'func' will always be called from the main thread in idle time even -if it is invokved from a worker thread, 'arg' must not be on the stack. - -Returns nonzero on success, zero on failure - -added during 0.3.4+ (2004/08/14) -*/ -int CallFunctionAsync(void (__stdcall *func)(void *), void *arg); - -#endif // MODULES_H_ diff --git a/src/core/stdafx.cpp b/src/core/stdafx.cpp deleted file mode 100644 index 288f19664b..0000000000 --- a/src/core/stdafx.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* - -Copyright (C) 2012-15 Miranda NG team (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "commonheaders.h" \ No newline at end of file -- cgit v1.2.3