From 0f95cbb4a9f1c9a613dccb9d53f5ddb50a8cadd7 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 3 Jul 2012 19:23:06 +0000 Subject: AutoShutdown: code cleaning x64 compilation fix git-svn-id: http://svn.miranda-ng.org/main/trunk@742 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoShutdown/common.h | 4 +- plugins/AutoShutdown/cpuusage.cpp | 46 ------- plugins/AutoShutdown/frame.cpp | 22 ++-- plugins/AutoShutdown/m_shutdown.h | 196 ------------------------------ plugins/AutoShutdown/main.cpp | 15 +-- plugins/AutoShutdown/options.cpp | 8 +- plugins/AutoShutdown/res/Thumbs.db | Bin 6144 -> 0 bytes plugins/AutoShutdown/settingsdlg.cpp | 20 ++-- plugins/AutoShutdown/shutdownsvc.cpp | 104 +++++----------- plugins/AutoShutdown/shutdownsvc.h | 6 +- plugins/AutoShutdown/utils.cpp | 144 ++-------------------- plugins/AutoShutdown/utils.h | 2 +- plugins/AutoShutdown/watcher.cpp | 31 +---- plugins/AutoShutdown/watcher.h | 6 +- plugins/ExternalAPI/m_flags.inc | 74 ------------ plugins/ExternalAPI/m_hotkey.h | 67 ----------- plugins/ExternalAPI/m_hotkeysplus.h | 22 ---- plugins/ExternalAPI/m_hotkeysservice.h | 213 --------------------------------- plugins/ExternalAPI/m_langman.inc | 48 -------- 19 files changed, 75 insertions(+), 953 deletions(-) delete mode 100644 plugins/AutoShutdown/m_shutdown.h delete mode 100644 plugins/AutoShutdown/res/Thumbs.db delete mode 100644 plugins/ExternalAPI/m_flags.inc delete mode 100644 plugins/ExternalAPI/m_hotkey.h delete mode 100644 plugins/ExternalAPI/m_hotkeysplus.h delete mode 100644 plugins/ExternalAPI/m_hotkeysservice.h delete mode 100644 plugins/ExternalAPI/m_langman.inc (limited to 'plugins') diff --git a/plugins/AutoShutdown/common.h b/plugins/AutoShutdown/common.h index 2feca26b5f..e0a82ad782 100644 --- a/plugins/AutoShutdown/common.h +++ b/plugins/AutoShutdown/common.h @@ -64,13 +64,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include -#include -#include -#include #include #include #include diff --git a/plugins/AutoShutdown/cpuusage.cpp b/plugins/AutoShutdown/cpuusage.cpp index a1f4d4e5d3..d99be4a6fe 100644 --- a/plugins/AutoShutdown/cpuusage.cpp +++ b/plugins/AutoShutdown/cpuusage.cpp @@ -47,21 +47,7 @@ static BOOL WinNT_PerfStatsSwitch(TCHAR *pszServiceName,BOOL fDisable) return fSwitched; } -#if !defined(_UNICODE) -static void Win9x_PerfStatsSwitch(HKEY hKey,char *pszAction,char *pszName) -{ - DWORD dwData,dwSize; - dwSize=sizeof(dwData); - if(!RegOpenKeyExA(hKey,pszAction,0,KEY_QUERY_VALUE,&hKey)) { - /* a simple query does the trick (data and size must not be NULL!) */ - RegQueryValueExA(hKey,pszName,NULL,NULL,(BYTE*)&dwData,&dwSize); - RegCloseKey(hKey); - } -} -#endif - /************************* Poll Thread ********************************/ - struct CpuUsageThreadParams { DWORD dwDelayMillis; CPUUSAGEAVAILPROC pfnDataAvailProc; @@ -85,38 +71,6 @@ static BOOL CallBackAndWait(struct CpuUsageThreadParams *param,BYTE nCpuUsage) return !Miranda_Terminated(); } -#if !defined(_UNICODE) -static void Win9x_PollThread(struct CpuUsageThreadParams *param) -{ - HKEY hKeyStats,hKeyData; - DWORD dwBufferSize,dwData; - - if(!RegOpenKeyExA(HKEY_DYN_DATA,"PerfStats",0,KEY_QUERY_VALUE,&hKeyStats)) { - /* start query */ - /* not needed for kernel - * Win9x_PerfStatsSwitch(hKeyStats,"StartSrv","KERNEL"); */ - Win9x_PerfStatsSwitch(hKeyStats,"StartStat","KERNEL\\CPUUsage"); - /* retrieve cpu usage */ - if(!RegOpenKeyExA(hKeyStats,"StatData",0,KEY_QUERY_VALUE,&hKeyData)) { - dwBufferSize=sizeof(dwData); - while(!RegQueryValueExA(hKeyData,"KERNEL\\CPUUsage",NULL,NULL,(BYTE*)&dwData,&dwBufferSize)) { - dwBufferSize=sizeof(dwData); - if(!CallBackAndWait(param,(BYTE)dwData)) break; - } - RegCloseKey(hKeyData); - } - /* stop query */ - Win9x_PerfStatsSwitch(hKeyStats,"StopStat","KERNEL\\CPUUsage"); - /* not needed for kernel - * Win9x_PerfStatsSwitch(hKeyStats,"StopSrv","KERNEL"); */ - RegCloseKey(hKeyStats); - } - /* return error for PollCpuUsage() if never succeeded */ - if(param->hFirstEvent!=NULL) SetEvent(param->hFirstEvent); - mir_free(param); -} -#endif /* !_UNICODE */ - static void WinNT_PollThread(void *vparam) { CpuUsageThreadParams *param = (CpuUsageThreadParams*)vparam; diff --git a/plugins/AutoShutdown/frame.cpp b/plugins/AutoShutdown/frame.cpp index 8c288c5dba..425edb3831 100644 --- a/plugins/AutoShutdown/frame.cpp +++ b/plugins/AutoShutdown/frame.cpp @@ -76,7 +76,7 @@ static LRESULT CALLBACK ProgressBarSubclassProc(HWND hwndProgress,UINT msg,WPARA case WM_LBUTTONDBLCLK: return SendMessage(GetParent(hwndProgress),msg,wParam,lParam); } - return CallWindowProc((WNDPROC)GetWindowLong(hwndProgress,GWL_USERDATA),hwndProgress,msg,wParam,lParam); + return CallWindowProc((WNDPROC)GetWindowLongPtr(hwndProgress, GWLP_USERDATA), hwndProgress, msg, wParam, lParam); } /************************* Window Class *******************************/ @@ -117,12 +117,12 @@ struct CountdownFrameWndData { /* sizeof=57, max cbClsExtra=40 on Win32 */ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARAM lParam) { - struct CountdownFrameWndData *dat=(struct CountdownFrameWndData*)GetWindowLong(hwndFrame,GWL_USERDATA); + struct CountdownFrameWndData *dat=(struct CountdownFrameWndData*)GetWindowLongPtr(hwndFrame, GWLP_USERDATA); switch(msg) { case WM_NCCREATE: /* init window data */ dat=(struct CountdownFrameWndData*)mir_calloc(sizeof(*dat)); - SetWindowLong(hwndFrame,GWL_USERDATA,(LONG)dat); + SetWindowLongPtr(hwndFrame, GWLP_USERDATA, (LONG)dat); if(dat==NULL) return FALSE; /* creation failed */ dat->fTimeFlags=*(WORD*)((CREATESTRUCT*)lParam)->lpCreateParams; dat->flags=FWPDF_COUNTDOWNINVALID; @@ -153,7 +153,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA NULL); if(dat->hwndProgress==NULL) return -1; /* creation failed, calls WM_DESTROY */ SendMessage(dat->hwndProgress,PBM_SETSTEP,(WPARAM)1,0); - SetWindowLong(dat->hwndProgress,GWL_USERDATA,SetWindowLong(dat->hwndProgress,GWL_WNDPROC,(LONG)ProgressBarSubclassProc)); + SetWindowLongPtr(dat->hwndProgress, GWLP_USERDATA, SetWindowLongPtr(dat->hwndProgress, GWLP_WNDPROC, (LONG)ProgressBarSubclassProc)); dat->hwndDesc=CreateWindowEx(WS_EX_NOPARENTNOTIFY, _T("Static"), (dat->fTimeFlags&SDWTF_ST_TIME)?TranslateT("Shutdown at:"):TranslateT("Time left:"), @@ -243,7 +243,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA if(dat->hFont!=NULL) DeleteObject(dat->hFont); if(dat->hbrBackground!=NULL) DeleteObject(dat->hbrBackground); mir_free(dat); - SetWindowLong(hwndFrame,GWL_USERDATA,(LONG)NULL); + SetWindowLongPtr(hwndFrame, GWLP_USERDATA, (LONG)NULL); break; case WM_SIZE: { RECT rc; @@ -391,7 +391,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA dat->flags|=FWPDF_COUNTDOWNINVALID; /* step up to upper range */ SendMessage(dat->hwndProgress,PBM_SETPOS,SendMessage(dat->hwndProgress,PBM_GETRANGE,FALSE,0),0); - SetWindowLong(dat->hwndProgress,GWL_STYLE,GetWindowLong(dat->hwndProgress,GWL_STYLE)|PBM_SETMARQUEE); + SetWindowLongPtr(dat->hwndProgress, GWL_STYLE, GetWindowLongPtr(dat->hwndProgress, GWL_STYLE) | PBM_SETMARQUEE); SendMessage(dat->hwndProgress,PBM_SETMARQUEE,TRUE,10); /* marquee for rest of time */ return 0; case M_PAUSE_COUNTDOWN: @@ -477,15 +477,15 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA if(dat->flags&FWPDF_TIMEISCLIPPED && (HWND)wParam==dat->hwndTime && IsWinVer2000Plus()) { RECT rc; if(GetWindowRect(dat->hwndTime,&rc)) { - SetWindowLong(dat->hwndToolTip,GWL_STYLE,GetWindowLong(dat->hwndToolTip,GWL_STYLE)|TTS_NOANIMATE); - SetWindowLong(dat->hwndToolTip,GWL_EXSTYLE,GetWindowLong(dat->hwndToolTip,GWL_EXSTYLE)|WS_EX_TRANSPARENT); + SetWindowLongPtr(dat->hwndToolTip, GWL_STYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_STYLE) | TTS_NOANIMATE); + SetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE) | WS_EX_TRANSPARENT); SendMessage(dat->hwndToolTip,TTM_ADJUSTRECT,TRUE,(LPARAM)&rc); SetWindowPos(dat->hwndToolTip,NULL,rc.left,rc.top,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); return TRUE; /* self-defined position */ } } - SetWindowLong(dat->hwndToolTip,GWL_STYLE,GetWindowLong(dat->hwndToolTip,GWL_STYLE)&(~TTS_NOANIMATE)); - SetWindowLong(dat->hwndToolTip,GWL_EXSTYLE,GetWindowLong(dat->hwndToolTip,GWL_EXSTYLE)&(~WS_EX_TRANSPARENT)); + SetWindowLongPtr(dat->hwndToolTip, GWL_STYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_STYLE) & (~TTS_NOANIMATE)); + SetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_EXSTYLE) & (~WS_EX_TRANSPARENT)); return 0; case TTN_POP: /* workaround #5: frame does not get redrawn after @@ -592,8 +592,6 @@ void CloseCountdownFrame(void) static int FrameModulesLoaded(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { LOGFONT lf; COLORREF clr; diff --git a/plugins/AutoShutdown/m_shutdown.h b/plugins/AutoShutdown/m_shutdown.h deleted file mode 100644 index 87e25e8851..0000000000 --- a/plugins/AutoShutdown/m_shutdown.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - -'AutoShutdown'-Plugin for -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright (C) 2004-2007 H. Herkenrath - -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 (Shutdown-License.txt); if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef M_SHUTDOWN_H__ -#define M_SHUTDOWN_H__ - -#if defined (_MSC_VER) && (_MSC_VER >= 1020) - #pragma once -#endif - -/* - AutoShutdown v1.4.0.2 -*/ - -/* interface id */ -#if !defined(MIID_SHUTDOWN) - #define MIID_SHUTDOWN {0x142982a8,0x88cf,0x4c65,{0x87,0x21,0x6d,0xe2,0x7d,0x5c,0xe7,0xb5}} -#endif - -/******************************************************************/ -/************************* SERVICES *******************************/ -/******************************************************************/ - -/* Show settings dialog v1.3.0.0+ -Shows the dialog by which the shutdown watcher can be started. -If the dialog is already opened this brings it to foreground. - wParam=lParam=0 -Returns 0 on success, nonzero otherwise. -*/ -#define MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG "AutoShutdown/ShowSettingsDialog" - -/* Initiate shutdown process v1.3.0.0+ -Initiates the shutdown process for a given shutdown type. -If another shutdown process is already pending it will return error. -Associated events: ME_AUTOSHUTDOWN_OKTOSHUTDOWN, ME_AUTOSHUTDOWN_SHUTDOWN - wParam=shutdownType - lParam=(LPARAM)(BOOL)fShowConfirmDlg (whether to show the warning dialog or not) -Returns 0 on success, nonzero otherwise. -*/ -#define MS_AUTOSHUTDOWN_SHUTDOWN "AutoShutdown/Shutdown" - -/* shutdown types */ -#define SDSDT_CLOSEMIRANDA 1 // close miranda process -#define SDSDT_SETMIRANDAOFFLINE 2 // set all protocols to offline -#define SDSDT_LOGOFF 3 // logoff from Windows -#define SDSDT_REBOOT 4 // reboot computer -#define SDSDT_SHUTDOWN 5 // shutdown Windows and power off -#define SDSDT_STANDBY 6 // standby mode -#define SDSDT_HIBERNATE 7 // hibernate mode -#define SDSDT_LOCKWORKSTATION 8 // lock the workstation -#define SDSDT_CLOSERASCONNECTIONS 9 // close all dialup connections -#define SDSDT_MAX 9 - -/* Get shutdown type description v1.4.0.0+ -Gets a textual description of the given shutdown type. - wParam=shutdownType - lParam=flags (see GSTDF_* below) -Returns a static buffer of the description of the given shutdown type. -It does not need to be freed in any way. -The returned text is already translated. -Returns a pointer to a string on success, NULL on error. -*/ -#define MS_AUTOSHUTDOWN_GETTYPEDESCRIPTION "AutoShutdown/GetTypeDescription" - -#define GSTDF_LONGDESC 0x0001 // returns a long description -#define GSTDF_UNICODE 0x0002 // returns a Unicode string -#define GSTDF_UNTRANSLATED 0x0004 // returns an untranslated string -#if defined(_UNICODE) - #define GSTDF_TCHAR GSTDF_UNICODE // will return WCHAR* -#else - #define GSTDF_TCHAR 0 // will return char*, as usual -#endif - -/* Check if shutdown type is enabled v1.4.0.0+ -Tests if a specific shutdown type is activated and its use is possible -on the system. For example hibernate and stand-by modes are not available on -older versions of Windows (needs Windows ME/2000+). -Shutdown might also be prohibited by security restrictions. -This services checks it all. -However, there is no need to call this before calling MS_AUTOSHUTDOWN_SHUTDOWN. -MS_AUTOSHUTDOWN_SHUTDOWN will fail if the given shutdown type is not enabled. - wParam=shutdownType - lParam=0 -Returns TRUE if the given shutdown type is enabled, FALSE otherwise. -*/ -#define MS_AUTOSHUTDOWN_ISTYPEENABLED "AutoShutdown/IsTypeEnabled" - -/* Start shutdown watcher v1.4.0.0+ -Starts the watcher using the last settings specified on the dialog -shown by MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG. -Call MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG instead to offer -options about what watcher to use. -Associated event: ME_AUTOSHUTDOWN_WATCHERCHANGED - wParam=lParam=0 -Returns 0 on success, nonzero otherwise. -*/ -#define MS_AUTOSHUTDOWN_STARTWATCHER "AutoShutdown/StartWatcher" - -/* Stop shutdown watcher v1.4.0.0+ -Stops the currently running watcher. -If the watcher is not running, it returns error. -Associated event: ME_AUTOSHUTDOWN_WATCHERCHANGED - wParam=lParam=0 -Returns 0 on success, nonzero otherwise. -*/ -#define MS_AUTOSHUTDOWN_STOPWATCHER "AutoShutdown/StopWatcher" - -/* Check if watcher is running v1.4.0.0+ -Checks if the watcher is currently active or not. - wParam=lParam=0 -Returns TRUE if the watcher is enabled, FALSE otherwise. -*/ -#define MS_AUTOSHUTDOWN_ISWATCHERENABLED "AutoShutdown/IsWatcherEnabled" - -/******************************************************************/ -/************************** EVENTS ********************************/ -/******************************************************************/ - -/* Disallow shutdown process (event) v1.3.0.0+ -Gets fired when MS_AUTOSHUTDOWN_SHUTDOWN is called. -Parmeters are the same as specified at the call to MS_AUTOSHUTDOWN_SHUTDOWN. - wParam=shutdownType - lParam=(LPARAM)(BOOL)fShowConfirmDlg -Return 0 to allow shutdown, 1 to disallow. -*/ -#define ME_AUTOSHUTDOWN_OKTOSHUTDOWN "AutoShutdown/OkToShutdown" - -/* Shutdown process started (event) v1.3.0.1+ -Gets fired when ME_AUTOSHUTDOWN_OKTOSHUTDOWN was confirmed. -Parmeters are the same as specified at the call -to MS_AUTOSHUTDOWN_SHUTDOWN. - wParam=shutdownType - lParam=(LPARAM)(BOOL)fShowConfirmDlg -Unused, return always 0 here. -*/ -#define ME_AUTOSHUTDOWN_SHUTDOWN "AutoShutdown/ShutdownEvent" - -/* Watcher changed (event) v1.3.0.0+ -Fired when MS_AUTOSHUTDOWN_STARTWATCHER or MS_AUTOSHUTDOWN_STOPWATCHER -is called. - wParam=(WPARAM)(BOOL)fIsStarted (whether whe watcher is running now) - lParam=0 -Unused, return always 0 here. -*/ -#define ME_AUTOSHUTDOWN_WATCHERCHANGED "AutoShutdown/Watcher/Changed" - - -#ifndef SHUTDOWN_NOSETTINGS -#define SETTING_REMEMBERONRESTART_DEFAULT 0 // SDROR_RUNNING -#define SETTING_SHOWCONFIRMDLG_DEFAULT 1 -#define SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT 30 // seconds -#define SETTING_WEATHERSHUTDOWN_DEFAULT 0 -#define SETTING_HDDOVERHEATSHUTDOWN_DEFAULT 1 -#define SETTING_SMARTOFFLINECHECK_DEFAULT 1 - -#define SETTING_SHUTDOWNTYPE_DEFAULT SDSDT_SHUTDOWN -#define SETTING_WATCHERFLAGS_DEFAULT (SDWTF_SPECIFICTIME|SDWTF_ST_COUNTDOWN) -#define SETTING_COUNTDOWN_DEFAULT 30 -#define SETTING_COUNTDOWNUNIT_DEFAULT 60 // x times countdown seconds -#define SETTING_TIMESTAMP_DEFAULT (DWORD)(time(NULL)+(SETTING_COUNTDOWN_DEFAULT*SETTING_COUNTDOWNUNIT_DEFAULT)) -#define SETTING_CPUUSAGETHRESHOLD_DEFAULT 90 // percent - -#define SDWTF_SPECIFICTIME 0x0001 -#define SDWTF_ST_TIME 0x0002 -#define SDWTF_ST_COUNTDOWN 0x0004 -#define SDWTF_ST_MASK 0x0006 /* bitmask for SDWTF_ST_* bits */ -#define SDWTF_MESSAGE 0x0008 -#define SDWTF_FILETRANSFER 0x0010 -#define SDWTF_IDLE 0x0020 -#define SDWTF_STATUS 0x0040 -#define SDWTF_CPUUSAGE 0x0080 -#define SDWTF_MASK 0x00FF /* bitmask for all SDWTF_* bits */ - -#define SDROR_RUNNING 3 -#endif - -#endif // M_SHUTDOWN_H diff --git a/plugins/AutoShutdown/main.cpp b/plugins/AutoShutdown/main.cpp index 22fab33c6d..43501bee52 100644 --- a/plugins/AutoShutdown/main.cpp +++ b/plugins/AutoShutdown/main.cpp @@ -80,15 +80,9 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir) static int ShutdownModulesLoaded(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); if(ServiceExists("DBEditorpp/RegisterSingleModule")) CallService("DBEditorpp/RegisterSingleModule",(WPARAM)"AutoShutdown",0); - /* merged thundershutdown plugin */ - if(GetModuleHandleA("tshutdown.dll")) { - DBWriteContactSettingByte(NULL,"PluginDisable","tshutdown.dll",1); - DBWriteContactSettingByte(NULL,"AutoShutdown","WeatherShutdown",1); - } + return 0; } @@ -122,12 +116,7 @@ extern "C" __declspec(dllexport) int Load(void) InitSettingsDlg(); InitOptions(); - /* installation */ - InstallFile(_T("Shutdown-Readme.txt"),_T("Docs\\")); - InstallFile(_T("Shutdown-License.txt"),_T("Docs\\")); - InstallFile(_T("Shutdown-SDK.zip"),_T("Docs\\")); - InstallFile(_T("countdown.wav"),_T("Sounds\\")); - hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,ShutdownModulesLoaded); + hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ShutdownModulesLoaded); return 0; } diff --git a/plugins/AutoShutdown/options.cpp b/plugins/AutoShutdown/options.cpp index 1e23b9005a..c173a169a9 100644 --- a/plugins/AutoShutdown/options.cpp +++ b/plugins/AutoShutdown/options.cpp @@ -31,7 +31,7 @@ static HANDLE hHookModulesLoaded; #define M_ENABLE_SUBCTLS (WM_APP+111) -static int CALLBACK ShutdownOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_INITDIALOG: @@ -106,7 +106,6 @@ static int CALLBACK ShutdownOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA static int ShutdownOptInit(WPARAM wParam,LPARAM lParam) { OPTIONSDIALOGPAGE odp; - UNREFERENCED_PARAMETER(lParam); ZeroMemory(&odp,sizeof(odp)); odp.cbSize=sizeof(odp); odp.hInstance=hInst; @@ -116,7 +115,7 @@ static int ShutdownOptInit(WPARAM wParam,LPARAM lParam) odp.ptszTitle=_T("Automatic Shutdown"); /* autotranslated */ odp.ptszTab=_T("Automatic Shutdown"); /* autotranslated, can be made a tab */ odp.flags=ODPF_BOLDGROUPS|ODPF_EXPERTONLY|ODPF_TCHAR; - odp.pfnDlgProc=ShutdownOptDlgProc; + odp.pfnDlgProc = ShutdownOptDlgProc; Options_AddPage(wParam, &odp); return 0; } @@ -125,7 +124,6 @@ static int ShutdownOptInit(WPARAM wParam,LPARAM lParam) static int __stdcall ActionProc(DWORD idAction,REPORTINFO *ri,int shutdownType) { - UNREFERENCED_PARAMETER(ri); if(idAction&ACT_PERFORM) ServiceShutdown(shutdownType,TRUE); return 0; } @@ -143,8 +141,6 @@ static int HangupActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_CLO static int TriggerRegisterActions(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); /* new trigger API (0.2.0.69+) */ if(ServiceExists(MS_TRIGGER_REGISTERCONDITION)) { ACTIONREGISTER ar; diff --git a/plugins/AutoShutdown/res/Thumbs.db b/plugins/AutoShutdown/res/Thumbs.db deleted file mode 100644 index 28fd3e08f0..0000000000 Binary files a/plugins/AutoShutdown/res/Thumbs.db and /dev/null differ diff --git a/plugins/AutoShutdown/settingsdlg.cpp b/plugins/AutoShutdown/settingsdlg.cpp index 24bceaa682..2871c65e33 100644 --- a/plugins/AutoShutdown/settingsdlg.cpp +++ b/plugins/AutoShutdown/settingsdlg.cpp @@ -64,7 +64,7 @@ static BOOL AnyProtoHasCaps(DWORD caps1) #define M_ENABLE_SUBCTLS (WM_APP+111) #define M_UPDATE_SHUTDOWNDESC (WM_APP+112) #define M_CHECK_DATETIME (WM_APP+113) -static BOOL CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_INITDIALOG: @@ -392,15 +392,13 @@ static BOOL CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM /************************* Services ***********************************/ -static int ServiceShowSettingsDialog(WPARAM wParam,LPARAM lParam) +static INT_PTR ServiceShowSettingsDialog(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); if(hwndSettingsDlg!=NULL) { /* already opened, bring to front */ SetForegroundWindow(hwndSettingsDlg); return 0; } - return (CreateDialog(hInst,MAKEINTRESOURCE(IDD_SETTINGS),NULL,SettingsDlgProc)==NULL); + return (CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETTINGS), NULL, SettingsDlgProc) == NULL); } /************************* Toolbar ************************************/ @@ -410,8 +408,6 @@ static WORD hToolbarButton; static int ToolbarLoaded(WPARAM wParam,LPARAM lParam) { TTBButton ttbb; - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); ZeroMemory(&ttbb,sizeof(ttbb)); ttbb.cbSize=sizeof(ttbb); @@ -470,10 +466,8 @@ void SetShutdownMenuItem(BOOL fActive) IcoLib_ReleaseIcon(cmi.hIcon); } -static int MenuItemCommand(WPARAM wParam,LPARAM lParam) +static INT_PTR MenuItemCommand(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); /* toggle between StopWatcher and ShowSettingsDdialog */ if(ServiceIsWatcherEnabled(0,0)) ServiceStopWatcher(0,0); @@ -487,17 +481,17 @@ static int MenuItemCommand(WPARAM wParam,LPARAM lParam) void InitSettingsDlg(void) { /* Menu Item */ - hServiceMenuCommand=CreateServiceFunction("AutoShutdown/MenuCommand",MenuItemCommand); + hServiceMenuCommand = CreateServiceFunction("AutoShutdown/MenuCommand", MenuItemCommand); hMainMenuItem=hTrayMenuItem=NULL; SetShutdownMenuItem(FALSE); /* Toolbar Item */ hToolbarButton=0; hHookToolbarLoaded=HookEvent(ME_TTB_MODULELOADED,ToolbarLoaded); /* no service to check for */ /* Hotkey */ - SkinAddNewHotkey("AutoShutdown_Toggle",Translate("Main"),Translate("Toggle Automatic Shutdown"),'T',HOTKEYF_CONTROL|HOTKEYF_SHIFT,"AutoShutdown/MenuCommand"); + AddHotkey(); /* Services */ hwndSettingsDlg=NULL; - hServiceShowDlg=CreateServiceFunction(MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG,ServiceShowSettingsDialog); + hServiceShowDlg = CreateServiceFunction(MS_AUTOSHUTDOWN_SHOWSETTINGSDIALOG, ServiceShowSettingsDialog); } void UninitSettingsDlg(void) diff --git a/plugins/AutoShutdown/shutdownsvc.cpp b/plugins/AutoShutdown/shutdownsvc.cpp index 52df4159d9..57c12c65a2 100644 --- a/plugins/AutoShutdown/shutdownsvc.cpp +++ b/plugins/AutoShutdown/shutdownsvc.cpp @@ -52,13 +52,7 @@ static BOOL WinNT_SetPrivilege(TCHAR *pszPrivName,BOOL bEnable) static void BroadcastEndSession(DWORD dwRecipients,LPARAM lParam) { LONG (WINAPI *pfnBroadcastSystemMessage)(DWORD,DWORD*,UINT,WPARAM,LPARAM); -#if defined(_UNICODE) *(PROC*)&pfnBroadcastSystemMessage=GetProcAddress(GetModuleHandleA("USER32"),"BroadcastSystemMessageW"); -#else - *(PROC*)&pfnBroadcastSystemMessage=GetProcAddress(GetModuleHandleA("USER32"),"BroadcastSystemMessageA"); - if(!pfnBroadcastSystemMessage) /* Win95 has undecorated API */ - *(PROC*)&pfnBroadcastSystemMessage=GetProcAddress(GetModuleHandleA("USER32"),"BroadcastSystemMessage"); -#endif if(pfnBroadcastSystemMessage) pfnBroadcastSystemMessage(BSF_FORCEIFHUNG,&dwRecipients,WM_ENDSESSION,TRUE,lParam); } @@ -76,23 +70,7 @@ static BOOL WinNT_IsWorkStationLocked(void) return bLocked; } -#if !defined(_UNICODE) -static void Win9x_TerminateExplorer(void) -{ - HANDLE hProcess; - DWORD idProcess; - if(GetWindowThreadProcessId(GetDesktopWindow(),&idProcess)) { - hProcess=OpenProcess(PROCESS_TERMINATE,FALSE,idProcess); - if(hProcess!=NULL) { - TerminateProcess(hProcess,0); - CloseHandle(hProcess); - } - } -} -#endif - /************************* Workers ************************************/ - static BOOL IsShutdownTypeEnabled(BYTE shutdownType) { BOOL bReturn=FALSE; @@ -247,15 +225,9 @@ static DWORD ShutdownNow(BYTE shutdownType) DWORD (APIENTRY *pfnRasEnumConnections)(RASCONN*,DWORD*,DWORD*); DWORD (APIENTRY *pfnRasHangUp)(HRASCONN); DWORD (APIENTRY *pfnRasGetConnectStatus)(HRASCONN,RASCONNSTATUS*); - #if defined(_UNICODE) - *(PROC*)&pfnRasEnumConnections=GetProcAddress(hRasApiDLL,"RasEnumConnectionsW"); - *(PROC*)&pfnRasHangUp=GetProcAddress(hRasApiDLL,"RasHangUpW"); - *(PROC*)&pfnRasGetConnectStatus=GetProcAddress(hRasApiDLL,"RasGetConnectStatusW"); - #else - *(PROC*)&pfnRasEnumConnections=GetProcAddress(hRasApiDLL,"RasEnumConnectionsA"); - *(PROC*)&pfnRasHangUp=GetProcAddress(hRasApiDLL,"RasHangUpA"); - *(PROC*)&pfnRasGetConnectStatus=GetProcAddress(hRasApiDLL,"RasGetConnectStatusA"); - #endif + *(PROC*)&pfnRasEnumConnections=GetProcAddress(hRasApiDLL,"RasEnumConnectionsW"); + *(PROC*)&pfnRasHangUp=GetProcAddress(hRasApiDLL,"RasHangUpW"); + *(PROC*)&pfnRasGetConnectStatus=GetProcAddress(hRasApiDLL,"RasGetConnectStatusW"); if(pfnRasEnumConnections && pfnRasGetConnectStatus && pfnRasHangUp) { RASCONN *paConn; RASCONN *paConnBuf; @@ -322,13 +294,8 @@ static DWORD ShutdownNow(BYTE shutdownType) /* WinNT4/2000/XP */ { BOOL (WINAPI *pfnInitiateSystemShutdownEx)(const TCHAR*,const TCHAR*,DWORD,BOOL,BOOL,DWORD); BOOL (WINAPI *pfnInitiateSystemShutdown)(const TCHAR*,const TCHAR*,DWORD,BOOL,BOOL); - #if defined(_UNICODE) - *(PROC*)&pfnInitiateSystemShutdownEx=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownExW"); - *(PROC*)&pfnInitiateSystemShutdown=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownW"); - #else - *(PROC*)&pfnInitiateSystemShutdownEx=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownExA"); - *(PROC*)&pfnInitiateSystemShutdown=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownA"); - #endif + *(PROC*)&pfnInitiateSystemShutdownEx=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownExW"); + *(PROC*)&pfnInitiateSystemShutdown=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownW"); if(pfnInitiateSystemShutdownEx!=NULL || pfnInitiateSystemShutdown!=NULL) { WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE); @@ -372,9 +339,6 @@ static DWORD ShutdownNow(BYTE shutdownType) * Enter Windows Password dialog box, however, the user's desktop remains.) * To log off the user forcibly, terminate the Explorer process before calling * ExitWindowsEx with EWX_LOGOFF and EWX_FORCE. */ - #if !defined(_UNICODE) - if(shutdownType==SDSDT_LOGOFF && !IsWinVerNT()) Win9x_TerminateExplorer(); - #endif } if(!ExitWindowsEx(flags,SHTDN_REASON_MAJOR_OTHER|SHTDN_REASON_MINOR_OTHER|SHTDN_REASON_FLAG_PLANNED)) dwErrCode=GetLastError(); @@ -390,16 +354,16 @@ static DWORD ShutdownNow(BYTE shutdownType) #define M_START_SHUTDOWN (WM_APP+111) #define M_UPDATE_COUNTDOWN (WM_APP+112) -static BOOL CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { - BYTE shutdownType=(BYTE)GetWindowLong(hwndDlg,DWL_USER); - WORD countdown=(WORD)GetWindowLong(GetDlgItem(hwndDlg,IDC_TEXT_HEADER),GWL_USERDATA); + BYTE shutdownType=(BYTE)GetWindowLongPtr(hwndDlg, DWLP_USER); + WORD countdown=(WORD)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA); static BOOL (WINAPI *pfnLockSetForegroundWindow)(UINT); switch(msg) { case WM_INITDIALOG: hwndShutdownDlg=hwndDlg; - SetWindowLong(hwndDlg,DWL_USER,(LONG)lParam); + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG)lParam); TranslateDialogDefault(hwndDlg); if(lParam==SDSDT_SHUTDOWN || lParam==SDSDT_REBOOT || lParam==SDSDT_LOGOFF) @@ -413,11 +377,11 @@ static BOOL CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } else hBoldFont=NULL; SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,(WPARAM)hBoldFont,FALSE); - SetWindowLong(GetDlgItem(hwndDlg,IDC_TEXT_HEADER),GWL_USERDATA,(LONG)hBoldFont); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, (LONG)hBoldFont); } { WORD countdown=DBGetContactSettingWord(NULL,"AutoShutdown","ConfirmDlgCountdown",SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT); if(countdown<3) countdown=SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT; - SetWindowLong(GetDlgItem(hwndDlg,IDC_TEXT_HEADER),GWL_USERDATA,countdown); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, countdown); SendMessage(hwndDlg,M_UPDATE_COUNTDOWN,0,countdown); } SkinPlaySound("AutoShutdown_Countdown"); @@ -465,7 +429,7 @@ static BOOL CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case WM_TIMER: if(countdown) { --countdown; - SetWindowLong(GetDlgItem(hwndDlg,IDC_TEXT_HEADER),GWL_USERDATA,countdown); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, countdown); if(countdown==27 || countdown==24 || countdown==21 || countdown==19 || countdown==17 || countdown==15 || countdown==13 || countdown==11 || countdown<=10) @@ -495,7 +459,7 @@ static BOOL CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM switch(LOWORD(wParam)) { case IDC_BUTTON_SHUTDOWNNOW: KillTimer(hwndDlg,1); - SetWindowLong(GetDlgItem(hwndDlg,IDC_TEXT_HEADER),GWL_USERDATA,0); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, 0); SendMessage(hwndDlg,M_UPDATE_COUNTDOWN,0,(LONG)0); PostMessage(hwndDlg,M_START_SHUTDOWN,0,0); return TRUE; @@ -513,7 +477,7 @@ static BOOL CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM /************************* Services ***********************************/ -int ServiceShutdown(WPARAM wParam,LPARAM lParam) +INT_PTR ServiceShutdown(WPARAM wParam,LPARAM lParam) { /* passing 0 as wParam is only to be used internally, undocumented */ if(!wParam) wParam=DBGetContactSettingByte(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT); @@ -529,7 +493,7 @@ int ServiceShutdown(WPARAM wParam,LPARAM lParam) NotifyEventHooks(hEventShutdown,wParam,lParam); /* show dialog */ if(lParam && DBGetContactSettingByte(NULL,"AutoShutdown","ShowConfirmDlg",SETTING_SHOWCONFIRMDLG_DEFAULT)) - if(CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_SHUTDOWNNOW),NULL,ShutdownDlgProc,(LPARAM)(BYTE)wParam)!=NULL) + if(CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHUTDOWNNOW), NULL, ShutdownDlgProc, (LPARAM)(BYTE)wParam) != NULL) return 0; /* show error */ { DWORD dwErrCode; @@ -545,13 +509,12 @@ int ServiceShutdown(WPARAM wParam,LPARAM lParam) return 0; } -int ServiceIsTypeEnabled(WPARAM wParam,LPARAM lParam) +INT_PTR ServiceIsTypeEnabled(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(lParam); return IsShutdownTypeEnabled((BYTE)wParam); /* does shutdownType range check */ } -int ServiceGetTypeDescription(WPARAM wParam,LPARAM lParam) +INT_PTR ServiceGetTypeDescription(WPARAM wParam,LPARAM lParam) { TCHAR *pszDesc; const TCHAR *apszShort[]={_T("Close Miranda IM"),_T("Set Miranda IM offline"),_T("Log off user"), @@ -574,25 +537,14 @@ int ServiceGetTypeDescription(WPARAM wParam,LPARAM lParam) pszDesc=(TCHAR*)((lParam&GSTDF_LONGDESC)?apszLong:apszShort)[wParam-1]; if(!(lParam&GSTDF_UNTRANSLATED)) pszDesc=TranslateTS(pszDesc); /* convert as needed */ - #if defined(_UNICODE) - if(!(lParam&GSTDF_UNICODE)) { - static char szConvBuf[128]; - char *buf=u2a(pszDesc); - if(buf==NULL) return (int)NULL; - lstrcpynA(szConvBuf,buf,sizeof(szConvBuf)); - mir_free(buf); - return (int)szConvBuf; - } - #else - if(lParam&GSTDF_UNICODE) { - static WCHAR szConvBuf[128]; - WCHAR *buf=a2u(pszDesc); - if(buf==NULL) return (int)NULL; - lstrcpynW(szConvBuf,buf,SIZEOF(szConvBuf)); - mir_free(buf); - return (int)szConvBuf; - } - #endif + if(!(lParam&GSTDF_UNICODE)) { + static char szConvBuf[128]; + char *buf=u2a(pszDesc); + if(buf==NULL) return (int)NULL; + lstrcpynA(szConvBuf,buf,sizeof(szConvBuf)); + mir_free(buf); + return (int)szConvBuf; + } return (int)pszDesc; } @@ -606,9 +558,9 @@ void InitShutdownSvc(void) /* Services */ hEventOkToShutdown=CreateHookableEvent(ME_AUTOSHUTDOWN_OKTOSHUTDOWN); hEventShutdown=CreateHookableEvent(ME_AUTOSHUTDOWN_SHUTDOWN); - hServiceShutdown=CreateServiceFunction(MS_AUTOSHUTDOWN_SHUTDOWN,ServiceShutdown); - hServiceIsTypeEnabled=CreateServiceFunction(MS_AUTOSHUTDOWN_ISTYPEENABLED,ServiceIsTypeEnabled); - hServiceGetTypeDesc=CreateServiceFunction(MS_AUTOSHUTDOWN_GETTYPEDESCRIPTION,ServiceGetTypeDescription); + hServiceShutdown = CreateServiceFunction(MS_AUTOSHUTDOWN_SHUTDOWN, ServiceShutdown); + hServiceIsTypeEnabled = CreateServiceFunction(MS_AUTOSHUTDOWN_ISTYPEENABLED, ServiceIsTypeEnabled); + hServiceGetTypeDesc = CreateServiceFunction(MS_AUTOSHUTDOWN_GETTYPEDESCRIPTION, ServiceGetTypeDescription); } void UninitShutdownSvc(void) diff --git a/plugins/AutoShutdown/shutdownsvc.h b/plugins/AutoShutdown/shutdownsvc.h index 412db18ee6..639d02a7fa 100644 --- a/plugins/AutoShutdown/shutdownsvc.h +++ b/plugins/AutoShutdown/shutdownsvc.h @@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Services */ -int ServiceShutdown(WPARAM wParam,LPARAM lParam); -int ServiceIsTypeEnabled(WPARAM wParam,LPARAM lParam); -int ServiceGetTypeDescription(WPARAM wParam,LPARAM lParam); +INT_PTR ServiceShutdown(WPARAM wParam,LPARAM lParam); +INT_PTR ServiceIsTypeEnabled(WPARAM wParam,LPARAM lParam); +INT_PTR ServiceGetTypeDescription(WPARAM wParam,LPARAM lParam); /* Misc */ void InitShutdownSvc(void); diff --git a/plugins/AutoShutdown/utils.cpp b/plugins/AutoShutdown/utils.cpp index d9ea4a879e..c0128f80d6 100644 --- a/plugins/AutoShutdown/utils.cpp +++ b/plugins/AutoShutdown/utils.cpp @@ -24,28 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /************************* String *********************************/ // mir_free() the return value -#if !defined(_UNICODE) -WCHAR* a2u(const char *pszAnsi) -{ - int codepage,cch; - WCHAR *psz; - - if(pszAnsi==NULL) return NULL; - codepage=CallService(MS_LANGPACK_GETCODEPAGE,0,0); - cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,NULL,0); - if(!cch) return NULL; - - psz=(WCHAR*)mir_alloc(cch*sizeof(WCHAR)); - if(psz!=NULL && !MultiByteToWideChar(codepage,0,pszAnsi,-1,psz,cch)) { - mir_free(psz); - return NULL; - } - return psz; -} -#endif - -// mir_free() the return value -#if defined(_UNICODE) char* u2a(const WCHAR *pszUnicode) { int codepage,cch; @@ -66,7 +44,6 @@ char* u2a(const WCHAR *pszUnicode) } return psz; } -#endif void TrimString(TCHAR *pszStr) { @@ -182,28 +159,17 @@ BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown) { static BOOL fInited=FALSE; static int (WINAPI *pfnStrFromTimeInterval)(TCHAR*,UINT,DWORD,int); - #if defined(_UNICODE) static int (WINAPI *pfnGetDurationFormat)(LCID,DWORD,const SYSTEMTIME*,double,WCHAR*,WCHAR*,int); - #endif /* Init */ if(!fInited) { - #if defined(_UNICODE) *(PROC*)&pfnGetDurationFormat=GetProcAddress(GetModuleHandleA("KERNEL32"),"GetDurationFormat"); if(pfnGetDurationFormat==NULL) { - #endif HMODULE hShlwDLL=LoadLibraryA("SHLWAPI"); /* all ascii */ - #if defined(_UNICODE) - *(PROC*)&pfnStrFromTimeInterval=GetProcAddress(hShlwDLL,"StrFromTimeIntervalW"); - #else - *(PROC*)&pfnStrFromTimeInterval=GetProcAddress(hShlwDLL,"StrFromTimeIntervalA"); - #endif - #if defined(_UNICODE) + *(PROC*)&pfnStrFromTimeInterval=GetProcAddress(hShlwDLL,"StrFromTimeIntervalW"); } - #endif fInited=TRUE; } /* WinVista */ - #if defined(_UNICODE) if(pfnGetDurationFormat!=NULL) { SYSTEMTIME st; LCID locale; @@ -213,7 +179,6 @@ BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown) return TRUE; return FALSE; } - #endif /* Win9x/NT/XP */ if(pfnStrFromTimeInterval!=NULL) return pfnStrFromTimeInterval(pszOut,nSize,(countdown>(MAXDWORD/1000))?MAXDWORD:(countdown*1000),10)!=0; @@ -362,101 +327,16 @@ int SkinAddNewSoundBundled(const char *pszDbName,const char *pszSection,const ch return 0; } -/* workaround for 'Hotkey Service' plugin because it has needs an event catcher */ -static char szHotkeyService[MAXMODULELABELLENGTH]; -static int moduleId,itemId; -static int HotkeysServiceHotkeyPressed(WPARAM wParam,LPARAM lParam) -{ - UNREFERENCED_PARAMETER(lParam); - if(((THKSEvent*)wParam)->moduleId==moduleId && ((THKSEvent*)wParam)->itemId==LOWORD(itemId)) - CallService(szHotkeyService,0,0); - return 0; -} - -/* defines for 'Hotkey Manager' */ -#define HK_ACT_OVERWRITE 0 -#define HKF_GLOBAL 0x00000001 -#define HKF_WPARNUM 0x00000008 -#define HKF_HEX 0x00000200 -#define HKF_LCURRENT 0x00001000 -#define HKT_SERVICE 2 -typedef struct { - void *reserved1; - void *reserved2; - int hotkey; - WCHAR* descr; - DWORD flags; - ATOM reserved3; - DWORD _type; - char* service; - WPARAM wparam; - LPARAM lparam; -} HOTKEYREC; -#define MS_HK_ADDHOTKEY "HotKey/AddHotkey" - -int SkinAddNewHotkey(const char *pszDbName,const char *pszSection,const char *pszDescription,UINT vk,UINT hotkeyfModifiers,const char *pszServiceName) +void AddHotkey() { - if(ServiceExists(MS_SKIN_ADDHOTKEY)) { /* clist_mw, clist_modern */ - SKINHOTKEYDESCEX shd; - ZeroMemory(&shd,sizeof(shd)); - shd.cbSize=sizeof(shd); - shd.pszName=(char*)pszDbName; - shd.pszDescription=(char*)pszDescription; - shd.pszSection=(char*)pszSection; - shd.pszService=(char*)pszServiceName; - shd.DefHotKey=MAKEWORD(vk,hotkeyfModifiers); - CallService(MS_SKIN_ADDHOTKEY,0,(LPARAM)&shd); - /* no return */ - } - if(ServiceExists(MS_HOTKEYSPLUS_ADDKEY)) /* 'Hotkeys Plus' */ - return CallService(MS_HOTKEYSPLUS_ADDKEY,(WPARAM)pszServiceName,(LPARAM)pszDescription); - if(ServiceExists(HKS_REGISTERFUNCTION)) { /* mHotKey */ - KEYHASH kh; - kh.isShift=(hotkeyfModifiers&HOTKEYF_SHIFT)!=0; - kh.isCtrl=(hotkeyfModifiers&HOTKEYF_CONTROL)!=0; - kh.isAlt=(hotkeyfModifiers&HOTKEYF_ALT)!=0; - kh.vkCode=vk; - return !CallService(HKS_REGISTERFUNCTION,(WPARAM)&kh,(LPARAM)pszServiceName); - } - if(ServiceExists(MS_HK_ADDHOTKEY)) { /* 'Hotkey Manager' */ - HOTKEYREC hkr; - ZeroMemory(&hkr,sizeof(hkr)); - hkr.hotkey=(int)MAKEWORD(vk,hotkeyfModifiers); - #if defined(_UNICODE) - hkr.descr=(WCHAR*)pszDescription; - #else - hkr.descr=(WCHAR*)a2u(pszDescription); - #endif - hkr.flags=HKF_GLOBAL|HKF_WPARNUM|HKF_LCURRENT|HKF_HEX; - hkr._type=HKT_SERVICE; - hkr.service=(char*)pszServiceName; - CallService(MS_HK_ADDHOTKEY,(WPARAM)&hkr,HK_ACT_OVERWRITE); - #if !defined(_UNICODE) - mir_free(hkr.descr); - #endif - return 0; - } - if(ServiceExists(MS_HKS_REGISTER_ITEM)) { /* 'Hotkeys Service' */ - THKSItem item; - ZeroMemory(&item,sizeof(item)); - item.name=(char*)pszSection; - item.itemType=HKS_ITEM_MODULE; - item.owner=LOWORD(CallService(MS_HKS_REGISTER_ITEM,(WPARAM)&item,0)); - item.name=(char*)pszDescription; - item.itemType=HKS_ITEM_ACTION; - item.hotkey.key=(WORD)vk; - item.hotkey.modifiers=MOD_GLOBAL; - if(hotkeyfModifiers&HOTKEYF_ALT) item.hotkey.modifiers|=MOD_ALT; - if(hotkeyfModifiers&HOTKEYF_CONTROL) item.hotkey.modifiers|=MOD_CONTROL; - if(hotkeyfModifiers&HOTKEYF_SHIFT) item.hotkey.modifiers|=MOD_SHIFT; - if(hotkeyfModifiers&HOTKEYF_EXT) item.hotkey.modifiers|=MOD_WIN; - /* no possibility to specify a service to call, - * all processing needs to be done in the plugins */ - moduleId=item.owner; - mir_snprintf(szHotkeyService,sizeof(szHotkeyService),"%s",pszServiceName); // only allows for one hotkey as a whole - HookEvent(ME_HKS_KEY_PRESSED,HotkeysServiceHotkeyPressed); - itemId=CallService(MS_HKS_REGISTER_ITEM,(WPARAM)&item,0); - return HIWORD(itemId); - } - return 1; + HOTKEYDESC hkd = {0}; + hkd.cbSize = sizeof(hkd); + hkd.dwFlags = HKD_TCHAR; + hkd.pszName = "AutoShutdown_Toggle"; + hkd.ptszDescription = _T("Toggle Automatic Shutdown"); + hkd.ptszSection = _T("Main"); + hkd.pszService = "AutoShutdown/MenuCommand"; + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'T') | HKF_MIRANDA_LOCAL; + hkd.lParam = FALSE; + Hotkey_Register(&hkd); } diff --git a/plugins/AutoShutdown/utils.h b/plugins/AutoShutdown/utils.h index 98b4825ec0..d70dd980d7 100644 --- a/plugins/AutoShutdown/utils.h +++ b/plugins/AutoShutdown/utils.h @@ -45,4 +45,4 @@ HANDLE IcoLib_AddIconRes(const char *pszDbName,const TCHAR *pszSection,const TCH HICON IcoLib_GetIcon(const char *pszDbName); int IcoLib_ReleaseIcon(HICON hIcon); int SkinAddNewSoundBundled(const char *pszDbName,const char *pszSection,const char *pszDesc,const char *pszSubDir,const char *pszDefaultFile); -int SkinAddNewHotkey(const char *pszDbName,const char* pszSection,const char *pszDescription,UINT vk,UINT hotkeyfModifiers,const char *pszServiceName); +void AddHotkey(); diff --git a/plugins/AutoShutdown/watcher.cpp b/plugins/AutoShutdown/watcher.cpp index ad9422e439..3121248cba 100644 --- a/plugins/AutoShutdown/watcher.cpp +++ b/plugins/AutoShutdown/watcher.cpp @@ -65,7 +65,6 @@ static void __inline ShutdownAndStopWatcher(void) // ppBlob might get reallocated, must have been allocated using mir_alloc() static TCHAR* GetMessageText(BYTE **ppBlob,DWORD *pcbBlob) { -#if defined(_UNICODE) DWORD cb; (*ppBlob)[*pcbBlob]=0; cb=lstrlenA((char*)*ppBlob); @@ -88,15 +87,10 @@ static TCHAR* GetMessageText(BYTE **ppBlob,DWORD *pcbBlob) ((WCHAR*)buf)[len-1]=0; return (WCHAR*)buf; } -#else - (*ppBlob)[*pcbBlob]=0; - return (char*)*ppBlob; -#endif } static int MsgEventAdded(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); if(currentWatcherType&SDWTF_MESSAGE) { DBEVENTINFO dbe; dbe.cbSize=sizeof(dbe); @@ -128,7 +122,6 @@ static int nTransfersCount; static int ProtoAck(WPARAM wParam,LPARAM lParam) { ACKDATA *ack=(ACKDATA*)lParam; - UNREFERENCED_PARAMETER(wParam); if(ack->type==ACKTYPE_FILE) switch(ack->result) { case ACKRESULT_DATA: @@ -174,7 +167,6 @@ static int ProtoAck(WPARAM wParam,LPARAM lParam) static int IdleChanged(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); if(currentWatcherType&SDWTF_IDLE && lParam&IDF_ISIDLE) ShutdownAndStopWatcher(); return 0; @@ -258,8 +250,6 @@ static int WeatherUpdated(WPARAM wParam,LPARAM lParam) static int HddOverheat(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); if(DBGetContactSettingByte(NULL,"AutoShutdown","HddOverheatShutdown",SETTING_HDDOVERHEATSHUTDOWN_DEFAULT)) ServiceShutdown(SDSDT_SHUTDOWN,TRUE); return 0; @@ -267,10 +257,8 @@ static int HddOverheat(WPARAM wParam,LPARAM lParam) /************************* Services ***********************************/ -int ServiceStartWatcher(WPARAM wParam,LPARAM lParam) +INT_PTR ServiceStartWatcher(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - /* passing watcherType as lParam is only to be used internally, undocumented */ if(lParam==0) lParam=(LPARAM)DBGetContactSettingWord(NULL,"AutoShutdown","WatcherFlags",0); @@ -304,10 +292,8 @@ int ServiceStartWatcher(WPARAM wParam,LPARAM lParam) return 0; } -int ServiceStopWatcher(WPARAM wParam,LPARAM lParam) +INT_PTR ServiceStopWatcher(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); if(currentWatcherType==0) return 1; /* Time Shutdown */ @@ -323,10 +309,8 @@ int ServiceStopWatcher(WPARAM wParam,LPARAM lParam) return 0; } -int ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam) +INT_PTR ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); return currentWatcherType!=0; } @@ -334,9 +318,6 @@ int ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam) static int WatcherModulesLoaded(WPARAM wParam,LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - /* Weather Shutdown */ if(ServiceExists(MS_WEATHER_UPDATE)) hHookWeatherUpdated=HookEvent(ME_WEATHER_UPDATED,WeatherUpdated); @@ -372,9 +353,9 @@ void InitWatcher(void) hHookHddOverheat=NULL; /* Services */ hEventWatcherChanged=CreateHookableEvent(ME_AUTOSHUTDOWN_WATCHERCHANGED); - hServiceStartWatcher=CreateServiceFunction(MS_AUTOSHUTDOWN_STARTWATCHER,ServiceStartWatcher); - hServiceStopWatcher=CreateServiceFunction(MS_AUTOSHUTDOWN_STOPWATCHER,ServiceStopWatcher); - hServiceIsEnabled=CreateServiceFunction(MS_AUTOSHUTDOWN_ISWATCHERENABLED,ServiceIsWatcherEnabled); + hServiceStartWatcher = CreateServiceFunction(MS_AUTOSHUTDOWN_STARTWATCHER, ServiceStartWatcher); + hServiceStopWatcher = CreateServiceFunction(MS_AUTOSHUTDOWN_STOPWATCHER, ServiceStopWatcher); + hServiceIsEnabled = CreateServiceFunction(MS_AUTOSHUTDOWN_ISWATCHERENABLED, ServiceIsWatcherEnabled); /* Misc */ hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,WatcherModulesLoaded); } diff --git a/plugins/AutoShutdown/watcher.h b/plugins/AutoShutdown/watcher.h index 20f4e431c3..962378b811 100644 --- a/plugins/AutoShutdown/watcher.h +++ b/plugins/AutoShutdown/watcher.h @@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Services */ -int ServiceStartWatcher(WPARAM wParam,LPARAM lParam); -int ServiceStopWatcher(WPARAM wParam,LPARAM lParam); -int ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam); +INT_PTR ServiceStartWatcher(WPARAM wParam,LPARAM lParam); +INT_PTR ServiceStopWatcher(WPARAM wParam,LPARAM lParam); +INT_PTR ServiceIsWatcherEnabled(WPARAM wParam,LPARAM lParam); /* Misc */ void InitWatcher(void); diff --git a/plugins/ExternalAPI/m_flags.inc b/plugins/ExternalAPI/m_flags.inc deleted file mode 100644 index f3dc0e8367..0000000000 --- a/plugins/ExternalAPI/m_flags.inc +++ /dev/null @@ -1,74 +0,0 @@ -{ -Miranda IM Country Flags Plugin -Copyright (C) 2006-2007 H. Herkenrath - -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 (Flags-License.txt); if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -} - -{$ifndef M_FLAGS_H} -{$define M_FLAGS_H} - -const - -{ - Country Flags Plugin v0.1.0.3 -} - -{ interface id } -MIID_FLAGS: TGUID = '{88A3B66E-C438-4381-BC17-71D99D225F9C}'; - -{ Load a country flag icon from the skin library. v0.1.0.0+ -The retrieved icon should be released using MS_SKIN2_RELEASEICON after use. -The country numbers can be retrieved using MS_UTILS_GETCOUNTRYLIST. -Another way to get the country numbers are the CTRY_* constants in winnls.h of WinAPI. -To retrieve the country number from a locale, call GetLocaleInfo(). -with LOCALE_ICOUNTRY. - wParam : countryNumber - lParam : (BOOL)fReturnHandle (nonzero to to retrieve the icolib handle instead of the icon) -Returns a icon handle (HICON) on success, NULL on error. -} -MS_FLAGS_LOADCOUNTRYFLAGICON = 'Flags/LoadCountryFlagIcon'; - -{ Create a merged country flag icon. v0.1.0.0+ -The retrieved icon should be released using DestroyIcon() after use. - wParam : countryNumberUpper - lParam : countryNumberLower -Returns a icon handle (HICON) on success, NULL on error. -} -MS_FLAGS_CREATEMERGEDFLAGICON = 'Flags/CreateMergedFlagIcon'; - -{ Get a corresponding country given an (external) IP address. v0.1.0.0+ -The retrieved number can be converted to a normal country name -using MS_UTILS_GETCOUNTRYBYNUMBER. - wParam : dwExternalIP (same format as used Netlib) - lParam : 0 -Returns a country number on success, -or 0xFFFF on failure (MS_UTILS_GETCOUNTRYBYNUMBER returns "Unknown" for this). -} -MS_FLAGS_IPTOCOUNTRY = 'Flags/IpToCountry'; - -{ Detect the origin country of a contact. v0.1.0.0+ -This uses the contacts's IP first, and falls back on using -CNF_COUNTRY and CNF_COCOUNTRY of contact details. -To get the contact's IP it relies on the db setting -"RealIP" in the proto module. - wParam : (WPARAM)(HANDLE)hContact - lParam : 0 -Returns a country number on success, -or 0xFFFF on failure (MS_UTILS_GETCOUNTRYBYNUMBER returns "Unknown" for this). -} -MS_FLAGS_DETECTCONTACTORIGINCOUNTRY = 'Flags/DetectContactOriginCountry'; - -{$endif} // M_FLAGS_H diff --git a/plugins/ExternalAPI/m_hotkey.h b/plugins/ExternalAPI/m_hotkey.h deleted file mode 100644 index 1af34b4342..0000000000 --- a/plugins/ExternalAPI/m_hotkey.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef H_HOTKEY_H -#define H_HOTKEY_H - -//hotkey struct - typedef struct{ - BOOL isShift; //determines if hotkey uses shift - BOOL isCtrl; //determines if hotkey uses control - BOOL isAlt; //determines if hotkey uses alt - UINT vkCode; - - }KEYHASH,*PKEYHASH; - - //struct passed to HKS_GET_NAME_BYHASH the result of calling it will be stored in char* name - typedef struct{ - char* name; //pointer to buffer where the result will be stored - size_t bufferlen; //size of the buffer - }GETNAMEWPARAM; - - /*this below are registred miranda services and should be called by CallService */ - - /* this funtion registers new hot key function, function must be registred as miranda service - lParam = (KEYHASH*) hotKeyDefinition - wParam = (const char*)ServiceName - returns true on success and false if fails */ - #define HKS_REGISTERFUNCTION "mhotkeyregister" - /* unregisters function as hot key function - lParam = (KEYHASH*) hotKeyDefinition /search function by it's hotkey combination - wParam = NULL - and if - lParam = NULL - wParam = (const char*) functionName //search function by it's name - returns if function was propertly deleted returns true else returns false */ - #define HKS_UNREGISTERFUNCTION "mhotkeyunregister" - - /* - Updates hotkey to the specific function (if another function use this hot key it'll be assigned to this - and that function will be unregistred as hotkey function) - wParam = (const char*) FunctoinName // name of the function you want to update - lParam = (KEYHASH*)newHotKey - - returns: true on success and false on failure - */ - #define HKS_UPDATEHOTKEY "mhotkeyupdate" - - /* gets function hash by function name, the result is stored in lParam(KEYHASH*) - wParam = (const char*)functionName - lParam = (KEYHASH*) - here the result is stored - */ - #define HKS_GET_HASH_BYNAME "mhgethashbyname" - /* gets functoin name by it's hash the GETNAMEPARAM struct must be filled before calling this - it has to be passed as wParam, and there will be result stored. - wParam=(GETNAMEPARAM*)Result - lParam=(KEYHASH*)keyHash - */ - #define HKS_GET_NAME_BYHASH "mhgetnamebyhash" - /* converts keyHash to windows hotkey - wParam=(DWORD*)result - lParam=(KEYHASH*)hotKey - */ - #define HKS_HASH_TO_HOTKEY "mhhashtohotkey" - /*converts windows hotkey to keyHash - wParam=(DWORD*)hotkey - lParam=(KEYHASH*)result - */ - #define MKS_HOTKEY_TO_HASH "mhhotkeytohash" - -#endif \ No newline at end of file diff --git a/plugins/ExternalAPI/m_hotkeysplus.h b/plugins/ExternalAPI/m_hotkeysplus.h deleted file mode 100644 index 3da357f109..0000000000 --- a/plugins/ExternalAPI/m_hotkeysplus.h +++ /dev/null @@ -1,22 +0,0 @@ -#define MS_HOTKEYSPLUS_ADDKEY "HotkeysPlus/Add" - -/* -This service registers hotkey for -WPARAM - service to perform -LPARAM - decription of the service -Returned values: - 0 - success, - 1 - hotkey for this function is already existing, - 2 - the service, that you try to register the hotkey for, not exists -*/ - -#define MS_HOTKEYSPLUS_EXISTKEY "HotkeysPlus/Exist" -/* -This service checks whether hotkey for service (WPARAM) exists -LPARAM - not used -Returned values: - 0 - failed, - 1 - the hotkey for this function exists, - 2 - the service not exists -*/ - diff --git a/plugins/ExternalAPI/m_hotkeysservice.h b/plugins/ExternalAPI/m_hotkeysservice.h deleted file mode 100644 index 6e777b1876..0000000000 --- a/plugins/ExternalAPI/m_hotkeysservice.h +++ /dev/null @@ -1,213 +0,0 @@ -#ifndef __M_HOTKEYSSERVICE__ -# define __M_HOTKEYSSERVICE__ - - -#define HKS_SERVICE_NAME "HotkeysService" - -// Modifiers for hotkeys -//#define MOD_ALT 0x0001 -//#define MOD_CONTROL 0x0002 -//#define MOD_SHIFT 0x0004 -//#define MOD_WIN 0x0008 -#define MOD_GLOBAL 0x0010 - -// FLAGS -// inherit modifiers from group (specified modifiers ignored) -#define HKS_ACTION_SHAREMODIFIERS 1 -// register item, but disable -#define HKS_INITIALLY_DISABLED 2 - -#if defined(_MSC_VER) -#pragma warning(push) /* save warning settings */ -#pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union */ -#endif - -// Structure of hotkey -typedef union -{ - struct - { - WORD key; - WORD modifiers; - }; - DWORD hotkey; - -} THKSHotkey, *PHKSHotkey; - -#if defined(_MSC_VER) -#pragma warning(pop) /* restore warning settings */ -#endif - -// ITEM TYPES -#define HKS_ITEM_MODULE 1 -#define HKS_ITEM_GROUP 2 -#define HKS_ITEM_ACTION 3 -#define HKS_ITEM_MACRO 4 - - -// Structure passed to RegisterItem service. -// Used only for registration pursposes, so free it after call. -// name, owner and itemType field is mandatory. -// owner is item ID or must be 0 for 1st level items (module, single action or macro) -// itemType can be one of ITEM TYPES constants. -// flags can be combined from FLAGS constants. -// Group can contain other groups and items and optionally -// set group modifiers. Only item can be tree leaf. -// If creating group, hotkey.modifiers will be used -// as group modifiers (if nonzero) -// If creating action, hotkey is optional. If hotkey.key is filled, then -// hotkey will be assigned to item (if unused). -// If creating macro, hotkey is mandatory. - -typedef struct -{ - int owner; - char *name; - int itemType; - THKSHotkey hotkey; - int flags; - -} THKSItem, *PHKSItem; - - -// Register item -// wParam: item data in PKHSItem format -// lParam: 0 -// Returns HANDLE called "ID" in loWord. -// For actions and macros, hiWord returns state: 0 if ok, other if passed hotkey -// can't be registered (for example already used) -// In other cases hiWord is useless -#define MS_HKS_REGISTER_ITEM HKS_SERVICE_NAME "/RegisterItem" - -// Unregister item -// If item is Group, then all subItems will be unregistered. -// wParam: item ID -// lParam: 0 -// Returns: 0 on success, other on fail -#define MS_HKS_UNREGISTER_ITEM HKS_SERVICE_NAME "/UnregisterItem" - -// Assign hotkey to item. If item is group, then only -// modifiers are taken as group modifiers. Do not call on modules. -// Hotkey consists of modifiers in hiWord and key in loWord. -// wParam: item ID -// lParam: hotkey as PHKS_Hotkey to register -// Returns: -// on success: hotkey -// on error: 0 -#define MS_HKS_ASSIGN_HOTKEY HKS_SERVICE_NAME "/AssignHotkey" - -// Get hotkey assigned to item. Don't apply to modules. -// wParam: item ID -// lParam: 0 -// Returns: hotkey assigned, 0 otherwise. -#define MS_HKS_GET_HOTKEY HKS_SERVICE_NAME "/GetAssignedHotkey" - -// Unassign hotkey from item. Only valid on action and macro items. -// wParam: item ID -// lParam: 0 -// Returns: 0 on success, other on fail -#define MS_HKS_UNASSIGN_HOTKEY HKS_SERVICE_NAME "/UnassignHotkey" - -// Enable/Disable item. -// If item is group or module, then all subItems will be affected. -// wParam: item ID -// lParam: 1 to enable, anything else to disable -// Returns: 0 on success, other on fail -#define MS_HKS_ENABLE_ITEM HKS_SERVICE_NAME "/EnableItem" - -// Hotkey to text -// wParam: hotkey to textify -// lParam: address to place string, space must be allocated -// Returns: 0 -#define MS_HKS_TO_TEXT HKS_SERVICE_NAME "/HotkeyToText" - -// Get hotkey from text -// wParam: text to convert to hotkey -// lParam: 0 -// Returns: hotkey -#define MS_HKS_FROM_TEXT HKS_SERVICE_NAME "/HotkeyFromText" - - -typedef struct -{ - int itemId; - int moduleId; - char *name; - int itemType; - THKSHotkey hotkey; - -} THKSEvent, *PHKSEvent; - -// Event when hotkey is pressed -// wParam: PHKSEvent -// lParam: 0 -#define ME_HKS_KEY_PRESSED HKS_SERVICE_NAME "/HotkeyPressed" - - - - -// Util functions //////////////////////////////////////////////////////////////////////// - - -__inline static int HKS_RegisterModule(char *name) -{ - THKSItem item = {0}; - - if (!ServiceExists(MS_HKS_REGISTER_ITEM)) - return -1; - - item.name = name; - item.itemType = HKS_ITEM_MODULE; - - return LOWORD(CallService(MS_HKS_REGISTER_ITEM, (WPARAM) &item, 0)); -} - - -__inline static int HKS_RegisterAction(int owner, char *name, int modifiers, char key, int flags) -{ - THKSItem item = {0}; - - if (!ServiceExists(MS_HKS_REGISTER_ITEM)) - return -1; - - item.owner = owner; - item.name = name; - item.itemType = HKS_ITEM_ACTION; - item.flags = flags; - - if(key != 0) - { - item.hotkey.key = (WORD) key; - item.hotkey.modifiers = (WORD)modifiers; - } - - return LOWORD(CallService(MS_HKS_REGISTER_ITEM, (WPARAM) &item, 0)); -} - - -__inline static int HKS_RegisterGroup(int owner, char *name, int modifiers, int flags) -{ - THKSItem item = {0}; - - if (!ServiceExists(MS_HKS_REGISTER_ITEM)) - return -1; - - item.owner = owner; - item.name = name; - item.itemType = HKS_ITEM_GROUP; - item.flags = flags; - item.hotkey.modifiers = (WORD)modifiers; - - return LOWORD(CallService(MS_HKS_REGISTER_ITEM, (WPARAM) &item, 0)); -} - -__inline static int HKS_Unregister(int id) -{ - if (!ServiceExists(MS_HKS_UNREGISTER_ITEM)) - return -1; - - return CallService(MS_HKS_UNREGISTER_ITEM, (WPARAM) id, 0); -} - - -#endif diff --git a/plugins/ExternalAPI/m_langman.inc b/plugins/ExternalAPI/m_langman.inc deleted file mode 100644 index dce69e38e6..0000000000 --- a/plugins/ExternalAPI/m_langman.inc +++ /dev/null @@ -1,48 +0,0 @@ -{ - -'Language Pack Manager'-Plugin for -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2005-2007 H. Herkenrath - -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 (LangMan-License.txt); if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -} - -{$ifndef M_LANGMAN_H} -{$define M_LANGMAN_H} - -const - -{ - Language Pack Manager v1.0.2.2 - If you have any question or extension whishes please let me know: - hrathh at users.sourceforge.net -} - -{ interface id } -MIID_LANGMAN: TGUID = '{D80370D5-4B1E-46a8-ACA4-1FAAD79B7D1E}'; - -{ Show the download language dialog. v1.0.2.0+ - wParam : 0 - lParam : 0 -The dialog can't have a parent due to it's asynchronous nature. -If the language window is already opened it will be -brought to front instead (returns success). -Returns 0 on success, nonzero otherwise. -} -MS_LANGMAN_SHOWLANGDIALOG = 'LangMan/ShowLangDialog'; - - -{$endif} // M_LANGMAN_H -- cgit v1.2.3