From 2cf824fd2efaec5fa0125fdde5fd513dd906d844 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 25 Sep 2013 19:25:38 +0000 Subject: plugins cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6233 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/src/alarm_win.cpp | 18 +-- plugins/Alarms/src/alarm_win.h | 1 - plugins/Alarms/src/options.cpp | 6 - plugins/AutoShutdown/shutdown_10.vcxproj | 8 +- plugins/AutoShutdown/shutdown_11.vcxproj | 8 +- plugins/AutoShutdown/src/common.h | 2 + plugins/AutoShutdown/src/shutdownsvc.cpp | 121 +++++++--------- plugins/BossKeyPlus/BossKey_10.vcxproj | 7 +- plugins/BossKeyPlus/BossKey_11.vcxproj | 4 + plugins/BossKeyPlus/src/BossKey.cpp | 22 +-- plugins/BossKeyPlus/src/BossKey.h | 3 +- plugins/BossKeyPlus/src/Options.cpp | 5 - plugins/Clist_blind/src/cluiopts.cpp | 7 +- plugins/Clist_blind/src/init.cpp | 5 - .../Clist_modern/src/hdr/modern_global_structure.h | 1 - plugins/Clist_modern/src/modern_aniavatars.cpp | 8 +- plugins/Clist_modern/src/modern_cachefuncs.cpp | 35 +---- plugins/Clist_modern/src/modern_clcopts.cpp | 2 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 57 -------- plugins/Clist_modern/src/modern_clistopts.cpp | 6 +- plugins/Clist_modern/src/modern_gdiplus.cpp | 19 +-- plugins/Clist_modern/src/modern_skinengine.cpp | 67 +-------- plugins/Clist_modern/src/modern_skinopt.cpp | 27 +--- plugins/Clist_mw/src/clui.cpp | 13 +- plugins/Clist_mw/src/cluiopts.cpp | 3 +- plugins/NotesAndReminders/src/main.cpp | 26 ---- plugins/NotesAndReminders/src/miscutils.cpp | 5 - plugins/NotesAndReminders/src/miscutils.h | 5 - plugins/NotesAndReminders/src/notes.cpp | 8 +- plugins/NotesAndReminders/src/options.cpp | 4 - plugins/NotesAndReminders/src/reminders.cpp | 161 --------------------- plugins/Ping/ping_10.vcxproj | 8 +- plugins/Ping/ping_11.vcxproj | 8 +- plugins/Ping/src/common.h | 1 + plugins/Ping/src/icmp.cpp | 45 +----- plugins/Ping/src/icmp.h | 10 -- plugins/Ping/src/pingthread.cpp | 37 ++--- 37 files changed, 125 insertions(+), 648 deletions(-) (limited to 'plugins') diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index b46758cbc1..67f8c38958 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -6,10 +6,6 @@ #define SPEACH_REPEAT_PERIOD 15000 // milliseconds HANDLE hAlarmWindowList = 0; -HMODULE hUserDll; -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD) = 0; -BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags) = 0; - FontIDT title_font_id, window_font_id; ColourIDT bk_colour_id; HFONT hTitleFont = 0, hWindowFont = 0; @@ -33,11 +29,6 @@ void SetAlarmWinOptions() WindowList_Broadcast(hAlarmWindowList, WMU_SETOPT, IDC_SNOOZE, 0); } -bool TransparencyEnabled() -{ - return MySetLayeredWindowAttributes != 0; -} - INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch ( msg ) { @@ -146,8 +137,7 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) | WS_EX_LAYERED); #endif #ifdef LWA_ALPHA - if (MySetLayeredWindowAttributes) - MySetLayeredWindowAttributes(hwndDlg, RGB(0,0,0), (int)((100 - opt->aw_trans) / 100.0 * 255), LWA_ALPHA); + SetLayeredWindowAttributes(hwndDlg, RGB(0,0,0), (int)((100 - opt->aw_trans) / 100.0 * 255), LWA_ALPHA); #endif } return TRUE; @@ -413,10 +403,6 @@ int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam) void InitAlarmWin() { - hUserDll = LoadLibrary(_T("user32.dll")); - if (hUserDll) - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - hAlarmWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); HookEvent(ME_SYSTEM_MODULESLOADED, AlarmWinModulesLoaded); @@ -426,8 +412,6 @@ void DeinitAlarmWin() { WindowList_Broadcast(hAlarmWindowList, WM_COMMAND, IDC_SNOOZE, 0); - FreeLibrary(hUserDll); - if (hBackgroundBrush) DeleteObject(hBackgroundBrush); if (hTitleFont) DeleteObject(hTitleFont); if (hWindowFont) DeleteObject(hWindowFont); diff --git a/plugins/Alarms/src/alarm_win.h b/plugins/Alarms/src/alarm_win.h index 19576050c6..5a73de86dd 100644 --- a/plugins/Alarms/src/alarm_win.h +++ b/plugins/Alarms/src/alarm_win.h @@ -14,7 +14,6 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar extern HANDLE hAlarmWindowList; void SetAlarmWinOptions(); -bool TransparencyEnabled(); void InitAlarmWin(); void DeinitAlarmWin(); diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index c16c8c118b..68657c65f7 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -888,12 +888,6 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 0)); SendMessage(GetDlgItem(hwndDlg, IDC_SPIN_TRANS), UDM_SETPOS, 0, temp_options.aw_trans); - if (!TransparencyEnabled()) { - HWND hw = GetDlgItem(hwndDlg, IDC_SPIN_TRANS); - EnableWindow(hw, FALSE); - hw = GetDlgItem(hwndDlg, IDC_ED_TRANS); - EnableWindow(hw, FALSE); - } } CheckDlgButton(hwndDlg, IDC_SHOWHIDE, temp_options.auto_showhide ? TRUE : FALSE); diff --git a/plugins/AutoShutdown/shutdown_10.vcxproj b/plugins/AutoShutdown/shutdown_10.vcxproj index 1518ed9509..e322560bb8 100644 --- a/plugins/AutoShutdown/shutdown_10.vcxproj +++ b/plugins/AutoShutdown/shutdown_10.vcxproj @@ -94,7 +94,7 @@ Windows $(IntDir)$(TargetName).lib 0x11070000 - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) false $(ProfileDir)..\..\bin10\lib @@ -122,7 +122,7 @@ Windows $(IntDir)$(TargetName).lib 0x11070000 - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) false $(ProfileDir)..\..\bin10\lib @@ -155,7 +155,7 @@ true false $(ProfileDir)..\..\bin10\lib - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) /PDBALTPATH:%_PDB% @@ -183,7 +183,7 @@ Windows $(IntDir)$(TargetName).lib 0x11070000 - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) true true false diff --git a/plugins/AutoShutdown/shutdown_11.vcxproj b/plugins/AutoShutdown/shutdown_11.vcxproj index 71b22a5bd5..d1a11007de 100644 --- a/plugins/AutoShutdown/shutdown_11.vcxproj +++ b/plugins/AutoShutdown/shutdown_11.vcxproj @@ -98,7 +98,7 @@ Windows $(IntDir)$(TargetName).lib 0x11070000 - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) false $(ProfileDir)..\..\bin11\lib false @@ -127,7 +127,7 @@ Windows $(IntDir)$(TargetName).lib 0x11070000 - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) false $(ProfileDir)..\..\bin11\lib @@ -160,7 +160,7 @@ true false $(ProfileDir)..\..\bin11\lib - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) @@ -187,7 +187,7 @@ Windows $(IntDir)$(TargetName).lib 0x11070000 - comctl32.lib;UxTheme.lib;Shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;UxTheme.lib;Shlwapi.lib;PowrProf.lib;Rasapi32.lib;%(AdditionalDependencies) true true false diff --git a/plugins/AutoShutdown/src/common.h b/plugins/AutoShutdown/src/common.h index 2eae1b9bab..7a59d8961f 100644 --- a/plugins/AutoShutdown/src/common.h +++ b/plugins/AutoShutdown/src/common.h @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include +#include /* WinXP+: shutdown reason codes */ #if defined(EWX_RESTARTAPPS) /* new MS Platform SDK */ diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index fb351ebef5..f9fe70fb56 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -73,14 +73,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) switch(shutdownType) { case SDSDT_HIBERNATE: case SDSDT_STANDBY: - { HMODULE hPowerDLL=LoadLibraryA("POWRPROF"); /* all ascii */ - if (hPowerDLL != NULL) { - BOOLEAN (STDAPICALLTYPE *pfnIsPwrModeAllowed)(void); - *(PROC*)&pfnIsPwrModeAllowed=GetProcAddress(hPowerDLL,(shutdownType==SDSDT_HIBERNATE)?"IsPwrHibernateAllowed":"IsPwrSuspendAllowed"); - if (pfnIsPwrModeAllowed) bReturn=pfnIsPwrModeAllowed() != 0; - FreeLibrary(hPowerDLL); - } - } + bReturn = shutdownType == SDSDT_HIBERNATE ? IsPwrHibernateAllowed() : IsPwrSuspendAllowed() != 0; /* test privilege */ if (bReturn) { bReturn=WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE); @@ -117,7 +110,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) break; case SDSDT_CLOSERASCONNECTIONS: /* check if RAS installed/available */ - bReturn=SearchPath(NULL,_T("RASAPI32"),_T(".DLL"),0,NULL,NULL) != 0; + bReturn = TRUE; break; case SDSDT_SETMIRANDAOFFLINE: case SDSDT_CLOSEMIRANDA: @@ -180,74 +173,60 @@ static DWORD ShutdownNow(BYTE shutdownType) ShutdownNow(SDSDT_SETMIRANDAOFFLINE); /* set Miranda offline */ /* hang up all ras connections */ { - HMODULE hRasApiDLL=LoadLibrary(_T("RASAPI32")); /* all ascii */ - if (hRasApiDLL != NULL) { - DWORD (APIENTRY *pfnRasEnumConnections)(RASCONN*,DWORD*,DWORD*); - DWORD (APIENTRY *pfnRasHangUp)(HRASCONN); - DWORD (APIENTRY *pfnRasGetConnectStatus)(HRASCONN,RASCONNSTATUS*); - *(PROC*)&pfnRasEnumConnections=GetProcAddress(hRasApiDLL,"RasEnumConnectionsW"); - *(PROC*)&pfnRasHangUp=GetProcAddress(hRasApiDLL,"RasHangUpW"); - *(PROC*)&pfnRasGetConnectStatus=GetProcAddress(hRasApiDLL,"RasGetConnectStatusW"); - if (pfnRasEnumConnections && pfnRasGetConnectStatus && pfnRasHangUp) { - RASCONN *paConn; - RASCONN *paConnBuf; - DWORD dwConnSize,dwConnItems,dwRetries; - RASCONNSTATUS rcs; - DWORD dw,dwLastTickCount; - - dwConnSize=sizeof(RASCONN); - dwConnItems=0; - paConn=(RASCONN*)mir_alloc(dwConnSize); - dwErrCode=ERROR_NOT_ENOUGH_MEMORY; - if (paConn != NULL) { - for(dwRetries=5; dwRetries != 0; dwRetries--) { /* prevent infinite loop (rare) */ - ZeroMemory(paConn, dwConnSize); - paConn[0].dwSize = sizeof(RASCONN); - dwErrCode = pfnRasEnumConnections(paConn,&dwConnSize,&dwConnItems); - if (dwErrCode != ERROR_BUFFER_TOO_SMALL) break; - paConnBuf=(RASCONN*)mir_realloc(paConn,dwConnSize); - if (paConnBuf != NULL) { - mir_free(paConn); - paConn = NULL; - dwErrCode = ERROR_NOT_ENOUGH_MEMORY; - break; - } - paConn=paConnBuf; + RASCONN *paConn; + RASCONN *paConnBuf; + DWORD dwConnSize,dwConnItems,dwRetries; + RASCONNSTATUS rcs; + DWORD dw,dwLastTickCount; + + dwConnSize=sizeof(RASCONN); + dwConnItems=0; + paConn=(RASCONN*)mir_alloc(dwConnSize); + dwErrCode=ERROR_NOT_ENOUGH_MEMORY; + if (paConn != NULL) { + for(dwRetries=5; dwRetries != 0; dwRetries--) { /* prevent infinite loop (rare) */ + ZeroMemory(paConn, dwConnSize); + paConn[0].dwSize = sizeof(RASCONN); + dwErrCode = RasEnumConnections(paConn, &dwConnSize, &dwConnItems); + if (dwErrCode != ERROR_BUFFER_TOO_SMALL) break; + paConnBuf=(RASCONN*)mir_realloc(paConn,dwConnSize); + if (paConnBuf != NULL) { + mir_free(paConn); + paConn = NULL; + dwErrCode = ERROR_NOT_ENOUGH_MEMORY; + break; + } + paConn=paConnBuf; + } + if (dwErrCode==ERROR_SUCCESS || dwErrCode==ERROR_BUFFER_TOO_SMALL) { + for(dw=0;dw3000) - break; /* wraparound works */ - } - } + else { + dwErrCode = RasHangUp(paConn[dw].hrasconn); + if (!dwErrCode) paConn[dw].hrasconn=NULL; /* do not wait for on error */ + } + } + /* RAS does not allow to quit directly after HangUp (see docs) */ + dwLastTickCount = GetTickCount(); + ZeroMemory(&rcs,sizeof(RASCONNSTATUS)); + rcs.dwSize = sizeof(RASCONNSTATUS); + for(dw=0; dw < dwConnItems; ++dw) { + if (paConn[dw].hrasconn != NULL) { + while(RasGetConnectStatus(paConn[dw].hrasconn, &rcs) != ERROR_INVALID_HANDLE) { + Sleep(0); /* give rest of time silce to other threads with equal priority */ + /* infinite loop protection (3000ms defined in docs) */ + dwRetries = GetTickCount(); + if (dwRetries - dwLastTickCount>3000) + break; /* wraparound works */ } } - mir_free(paConn); /* does NULL check */ } } - else dwErrCode = GetLastError(); - FreeLibrary(hRasApiDLL); + mir_free(paConn); /* does NULL check */ } - else dwErrCode = GetLastError(); } /* set Miranda to offline again, to remain offline with reconnection plugins */ ShutdownNow(SDSDT_SETMIRANDAOFFLINE); diff --git a/plugins/BossKeyPlus/BossKey_10.vcxproj b/plugins/BossKeyPlus/BossKey_10.vcxproj index 50397d9cdd..c82baffb05 100644 --- a/plugins/BossKeyPlus/BossKey_10.vcxproj +++ b/plugins/BossKeyPlus/BossKey_10.vcxproj @@ -96,6 +96,7 @@ Windows $(ProfileDir)..\..\bin10\lib /PDBALTPATH:%_PDB% + Wtsapi32.lib;%(AdditionalDependencies) @@ -122,6 +123,7 @@ Windows 0x32270000 $(ProfileDir)..\..\bin10\lib + Wtsapi32.lib;%(AdditionalDependencies) @@ -151,6 +153,7 @@ Windows $(ProfileDir)..\..\bin10\lib /PDBALTPATH:%_PDB% + Wtsapi32.lib;%(AdditionalDependencies) @@ -176,6 +179,7 @@ 0x32270000 Windows $(ProfileDir)..\..\bin10\lib + Wtsapi32.lib;%(AdditionalDependencies) @@ -195,9 +199,6 @@ - - - diff --git a/plugins/BossKeyPlus/BossKey_11.vcxproj b/plugins/BossKeyPlus/BossKey_11.vcxproj index cfd3780b77..6c551894b9 100644 --- a/plugins/BossKeyPlus/BossKey_11.vcxproj +++ b/plugins/BossKeyPlus/BossKey_11.vcxproj @@ -99,6 +99,7 @@ true Windows $(ProfileDir)..\..\bin11\lib + Wtsapi32.lib;%(AdditionalDependencies) @@ -126,6 +127,7 @@ 0x32270000 $(ProfileDir)..\..\bin11\lib false + Wtsapi32.lib;%(AdditionalDependencies) @@ -154,6 +156,7 @@ true Windows $(ProfileDir)..\..\bin11\lib + Wtsapi32.lib;%(AdditionalDependencies) @@ -179,6 +182,7 @@ 0x32270000 Windows $(ProfileDir)..\..\bin11\lib + Wtsapi32.lib;%(AdditionalDependencies) diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 9018cafb88..98d8068c78 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -36,7 +36,7 @@ HANDLE g_hHideService, g_hIsHiddenService; HWINEVENTHOOK g_hWinHook; HWND g_hListenWindow, hDlg, g_hDlgPass, hOldForegroundWindow; HWND_ITEM *g_pMirWnds; // a pretty simple linked list -HMODULE hWTS, hDwmApi; +HMODULE hDwmApi; DWORD g_dwMirandaPID; WORD g_wMask, g_wMaskAdv; bool g_bWindowHidden, g_fKeyPressed, g_fPassRequested, g_TrayIcon; @@ -49,8 +49,6 @@ TCHAR **oldStatusMsg; BYTE g_bOldSetting; int hLangpack; -PWTSRegisterSessionNotification wtsRegisterSessionNotification ; -PWTSUnRegisterSessionNotification wtsUnRegisterSessionNotification; PFNDwmIsCompositionEnabled dwmIsCompositionEnabled; void LanguageChanged(HWND hDlg); @@ -715,19 +713,8 @@ int MirandaLoaded(WPARAM,LPARAM) if (RegisterClass(&winclass)) { - hWTS = LoadLibrary(_T("wtsapi32.dll")); - g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO,BOSSKEY_LISTEN_INFO,WS_POPUP,0,0,5,5,pcli->hwndContactList,NULL,g_hInstance,NULL); - - if (hWTS) - { - wtsRegisterSessionNotification = (PWTSRegisterSessionNotification)GetProcAddress(hWTS, "WTSRegisterSessionNotification"); - if (wtsRegisterSessionNotification) - { - wtsUnRegisterSessionNotification = (PWTSUnRegisterSessionNotification)GetProcAddress(hWTS, "WTSUnRegisterSessionNotification"); - wtsRegisterSessionNotification(g_hListenWindow, 0); - } - } + WTSRegisterSessionNotification(g_hListenWindow, 0); } if (IsWinVerVistaPlus()) @@ -809,13 +796,10 @@ extern "C" int __declspec(dllexport) Unload(void) if (g_hListenWindow) { - if (wtsUnRegisterSessionNotification) - wtsUnRegisterSessionNotification(g_hListenWindow); + WTSUnRegisterSessionNotification(g_hListenWindow); DestroyWindow(g_hListenWindow); } - if (hWTS) - FreeLibrary(hWTS); if (hDwmApi) FreeLibrary(hDwmApi); diff --git a/plugins/BossKeyPlus/src/BossKey.h b/plugins/BossKeyPlus/src/BossKey.h index 71330e6037..2198c35bd7 100644 --- a/plugins/BossKeyPlus/src/BossKey.h +++ b/plugins/BossKeyPlus/src/BossKey.h @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -109,6 +110,4 @@ typedef struct HWND_ITEM_TYPE HWND_ITEM_TYPE *next; } HWND_ITEM; -typedef BOOL (WINAPI *PWTSRegisterSessionNotification)(HWND hWnd, DWORD dwFlags); -typedef BOOL (WINAPI *PWTSUnRegisterSessionNotification)(HWND hWnd); typedef HRESULT (WINAPI *PFNDwmIsCompositionEnabled)(BOOL *); diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index c9be056eb2..95046f8922 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -50,11 +50,6 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) g_fOptionsOpen = true; s_fRedraw = false; - extern PWTSRegisterSessionNotification wtsRegisterSessionNotification; - - if (wtsRegisterSessionNotification == 0) - EnableWindow(GetDlgItem(hwndDlg, IDC_MAINOPT_HIDEIFLOCK), SW_HIDE); - // set icon and tooltip for variables help button variables_skin_helpbutton(hwndDlg, IDC_MAINOPT_VARHELP); diff --git a/plugins/Clist_blind/src/cluiopts.cpp b/plugins/Clist_blind/src/cluiopts.cpp index afc07d3802..5ba32173d9 100644 --- a/plugins/Clist_blind/src/cluiopts.cpp +++ b/plugins/Clist_blind/src/cluiopts.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "commonheaders.h" -extern BOOL(WINAPI * MySetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); - static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -212,10 +210,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - if (MySetLayeredWindowAttributes) - MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), - (BYTE) db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), - LWA_ALPHA); + SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } else SetWindowLong(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLong(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index dd43fb674c..7e32786bcf 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -28,8 +28,6 @@ HINSTANCE g_hInst = 0; CLIST_INTERFACE* pcli = NULL; HIMAGELIST himlCListClc = NULL; -BOOL(WINAPI * MySetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD) = NULL; - LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); void RebuildEntireList(HWND hwnd, ClcData *dat); @@ -158,9 +156,6 @@ extern "C" int __declspec(dllexport) CListInitialise() pcli->hInst = g_hInst; pcli->pfnPaintClc = PaintClc; - MySetLayeredWindowAttributes = (BOOL(WINAPI *) (HWND, COLORREF, BYTE, DWORD)) GetProcAddress( - LoadLibraryA("user32.dll"), "SetLayeredWindowAttributes"); - CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/plugins/Clist_modern/src/hdr/modern_global_structure.h b/plugins/Clist_modern/src/hdr/modern_global_structure.h index 09036459ec..b8742177a0 100644 --- a/plugins/Clist_modern/src/hdr/modern_global_structure.h +++ b/plugins/Clist_modern/src/hdr/modern_global_structure.h @@ -41,7 +41,6 @@ typedef struct tagCLUIDATA BOOL fSmoothAnimation; BOOL fLayered; BOOL fDocked; - BOOL fGDIPlusFail; BOOL fSortNoOfflineBottom; BOOL fAutoSize; BOOL fAeroGlass; diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index b54eed3821..093f0852e6 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -211,10 +211,7 @@ static void _AniAva_AnimationTreadProc(void*) // Init AniAva module int AniAva_InitModule() { - if (g_CluiData.fGDIPlusFail) - return 0; - - if ( !(db_get_b(NULL,"CList","AvatarsAnimated",( ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) && + if ( !(db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) && db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT))) return 0; @@ -269,8 +266,7 @@ int AniAva_UnloadModule() int AniAva_UpdateOptions() { BOOL bReloadAvatars = FALSE; - BOOL bBeEnabled = (!g_CluiData.fGDIPlusFail && - db_get_b(NULL,"CList","AvatarsAnimated",( ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) && + BOOL bBeEnabled = (db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) && db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)); if (bBeEnabled && !s_bModuleStarted) { AniAva_InitModule(); diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 48f44932c6..e9ae405c35 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -778,40 +778,7 @@ void Cache_ProceedAvatarInList(ClcData *dat, ClcContact *contact) int w = width_clip; int h = height_clip; - if ( !g_CluiData.fGDIPlusFail) //Use gdi+ engine - DrawAvatarImageWithGDIp(hdc, 0, 0, w, h,ace->hbmPic, 0, 0, ace->bmWidth,ace->bmHeight,ace->dwFlags,255); - else { - if ( !(ace->dwFlags & AVS_PREMULTIPLIED)) { - HDC hdcTmp = CreateCompatibleDC(hdc); - RECT r = {0, 0, w,h}; - HDC hdcTmp2 = CreateCompatibleDC(hdc); - HBITMAP bmo = (HBITMAP)SelectObject(hdcTmp,ace->hbmPic); - HBITMAP b2 = ske_CreateDIB32(w,h); - HBITMAP bmo2 = (HBITMAP)SelectObject(hdcTmp2,b2); - SetStretchBltMode(hdcTmp, HALFTONE); - SetStretchBltMode(hdcTmp2, HALFTONE); - StretchBlt(hdcTmp2, 0, 0, w, h, - hdcTmp, 0, 0, ace->bmWidth, ace->bmHeight, - SRCCOPY); - - ske_SetRectOpaque(hdcTmp2,&r); - BitBlt(hdc, rc.left, rc.top, w, h,hdcTmp2, 0, 0, SRCCOPY); - SelectObject(hdcTmp2,bmo2); - SelectObject(hdcTmp,bmo); - DeleteDC(hdcTmp); - DeleteDC(hdcTmp2); - DeleteObject(b2); - } - else { - BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - HDC hdcTempAv = CreateCompatibleDC(hdc); - HBITMAP hbmTempAvOld; - hbmTempAvOld = (HBITMAP)SelectObject(hdcTempAv,ace->hbmPic); - ske_AlphaBlend(hdc, rc.left, rc.top, w, h, hdcTempAv, 0, 0, ace->bmWidth,ace->bmHeight, bf); - SelectObject(hdcTempAv, hbmTempAvOld); - DeleteDC(hdcTempAv); - } - } + DrawAvatarImageWithGDIp(hdc, 0, 0, w, h,ace->hbmPic, 0, 0, ace->bmWidth,ace->bmHeight,ace->dwFlags,255); } SelectObject(hdc,oldBmp); DeleteDC(hdc); diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 916d7d7839..77e12e9bf3 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -845,7 +845,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL,"CList","DisableTrayFlash",SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); - CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",( ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) == 1 ? BST_CHECKED : BST_UNCHECKED ); if (IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)) { EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 7ae0f488bc..50392aba60 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1406,66 +1406,9 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact // Draw avatar if ( dat->use_avatar_service ) - /*if ( ServiceExists( MS_AV_BLENDDRAWAVATAR )) - { - AVATARDRAWREQUEST adr; - - adr.cbSize = sizeof( AVATARDRAWREQUEST ); - adr.hContact = Drawing->hContact; - adr.hTargetDC = hdcMem; - adr.rcDraw = p_rect; - adr.dwFlags = ( dat->avatars_draw_border ? AVDRQ_DRAWBORDER : 0 ) | - ( dat->avatars_round_corners ? AVDRQ_ROUNDEDCORNER : 0 ) | - AVDRQ_HIDEBORDERONTRANSPARENCY; - adr.clrBorder = dat->avatars_border_color; - adr.radius = round_radius; - adr.alpha = blendmode; - - CallService(MS_AV_DRAWAVATAR, 0, (LPARAM) &adr ); - } - else - */ { int w = width; int h = height; -/* if ( !g_CluiData.fGDIPlusFail ) //Use gdi+ engine - { - DrawAvatarImageWithGDIp( hdcMem, p_rect.left, p_rect.top, w, h, Drawing->avatar_data->hbmPic, 0, 0, Drawing->avatar_data->bmWidth, Drawing->avatar_data->bmHeight, Drawing->avatar_data->dwFlags, blendmode ); - } - else - { - if ( !( Drawing->avatar_data->dwFlags&AVS_PREMULTIPLIED )) - { - HDC hdcTmp = CreateCompatibleDC( hdcMem ); - RECT r = {0, 0, w, h}; - HDC hdcTmp2 = CreateCompatibleDC( hdcMem ); - HBITMAP bmo = ( HBITMAP )SelectObject( hdcTmp, Drawing->avatar_data->hbmPic ); - HBITMAP b2 = ske_CreateDIB32( w, h ); - HBITMAP bmo2 = ( HBITMAP )SelectObject( hdcTmp2, b2 ); - SetStretchBltMode( hdcTmp, HALFTONE ); - SetStretchBltMode( hdcTmp2, HALFTONE ); - StretchBlt( hdcTmp2, 0, 0, w, h, - hdcTmp, 0, 0, Drawing->avatar_data->bmWidth, Drawing->avatar_data->bmHeight, - SRCCOPY ); - - ske_SetRectOpaque( hdcTmp2, &r ); - BitBlt( hdcMem, p_rect.left, p_rect.top, w, h, hdcTmp2, 0, 0, SRCCOPY ); - SelectObject( hdcTmp2, bmo2 ); - SelectObject( hdcTmp, bmo ); - DeleteDC( hdcTmp ); - DeleteDC( hdcTmp2 ); - DeleteObject( b2 ); - } - else { - BLENDFUNCTION bf = {AC_SRC_OVER, 0, blendmode, AC_SRC_ALPHA }; - HDC hdcTempAv = CreateCompatibleDC( hdcMem ); - HBITMAP hbmTempAvOld; - hbmTempAvOld = ( HBITMAP )SelectObject( hdcTempAv, Drawing->avatar_data->hbmPic ); - ske_AlphaBlend( hdcMem, p_rect.left, p_rect.top, w, h, hdcTempAv, 0, 0, Drawing->avatar_data->bmWidth, Drawing->avatar_data->bmHeight, bf ); - SelectObject( hdcTempAv, hbmTempAvOld ); - DeleteDC( hdcTempAv ); - } - }*/ _DrawContactAvatar( hdcMem, dat, Drawing, &row_rc, selected, hottrack, p_rect, &p_rect ); } else diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp index 6b234ee068..04d6a8397b 100644 --- a/plugins/Clist_modern/src/modern_clistopts.cpp +++ b/plugins/Clist_modern/src/modern_clistopts.cpp @@ -241,7 +241,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); - CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",( ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) == 1 ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(NULL,"CList","AvatarsInSeparateWnd",SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); @@ -323,7 +323,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_OVERLAY_ICON_CONTACT),FALSE); } - if ( !ServiceExists(MS_AV_GETAVATARBITMAP) || g_CluiData.fGDIPlusFail) { + if ( !ServiceExists(MS_AV_GETAVATARBITMAP)) { EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ANIAVATARS),FALSE); SetDlgItemText(hwndDlg, IDC_SHOW_ANIAVATARS, TranslateT("Animate Avatars (GDI+ and Avatar Service module (avs.dll) are required)")); } @@ -347,7 +347,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_SIZE_SPIN),enabled); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_SIZE_PIXELS2),enabled); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_SIZE_PIXELS3),enabled); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ANIAVATARS),enabled && ( ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ANIAVATARS), enabled && ServiceExists(MS_AV_GETAVATARBITMAP)); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_WIDTH),enabled); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_WIDTH_SPIN),enabled); diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp index 972105cfb1..f4241b4778 100644 --- a/plugins/Clist_modern/src/modern_gdiplus.cpp +++ b/plugins/Clist_modern/src/modern_gdiplus.cpp @@ -22,26 +22,15 @@ int g_hottrack; void InitGdiPlus(void) { GdiplusStartupInput gdiplusStartupInput; - g_CluiData.fGDIPlusFail = false; - __try { - if (g_gdiplusToken == 0) - GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL); - } - __except ( EXCEPTION_EXECUTE_HANDLER ) { - g_CluiData.fGDIPlusFail = true; - } + if (g_gdiplusToken == 0) + GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL); } void ShutdownGdiPlus(void) { GdiplusStartupInput gdiplusStartupInput; - __try { - if (g_gdiplusToken) - GdiplusShutdown(g_gdiplusToken); - } - __except ( EXCEPTION_EXECUTE_HANDLER ) { - g_CluiData.fGDIPlusFail = true; - } + if (g_gdiplusToken) + GdiplusShutdown(g_gdiplusToken); g_gdiplusToken = 0; } diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 960b5293a4..cfe4f3e1a5 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -92,24 +92,6 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM lParam); static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam); static INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM lParam); -//Decoders -static HMODULE hImageDecoderModule; - -typedef DWORD (__stdcall *pfnImgNewDecoder)(void ** ppDecoder); -static pfnImgNewDecoder ImgNewDecoder; - -typedef DWORD (__stdcall *pfnImgDeleteDecoder)(void * pDecoder); -static pfnImgDeleteDecoder ImgDeleteDecoder; - -typedef DWORD (__stdcall *pfnImgNewDIBFromFile)(LPVOID /*in*/pDecoder, LPCSTR /*in*/pFileName, LPVOID /*out*/*pImg); -static pfnImgNewDIBFromFile ImgNewDIBFromFile; - -typedef DWORD (__stdcall *pfnImgDeleteDIBSection)(LPVOID /*in*/pImg); -static pfnImgDeleteDIBSection ImgDeleteDIBSection; - -typedef DWORD (__stdcall *pfnImgGetHandle)(LPVOID /*in*/pImg, HBITMAP /*out*/*pBitmap, LPVOID /*out*/*ppDIBBits); -static pfnImgGetHandle ImgGetHandle; - static MODERNEFFECT meCurrentEffect = {-1,{0}, 0, 0}; @@ -428,36 +410,6 @@ HRESULT SkinEngineLoadModule() // Initialize GDI+ InitGdiPlus(); AniAva_InitModule(); - //load decoder - hImageDecoderModule = NULL; - if (g_CluiData.fGDIPlusFail) - { - hImageDecoderModule = LoadLibrary(_T("ImgDecoder.dll")); - if (hImageDecoderModule == NULL) - { - char tDllPath[ MAX_PATH ]; - GetModuleFileNameA( g_hInst, tDllPath, sizeof( tDllPath )); - { - char* p = strrchr( tDllPath, '\\' ); - if ( p != NULL ) - strcpy( p+1, "ImgDecoder.dll"); - else - { - strcpy( tDllPath, "ImgDecoder.dll"); - } - } - - hImageDecoderModule = LoadLibraryA(tDllPath); - } - if (hImageDecoderModule != NULL) - { - ImgNewDecoder = (pfnImgNewDecoder )GetProcAddress( hImageDecoderModule, "ImgNewDecoder"); - ImgDeleteDecoder = (pfnImgDeleteDecoder )GetProcAddress( hImageDecoderModule, "ImgDeleteDecoder"); - ImgNewDIBFromFile = (pfnImgNewDIBFromFile)GetProcAddress( hImageDecoderModule, "ImgNewDIBFromFile"); - ImgDeleteDIBSection = (pfnImgDeleteDIBSection)GetProcAddress( hImageDecoderModule, "ImgDeleteDIBSection"); - ImgGetHandle = (pfnImgGetHandle)GetProcAddress( hImageDecoderModule, "ImgGetHandle"); - } - } //create services CreateServiceFunction(MS_SKIN_DRAWGLYPH,ske_Service_DrawGlyph); CreateServiceFunction(MS_SKINENG_UPTATEFRAMEIMAGE,ske_Service_UpdateFrameImage); @@ -506,7 +458,6 @@ int SkinEngineUnloadModule() DeleteCriticalSection(&cs_SkinChanging); GdiFlush(); DestroyHookableEvent(g_CluiData.hEventSkinServicesCreated); - if (hImageDecoderModule) FreeLibrary(hImageDecoderModule); AniAva_UnloadModule(); ShutdownGdiPlus(); //free variables @@ -515,7 +466,7 @@ int SkinEngineUnloadModule() BOOL ske_AlphaBlend(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest,HDC hdcSrc,int nXOriginSrc,int nYOriginSrc,int nWidthSrc,int nHeightSrc,BLENDFUNCTION blendFunction) { - if (g_CluiData.fDisableSkinEngine && !(!g_CluiData.fGDIPlusFail && blendFunction.BlendFlags&128)) + if (g_CluiData.fDisableSkinEngine && !(blendFunction.BlendFlags&128)) { if (nWidthDest != nWidthSrc || nHeightDest != nHeightSrc) return StretchBlt(hdcDest,nXOriginDest,nYOriginDest,nWidthDest,nHeightDest,hdcSrc,nXOriginSrc,nYOriginSrc,nWidthSrc,nHeightSrc, SRCCOPY); @@ -523,7 +474,7 @@ BOOL ske_AlphaBlend(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest return BitBlt(hdcDest,nXOriginDest,nYOriginDest,nWidthDest,nHeightDest,hdcSrc,nXOriginSrc,nYOriginSrc, SRCCOPY); } - if ( !g_CluiData.fGDIPlusFail && blendFunction.BlendFlags&128 ) //Use gdi+ engine + if (blendFunction.BlendFlags&128) //Use gdi+ engine { return GDIPlus_AlphaBlend( hdcDest,nXOriginDest,nYOriginDest,nWidthDest,nHeightDest, hdcSrc,nXOriginSrc,nYOriginSrc,nWidthSrc,nHeightSrc, @@ -1939,9 +1890,7 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) HBITMAP hBitmap = NULL; TCHAR ext[5]; BYTE f = 0; - LPBYTE pBitmapBits; LPVOID pImg = NULL; - LPVOID m_pImgDecoder; BITMAP bmpInfo; { @@ -1960,17 +1909,9 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) GetObject(hBitmap, sizeof(BITMAP), &bmpInfo); f = (bmpInfo.bmBits != NULL); } - else if (hImageDecoderModule == NULL || !mir_bool_tstrcmpi(ext, _T(".png"))) { + else if (!mir_bool_tstrcmpi(ext, _T(".png"))) { hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)tszFileName); } - else { - f = 1; - ImgNewDecoder(&m_pImgDecoder); - if ( !ImgNewDIBFromFile(m_pImgDecoder, _T2A(tszFileName), &pImg)) { - ImgGetHandle(pImg, &hBitmap, (LPVOID *)&pBitmapBits); - ImgDeleteDecoder(m_pImgDecoder); - } - } if (hBitmap) { GetObject(hBitmap, sizeof(BITMAP), &bmpInfo); @@ -1999,7 +1940,7 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) static HBITMAP ske_skinLoadGlyphImage(const TCHAR *tszFileName) { - if ( !g_CluiData.fGDIPlusFail && !wildcmpit(tszFileName, _T("*.tga"))) + if (!wildcmpit(tszFileName, _T("*.tga"))) return GDIPlus_LoadGlyphImage(tszFileName); return ske_LoadGlyphImageByDecoders(tszFileName); diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 5d4003185e..7fb29421e3 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -240,19 +240,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara imgPos.x = workRect.left+(( wWidth-dWidth )>>1 ); imgPos.y = workRect.top+(( wHeight-dHeight )>>1 ); //DrawImage - if ( !g_CluiData.fGDIPlusFail ) //Use gdi+ engine - { - DrawAvatarImageWithGDIp( memDC, imgPos.x, imgPos.y, dWidth, dHeight, hPreviewBitmap, 0, 0, bmp.bmWidth, bmp.bmHeight, 8, 255 ); - } - else - { - BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - HDC imgDC = CreateCompatibleDC( dis->hDC ); - HBITMAP imgOldbmp = (HBITMAP) SelectObject( imgDC, hPreviewBitmap ); - ske_AlphaBlend( memDC, imgPos.x, imgPos.y, dWidth, dHeight, imgDC, 0, 0, bmp.bmWidth, bmp.bmHeight, bf ); - SelectObject( imgDC, imgOldbmp ); - DeleteDC( imgDC ); - } + DrawAvatarImageWithGDIp( memDC, imgPos.x, imgPos.y, dWidth, dHeight, hPreviewBitmap, 0, 0, bmp.bmWidth, bmp.bmHeight, 8, 255 ); } BitBlt( dis->hDC, dis->rcItem.left, dis->rcItem.top, mWidth, mHeight, memDC, 0, 0, SRCCOPY ); SelectObject( memDC, holdbmp ); @@ -553,8 +541,6 @@ INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam) { DRAWITEMSTRUCT *dis = ( DRAWITEMSTRUCT * )wParam; - HDC imgDC; - HBITMAP imgOldbmp; int mWidth, mHeight; RECT workRect = {0}; mWidth = dis->rcItem.right-dis->rcItem.left; @@ -593,16 +579,7 @@ INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam) imgPos.x = workRect.left+(( wWidth-dWidth )>>1 ); imgPos.y = workRect.top+(( wHeight-dHeight )>>1 ); //DrawImage - if ( !g_CluiData.fGDIPlusFail ) //Use gdi+ engine - DrawAvatarImageWithGDIp( dis->hDC, imgPos.x, imgPos.y, dWidth, dHeight, hPreviewBitmap, 0, 0, bmp.bmWidth, bmp.bmHeight, 8, 255 ); - else { - BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - imgDC = CreateCompatibleDC( dis->hDC ); - imgOldbmp = ( HBITMAP )SelectObject( imgDC, hPreviewBitmap ); - ske_AlphaBlend( dis->hDC, imgPos.x, imgPos.y, dWidth, dHeight, imgDC, 0, 0, bmp.bmWidth, bmp.bmHeight, bf ); - SelectObject( imgDC, imgOldbmp ); - DeleteDC( imgDC ); - } + DrawAvatarImageWithGDIp( dis->hDC, imgPos.x, imgPos.y, dWidth, dHeight, hPreviewBitmap, 0, 0, bmp.bmWidth, bmp.bmHeight, 8, 255 ); ske_UnloadGlyphImage(hPreviewBitmap); } } diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index 5476afd190..d04b463c6e 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -28,7 +28,6 @@ extern int DefaultImageListColorDepth; -static HMODULE hUserDll; HMENU hMenuMain; static HANDLE hContactDraggingEvent,hContactDroppedEvent,hContactDragStopEvent; UINT hMsgGetProfile = 0; @@ -58,9 +57,6 @@ int CycleTimeInterval = 2000; int CycleIconCount = 8; int DefaultStep = 100; -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); - int CluiOptInit(WPARAM wParam,LPARAM lParam); int SortList(WPARAM wParam,LPARAM lParam); @@ -476,8 +472,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if ( db_get_b( NULL, "CList", "Transparent", 0 )) { SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); - if ( MySetLayeredWindowAttributes ) - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); } transparentFocus = 1; return FALSE; @@ -727,12 +722,6 @@ int LoadCLUIModule(void) canloadstatusbar = FALSE; hFrameContactTree = 0; - hUserDll = LoadLibraryA("user32.dll"); - if (hUserDll) { - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); - } - HookEvent(ME_SYSTEM_MODULESLOADED,CluiModulesLoaded); HookEvent(ME_OPT_INITIALISE,CluiOptInit); hContactDraggingEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGGING); diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index 45d1dca8db..f623a7adb7 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" extern HMENU hMenuMain; -extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); extern HANDLE hFrameHelperStatusBar; @@ -260,7 +259,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); if (IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) { SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); + SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 3bb0919e47..e9776abf1e 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -9,9 +9,7 @@ HANDLE hkTopToolbarInit = NULL; HANDLE hkModulesLoaded = NULL; HANDLE hkFontChange = NULL; HANDLE hkColorChange = NULL; -HMODULE hUserDll = NULL; HMODULE hRichedDll = NULL; -HMODULE hKernelDll = NULL; extern TREEELEMENT *g_Stickies; extern TREEELEMENT *RemindersList; @@ -286,10 +284,6 @@ extern "C" __declspec(dllexport) int Unload(void) if (hRichedDll) FreeLibrary(hRichedDll); - if (hUserDll) - FreeLibrary(hUserDll); - if (hKernelDll) - FreeLibrary(hKernelDll); return 0; } @@ -317,26 +311,6 @@ extern "C" __declspec(dllexport) int Load(void) return 0; } - hUserDll = LoadLibrary(_T("user32.dll")); - if (hUserDll) { - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll,"SetLayeredWindowAttributes"); - MyMonitorFromWindow = (HANDLE (WINAPI*)(HWND,DWORD))GetProcAddress(hUserDll,"MonitorFromWindow"); - } - else { - MySetLayeredWindowAttributes = NULL; - MyMonitorFromWindow = NULL; - } - - hKernelDll = LoadLibrary(_T("kernel32.dll")); - if (hKernelDll) { - MyTzSpecificLocalTimeToSystemTime = (BOOL (WINAPI*)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME))GetProcAddress(hKernelDll,"TzSpecificLocalTimeToSystemTime"); - MySystemTimeToTzSpecificLocalTime = (BOOL (WINAPI*)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME))GetProcAddress(hKernelDll,"SystemTimeToTzSpecificLocalTime"); - } - else { - MyTzSpecificLocalTimeToSystemTime = NULL; - MySystemTimeToTzSpecificLocalTime = NULL; - } - InitServices(); WS_Init(); diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp index f29ef4c233..71dc3644dd 100644 --- a/plugins/NotesAndReminders/src/miscutils.cpp +++ b/plugins/NotesAndReminders/src/miscutils.cpp @@ -1,10 +1,5 @@ #include "globals.h" -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -HANDLE (WINAPI *MyMonitorFromWindow)(HWND,DWORD); -BOOL (WINAPI *MyTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME); -BOOL (WINAPI *MySystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME); - WORD ConvertHotKeyToControl(WORD HK) { WORD R = 0; diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h index 9b8106a7ff..2b7c779b9e 100644 --- a/plugins/NotesAndReminders/src/miscutils.h +++ b/plugins/NotesAndReminders/src/miscutils.h @@ -10,11 +10,6 @@ void WriteSettingIntArray(HANDLE hContact,char *ModuleName, bool ReadSettingIntArray(HANDLE hContact,char *ModuleName, char *SettingName,int *Value, int Size); -extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -extern HANDLE (WINAPI *MyMonitorFromWindow)(HWND,DWORD); -extern BOOL (WINAPI *MyTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME); -extern BOOL (WINAPI *MySystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME); - WORD ConvertHotKeyToControl(WORD HK); WORD ConvertControlToHotKey(WORD HK); diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 5c19457227..c8146bd1e7 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -303,7 +303,7 @@ STICKYNOTE* NewNoteEx(int Ax,int Ay,int Aw,int Ah,char *Data,ULARGE_INTEGER *ID, TSN->pCustomFont = pCustomFont; L1 = WS_EX_TOOLWINDOW; - if (MySetLayeredWindowAttributes && g_Transparency < 255) L1 |= WS_EX_LAYERED; + if (g_Transparency < 255) L1 |= WS_EX_LAYERED; if (OnTop) L1 |= WS_EX_TOPMOST; L2 = WS_POPUP | WS_THICKFRAME | WS_CAPTION; @@ -313,14 +313,14 @@ STICKYNOTE* NewNoteEx(int Ax,int Ay,int Aw,int Ah,char *Data,ULARGE_INTEGER *ID, // we don't have to worry about notes "drifting" between sessions TSN->SNHwnd = CreateWindowEx(L1, NOTE_WND_CLASS, _T("StickyNote"), L2, Ax,Ay,Aw,Ah, NULL, 0, hmiranda, TSN); - if (MySetLayeredWindowAttributes && g_Transparency < 255) - MySetLayeredWindowAttributes(TSN->SNHwnd,0,(BYTE)g_Transparency,LWA_ALPHA); + if (g_Transparency < 255) + SetLayeredWindowAttributes(TSN->SNHwnd,0,(BYTE)g_Transparency,LWA_ALPHA); // ensure that window is not placed off-screen (if previous session had different monitor count or resolution) // NOTE: SetWindowPlacement should do this, but it's extremly flakey if (Data) { - if (MyMonitorFromWindow && !MyMonitorFromWindow(TSN->SNHwnd, MONITOR_DEFAULTTONULL) ) + if (!MonitorFromWindow(TSN->SNHwnd, MONITOR_DEFAULTTONULL) ) { TWP.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(GetDesktopWindow(), &TWP); diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 1cbb55f47b..cb1c01a988 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -376,10 +376,6 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar SetDlgItemText(hdlg,IDC_EDIT_EMAILSMS,""); SetDlgItemText(hdlg,IDC_EDIT_ALTBROWSER,g_lpszAltBrowser ? g_lpszAltBrowser : _T("")); - if (!MySetLayeredWindowAttributes) - { // layered UI not available - EnableWindow(GetDlgItem(hdlg,IDC_SLIDER_TRANSPARENCY), FALSE); - } return TRUE; } case WM_HSCROLL: diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index c2fc4306ea..21d9626fdd 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -68,167 +68,6 @@ static int ReminderSortCb(TREEELEMENT *v1, TREEELEMENT *v2) return (((REMINDERDATA*)v1->ptrdata)->When.QuadPart < ((REMINDERDATA*)v2->ptrdata)->When.QuadPart) ? -1 : 1; } - -#ifndef WINXP_MINIMUM -// TzSpecificLocalTimeToSystemTime/SystemTimeToTzSpecificLocalTime (re-)implemented to work on win2k and older - -static const int DaysInMonth[2][12] = -{ - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, // normal year - { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } // leap year -}; - -static __inline BOOL IsLeapYear(UINT Y) -{ - return !(Y & 3) && ((Y % 100) || !(Y % 400)); -} - -static int TZDateComp(const SYSTEMTIME *lpDate, const SYSTEMTIME *lpDateRef) -{ - int boundaryDay, day; - - if (lpDate->wMonth < lpDateRef->wMonth) - return -1; - if (lpDate->wMonth > lpDateRef->wMonth) - return 1; - - if (!lpDateRef->wYear) - { - const int week = (int)lpDateRef->wDay; - const WORD wFirst = (6 + lpDateRef->wDayOfWeek - lpDate->wDayOfWeek + lpDate->wDay) % 7 + 1; - boundaryDay = (int)wFirst + 7 * (week - 1); - if (boundaryDay > DaysInMonth[ IsLeapYear(lpDate->wYear) ][lpDate->wMonth-1]) - boundaryDay -= 7; - } - else - boundaryDay = (int)lpDateRef->wDay; - - boundaryDay = ((boundaryDay * 24 + (int)lpDateRef->wHour) * 60 + (int)lpDateRef->wMinute) * 60; - day = (((int)lpDate->wDay * 24 + (int)lpDate->wHour) * 60 + (int)lpDate->wMinute) * 60 + (int)lpDate->wSecond; - - return (day < boundaryDay) ? -1 : (day > boundaryDay); -} - -static UINT TZGetType(LPTIME_ZONE_INFORMATION lpTZI, ULARGE_INTEGER *lpFT, BOOL bLocal) -{ - if (lpTZI->DaylightDate.wMonth) - { - ULARGE_INTEGER ft = *lpFT; - SYSTEMTIME tm; - BOOL BeforeStandardDate, AfterDaylightDate; - UINT id; - - if (!lpTZI->StandardDate.wMonth || (!lpTZI->StandardDate.wYear - && (!lpTZI->StandardDate.wDay || lpTZI->StandardDate.wDay > 5 - || !lpTZI->DaylightDate.wDay || lpTZI->DaylightDate.wDay > 5))) - return TIME_ZONE_ID_INVALID; - - if (!bLocal) - ft.QuadPart -= (LONGLONG)(lpTZI->Bias + lpTZI->DaylightBias) * (LONGLONG)600000000; - - FileTimeToSystemTime((FILETIME*)&ft, &tm); - - BeforeStandardDate = (TZDateComp(&tm, &lpTZI->StandardDate) < 0); - - if (!bLocal) - { - ft.QuadPart -= (LONGLONG)(lpTZI->StandardBias - lpTZI->DaylightBias) * (LONGLONG)600000000; - FileTimeToSystemTime((FILETIME*)&ft, &tm); - } - - AfterDaylightDate = (TZDateComp(&tm, &lpTZI->DaylightDate) >= 0); - - id = TIME_ZONE_ID_STANDARD; - if (lpTZI->DaylightDate.wMonth < lpTZI->StandardDate.wMonth) - { - if (BeforeStandardDate && AfterDaylightDate) - id = TIME_ZONE_ID_DAYLIGHT; - } - else - { - if (BeforeStandardDate || AfterDaylightDate) - id = TIME_ZONE_ID_DAYLIGHT; - } - - return id; - } - - return TIME_ZONE_ID_UNKNOWN; -} - -static BOOL TZGetBias(LPTIME_ZONE_INFORMATION lpTZI, ULARGE_INTEGER *lpFT, BOOL bLocal, LONG *pBias) -{ - LONG Bias = lpTZI->Bias; - - switch ( TZGetType(lpTZI, lpFT, bLocal) ) - { - case TIME_ZONE_ID_INVALID: return FALSE; - case TIME_ZONE_ID_DAYLIGHT: Bias += lpTZI->DaylightBias; break; - case TIME_ZONE_ID_STANDARD: Bias += lpTZI->StandardBias; break; - } - - *pBias = Bias; - - return TRUE; -} - -#define TzSpecificLocalTimeToSystemTime _TzSpecificLocalTimeToSystemTime -static BOOL _TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTZI, LPSYSTEMTIME lpLocal, LPSYSTEMTIME lpUtc) -{ - TIME_ZONE_INFORMATION tzi; - ULARGE_INTEGER ft; - LONG Bias; - - // if possible use the real function (shouldn't be necessary, be feels more comfortable) - if (MyTzSpecificLocalTimeToSystemTime) - return MyTzSpecificLocalTimeToSystemTime(lpTZI, lpLocal, lpUtc); - - if (!lpTZI) - { - if (GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_INVALID) - return FALSE; - lpTZI = &tzi; - } - - if (!SystemTimeToFileTime(lpLocal, (FILETIME*)&ft) - || !TZGetBias(lpTZI, &ft, TRUE, &Bias)) - return FALSE; - - ft.QuadPart += (LONGLONG)Bias * (LONGLONG)600000000; - - return FileTimeToSystemTime((FILETIME*)&ft, lpUtc); -} - -#define SystemTimeToTzSpecificLocalTime _SystemTimeToTzSpecificLocalTime -static BOOL _SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTZI, LPSYSTEMTIME lpUtc, LPSYSTEMTIME lpLocal) -{ - TIME_ZONE_INFORMATION tzi; - ULARGE_INTEGER ft; - LONG Bias; - - // if possible use the real function (shouldn't be necessary, be feels more comfortable) - if (MySystemTimeToTzSpecificLocalTime) - return MySystemTimeToTzSpecificLocalTime(lpTZI, lpUtc, lpLocal); - - if (!lpTZI) - { - if (GetTimeZoneInformation(&tzi) == TIME_ZONE_ID_INVALID) - return FALSE; - lpTZI = &tzi; - } - - if (!SystemTimeToFileTime(lpUtc, (FILETIME*)&ft) - || !TZGetBias(lpTZI, &ft, FALSE, &Bias)) - return FALSE; - - ft.QuadPart -= (LONGLONG)Bias * (LONGLONG)600000000; - - return FileTimeToSystemTime((FILETIME*)&ft, lpLocal); -} - -#endif - - // time convertsion routines that take local time-zone specific daylight saving configuration into account // (unlike the standard FileTimeToLocalFileTime functions) diff --git a/plugins/Ping/ping_10.vcxproj b/plugins/Ping/ping_10.vcxproj index dd9bec31ab..de3c728eef 100644 --- a/plugins/Ping/ping_10.vcxproj +++ b/plugins/Ping/ping_10.vcxproj @@ -93,7 +93,7 @@ $(IntDir)$(TargetName).lib $(ProfileDir)..\..\bin10\lib Windows - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) @@ -115,7 +115,7 @@ ..\..\include\msapi - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) true true true @@ -144,7 +144,7 @@ ..\..\include\msapi - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) true 0x22040000 false @@ -173,7 +173,7 @@ ..\..\include\msapi - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) true true true diff --git a/plugins/Ping/ping_11.vcxproj b/plugins/Ping/ping_11.vcxproj index b983868e95..570e9328b9 100644 --- a/plugins/Ping/ping_11.vcxproj +++ b/plugins/Ping/ping_11.vcxproj @@ -97,7 +97,7 @@ $(IntDir)$(TargetName).lib $(ProfileDir)..\..\bin11\lib Windows - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) false @@ -120,7 +120,7 @@ ..\..\include\msapi - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) true true true @@ -149,7 +149,7 @@ ..\..\include\msapi - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) true 0x22040000 false @@ -178,7 +178,7 @@ ..\..\include\msapi - ws2_32.lib;%(AdditionalDependencies) + ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies) true true true diff --git a/plugins/Ping/src/common.h b/plugins/Ping/src/common.h index 48ddd31e03..f2d7259c65 100644 --- a/plugins/Ping/src/common.h +++ b/plugins/Ping/src/common.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp index eeab3cf567..3cd34384bc 100644 --- a/plugins/Ping/src/icmp.cpp +++ b/plugins/Ping/src/icmp.cpp @@ -9,57 +9,23 @@ ICMP::ICMP(): timeout(2000), functions_loaded(false) { - hDLL = LoadLibrary(_T("IPHLPAPI.DLL")); - if(hDLL) { - pIcmpCreateFile = (pfnHV)GetProcAddress(hDLL, "IcmpCreateFile"); - pIcmpCloseHandle = (pfnBH)GetProcAddress(hDLL, "IcmpCloseHandle"); - pIcmpSendEcho2 = (pfnDHDPWPipPDD)GetProcAddress(hDLL, "IcmpSendEcho2"); - } - if (hDLL == 0 || pIcmpCreateFile == 0 || pIcmpCloseHandle == 0 || pIcmpSendEcho2 == 0) { - hDLL = LoadLibrary(_T("ICMP.DLL")); - if(hDLL) { - pIcmpCreateFile = (pfnHV)GetProcAddress(hDLL, "IcmpCreateFile"); - pIcmpCloseHandle = (pfnBH)GetProcAddress(hDLL, "IcmpCloseHandle"); - pIcmpSendEcho2 = (pfnDHDPWPipPDD)GetProcAddress(hDLL, "IcmpSendEcho2"); - } - if (hDLL == 0 || pIcmpCreateFile == 0 || pIcmpCloseHandle == 0 || pIcmpSendEcho2 == 0) - return; - else - db_set_s(0, PLUG, "PingLib", "ICMP.DLL"); // for debugging - } else - db_set_s(0, PLUG, "PingLib", "IPHLPAPI.DLL"); // for debugging - WSAData wsaData; if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) { WSACleanup(); - FreeLibrary((HMODULE)hDLL); return; } - /* - hIP = pIcmpCreateFile(); - if (hIP == INVALID_HANDLE_VALUE) { - pIcmpCloseHandle(hIP); - return; - } - */ - buff = new char[BUFFER_SIZE]; functions_loaded = true; } -void ICMP::stop() { - //if(hIP) { - // pIcmpCloseHandle(hIP); - // hIP = 0; - //} +void ICMP::stop() +{ } ICMP::~ICMP() { if(hIP) stop(); WSACleanup(); - if(hDLL) - FreeLibrary(hDLL); delete[] buff; } @@ -90,12 +56,11 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply) reply.Status = 0; - hIP = pIcmpCreateFile(); + hIP = IcmpCreateFile(); if (hIP == INVALID_HANDLE_VALUE) return false; - //pIcmpSendEcho2(hIP, 0, 0, 0, address, data, sizeof(data), &ipoi, buff, sizeof(ICMP_ECHO_REPLY) + sizeof(data), timeout); - DWORD rep_cnt = pIcmpSendEcho2(hIP, 0, 0, 0, address, data, sizeof(data), 0, buff, BUFFER_SIZE, timeout); + DWORD rep_cnt = IcmpSendEcho2(hIP, 0, 0, 0, address, data, sizeof(data), 0, buff, BUFFER_SIZE, timeout); if (rep_cnt == 0) { DWORD code = GetLastError(); @@ -110,7 +75,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply) } memcpy(&reply, buff, sizeof(ICMP_ECHO_REPLY)); - pIcmpCloseHandle(hIP); + IcmpCloseHandle(hIP); return (reply.Status == 0); } diff --git a/plugins/Ping/src/icmp.h b/plugins/Ping/src/icmp.h index e3da22691b..110f5b554c 100644 --- a/plugins/Ping/src/icmp.h +++ b/plugins/Ping/src/icmp.h @@ -3,18 +3,8 @@ #ifndef _ICMP_H #define _ICMP_H -typedef HANDLE (WINAPI* pfnHV)(VOID); -typedef BOOL (WINAPI* pfnBH)(HANDLE); -typedef DWORD (WINAPI* pfnDHDPWPipPDD)(HANDLE, HANDLE, FARPROC, PVOID, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION, LPVOID, DWORD, DWORD); - class ICMP { protected: - pfnHV pIcmpCreateFile; - pfnBH pIcmpCloseHandle; - pfnDHDPWPipPDD pIcmpSendEcho2; - - HMODULE hDLL; - HANDLE hIP; unsigned int timeout; diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 242f7266bd..f785976e51 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -2,7 +2,7 @@ int upCount, total = 0; -int list_size = 0; +size_t list_size = 0; HANDLE mainThread; HANDLE hWakeEvent = 0; @@ -25,9 +25,6 @@ HFONT hFont = 0; COLORREF bk_col = RGB(255, 255, 255); //////////////// -static HMODULE hUserDll; -BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags); #define TM_AUTOALPHA 1 static int transparentFocus=1; ///////////////// @@ -105,7 +102,7 @@ DWORD WINAPI sttCheckStatusThreadProc( void *vp) Lock(&data_list_cs, "ping thread loop start"); set_list_changed(false); - int size = data_list.size(); + size_t size = data_list.size(); Unlock(&data_list_cs); int index = 0; @@ -530,7 +527,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); #endif #ifdef LWA_ALPHA - if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); #endif } } @@ -553,7 +550,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) { KillTimer(hwnd,TM_AUTOALPHA); #ifdef LWA_ALPHA - if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); #endif transparentFocus=1; } @@ -562,9 +559,9 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_SETCURSOR: if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) { - if (!transparentFocus && GetForegroundWindow()!=hwnd && MySetLayeredWindowAttributes) { + if (!transparentFocus && GetForegroundWindow()!=hwnd) { #ifdef LWA_ALPHA - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); #endif transparentFocus=1; SetTimer(hwnd, TM_AUTOALPHA,250,NULL); @@ -588,12 +585,12 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar hwndPt=WindowFromPoint(pt); inwnd=(hwndPt==hwnd || GetParent(hwndPt)==hwnd); } - if (inwnd!=transparentFocus && MySetLayeredWindowAttributes) + if (inwnd!=transparentFocus) { //change transparentFocus=inwnd; #ifdef LWA_ALPHA - if(transparentFocus) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); - else MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); + if(transparentFocus) SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + else SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); #endif } if(!transparentFocus) KillTimer(hwnd,TM_AUTOALPHA); @@ -616,7 +613,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar sourceAlpha=0; destAlpha=(BYTE)db_get_b(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT); #ifdef LWA_ALPHA - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), 0, LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), 0, LWA_ALPHA); #endif noRecurse=1; ShowWindow(hwnd,SW_SHOW); @@ -630,16 +627,16 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar thisTick=GetTickCount(); if(thisTick>=startTick+200) break; #ifdef LWA_ALPHA - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)(sourceAlpha+(destAlpha-sourceAlpha)*(int)(thisTick-startTick)/200), LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)(sourceAlpha+(destAlpha-sourceAlpha)*(int)(thisTick-startTick)/200), LWA_ALPHA); #endif } #ifdef LWA_ALPHA - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)destAlpha, LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)destAlpha, LWA_ALPHA); #endif } else { // if(wParam) SetForegroundWindow(hwnd); - MyAnimateWindow(hwnd,200,AW_BLEND|(wParam?0:AW_HIDE)); + AnimateWindow(hwnd,200,AW_BLEND|(wParam?0:AW_HIDE)); //SetWindowPos(label,0,0,0,0,0,SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED); } #endif @@ -915,7 +912,7 @@ void UpdateFrame() { GetWindowRect(hwnd_clist, &r_clist); RECT r_frame; GetWindowRect(hpwnd, &r_frame); - int height = list_size * options.row_height; + int height = (int)list_size * options.row_height; if(GetWindowLong(hpwnd, GWL_STYLE) & WS_BORDER) { RECT r_frame_client; GetClientRect(hpwnd, &r_frame_client); @@ -969,12 +966,6 @@ void AttachToClist(bool attach) void InitList() { - hUserDll = LoadLibrary(_T("user32.dll")); - if (hUserDll) { - MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); - } - hwnd_clist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); WNDCLASS wndclass; -- cgit v1.2.3