diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-22 17:14:55 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-22 17:14:55 +0000 |
commit | d8967087af559a43f1801e3e89411d570cbb3110 (patch) | |
tree | b6596526a66c1aa8b80bab769cc7fd5472b327a8 | |
parent | d867e44172947b51b34d60a672673dffd771a304 (diff) |
plugins cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6185 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
40 files changed, 188 insertions, 711 deletions
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index 4228b56b32..c3f0a740ee 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -113,22 +113,18 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) }
break;
case SDSDT_LOCKWORKSTATION:
- { void (WINAPI *pfnLockWorkStation)(void);
- *(PROC*)&pfnLockWorkStation=GetProcAddress(GetModuleHandleA("USER32"),"LockWorkStation");
- if(pfnLockWorkStation) {
- HKEY hKey;
- DWORD dwSize,dwSetting;
- /* DisableLockWorkstation is DWORD on Win2000+ */
- bReturn=TRUE;
- if(RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"),0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS) {
- dwSize=sizeof(dwSetting);
- if(!RegQueryValueEx(hKey, _T("DisableLockWorkstation"), 0, NULL, (LPBYTE)&dwSetting, &dwSize))
- if(dwSetting) bReturn=FALSE;
- RegCloseKey(hKey);
- }
+ {
+ HKEY hKey;
+ DWORD dwSize,dwSetting;
+ /* DisableLockWorkstation is DWORD on Win2000+ */
+ bReturn=TRUE;
+ if(RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"),0,KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS) {
+ dwSize=sizeof(dwSetting);
+ if(!RegQueryValueEx(hKey, _T("DisableLockWorkstation"), 0, NULL, (LPBYTE)&dwSetting, &dwSize))
+ if(dwSetting)
+ bReturn=FALSE;
+ RegCloseKey(hKey);
}
- else
- bReturn=SearchPath(NULL,_T("LOGIN.SCR"),NULL,0,NULL,NULL)!=0;
}
break;
case SDSDT_CLOSERASCONNECTIONS:
@@ -185,42 +181,9 @@ static DWORD ShutdownNow(BYTE shutdownType) WinNT_SetPrivilege(SE_SHUTDOWN_NAME,FALSE);
break;
case SDSDT_LOCKWORKSTATION:
- { BOOL (WINAPI *pfnLockWorkStation)(void);
- *(PROC*)&pfnLockWorkStation=GetProcAddress(GetModuleHandleA("USER32"),"LockWorkStation");
- if(pfnLockWorkStation!=NULL) /* Win2000+ */
- if(!pfnLockWorkStation() && !WinNT_IsWorkStationLocked())
- dwErrCode=GetLastError();
- else {
- HKEY hKey;
- /* start LOGON.SCR screensaver (locks workstation on NT4) */
- if(!SearchPath(NULL,_T("LOGIN.SCR"),NULL,0,NULL,NULL)) {
- if(RegCreateKeyEx(HKEY_CURRENT_USER,_T("Control Panel\\Desktop"),0,NULL,REG_OPTION_VOLATILE,KEY_QUERY_VALUE|KEY_SET_VALUE,NULL,&hKey,NULL)==ERROR_SUCCESS) {
- TCHAR szScreenSaveActive[2],szScreenSaverIsSecure[2],szScrnsaveExe[MAX_PATH];
- DWORD dwSize;
- /* save old settings */
- dwSize=sizeof(szScreenSaveActive); /* in bytes */
- ZeroMemory(&szScreenSaveActive,dwSize);
- RegQueryValueEx(hKey, _T("ScreenSaveActive"), 0, NULL, (LPBYTE)szScreenSaveActive, &dwSize);
- dwSize=sizeof(szScreenSaverIsSecure); /* in bytes */
- ZeroMemory(&szScreenSaverIsSecure, dwSize);
- RegQueryValueEx(hKey, _T("ScreenSaverIsSecure"), 0, NULL, (LPBYTE)szScreenSaverIsSecure, &dwSize);
- dwSize=sizeof(szScrnsaveExe); /* in bytes */
- ZeroMemory(&szScrnsaveExe, dwSize);
- RegQueryValueEx(hKey, _T("SCRNSAVE.EXE"), 0, NULL, (LPBYTE)szScrnsaveExe, &dwSize);
- /* set LOGON.SCR data */
- if(!RegSetValueEx(hKey, _T("ScreenSaveActive"), 0, REG_SZ, (LPBYTE)_T("1"), 2) &&
- !RegSetValueEx(hKey, _T("ScreenSaverIsSecure"), 0, REG_SZ, (LPBYTE)"1", 2) &&
- !RegSetValueEx(hKey, _T("SCRNSAVE.EXE"), 0, REG_SZ, (LPBYTE)_T("LOGIN.SCR"), 10))
- SendMessage(GetForegroundWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0);
- else dwErrCode=GetLastError();
- /* restore old settings */
- RegSetValueEx(hKey, _T("ScreenSaveActive"), 0, REG_SZ, (BYTE*)szScreenSaveActive, (lstrlen(szScreenSaveActive)+1)*sizeof(TCHAR));
- RegSetValueEx(hKey, _T("ScreenSaverIsSecure"), 0, REG_SZ, (BYTE*)szScreenSaverIsSecure, (lstrlen(szScreenSaverIsSecure)+1)*sizeof(TCHAR));
- RegSetValueEx(hKey, _T("SCRNSAVE.EXE"), 0, REG_SZ, (BYTE*)szScrnsaveExe, (lstrlen(szScrnsaveExe)+1)*sizeof(TCHAR));
- RegCloseKey(hKey);
- } else dwErrCode=GetLastError();
- } else dwErrCode=GetLastError();
- } else dwErrCode=GetLastError();
+ {
+ if(!WinNT_IsWorkStationLocked())
+ dwErrCode=GetLastError();
}
break;
case SDSDT_CLOSERASCONNECTIONS:
@@ -298,29 +261,21 @@ static DWORD ShutdownNow(BYTE shutdownType) break;
}
/* WinNT4/2000/XP */
- { BOOL (WINAPI *pfnInitiateSystemShutdownEx)(const TCHAR*,const TCHAR*,DWORD,BOOL,BOOL,DWORD);
- BOOL (WINAPI *pfnInitiateSystemShutdown)(const TCHAR*,const TCHAR*,DWORD,BOOL,BOOL);
- *(PROC*)&pfnInitiateSystemShutdownEx=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownExW");
- *(PROC*)&pfnInitiateSystemShutdown=GetProcAddress(GetModuleHandleA("ADVAPI32"),"InitiateSystemShutdownW");
- if(pfnInitiateSystemShutdownEx!=NULL || pfnInitiateSystemShutdown!=NULL) {
- WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE);
-
- /* does not send out WM_ENDSESSION messages, so we do it manually to
- * give the applications the chance to save their data */
- WinNT_SetPrivilege(SE_TCB_NAME,TRUE); /* for BSM_ALLDESKTOPS */
- BroadcastEndSession(BSM_APPLICATIONS|BSM_ALLDESKTOPS,ENDSESSION_CLOSEAPP); /* app should close itself */
- WinNT_SetPrivilege(SE_TCB_NAME,FALSE);
-
- if(pfnInitiateSystemShutdownEx!=NULL) {
- if(!pfnInitiateSystemShutdownEx(NULL,TranslateT("AutoShutdown"),0,TRUE,shutdownType==SDSDT_REBOOT,SHTDN_REASON_MAJOR_OTHER|SHTDN_REASON_MINOR_OTHER|SHTDN_REASON_FLAG_PLANNED))
- dwErrCode=GetLastError();
- } else if(!pfnInitiateSystemShutdown(NULL,TranslateT("AutoShutdown"),0,TRUE,shutdownType==SDSDT_REBOOT))
- dwErrCode=GetLastError();
-
- /* cleanly close Miranda */
- if(!dwErrCode) ShutdownNow(SDSDT_CLOSEMIRANDA);
- break;
- }
+ {
+ WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE);
+
+ /* does not send out WM_ENDSESSION messages, so we do it manually to
+ * give the applications the chance to save their data */
+ WinNT_SetPrivilege(SE_TCB_NAME,TRUE); /* for BSM_ALLDESKTOPS */
+ BroadcastEndSession(BSM_APPLICATIONS|BSM_ALLDESKTOPS,ENDSESSION_CLOSEAPP); /* app should close itself */
+ WinNT_SetPrivilege(SE_TCB_NAME,FALSE);
+
+ if(!InitiateSystemShutdownEx(NULL,TranslateT("AutoShutdown"),0,TRUE,shutdownType==SDSDT_REBOOT,SHTDN_REASON_MAJOR_OTHER|SHTDN_REASON_MINOR_OTHER|SHTDN_REASON_FLAG_PLANNED))
+ dwErrCode=GetLastError();
+
+ /* cleanly close Miranda */
+ if(!dwErrCode) ShutdownNow(SDSDT_CLOSEMIRANDA);
+ break;
}
/* fall through for Win9x */
case SDSDT_LOGOFF:
@@ -364,7 +319,6 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR {
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:
@@ -396,9 +350,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR /* disallow foreground window changes (WinMe/2000+) */
SetForegroundWindow(hwndDlg);
- *(PROC*)&pfnLockSetForegroundWindow=GetProcAddress(GetModuleHandleA("USER32"),"LockSetForegroundWindow");
- if(pfnLockSetForegroundWindow!=NULL)
- pfnLockSetForegroundWindow(LSFW_LOCK);
+ LockSetForegroundWindow(LSFW_LOCK);
SendMessage(hwndDlg,WM_NEXTDLGCTL,(WPARAM)GetDlgItem(hwndDlg,IDCANCEL),TRUE);
return FALSE; /* focus set on cancel */
@@ -407,7 +359,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR hwndShutdownDlg=NULL;
ShowWindow(hwndDlg,SW_HIDE);
/* reallow foreground window changes (WinMe/2000+) */
- if(pfnLockSetForegroundWindow) pfnLockSetForegroundWindow(LSFW_UNLOCK);
+ LockSetForegroundWindow(LSFW_UNLOCK);
Utils_SaveWindowPosition(hwndDlg,NULL,"AutoShutdown","ConfirmDlg_");
HICON hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,0);
HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h index 9e44332162..7a6d6c8489 100644 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ b/plugins/Clist_modern/src/hdr/modern_clist.h @@ -30,15 +30,6 @@ HTREEITEM GetTreeItemByHContact(HANDLE hContact); void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add);
int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status);
-typedef HMONITOR ( WINAPI *pfnMyMonitorFromPoint )(POINT,DWORD);
-extern pfnMyMonitorFromPoint MyMonitorFromPoint;
-
-typedef HMONITOR( WINAPI *pfnMyMonitorFromWindow) (HWND, DWORD);
-extern pfnMyMonitorFromWindow MyMonitorFromWindow;
-
-typedef BOOL(WINAPI *pfnMyGetMonitorInfo) (HMONITOR, LPMONITORINFO);
-extern pfnMyGetMonitorInfo MyGetMonitorInfo;
-
///////////////////////////////////////////////////////////////////////////////
class CSmileyString
diff --git a/plugins/Clist_modern/src/hdr/modern_clui.h b/plugins/Clist_modern/src/hdr/modern_clui.h index 0b978fb7c1..4360d183b7 100644 --- a/plugins/Clist_modern/src/hdr/modern_clui.h +++ b/plugins/Clist_modern/src/hdr/modern_clui.h @@ -180,7 +180,6 @@ private: protected:
HMODULE m_hDwmapiDll;
- HMODULE m_hUserDll;
enum { SNAPTOEDGESENSIVITY = 30 };
};
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index ec22ca3692..ec2016e1c2 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -199,19 +199,6 @@ extern BOOL ske_ResetTextEffect(HDC hdc); extern BOOL ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor);
extern void IvalidateDisplayNameCache(DWORD mode);
-typedef BOOL (WINAPI *pfnTryEnterCriticalSection)( LPCRITICAL_SECTION );
-extern pfnTryEnterCriticalSection fnTryEnterCriticalSection;
-
-typedef BOOL (WINAPI *pfnGetScrollBarInfo)( HWND, LONG, PSCROLLBARINFO );
-extern pfnGetScrollBarInfo fnGetScrollBarInfo;
-
-typedef HWND (WINAPI *pfnGetAncestor)( HWND, UINT );
-extern pfnGetAncestor fnGetAncestor;
-HWND WINAPI MyGetAncestor( HWND, UINT );
-
-typedef BOOL (WINAPI *pfnGetMenuBarInfo)( HWND, LONG, LONG, PMENUBARINFO );
-extern pfnGetMenuBarInfo fnGetMenuBarInfo;
-
extern SortedList *clistCache;
HICON LoadSmallIcon(HINSTANCE hInstance, int idx);
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 26ef062251..66d0e6e2b3 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -315,10 +315,6 @@ ClcContact* cliCreateClcContact( void ); ClcCacheEntry* cliCreateCacheItem(HANDLE hContact);
ClcCacheEntry* cliGetCacheEntry(HANDLE hContact);
-// FUNCTION POINTERS
-extern BOOL (WINAPI *g_proc_UpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
-extern BOOL (WINAPI *g_proc_SetLayeredWindowAttributesNew)(HWND,COLORREF,BYTE,DWORD);
-
#define WM_DWMCOMPOSITIONCHANGED 0x031E
#define DWM_BB_ENABLE 0x00000001
@@ -334,7 +330,6 @@ struct DWM_BLURBEHIND extern HRESULT (WINAPI *g_proc_DWMEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);
extern tPaintCallbackProc CLCPaint_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData);
-extern BOOL (WINAPI *MySetProcessWorkingSetSize)(HANDLE,SIZE_T,SIZE_T);
/* SkinEngine.c */
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 876a3b3464..ba005f236a 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -41,12 +41,6 @@ int hLangpack; TIME_API tmi;
-pfnTryEnterCriticalSection fnTryEnterCriticalSection;
-
-pfnGetAncestor fnGetAncestor;
-pfnGetMenuBarInfo fnGetMenuBarInfo;
-pfnGetScrollBarInfo fnGetScrollBarInfo;
-
static HRESULT SubclassClistInterface();
static HRESULT CreateHookableEvents();
int EventArea_UnloadModule();
@@ -84,15 +78,6 @@ extern "C" __declspec(dllexport) int CListInitialise() mir_getLP( &pluginInfo );
mir_getTMI(&tmi);
- HMODULE hKernel = GetModuleHandleA("kernel32.dll");
- fnTryEnterCriticalSection = ( pfnTryEnterCriticalSection )GetProcAddress( hKernel, "TryEnterCriticalSection");
-
- HMODULE hUser = GetModuleHandleA("user32.dll");
- fnGetMenuBarInfo = ( pfnGetMenuBarInfo )GetProcAddress( hUser, "GetMenuBarInfo");
- fnGetScrollBarInfo = ( pfnGetScrollBarInfo )GetProcAddress( hUser, "GetScrollBarInfo");
- if (( fnGetAncestor = ( pfnGetAncestor )GetProcAddress( hUser, "GetAncestor")) == NULL )
- fnGetAncestor = MyGetAncestor;
-
g_dwMainThreadID = GetCurrentThreadId();
CHECKRES ( PreLoadContactListModule ( ) );
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index a37aedb829..b54eed3821 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -349,7 +349,7 @@ void AniAva_UpdateParent() {
aacheck;
mir_cslock lck(s_CS);
- HWND parent = fnGetAncestor(pcli->hwndContactList, GA_PARENT);
+ HWND parent = GetAncestor(pcli->hwndContactList, GA_PARENT);
for (int i=0; i < s_Objects.getCount(); i++) {
ANIAVA_OBJECT * pai = (ANIAVA_OBJECT *)s_Objects[i];
SendMessage(pai->hWindow, AAM_SETPARENT, (WPARAM)parent,0);
@@ -399,7 +399,7 @@ int AniAva_SetAvatarPos(HANDLE hContact, RECT *rc, int overlayIdx, BYTE bAlpha) tszName = mir_a2t( szName );
hwnd = _AniAva_CreateAvatarWindowSync(tszName);
mir_free( tszName );
- parent = fnGetAncestor(pcli->hwndContactList,GA_PARENT);
+ parent = GetAncestor(pcli->hwndContactList, GA_PARENT);
pai->hWindow = hwnd;
SendMessage(hwnd,AAM_SETPARENT,(WPARAM)parent,0);
if (_AniAva_GetAvatarImageInfo(pai->dwAvatarUniqId,&avii))
@@ -814,14 +814,14 @@ static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent /*= NULL ske_AlphaBlend( hdcParent, rcInParent->left, rcInParent->top, szWnd.cx, szWnd.cy, copyFromDC, pt_from.x, pt_from.y, szWnd.cx, szWnd.cy, abf);
}
}
- else if ( !g_proc_UpdateLayeredWindow(dat->hWindow, hDC_animation, &ptWnd, &szWnd, copyFromDC, &pt_from, RGB(0, 0, 0), &bf, ULW_ALPHA )) {
+ else if ( !UpdateLayeredWindow(dat->hWindow, hDC_animation, &ptWnd, &szWnd, copyFromDC, &pt_from, RGB(0, 0, 0), &bf, ULW_ALPHA )) {
LONG exStyle;
exStyle = GetWindowLongPtr(dat->hWindow,GWL_EXSTYLE);
exStyle |= WS_EX_LAYERED;
SetWindowLongPtr(dat->hWindow,GWL_EXSTYLE,exStyle);
if ( !IMMEDIATE_DRAW )
SetWindowPos( pcli->hwndContactTree, dat->hWindow, 0, 0, 0, 0, SWP_ASYNCWINDOWPOS | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING );
- g_proc_UpdateLayeredWindow(dat->hWindow, hDC_animation, &ptWnd, &szWnd, copyFromDC, &pt_from, RGB(0, 0, 0), &bf, ULW_ALPHA );
+ UpdateLayeredWindow(dat->hWindow, hDC_animation, &ptWnd, &szWnd, copyFromDC, &pt_from, RGB(0, 0, 0), &bf, ULW_ALPHA );
}
g_CluiData.fAeroGlass = false;
@@ -1081,25 +1081,3 @@ static LRESULT CALLBACK _AniAva_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR #undef aacheck
#undef aalock
#undef aaunlock
-
-/////////////////////////////////////////////////////////////////
-// some stub
-
-HWND WINAPI MyGetAncestor( HWND hWnd, UINT option )
-{
- if (option == GA_PARENT)
- return GetParent(hWnd);
-
- if (option == GA_ROOTOWNER) {
- HWND result = hWnd;
- while(true) {
- HWND hParent = GetParent(result);
- if (!hParent)
- return result;
-
- result = hParent;
- }
- }
-
- return NULL;
-}
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 451594269f..c37020b629 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -612,10 +612,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w CheckDlgButton(hwndDlg,IDC_PROPORTIONAL,bmpUse&CLBF_PROPORTIONAL?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_TILEVROWH,bmpUse&CLBF_TILEVTOROWHEIGHT?BST_CHECKED:BST_UNCHECKED);
- HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD);
- MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandle(_T("shlwapi")),"SHAutoComplete");
- if (MySHAutoComplete)
- MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1);
+ SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
}
return TRUE;
@@ -1204,8 +1201,8 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AEROGLASS, db_get_b(NULL,"ModernData","AeroGlass",SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE),(g_proc_UpdateLayeredWindow != NULL && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT))?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_LAYERENGINE, (( db_get_b(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT) && g_proc_UpdateLayeredWindow != NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE), !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? TRUE : FALSE);
+ CheckDlgButton(hwndDlg, IDC_LAYERENGINE, (db_get_b(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED);
{
DBVARIANT dbv = {0};
@@ -1281,7 +1278,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg,IDC_ROUNDCORNERS),fEnabled);
if (LOWORD(wParam) == IDC_DISABLEENGINE)
{
- EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE),!IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE) && g_proc_UpdateLayeredWindow != NULL);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LAYERENGINE), !IsDlgButtonChecked(hwndDlg, IDC_DISABLEENGINE));
if (IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE))
CheckDlgButton(hwndDlg,IDC_LAYERENGINE,BST_CHECKED);
}
@@ -1340,7 +1337,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP db_set_b(NULL,"ModernData","AeroGlass",IsDlgButtonChecked(hwndDlg,IDC_AEROGLASS));
if ( !IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE))
{
- if (g_proc_UpdateLayeredWindow != NULL && IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE))
+ if (IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE))
db_set_b(NULL,"ModernData","EnableLayering",0);
else
db_unset(NULL,"ModernData","EnableLayering");
@@ -1504,11 +1501,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, }
SendMessage(hList, CB_SETCURSEL, 0, 0);
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_BKGRLIST, CBN_SELCHANGE), 0);
- {
- HRESULT (STDAPICALLTYPE *MySHAutoComplete)(HWND,DWORD);
- MySHAutoComplete = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(GetModuleHandleA("shlwapi"),"SHAutoComplete");
- if (MySHAutoComplete) MySHAutoComplete(GetDlgItem(hwndDlg,IDC_FILENAME),1);
- }
+ SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
return TRUE;
}
case WM_DESTROY:
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 7e776c9ecf..1dbb54c006 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -27,10 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "hdr/modern_clui.h"
#include <m_modernopt.h>
-pfnMyMonitorFromPoint MyMonitorFromPoint = NULL;
-pfnMyMonitorFromWindow MyMonitorFromWindow = NULL;
-pfnMyGetMonitorInfo MyGetMonitorInfo = NULL;
-
int OnLoadLangpack(WPARAM, LPARAM);
int CListMod_HideWindow(HWND hwndContactList, int mode);
@@ -53,8 +49,6 @@ void UninitTrayMenu(); HIMAGELIST hCListImages = NULL;
-BOOL (WINAPI *MySetProcessWorkingSetSize)(HANDLE,SIZE_T,SIZE_T);
-
//returns normal icon or combined with status overlay. Needs to be destroyed.
HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status)
{
@@ -186,16 +180,6 @@ HRESULT CluiLoadModule() CreateServiceFunction(MS_CLIST_TOGGLESOUNDS,ToggleSounds);
CreateServiceFunction(MS_CLIST_SETUSEGROUPS,SetUseGroups);
- MySetProcessWorkingSetSize = (BOOL (WINAPI*)(HANDLE,SIZE_T,SIZE_T))GetProcAddress(GetModuleHandle(_T("kernel32")),"SetProcessWorkingSetSize");
- hCListImages = ImageList_Create(16, 16, ILC_MASK|ILC_COLOR32, 32, 0);
- InitCustomMenus();
- InitTray();
-
- HINSTANCE hUser = GetModuleHandleA("USER32");
- MyMonitorFromPoint = ( pfnMyMonitorFromPoint )GetProcAddress( hUser,"MonitorFromPoint");
- MyMonitorFromWindow = ( pfnMyMonitorFromWindow )GetProcAddress( hUser, "MonitorFromWindow");
- MyGetMonitorInfo = ( pfnMyGetMonitorInfo )GetProcAddress( hUser, "GetMonitorInfoW");
-
CLUI::InitClui();
return S_OK;
}
@@ -318,7 +302,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) }
//hAux = GetParent(hAux);
hAuxOld = hAux;
- hAux = fnGetAncestor(hAux,GA_ROOTOWNER);
+ hAux = GetAncestor(hAux, GA_ROOTOWNER);
if (hAuxOld == hAux)
{
TCHAR buf[255];
@@ -431,8 +415,7 @@ int cliShowHide(WPARAM wParam,LPARAM lParam) }
}
- if (MySetProcessWorkingSetSize != NULL)
- MySetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
+ SetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
}
return 0;
}
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 9a6fc3ad05..35bdc19ac3 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -303,8 +303,7 @@ static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd,UINT message,UINT_PTR idEve if (CLUI_CheckOwnedByClui(ActiveWindow)) return;
CListMod_HideWindow(hwndClui, SW_HIDE);
- if (MySetProcessWorkingSetSize != NULL)
- MySetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
+ SetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
}
int cliTrayIconPauseAutoHide(WPARAM wParam,LPARAM lParam)
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 8b3084e3aa..c86934b64c 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -57,8 +57,6 @@ BOOL g_flag_bOnModulesLoadedCalled = FALSE; RECT g_rcEdgeSizingRect={0};
-BOOL (WINAPI *g_proc_SetLayeredWindowAttributesNew)(HWND,COLORREF,BYTE,DWORD);
-
/* Module global variables */
static BYTE bAlphaEnd;
@@ -290,7 +288,6 @@ HRESULT CLUI::CreateCluiFrames() }
CLUI::CLUI() :
- m_hUserDll( NULL ),
m_hDwmapiDll( NULL )
{
m_pCLUI = this;
@@ -323,22 +320,15 @@ CLUI::CLUI() : CLUI::~CLUI()
{
- FreeLibrary(m_hUserDll);
FreeLibrary(m_hDwmapiDll);
m_pCLUI = NULL;
}
HRESULT CLUI::LoadDllsRuntime()
{
- m_hUserDll = LoadLibrary(_T("user32.dll"));
- if (m_hUserDll) {
- g_proc_UpdateLayeredWindow = (BOOL (WINAPI *)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD))GetProcAddress(m_hUserDll, "UpdateLayeredWindow");
- g_proc_SetLayeredWindowAttributesNew = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(m_hUserDll, "SetLayeredWindowAttributes");
-
- g_CluiData.fLayered = (g_proc_UpdateLayeredWindow != NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
- g_CluiData.fSmoothAnimation = db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
- g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
- }
+ g_CluiData.fLayered = !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+ g_CluiData.fSmoothAnimation = db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
+ g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
if ( IsWinVerVistaPlus()) {
m_hDwmapiDll = LoadLibrary(_T("dwmapi.dll"));
@@ -470,15 +460,11 @@ HRESULT CLUI::CreateCLC() HRESULT CLUI::SnappingToEdge( WINDOWPOS *lpWindowPos )
{
- //by ZORG
- if ( MyMonitorFromWindow == NULL || MyGetMonitorInfo == NULL )
- return S_FALSE;
-
if ( db_get_b(NULL, "CLUI", "SnapToEdges", SETTING_SNAPTOEDGES_DEFAULT)) {
- HMONITOR curMonitor = MyMonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ HMONITOR curMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO monInfo;
monInfo.cbSize = sizeof(monInfo);
- MyGetMonitorInfo(curMonitor, &monInfo);
+ GetMonitorInfo(curMonitor, &monInfo);
RECT* dr = &(monInfo.rcWork);
@@ -524,7 +510,7 @@ BOOL CLUI_CheckOwnedByClui(HWND hWnd) return FALSE;
HWND hWndClui = pcli->hwndContactList;
- HWND hWndMid = fnGetAncestor(hWnd,GA_ROOTOWNER);
+ HWND hWndMid = GetAncestor(hWnd, GA_ROOTOWNER);
if (hWndMid == hWndClui)
return TRUE;
@@ -1153,9 +1139,6 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) RECT ra,r1;
HRGN treg,treg2;
- if ( !fnGetMenuBarInfo )
- return 1;
-
ClcData *dat = (ClcData*)GetWindowLongPtr(pcli->hwndContactTree,0);
if ( !dat)
return 1;
@@ -1163,7 +1146,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) GetWindowRect(hwnd, &ra);
MENUBARINFO mbi = { sizeof(MENUBARINFO) };
- fnGetMenuBarInfo(hwnd,OBJID_MENU, 0, &mbi);
+ GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
if ( !(mbi.rcBar.right-mbi.rcBar.left > 0 && mbi.rcBar.bottom-mbi.rcBar.top > 0))
return 1;
@@ -1173,7 +1156,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,r1.bottom);
if (item == 0) { //should remove item clips
for (int t = 1; t <= 2; t++) {
- fnGetMenuBarInfo(hwnd,OBJID_MENU, t, &mbi);
+ GetMenuBarInfo(hwnd, OBJID_MENU, t, &mbi);
treg2 = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom);
CombineRgn(treg,treg,treg2,RGN_DIFF);
DeleteObject(treg2);
@@ -1181,7 +1164,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) }
}
else {
- fnGetMenuBarInfo(hwnd,OBJID_MENU, item, &mbi);
+ GetMenuBarInfo(hwnd, OBJID_MENU, item, &mbi);
treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom+!db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT));
}
OffsetRgn(treg,-ra.left,-ra.top);
@@ -1524,8 +1507,8 @@ static int CLUI_SmoothAlphaThreadTransition(HWND hwnd) int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam)
{
- if ((!g_CluiData.fLayered
- && (!g_CluiData.fSmoothAnimation && !g_bTransparentFlag)) || !g_proc_SetLayeredWindowAttributesNew)
+ if (!g_CluiData.fLayered
+ && (!g_CluiData.fSmoothAnimation && !g_bTransparentFlag))
{
if (GoalAlpha>0 && wParam != 2)
{
@@ -1919,8 +1902,7 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN);
}
else db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED);
- if (MySetProcessWorkingSetSize != NULL)
- MySetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
+ SetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
}
return TRUE;
@@ -2487,12 +2469,10 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ) winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE);
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea,FALSE);
- if (MyMonitorFromWindow) {
- HMONITOR hMon = MyMonitorFromWindow(pcli->hwndContactTree, MONITOR_DEFAULTTONEAREST);
- MONITORINFO mi = { sizeof(mi) };
- if (MyGetMonitorInfo(hMon, &mi))
- rcWorkArea = mi.rcWork;
- }
+ HMONITOR hMon = MonitorFromWindow(pcli->hwndContactTree, MONITOR_DEFAULTTONEAREST);
+ MONITORINFO mi = { sizeof(mi) };
+ if (GetMonitorInfo(hMon, &mi))
+ rcWorkArea = mi.rcWork;
if (pnmc->pt.y>(rcWorkArea.bottom-rcWorkArea.top))
pnmc->pt.y = (rcWorkArea.bottom-rcWorkArea.top);
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index eda033938d..bce3cc73a3 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -145,28 +145,25 @@ int SetAlpha(BYTE Alpha) if ( !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide )
{
HWND hwnd = g_pfwFrames[i].OwnerWindow;
- if (g_proc_SetLayeredWindowAttributesNew)
+ long l;
+ l = GetWindowLongPtr(hwnd,GWL_EXSTYLE);
+ if ( !(l&WS_EX_LAYERED))
{
- long l;
- l = GetWindowLongPtr(hwnd,GWL_EXSTYLE);
- if ( !(l&WS_EX_LAYERED))
+ HWND parent = NULL;
+ if (g_CluiData.fOnDesktop)
{
- HWND parent = NULL;
- if (g_CluiData.fOnDesktop)
- {
- HWND hProgMan = FindWindow(_T("Progman"),NULL);
- if (IsWindow(hProgMan))
- parent = hProgMan;
- }
-
- CLUI_ShowWindowMod(hwnd,SW_HIDE);
- SetParent(hwnd,NULL);
- SetWindowLongPtr(hwnd,GWL_EXSTYLE,l|WS_EX_LAYERED);
- SetParent(hwnd,parent);
- if (l&WS_VISIBLE) CLUI_ShowWindowMod(hwnd,SW_SHOW);
+ HWND hProgMan = FindWindow(_T("Progman"),NULL);
+ if (IsWindow(hProgMan))
+ parent = hProgMan;
}
- g_proc_SetLayeredWindowAttributesNew(hwnd, g_CluiData.dwKeyColor,Alpha, LWA_ALPHA|LWA_COLORKEY);
+
+ CLUI_ShowWindowMod(hwnd,SW_HIDE);
+ SetParent(hwnd,NULL);
+ SetWindowLongPtr(hwnd,GWL_EXSTYLE,l|WS_EX_LAYERED);
+ SetParent(hwnd,parent);
+ if (l&WS_VISIBLE) CLUI_ShowWindowMod(hwnd,SW_SHOW);
}
+ SetLayeredWindowAttributes(hwnd, g_CluiData.dwKeyColor,Alpha, LWA_ALPHA|LWA_COLORKEY);
}
}
AniAva_RedrawAllAvatars(FALSE);
@@ -3520,7 +3517,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP static HWND CreateSubContainerWindow(HWND parent,int x,int y,int width,int height)
{
HWND hwnd;
- hwnd = CreateWindowEx(g_proc_SetLayeredWindowAttributesNew ? WS_EX_LAYERED:0, CLUIFrameSubContainerClassName,_T("SubContainerWindow"),WS_POPUP|(!g_CluiData.fLayered ? WS_BORDER : 0),x,y,width,height,parent, 0, g_hInst,0);
+ hwnd = CreateWindowEx(WS_EX_LAYERED, CLUIFrameSubContainerClassName,_T("SubContainerWindow"),WS_POPUP|(!g_CluiData.fLayered ? WS_BORDER : 0),x,y,width,height,parent, 0, g_hInst,0);
SetWindowLongPtr(hwnd,GWL_STYLE,GetWindowLongPtr(hwnd,GWL_STYLE)&~(WS_CAPTION|WS_BORDER));
if (g_CluiData.fOnDesktop)
{
diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index 08036e2669..616c7af1c1 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -42,19 +42,14 @@ static int dock_drag_dy = 0; static void Docking_GetMonitorRectFromPoint(POINT pt,RECT *rc)
{
- HMODULE hUserInstance = GetModuleHandle(_T("user32"));
+ MONITORINFO monitorInfo;
+ HMONITOR hMonitor = MonitorFromPoint(pt,MONITOR_DEFAULTTONEAREST); // always returns a valid value
+ monitorInfo.cbSize = sizeof(MONITORINFO);
- if ( MyMonitorFromPoint )
+ if (GetMonitorInfo(hMonitor, &monitorInfo))
{
- MONITORINFO monitorInfo;
- HMONITOR hMonitor = MyMonitorFromPoint(pt,MONITOR_DEFAULTTONEAREST); // always returns a valid value
- monitorInfo.cbSize = sizeof(MONITORINFO);
-
- if ( MyGetMonitorInfo(hMonitor,&monitorInfo))
- {
- CopyMemory(rc,&monitorInfo.rcMonitor,sizeof(RECT));
- return;
- }
+ CopyMemory(rc,&monitorInfo.rcMonitor,sizeof(RECT));
+ return;
}
// "generic" win95/NT support, also serves as failsafe
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index e270ee4ba9..960b5293a4 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -42,8 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SKINOBJECTSLIST g_SkinObjectList = {0};
CURRWNDIMAGEDATA * g_pCachedWindow = NULL;
-BOOL (WINAPI *g_proc_UpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
-
BOOL g_flag_bPostWasCanceled = FALSE;
BOOL g_flag_bFullRepaint = FALSE;
BOOL g_mutex_bLockUpdating = FALSE;
@@ -3543,7 +3541,7 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) //MyAlphaBlend(g_pCachedWindow->hImageDC,x+x1,y+y1,w1,h1,hdc,x1,y1,w1,h1,bf);
}
- if ( fnGetScrollBarInfo && (GetWindowLongPtr(Frame->hWnd,GWL_STYLE) & WS_VSCROLL))
+ if (GetWindowLongPtr(Frame->hWnd,GWL_STYLE) & WS_VSCROLL)
{
//Draw vertical scroll bar
//
@@ -3554,7 +3552,7 @@ static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) int dx,dy;
SCROLLBARINFO si = {0};
si.cbSize = sizeof(SCROLLBARINFO);
- fnGetScrollBarInfo(Frame->hWnd,OBJID_VSCROLL,&si);
+ GetScrollBarInfo(Frame->hWnd, OBJID_VSCROLL, &si);
rLine = (si.rcScrollBar);
rUpBtn = rLine;
rDnBtn = rLine;
@@ -3841,10 +3839,10 @@ void ske_ApplyTransluency() IsTransparancy = g_CluiData.fSmoothAnimation || g_bTransparentFlag;
if ( !g_bTransparentFlag && !g_CluiData.fSmoothAnimation && g_CluiData.bCurrentAlpha != 0)
g_CluiData.bCurrentAlpha = 255;
- if ( !g_CluiData.fLayered && (/*(g_CluiData.bCurrentAlpha == 255) || */(g_proc_SetLayeredWindowAttributesNew && IsTransparancy)))
+ if ( !g_CluiData.fLayered && IsTransparancy)
{
if ( !layered) SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
- if (g_proc_SetLayeredWindowAttributesNew) g_proc_SetLayeredWindowAttributesNew(hwnd, RGB(0, 0, 0), (BYTE)g_CluiData.bCurrentAlpha, LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)g_CluiData.bCurrentAlpha, LWA_ALPHA);
}
AniAva_RedrawAllAvatars(FALSE);
@@ -3884,13 +3882,13 @@ int ske_JustUpdateWindowImageRect(RECT *rty) dest.y = rect.top;
sz.cx = rect.right-rect.left;
sz.cy = rect.bottom-rect.top;
- if (g_proc_UpdateLayeredWindow && g_CluiData.fLayered)
+ if (g_CluiData.fLayered)
{
if ( !(GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE)&WS_EX_LAYERED))
SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) |WS_EX_LAYERED);
Sync( SetAlpha, g_CluiData.bCurrentAlpha );
- res = g_proc_UpdateLayeredWindow(pcli->hwndContactList,g_pCachedWindow->hScreenDC,&dest,&sz,g_pCachedWindow->hImageDC,&src,RGB(1,1,1),&bf,ULW_ALPHA);
+ res = UpdateLayeredWindow(pcli->hwndContactList,g_pCachedWindow->hScreenDC,&dest,&sz,g_pCachedWindow->hImageDC,&src,RGB(1,1,1),&bf,ULW_ALPHA);
g_CluiData.fAeroGlass = false;
CLUI_UpdateAeroGlass();
}
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 95f9926747..9bd0a8ade8 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -406,6 +406,6 @@ void CRTException::display() const TCHAR tszBoxMsg[500];
mir_sntprintf(tszBoxMsg, 500, _T("%s\n\n(%s)"), tszMsg, m_szParam);
- ::MessageBox(0, tszBoxMsg, _T("TabSRMM runtime error"), MB_OK | MB_ICONERROR);
+ ::MessageBox(0, tszBoxMsg, _T("Clist_nicer runtime error"), MB_OK | MB_ICONERROR);
mir_free(tszMsg);
}
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index beccc35107..cd4aed83a5 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -24,7 +24,6 @@ HINSTANCE hInst; DWORD mirandaVersion;
LCID packlcid;
HANDLE hCrashLogFolder, hVerInfoFolder;
-HMODULE hRichModule;
TCHAR* vertxt;
TCHAR* profname;
@@ -128,8 +127,6 @@ INT_PTR UploadVersionInfo(WPARAM, LPARAM lParam) INT_PTR ViewVersionInfo(WPARAM wParam, LPARAM)
{
- if (hRichModule == NULL && GetModuleHandle(TEXT("Riched20.dll")) == NULL)
- hRichModule = LoadLibrary(TEXT("Riched20.dll"));
if(hViewWnd)
{
SetForegroundWindow(hViewWnd);
@@ -368,7 +365,6 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
DestroyAllWindows();
- FreeLibrary(hRichModule);
DestroyExceptionHandler();
diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index cee6cb283c..305172a7c8 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -8,23 +8,15 @@ static PVOID exchndlr, exchndlrv; static pfnExceptionFilter threadfltr;
static PEXCEPTION_POINTERS lastptr;
-static HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
-
-tAddVectoredExceptionHandler pAddVectoredExceptionHandler = (tAddVectoredExceptionHandler)GetProcAddress(hKernel, "AddVectoredExceptionHandler");
-tRemoveVectoredExceptionHandler pRemoveVectoredExceptionHandler = (tRemoveVectoredExceptionHandler)GetProcAddress(hKernel, "RemoveVectoredExceptionHandler");
-tRtlCaptureContext pRtlCaptureContext = (tRtlCaptureContext)GetProcAddress(hKernel, "RtlCaptureContext");
-
void SetExceptionHandler(void)
{
-// if (pAddVectoredExceptionHandler && !exchndlrv)
-// exchndlrv = pAddVectoredExceptionHandler(0, myfilterv);
exchndlr = SetUnhandledExceptionFilter(myfilter);
}
void RemoveExceptionHandler(void)
{
- if (pRemoveVectoredExceptionHandler && exchndlrv)
- pRemoveVectoredExceptionHandler(exchndlrv);
+ if (exchndlrv)
+ RemoveVectoredExceptionHandler(exchndlrv);
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)exchndlr);
exchndlr = NULL;
exchndlrv = NULL;
@@ -163,13 +155,7 @@ void InvalidParameterHandler(const wchar_t*, const wchar_t*, const wchar_t*, uns CONTEXT ContextRecord = {0};
EXCEPTION_POINTERS info = { &ExceptionRecord, &ContextRecord };
- if (pRtlCaptureContext)
- pRtlCaptureContext(&ContextRecord);
- else
- {
- ContextRecord.ContextFlags = CONTEXT_ALL;
- GetThreadContext(GetCurrentThread(), &ContextRecord);
- }
+ RtlCaptureContext(&ContextRecord);
#if defined(_AMD64_)
ExceptionRecord.ExceptionAddress = (PVOID)ContextRecord.Rip;
diff --git a/plugins/CrashDumper/src/sdkstuff.h b/plugins/CrashDumper/src/sdkstuff.h index 4d160118fc..b1d8a5ad57 100644 --- a/plugins/CrashDumper/src/sdkstuff.h +++ b/plugins/CrashDumper/src/sdkstuff.h @@ -104,15 +104,3 @@ typedef struct _IMAGEHLP_MODULEW64_V2 { #ifdef DBGHELP_TRANSLATE_TCHAR
#define IMAGEHLP_MODULE64_V2 IMAGEHLP_MODULEW64_V2
#endif
-
-typedef void (WINAPI *tGetNativeSystemInfo)(LPSYSTEM_INFO);
-typedef BOOL (WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
-typedef BOOL (WINAPI *tGlobalMemoryStatusEx)(LPMEMORYSTATUSEX lpBuffer);
-typedef BOOL (WINAPI *tGetDiskFreeSpaceEx)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
-typedef LANGID (WINAPI *tGetUserDefaultUILanguage)(void);
-typedef LANGID (WINAPI *tGetSystemDefaultUILanguage)(void);
-typedef BOOL (WINAPI *tIsWow64Process)(HANDLE, PBOOL);
-typedef PVOID (WINAPI *tAddVectoredExceptionHandler)(ULONG FirstHandler, PVECTORED_EXCEPTION_HANDLER VectoredHandler);
-typedef ULONG (WINAPI *tRemoveVectoredExceptionHandler)(PVOID Handler);
-typedef BOOL (WINAPI *tIsProcessorFeaturePresent)(DWORD ProcessorFeature);
-typedef VOID (WINAPI *tRtlCaptureContext)(PCONTEXT ContextRecord);
diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 87dbe25725..13102434c3 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -18,21 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "utils.h"
-static HMODULE hKernel = GetModuleHandle(TEXT("kernel32.dll"));
-
-tGetNativeSystemInfo pGetNativeSystemInfo = (tGetNativeSystemInfo)GetProcAddress(hKernel, "GetNativeSystemInfo");
-tGetProductInfo pGetProductInfo = (tGetProductInfo) GetProcAddress(hKernel, "GetProductInfo");
-tGlobalMemoryStatusEx pGlobalMemoryStatusEx = (tGlobalMemoryStatusEx) GetProcAddress(hKernel, "GlobalMemoryStatusEx");
-tGetUserDefaultUILanguage pGetUserDefaultUILanguage = (tGetUserDefaultUILanguage) GetProcAddress(hKernel, "GetUserDefaultUILanguage");
-tGetSystemDefaultUILanguage pGetSystemDefaultUILanguage = (tGetSystemDefaultUILanguage) GetProcAddress(hKernel, "GetSystemDefaultUILanguage");
-tIsWow64Process pIsWow64Process = (tIsWow64Process) GetProcAddress(hKernel, "IsWow64Process");
-tIsProcessorFeaturePresent pIsProcessorFeaturePresent = (tIsProcessorFeaturePresent) GetProcAddress(hKernel, "IsProcessorFeaturePresent");
-
-
-tGetDiskFreeSpaceEx pGetDiskFreeSpaceEx = (tGetDiskFreeSpaceEx) GetProcAddress(hKernel, "GetDiskFreeSpaceExW");
-
-
-
void CheckForOtherCrashReportingPlugins(void)
{
HMODULE hModule = GetModuleHandle(TEXT("attache.dll"));
@@ -64,10 +49,7 @@ void GetOSDisplayString(bkstring& buffer) return;
}
- // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
- pGetNativeSystemInfo = (tGetNativeSystemInfo)GetProcAddress(hKernel, "GetNativeSystemInfo");
- if (NULL != pGetNativeSystemInfo) pGetNativeSystemInfo(&si);
- else GetSystemInfo(&si);
+ GetNativeSystemInfo(&si);
if (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4)
{
@@ -100,8 +82,7 @@ void GetOSDisplayString(bkstring& buffer) break;
}
- pGetProductInfo = (tGetProductInfo) GetProcAddress(hKernel, "GetProductInfo");
- if (pGetProductInfo != NULL) pGetProductInfo(6, 0, 0, 0, &dwType);
+ GetProductInfo(6, 0, 0, 0, &dwType);
switch(dwType)
{
@@ -472,7 +453,7 @@ void GetProcessorString(bkstring& buffer) TrimMultiSpaces(cpuName);
buffer.appendfmt(TEXT("CPU: %s [%s]"), cpuName, cpuIdent);
- if (pIsProcessorFeaturePresent && pIsProcessorFeaturePresent(PF_NX_ENABLED))
+ if (IsProcessorFeaturePresent(PF_NX_ENABLED))
buffer.append(TEXT(" [DEP Enabled]"));
SYSTEM_INFO si = {0};
@@ -485,40 +466,17 @@ void GetProcessorString(bkstring& buffer) void GetFreeMemoryString(bkstring& buffer)
{
unsigned ram;
- if (pGlobalMemoryStatusEx)
- {
- MEMORYSTATUSEX ms = {0};
- ms.dwLength = sizeof(ms);
- pGlobalMemoryStatusEx(&ms);
- ram = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
- }
- else
- {
- MEMORYSTATUS ms = {0};
- ZeroMemory(&ms, sizeof(ms));
- ms.dwLength = sizeof(ms);
- GlobalMemoryStatus(&ms);
- ram = (unsigned int)(ms.dwTotalPhys/(1024*1024))+1;
- }
+ MEMORYSTATUSEX ms = {0};
+ ms.dwLength = sizeof(ms);
+ GlobalMemoryStatusEx(&ms);
+ ram = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
buffer.appendfmt(TEXT("Installed RAM: %u MBytes"), ram);
}
void GetFreeDiskString(LPCTSTR dirname, bkstring& buffer)
{
ULARGE_INTEGER tnb, tfb, fs = {0};
- if (pGetDiskFreeSpaceEx)
- pGetDiskFreeSpaceEx(dirname, &fs, &tnb, &tfb);
- else
- {
- DWORD SectorsPerCluster, BytesPerSector;
- DWORD NumberOfFreeClusters, TotalNumberOfClusters;
-
- GetDiskFreeSpace(dirname, &SectorsPerCluster, &BytesPerSector,
- &NumberOfFreeClusters, &TotalNumberOfClusters);
-
- fs.QuadPart = BytesPerSector * SectorsPerCluster;
- fs.QuadPart *= NumberOfFreeClusters;
- }
+ GetDiskFreeSpaceEx(dirname, &fs, &tnb, &tfb);
fs.QuadPart /= (1024*1024);
buffer.appendfmt(TEXT("Free disk space on Miranda partition: %u MBytes"), fs.LowPart);
@@ -663,16 +621,8 @@ void GetLanguageString(bkstring& buffer) GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, name1, 256);
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, name2, 256);
- if (pGetUserDefaultUILanguage && pGetSystemDefaultUILanguage)
- {
- GetLocaleInfo(MAKELCID(pGetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name3, 256);
- GetLocaleInfo(MAKELCID(pGetSystemDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name4, 256);
- }
- else
- {
- _tcscpy(name3, name1);
- _tcscpy(name4, name2);
- }
+ GetLocaleInfo(MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name3, 256);
+ GetLocaleInfo(MAKELCID(GetSystemDefaultUILanguage(), SORT_DEFAULT), LOCALE_SENGLANGUAGE, name4, 256);
buffer.appendfmt(TEXT("OS Languages: (UI | Locale (User/System)) : %s/%s | %s/%s"), name3, name4, name1, name2);
}
@@ -738,12 +688,9 @@ void GetLanguagePackString(bkstring& buffer) void GetWow64String(bkstring& buffer)
{
BOOL wow64 = 0;
- if (pIsWow64Process)
+ if (!IsWow64Process(GetCurrentProcess(), &wow64))
{
- if (!pIsWow64Process(GetCurrentProcess(), &wow64))
- {
- wow64 = 0;
- }
+ wow64 = 0;
}
if (wow64) buffer.append(TEXT(" [running inside WOW64]"));
}
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 1df474c40a..1d081790de 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -490,15 +490,6 @@ static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) void ImageList_DrawDimmed(HIMAGELIST himl, int i, HDC hdc, int left, int top, UINT fStyle)
{
- typedef BOOL (WINAPI *TFnAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION);
- static TFnAlphaBlend pfnAlphaBlend = NULL;
-
- bool load_funcs = true;
- if (load_funcs) {
- pfnAlphaBlend = (TFnAlphaBlend)GetProcAddress(GetModuleHandleA("msimg32"), "AlphaBlend");
- load_funcs = false;
- }
-
int dx, dy;
ImageList_GetIconSize(himl, &dx, &dy);
@@ -507,15 +498,9 @@ void ImageList_DrawDimmed(HIMAGELIST himl, int i, HDC hdc, int left, int top, UI HBITMAP hbmOld = (HBITMAP)SelectObject(dcMem, hbm);
BitBlt(dcMem, 0, 0, dx, dx, hdc, left, top, SRCCOPY);
ImageList_Draw(himl, i, dcMem, 0, 0, fStyle);
- if (pfnAlphaBlend) {
- BLENDFUNCTION bf = {0};
- bf.SourceConstantAlpha = 180;
- pfnAlphaBlend(hdc, left, top, dx, dy, dcMem, 0, 0, dx, dy, bf);
- }
- else {
- SetStretchBltMode(hdc, HALFTONE);
- StretchBlt(hdc, left, top, dx, dy, dcMem, 0, 0, dx, dy, SRCCOPY);
- }
+ BLENDFUNCTION bf = {0};
+ bf.SourceConstantAlpha = 180;
+ GdiAlphaBlend(hdc, left, top, dx, dy, dcMem, 0, 0, dx, dy, bf);
SelectObject(dcMem, hbmOld);
DeleteObject(hbm);
DeleteDC(dcMem);
diff --git a/plugins/FloatingContacts/src/fltcont.h b/plugins/FloatingContacts/src/fltcont.h index d854e8083e..c4e98ab498 100644 --- a/plugins/FloatingContacts/src/fltcont.h +++ b/plugins/FloatingContacts/src/fltcont.h @@ -130,12 +130,6 @@ FCOptions; extern FCOptions fcOpt;
-extern BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
-extern BOOL (WINAPI *pUpdateLayeredWindow)
- (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc,
- COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
-
-
/////////////////////////////////////////////////////////////////////////////
static __forceinline BOOL ImageList_GetIconSize_my(HIMAGELIST himl, SIZE &sz)
@@ -164,9 +158,6 @@ int OnOptionsInitialize(WPARAM wParam, LPARAM lParam); /////////////////////////////////////////////////////////////////////////////
-typedef HRESULT (STDAPICALLTYPE *pfnSHAutoComplete)(HWND,DWORD);
-extern pfnSHAutoComplete fnSHAutoComplete;
-
#endif // #ifndef __FLTCONT_H__
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 4dbb233dd1..ec0e266b33 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -18,11 +18,6 @@ No warranty for any misbehaviour. #include "../Utils/mir_fonts.h"
-BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD);
-BOOL (WINAPI *pUpdateLayeredWindow)
- (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc,
- COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
-
// Globals
// TODO: move to some more approriate place, probably part of Thumbs manager
@@ -73,8 +68,6 @@ HGENMENU hMenuItemRemove, hMenuItemHideAll, hMainMenuItemHideAll; int hLangpack;
CLIST_INTERFACE *pcli;
-pfnSHAutoComplete fnSHAutoComplete;
-
//Options
FCOptions fcOpt = {0};
@@ -960,21 +953,6 @@ extern "C" int __declspec(dllexport) Load() HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
- HMODULE hUserDll = GetModuleHandleA("user32.dll");
- if (hUserDll) {
- pSetLayeredWindowAttributes =
- (BOOL (WINAPI *)(HWND, COLORREF, BYTE, DWORD))
- GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
- pUpdateLayeredWindow =
- (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))
- GetProcAddress(hUserDll, "UpdateLayeredWindow");
- }
- else {
- pSetLayeredWindowAttributes = NULL;
- pUpdateLayeredWindow = NULL;
- }
-
- fnSHAutoComplete = (pfnSHAutoComplete)GetProcAddress(GetModuleHandle(_T("shlwapi")), "SHAutoComplete");
return 0;
}
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index c28b3c767f..cd910b224d 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -192,8 +192,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_TILEV, ((bmpUse & CLBF_TILEV) ? BST_CHECKED : BST_UNCHECKED));
CheckDlgButton(hwndDlg, IDC_PROPORTIONAL, ((bmpUse & CLBF_PROPORTIONAL) ? BST_CHECKED : BST_UNCHECKED));
- if (fnSHAutoComplete)
- fnSHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
+ SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
// Windows 2K/XP
BYTE btOpacity = (BYTE)db_get_b(NULL, MODULE, "Opacity", 100);
@@ -203,8 +202,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", btOpacity);
SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), pSetLayeredWindowAttributes != 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), pSetLayeredWindowAttributes != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), SetLayeredWindowAttributes != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), SetLayeredWindowAttributes != 0);
}
return TRUE;
diff --git a/plugins/FloatingContacts/src/stdhdr.h b/plugins/FloatingContacts/src/stdhdr.h index c7a46e6f56..e5d1b328a2 100644 --- a/plugins/FloatingContacts/src/stdhdr.h +++ b/plugins/FloatingContacts/src/stdhdr.h @@ -7,6 +7,7 @@ #include <windows.h>
#include <assert.h>
#include <math.h>
+#include <Shlwapi.h>
#include <newpluginapi.h>
#include <m_system_cpp.h>
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 180637b9f5..ae14979ff0 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -470,7 +470,7 @@ void ThumbInfo::ThumbDeselect(BOOL bMouse) void ThumbInfo::SetThumbOpacity(BYTE bAlpha)
{
- if (pUpdateLayeredWindow && (bAlpha != btAlpha)) {
+ if (bAlpha != btAlpha) {
btAlpha = bAlpha;
UpdateContent();
}
@@ -673,25 +673,18 @@ void ThumbInfo::UpdateContent() SetTextColor(hdcDraw, oldColor);
SetBkMode(hdcDraw, oldBkMode);
- if (pUpdateLayeredWindow) {
- SetWindowLongPtr( hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongPtr( hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
- RECT rc; GetWindowRect(hwnd, &rc);
- POINT ptDst = {rc.left, rc.top};
- POINT ptSrc = {0, 0};
+ GetWindowRect(hwnd, &rc);
+ POINT ptDst = {rc.left, rc.top};
+ POINT ptSrc = {0, 0};
- BLENDFUNCTION blend;
- blend.BlendOp = AC_SRC_OVER;
- blend.BlendFlags = 0;
- blend.SourceConstantAlpha = 255;
- blend.AlphaFormat = AC_SRC_ALPHA;
+ blend.BlendOp = AC_SRC_OVER;
+ blend.BlendFlags = 0;
+ blend.SourceConstantAlpha = 255;
+ blend.AlphaFormat = AC_SRC_ALPHA;
- pUpdateLayeredWindow(hwnd, NULL, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
- }
- else {
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- UpdateWindow(hwnd);
- }
+ UpdateLayeredWindow(hwnd, NULL, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
}
void ThumbInfo::PopupMessageDialog( )
diff --git a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj index 5963e895dd..97af99ea28 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj +++ b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj @@ -86,7 +86,7 @@ <SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
</Link>
<ResourceCompile>
@@ -106,7 +106,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -130,7 +130,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -157,7 +157,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -174,6 +174,8 @@ </ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\Common.h" />
+ <ClInclude Include="src\constants.h" />
+ <ClInclude Include="src\EnumProc.h" />
<ClInclude Include="src\flash.h" />
<ClInclude Include="src\ignore.h" />
<ClInclude Include="src\keyboard.h" />
diff --git a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters index b30f7b3ad3..d348818f46 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters +++ b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters @@ -39,6 +39,12 @@ <ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\constants.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\EnumProc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\EnumProc.cpp">
diff --git a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj index 0e9879f5d3..3728b41dde 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj +++ b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj @@ -90,7 +90,7 @@ <SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProfileDir)..\..\bin11\lib</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
@@ -111,7 +111,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -135,7 +135,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -161,7 +161,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -177,6 +177,8 @@ </ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\Common.h" />
+ <ClInclude Include="src\constants.h" />
+ <ClInclude Include="src\EnumProc.h" />
<ClInclude Include="src\flash.h" />
<ClInclude Include="src\ignore.h" />
<ClInclude Include="src\keyboard.h" />
diff --git a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters index b30f7b3ad3..d348818f46 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters +++ b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters @@ -39,6 +39,12 @@ <ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\constants.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\EnumProc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\EnumProc.cpp">
diff --git a/plugins/KeyboardNotify/src/EnumProc.cpp b/plugins/KeyboardNotify/src/EnumProc.cpp index 8681f7d1ba..0277bdd351 100644 --- a/plugins/KeyboardNotify/src/EnumProc.cpp +++ b/plugins/KeyboardNotify/src/EnumProc.cpp @@ -24,193 +24,42 @@ BOOL WINAPI Enum16(DWORD, WORD, WORD, TCHAR *, TCHAR *, LPARAM); // Globals
-extern double dWinVer;
-extern BOOL bWindowsNT;
extern PROCESS_LIST ProcessList;
-HINSTANCE hInstLib, hInstLib2;
-HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD, DWORD);
-BOOL (WINAPI *lpfProcess32First)(HANDLE, LPPROCESSENTRY32);
-BOOL (WINAPI *lpfProcess32Next)(HANDLE, LPPROCESSENTRY32);
-BOOL (WINAPI *lpfEnumProcesses)(DWORD *, DWORD, DWORD *);
-BOOL (WINAPI *lpfEnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
-DWORD (WINAPI *lpfGetModuleBaseName)(HANDLE, HMODULE, LPTSTR, DWORD);
-INT (WINAPI *lpfVDMEnumTaskWOWEx)(DWORD, TASKENUMPROCEX, LPARAM);
-
-
-void LoadProcsLibrary(void)
-{
- if (bWindowsNT && dWinVer < 5) {
-
- if (!(hInstLib = LoadLibraryA("PSAPI.DLL")))
- return;
-
- if (!(hInstLib2 = LoadLibraryA("VDMDBG.DLL")))
- return;
-
- lpfEnumProcesses = (BOOL (WINAPI *)(DWORD *, DWORD, DWORD*)) GetProcAddress(hInstLib, "EnumProcesses");
- lpfEnumProcessModules = (BOOL (WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD)) GetProcAddress(hInstLib, "EnumProcessModules");
- lpfGetModuleBaseName = (DWORD (WINAPI *)(HANDLE, HMODULE, LPTSTR, DWORD)) GetProcAddress(hInstLib, "GetModuleBaseNameA");
-
- lpfVDMEnumTaskWOWEx = (INT (WINAPI *)(DWORD, TASKENUMPROCEX, LPARAM)) GetProcAddress(hInstLib2, "VDMEnumTaskWOWEx");
- } else {
-
- if (!(hInstLib = LoadLibraryA("Kernel32.DLL")))
- return;
-
- if (bWindowsNT && !(hInstLib2 = LoadLibraryA("VDMDBG.DLL")))
- return;
-
- lpfCreateToolhelp32Snapshot = (HANDLE (WINAPI *)(DWORD,DWORD)) GetProcAddress(hInstLib, "CreateToolhelp32Snapshot");
- lpfProcess32First = (BOOL (WINAPI *)(HANDLE,LPPROCESSENTRY32)) GetProcAddress(hInstLib, "Process32First");
- lpfProcess32Next = (BOOL (WINAPI *)(HANDLE,LPPROCESSENTRY32)) GetProcAddress(hInstLib, "Process32Next");
-
- if (bWindowsNT)
- lpfVDMEnumTaskWOWEx = (INT (WINAPI *)(DWORD, TASKENUMPROCEX, LPARAM)) GetProcAddress(hInstLib2, "VDMEnumTaskWOWEx");
- }
-}
-
-
-void UnloadProcsLibrary(void)
-{
- if (hInstLib)
- FreeLibrary(hInstLib);
- if (hInstLib2)
- FreeLibrary(hInstLib2);
-
- hInstLib = hInstLib = NULL;
- lpfCreateToolhelp32Snapshot = NULL;
- lpfProcess32First = NULL;
- lpfProcess32Next = NULL;
- lpfEnumProcesses = NULL;
- lpfEnumProcessModules = NULL;
- lpfGetModuleBaseName = NULL;
- lpfVDMEnumTaskWOWEx = NULL;
-}
-
-
BOOL areThereProcessesRunning(void)
{
HANDLE hSnapShot = NULL;
LPDWORD lpdwPIDs = NULL;
PROCESSENTRY32 procentry;
BOOL bFlag;
- DWORD dwSize;
- DWORD dwSize2;
- DWORD dwIndex;
- HMODULE hMod;
- HANDLE hProcess;
- TCHAR szFileName[MAX_PATH+1];
if (!ProcessList.count) // Process list is empty
return FALSE;
- // If Windows NT 4.0
- if (bWindowsNT && dWinVer < 5) {
-
- if (!lpfEnumProcesses || !lpfEnumProcessModules || !lpfGetModuleBaseName || !lpfVDMEnumTaskWOWEx)
- return FALSE;
-
- //
- // Call the PSAPI function EnumProcesses to get all of the ProcID's currently in the system.
- //
- // NOTE: In the documentation, the third parameter of EnumProcesses is named cbNeeded, which implies that you
- // can call the function once to find out how much space to allocate for a buffer and again to fill the buffer.
- // This is not the case. The cbNeeded parameter returns the number of PIDs returned, so if your buffer size is
- // zero cbNeeded returns zero.
- //
- // NOTE: The "HeapAlloc" loop here ensures that we actually allocate a buffer large enough for all the
- // PIDs in the system.
- //
- dwSize2 = 256 * sizeof(DWORD);
- do {
- if (lpdwPIDs) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- dwSize2 *= 2;
- }
- if (!(lpdwPIDs = (LPDWORD)HeapAlloc(GetProcessHeap(), 0, dwSize2)))
- return FALSE;
- if (!lpfEnumProcesses(lpdwPIDs, dwSize2, &dwSize)) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- return FALSE;
- }
- } while (dwSize == dwSize2);
-
- // How many ProcID's did we get?
- dwSize /= sizeof(DWORD);
-
- // Loop through each ProcID.
- for (dwIndex = 0; dwIndex < dwSize; dwIndex++) {
- TCHAR *szFileNameAux;
- szFileName[0] = '\0';
-
- // Open the process (if we can... security does not permit every process in the system to be opened).
- hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, lpdwPIDs[dwIndex]);
- if (hProcess) {
- // Here we call EnumProcessModules to get only the first module in the process. This will be the
- // EXE module for which we will retrieve the name.
- if (lpfEnumProcessModules(hProcess, &hMod, sizeof(hMod), &dwSize2)) {
- // Get the module name
- if (!lpfGetModuleBaseName(hProcess, hMod, szFileName, sizeof(szFileName)))
- szFileName[0] = '\0';
- }
- CloseHandle(hProcess);
- }
- szFileNameAux = filename(szFileName);
-
- // Search szFileName in user-defined list
- if (findFilename(szFileNameAux)) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- return TRUE;
- }
-
- // Did we just bump into an NTVDM?
- if (!_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
- BOOL bFound = FALSE;
-
- // Enum the 16-bit stuff.
- lpfVDMEnumTaskWOWEx(lpdwPIDs[dwIndex], (TASKENUMPROCEX) Enum16, (LPARAM)&bFound);
-
- // Did we find any user-defined process?
- if (bFound) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- return TRUE;
- }
- }
- }
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
-
- // If any OS other than Windows NT 4.0.
- } else {
-
- if (!lpfProcess32Next || !lpfProcess32First || !lpfCreateToolhelp32Snapshot)
- return FALSE;
-
- // Get a handle to a Toolhelp snapshot of all processes.
- if ((hSnapShot = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) == INVALID_HANDLE_VALUE)
- return FALSE;
+ // Get a handle to a Toolhelp snapshot of all processes.
+ if ((hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) == INVALID_HANDLE_VALUE)
+ return FALSE;
- // While there are processes, keep looping.
- for (procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=lpfProcess32First(hSnapShot, &procentry); bFlag; procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=lpfProcess32Next(hSnapShot, &procentry)) {
- TCHAR *szFileNameAux = filename(procentry.szExeFile);
+ // While there are processes, keep looping.
+ for (procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=Process32First(hSnapShot, &procentry); bFlag; procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=Process32Next(hSnapShot, &procentry)) {
+ TCHAR *szFileNameAux = filename(procentry.szExeFile);
- // Search szFileName in user-defined list
- if (findFilename(szFileNameAux))
- return TRUE;
+ // Search szFileName in user-defined list
+ if (findFilename(szFileNameAux))
+ return TRUE;
- // Did we just bump into an NTVDM?
- if (lpfVDMEnumTaskWOWEx && !_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
- BOOL bFound = FALSE;
+ // Did we just bump into an NTVDM?
+ if (!_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
+ BOOL bFound = FALSE;
- // Enum the 16-bit stuff.
- lpfVDMEnumTaskWOWEx(procentry.th32ProcessID, (TASKENUMPROCEX)Enum16, (LPARAM)&bFound);
+ // Enum the 16-bit stuff.
+ VDMEnumTaskWOWEx(procentry.th32ProcessID, (TASKENUMPROCEX)Enum16, (LPARAM)&bFound);
- // Did we find any user-defined process?
- if (bFound)
- return TRUE;
- }
- }
+ // Did we find any user-defined process?
+ if (bFound)
+ return TRUE;
+ }
}
return FALSE;
diff --git a/plugins/KeyboardNotify/src/EnumProc.h b/plugins/KeyboardNotify/src/EnumProc.h index 3770d7b694..489ce06fd6 100644 --- a/plugins/KeyboardNotify/src/EnumProc.h +++ b/plugins/KeyboardNotify/src/EnumProc.h @@ -21,7 +21,4 @@ typedef struct { TCHAR **szFileName;
} PROCESS_LIST;
-
-void LoadProcsLibrary(void);
-void UnloadProcsLibrary(void);
BOOL areThereProcessesRunning(void);
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 074b1236b9..645ea4b192 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -25,10 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static const DWORD ignoreIdToPf1[IGNOREEVENT_MAX] = {PF1_IMRECV, PF1_URLRECV, PF1_FILERECV, 0xFFFFFFFF};
-extern double dWinVer;
-extern BOOL bWindowsNT;
-
-
static DWORD GetMask(HANDLE hContact)
{
DWORD mask = db_get_dw(hContact, KEYBDMODULE, "Mask1", (DWORD)(-1));
@@ -214,7 +210,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA TranslateDialogDefault(hwndDlg);
{ int i;
HIMAGELIST hIml;
- hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ((bWindowsNT && dWinVer >= 5.01)?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, 3+IGNOREEVENT_MAX, 3+IGNOREEVENT_MAX);
+ hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3+IGNOREEVENT_MAX, 3+IGNOREEVENT_MAX);
ImageList_AddIcon(hIml, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SMALLDOT)));
ImageList_AddIcon(hIml, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FILLEDBLOB)));
ImageList_AddIcon(hIml, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_EMPTYBLOB)));
diff --git a/plugins/KeyboardNotify/src/keyboard.cpp b/plugins/KeyboardNotify/src/keyboard.cpp index b0a6761738..3ce6d8cba3 100644 --- a/plugins/KeyboardNotify/src/keyboard.cpp +++ b/plugins/KeyboardNotify/src/keyboard.cpp @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Common.h"
// Globals
-extern BOOL bWindowsNT;
extern BYTE bEmulateKeypresses;
HANDLE hKbdDev[10] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
@@ -51,9 +50,6 @@ BOOL OpenKeyboardDevice() int i = 0;
TCHAR aux1[MAX_PATH+1], aux2[MAX_PATH+1];
- if (!bWindowsNT)
- return TRUE;
-
do {
mir_sntprintf(aux1, SIZEOF(aux1), _T("Kbd%d"), i);
mir_sntprintf(aux2, SIZEOF(aux2), _T("\\Device\\KeyboardClass%d"), i);
@@ -77,13 +73,6 @@ BOOL ToggleKeyboardLights(BYTE byte) if (bEmulateKeypresses)
return keypresses_ToggleKeyboardLights(byte);
- if (!bWindowsNT) {
- outportb(0x60, 0xED);
- Sleep(10);
- outportb(0x60, byte);
- return TRUE;
- }
-
InputBuffer.UnitId = 0;
InputBuffer.LedFlags = byte;
@@ -98,9 +87,6 @@ void CloseKeyboardDevice() int i = 0;
TCHAR aux[MAX_PATH+1];
- if (!bWindowsNT)
- return;
-
do {
if (hKbdDev[i] != INVALID_HANDLE_VALUE)
CloseHandle(hKbdDev[i]);
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index b961c3b132..860b03ae92 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -68,9 +68,6 @@ BYTE bEmulateKeypresses = 0; DWORD dwLastInput = 0;
POINT lastGlobalMousePos = {0, 0};
-static BOOL (WINAPI * MyGetLastInputInfo)(PLASTINPUTINFO);
-
-
BYTE bFlashOnMsg;
BYTE bFlashOnURL;
BYTE bFlashOnFile;
@@ -104,9 +101,6 @@ BYTE bTrillianLedsOther; PROTOCOL_LIST ProtoList = {0, NULL};
PROCESS_LIST ProcessList = {0, NULL};
-double dWinVer;
-BOOL bWindowsNT;
-
int nWaitDelay;
unsigned int nExternCount = 0;
BOOL bFlashingEnabled = TRUE;
@@ -178,25 +172,10 @@ BOOL checkOpenWindow(HANDLE hContact) return FALSE;
}
-
-BOOL IsSaverOnNT4()
-{
- HDESK hd = OpenDesktop(_T("screen-saver"), 0, FALSE, MAXIMUM_ALLOWED);
-
- if(hd == NULL)
- return GetLastError()==ERROR_ACCESS_DENIED;
-
- CloseDesktop(hd);
- return TRUE;
-}
-
-
BOOL isScreenSaverRunning()
{
BOOL screenSaverIsRunning=FALSE;
- if (bWindowsNT && dWinVer < 5) return IsSaverOnNT4();
-
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &screenSaverIsRunning, FALSE);
return screenSaverIsRunning;
}
@@ -208,8 +187,6 @@ BOOL isWorkstationLocked() HDESK hd;
char buf[MAX_PATH];
- if (!bWindowsNT) return FALSE;
-
hd = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED); /* if it fails then the workstation is prolly locked anyway */
if (hd == NULL) return TRUE;
GetUserObjectInformation(hd, UOI_NAME, buf, sizeof(buf), NULL); /* if we got it (hmm,) get a name */
@@ -410,11 +387,11 @@ static void FlashThreadFunction() if ((bFlashUntil & UNTIL_NBLINKS) && GetTickCount() > (dwFlashStarted + wBlinksNumber * 1000))
break;
if (bFlashUntil & UNTIL_REATTENDED) {
- if (bMirandaOrWindows == ACTIVE_WINDOWS && MyGetLastInputInfo && !bEmulateKeypresses) {
+ if (bMirandaOrWindows == ACTIVE_WINDOWS && !bEmulateKeypresses) {
LASTINPUTINFO lii;
ZeroMemory(&lii, sizeof(lii));
lii.cbSize = sizeof(lii);
- MyGetLastInputInfo(&lii);
+ GetLastInputInfo(&lii);
dwLastInput = lii.dwTime;
}
if (dwLastInput > dwEventStarted)
@@ -706,7 +683,7 @@ void LoadSettings(void) bFlashOnOther = db_get_b(NULL, KEYBDMODULE, "onother", DEF_SETTING_OTHER);
bFullScreenMode = db_get_b(NULL, KEYBDMODULE, "fscreenmode", DEF_SETTING_FSCREEN);
bScreenSaverRunning = db_get_b(NULL, KEYBDMODULE, "ssaverrunning", DEF_SETTING_SSAVER);
- bWorkstationLocked = (bWindowsNT ? db_get_b(NULL, KEYBDMODULE, "wstationlocked", DEF_SETTING_LOCKED):0);
+ bWorkstationLocked = db_get_b(NULL, KEYBDMODULE, "wstationlocked", DEF_SETTING_LOCKED);
bProcessesAreRunning = db_get_b(NULL, KEYBDMODULE, "procsrunning", DEF_SETTING_PROCS);
bWorkstationActive = db_get_b(NULL, KEYBDMODULE, "wstationactive", DEF_SETTING_ACTIVE);
bFlashIfMsgOpen = db_get_b(NULL, KEYBDMODULE, "ifmsgopen", DEF_SETTING_IFMSGOPEN);
@@ -776,8 +753,6 @@ void GetWindowsVersion(void) if (!GetVersionEx((OSVERSIONINFO *)&osvi))
osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
}
- bWindowsNT = osvi.dwPlatformId==VER_PLATFORM_WIN32_NT;
- dWinVer = osvi.dwMajorVersion + osvi.dwMinorVersion / 10.0;
}
@@ -869,12 +844,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
TCHAR eventPrefix[MAX_PATH+1], eventName[MAX_PATH+1];
- LoadProcsLibrary();
- if (bWindowsNT && dWinVer >= 5)
- MyGetLastInputInfo = (BOOL (WINAPI *)(PLASTINPUTINFO)) GetProcAddress(GetModuleHandle(_T("user32")), "GetLastInputInfo");
- else
- MyGetLastInputInfo = NULL;
-
createProtocolList();
LoadSettings();
@@ -972,7 +941,6 @@ extern "C" __declspec(dllexport) int Unload(void) RestoreLEDState();
CloseKeyboardDevice();
- UnloadProcsLibrary();
destroyProcessList();
destroyProtocolList();
@@ -989,7 +957,7 @@ int HookWindowsHooks() if (bFlashUntil & UNTIL_REATTENDED)
switch (bMirandaOrWindows) {
case ACTIVE_WINDOWS:
- if (!MyGetLastInputInfo || bEmulateKeypresses) {
+ if (bEmulateKeypresses) {
if (hMouseHook == NULL)
hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, 0, GetCurrentThreadId());
if (hKeyBoardHook == NULL)
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index e72491c63a..54064e9065 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -40,8 +40,6 @@ void destroyXstatusListAux(void); extern HINSTANCE hInst;
-extern double dWinVer;
-extern BOOL bWindowsNT;
extern BYTE bFlashOnMsg;
extern BYTE bFlashOnURL;
@@ -317,8 +315,6 @@ INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SSAVER, bScreenSaverRunning ? BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOCKED, bWorkstationLocked ? BST_CHECKED:BST_UNCHECKED);
- if (!bWindowsNT)
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOCKED), FALSE);
CheckDlgButton(hwndDlg, IDC_PGMS, bProcessesAreRunning ? BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ACTIVE, bWorkstationActive ? BST_CHECKED:BST_UNCHECKED);
@@ -1362,7 +1358,7 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count)
imageCount += XstatusListAux[i].count;
- hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (bWindowsNT && dWinVer >= 5.01?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, imageCount, imageCount);
+ hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, imageCount, imageCount);
TreeView_SetImageList(hwndTree, hImageList, TVSIL_NORMAL);
ImageList_AddIcon(hImageList, hIconAux=(HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0));
diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index e7a80c94a1..e6b87adf42 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -28,9 +28,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) hInst = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
-
- extern bool VistaOrLater;
- VistaOrLater = GetProcAddress( GetModuleHandleA("kernel32.dll"), "GetProductInfo") != NULL;
}
return TRUE;
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 24dd32f9c1..ef08c5afcf 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -4,8 +4,6 @@ #pragma comment(lib, "rpcrt4.lib")
-bool VistaOrLater;
-
int DllFactoryCount, DllObjectCount;
struct TCMInvokeCommandInfo
@@ -563,7 +561,7 @@ HRESULT RemoveCOMRegistryEntries() void CheckUnregisterServer()
{
- if (VistaOrLater) {
+ if (IsWinVerVistaPlus) {
// launches regsvr to remove the dll under admin.
TCHAR szFileName[MAX_PATH], szBuf[MAX_PATH * 2];
GetModuleFileName(hInst, szFileName, SIZEOF(szFileName));
@@ -591,7 +589,7 @@ void CheckRegisterServer() HKEY hRegKey;
if ( !RegOpenKeyExA(HKEY_CLASSES_ROOT, "miranda.shlext", 0, KEY_READ, &hRegKey))
RegCloseKey(hRegKey);
- else if (VistaOrLater) {
+ else if (IsWinVerVistaPlus) {
MessageBoxA(0,
"Shell context menus requires your permission to register with Windows Explorer (one time only).",
"Miranda NG - Shell context menus (shellext.dll)", MB_OK | MB_ICONINFORMATION);
diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index aa59059208..e41f027ce9 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -212,7 +212,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum mii.dwTypeData = pg->szGroup;
// For Vista + let the system draw the theme && icons, pct = contact associated data
- if (VistaOrLater && pct != NULL && psd != NULL) {
+ if (IsWinVerVistaPlus && pct != NULL && psd != NULL) {
mii.fMask = MIIM_BITMAP | MIIM_FTYPE | MIIM_ID | MIIM_DATA | MIIM_STRING;
// BuildSkinIcons() built an array of bitmaps which we can use here
mii.hbmpItem = psd->hStatusBitmap;
@@ -237,7 +237,7 @@ int __stdcall ClearMRUIPC( void RemoveCheckmarkSpace(HMENU HMENU)
{
- if (!VistaOrLater)
+ if (!IsWinVerVistaPlus)
return;
MENUINFO mi;
@@ -473,7 +473,7 @@ static void BuildMenus(TEnumData *lParam) // allocate display info/memory for "Miranda" string
mii.cbSize = sizeof(MENUITEMINFO);
- if (VistaOrLater)
+ if (IsWinVerVistaPlus)
mii.fMask = MIIM_ID | MIIM_DATA | MIIM_FTYPE | MIIM_SUBMENU | MIIM_STRING | MIIM_BITMAP;
else
mii.fMask = MIIM_ID | MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
@@ -532,7 +532,7 @@ static void BuildMenus(TEnumData *lParam) static void BuildSkinIcons(TEnumData *lParam)
{
- IWICImagingFactory *factory = (VistaOrLater) ? ARGB_GetWorker() : NULL;
+ IWICImagingFactory *factory = (IsWinVerVistaPlus) ? ARGB_GetWorker() : NULL;
TSlotIPC *pct = lParam->ipch->NewIconsBegin;
TShellExt *Self = lParam->Self;
@@ -550,7 +550,7 @@ static void BuildSkinIcons(TEnumData *lParam) // with the shell object.
for (int j = 0; j < 10; j++) {
- if (VistaOrLater) {
+ if (IsWinVerVistaPlus) {
d->hBitmaps[j] = ARGB_BitmapFromIcon(factory, Self->hMemDC, p->hIcons[j]);
d->hIcons[j] = NULL;
}
@@ -654,7 +654,7 @@ HRESULT TShellExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFirs }
// if we're using Vista (or later), the ownerdraw code will be disabled, because the system draws the icons.
- if (VistaOrLater)
+ if (IsWinVerVistaPlus)
bMF_OWNERDRAW = false;
HANDLE hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, IPC_PACKET_SIZE, IPC_PACKET_NAME);
@@ -901,7 +901,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU MEASUREITEMSTRUCT *msi = (MEASUREITEMSTRUCT*)lParam;
TMenuDrawInfo *psd = (TMenuDrawInfo*)msi->itemData;
NONCLIENTMETRICS ncm;
- ncm.cbSize = (VistaOrLater) ? sizeof(ncm) : offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
+ ncm.cbSize = (IsWinVerVistaPlus) ? sizeof(ncm) : offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
// create the font used in menus, this font should be cached somewhere really
HFONT hFont = CreateFontIndirect(&ncm.lfMenuFont);
diff --git a/plugins/ShellExt/src/stdafx.h b/plugins/ShellExt/src/stdafx.h index 1a0f2574f0..bf47755b11 100644 --- a/plugins/ShellExt/src/stdafx.h +++ b/plugins/ShellExt/src/stdafx.h @@ -47,7 +47,6 @@ HRESULT RemoveCOMRegistryEntries(); extern HINSTANCE hInst;
extern HANDLE hLogger;
extern int DllFactoryCount, DllObjectCount;
-extern bool VistaOrLater;
int OnOptionsInit(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index 566e0c01d1..56ae26d20d 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -58,11 +58,6 @@ TAAAProtoSetting::~TAAAProtoSetting() /////////////////////////////////////////////////////////////////////////////////////////
-typedef HDESK (WINAPI* pfnOpenInputDesktop)( DWORD, BOOL, DWORD );
-static pfnOpenInputDesktop openInputDesktop = NULL;
-typedef HDESK (WINAPI* pfnCloseDesktop)( HDESK );
-static pfnCloseDesktop closeDesktop = NULL;
-
extern HANDLE hStateChangedEvent;
static BOOL ignoreLockKeys = FALSE;
@@ -86,7 +81,6 @@ static UINT_PTR hAutoAwayTimer; // prototypes
extern DWORD StatusModeToProtoFlag(int status);
extern int InitCommonStatus();
-static BOOL (WINAPI * MyGetLastInputInfo)(PLASTINPUTINFO);
void LoadOptions(TAAAProtoSetting** loadSettings, BOOL override);
static int HookWindowsHooks(int hookMiranda, int hookAll);
static int UnhookWindowsHooks();
@@ -135,7 +129,7 @@ void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override) if (!override) {
if (loadSettings[i].optionFlags & FLAG_MONITORMIRANDA)
monitorMiranda = TRUE;
- else if ( (MyGetLastInputInfo==NULL) || ignoreLockKeys || ignoreSysKeys || ignoreAltCombo || (monitorMouse != monitorKeyboard))
+ else if (ignoreLockKeys || ignoreSysKeys || ignoreAltCombo || (monitorMouse != monitorKeyboard))
monitorAll = TRUE;
} }
@@ -221,13 +215,11 @@ static BOOL IsWorkstationLocked (void) {
BOOL rc = FALSE;
- if (openInputDesktop != NULL) {
- HDESK hDesk = openInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if (hDesk == NULL)
- rc = TRUE;
- else if (closeDesktop != NULL)
- closeDesktop(hDesk);
- }
+ HDESK hDesk = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
+ if (hDesk == NULL)
+ rc = TRUE;
+ else
+ CloseDesktop(hDesk);
return rc;
}
@@ -291,13 +283,10 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD if ( aas.optionFlags & FLAG_MONITORMIRANDA )
mouseStationaryTimer = (GetTickCount() - lastMirandaInput)/1000;
else {
- if (MyGetLastInputInfo!=NULL) {
- LASTINPUTINFO lii = { 0 };
- lii.cbSize = sizeof(lii);
- MyGetLastInputInfo(&lii);
- mouseStationaryTimer = (GetTickCount()-lii.dwTime)/1000;
- }
- else mouseStationaryTimer = (GetTickCount() - lastInput)/1000;
+ LASTINPUTINFO lii = { 0 };
+ lii.cbSize = sizeof(lii);
+ GetLastInputInfo(&lii);
+ mouseStationaryTimer = (GetTickCount()-lii.dwTime)/1000;
}
int sts1Time = aas.awayTime * SECS_PER_MINUTE;
@@ -422,7 +411,6 @@ static int HookWindowsHooks(int hookMiranda, int hookAll) hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE,MirandaMouseHookFunction,NULL,GetCurrentThreadId());
}
if (hookAll) {
- MyGetLastInputInfo=NULL;
if ( monitorKeyboard && hKeyBoardHook == NULL )
hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, 0, GetCurrentThreadId());
if ( monitorMouse && hMouseHook == NULL )
@@ -583,15 +571,6 @@ static int AutoAwayShutdown(WPARAM wParam,LPARAM lParam) int CSModuleLoaded(WPARAM wParam, LPARAM lParam)
{
- HMODULE hUser32 = GetModuleHandleA("user32");
- openInputDesktop = ( pfnOpenInputDesktop )GetProcAddress (hUser32, "OpenInputDesktop");
- closeDesktop = ( pfnCloseDesktop )GetProcAddress (hUser32, "CloseDesktop");
-
- if (!db_get_b(NULL, MODULENAME, SETTING_IGNLOCK, FALSE))
- MyGetLastInputInfo = (BOOL (WINAPI *)(PLASTINPUTINFO))GetProcAddress(GetModuleHandleA("user32"),"GetLastInputInfo");
- else
- MyGetLastInputInfo = NULL;
-
HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged);
HookEvent(ME_OPT_INITIALISE, AutoAwayOptInitialise);
HookEvent(ME_SYSTEM_PRESHUTDOWN, AutoAwayShutdown);
|