diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-21 21:58:47 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-21 21:58:47 +0000 |
commit | 7c0fdf0c457d55b6bfdda0282cf5099057c715c7 (patch) | |
tree | 31389d750c1fb6a6e7ecdd9279d32c238a50ff62 /plugins/AutoShutdown | |
parent | 4d970faf406c59e807a9ffd4d7a51f1aaad6636a (diff) |
Not needed version checks removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@6172 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoShutdown')
-rw-r--r-- | plugins/AutoShutdown/src/cpuusage.cpp | 12 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/frame.cpp | 60 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/shutdownsvc.cpp | 16 |
3 files changed, 39 insertions, 49 deletions
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp index d99be4a6fe..8ab1fa91c0 100644 --- a/plugins/AutoShutdown/src/cpuusage.cpp +++ b/plugins/AutoShutdown/src/cpuusage.cpp @@ -90,15 +90,9 @@ static void WinNT_PollThread(void *vparam) LARGE_INTEGER liPrevCounterValue={0},liCurrentCounterValue={0},liPrevPerfTime100nSec={0};
/* init */
- if(IsWinVer2000Plus()) { /* Win2000+: */
- dwObjectId=238; /*'Processor' object */
- dwCounterId=6; /* '% processor time' counter */
- pwszInstanceName=L"_Total"; /* '_Total' instance */
- } else { /* WinNT4: */
- dwObjectId=2; /* 'System' object */
- dwCounterId=240; /* '% Total processor time' counter */
- pwszInstanceName=NULL;
- }
+ dwObjectId=238; /*'Processor' object */
+ dwCounterId=6; /* '% processor time' counter */
+ pwszInstanceName=L"_Total"; /* '_Total' instance */
_itot_s(dwObjectId, wszValueName, 10);
fSwitched = WinNT_PerfStatsSwitch(_T("PerfOS"), FALSE);
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index 3e8262d7fa..04b0a10422 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -180,38 +180,36 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA NULL);
if(dat->hwndTime==NULL) return -1; /* creation failed, calls WM_DESTROY */
/* create tooltips */
- if(IsWinVer98Plus() || IsWinVer2000Plus()) {
- TTTOOLINFO ti;
- dat->hwndToolTip=CreateWindowEx(WS_EX_TOPMOST,
- TOOLTIPS_CLASS,
- NULL,
- WS_POPUP|TTS_ALWAYSTIP|TTS_NOPREFIX,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- hwndFrame,
- NULL,
- params->hInstance,
- NULL);
- if(dat->hwndToolTip!=NULL) {
- SetWindowPos(dat->hwndToolTip,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
- ZeroMemory(&ti,sizeof(ti));
- ti.cbSize=sizeof(ti);
- ti.hwnd=hwndFrame;
- ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT;
- ti.lpszText=LPSTR_TEXTCALLBACK; /* commctl 4.70+ */
- ti.uId=(UINT)dat->hwndTime; /* in-place tooltip */
+ TTTOOLINFO ti;
+ dat->hwndToolTip=CreateWindowEx(WS_EX_TOPMOST,
+ TOOLTIPS_CLASS,
+ NULL,
+ WS_POPUP|TTS_ALWAYSTIP|TTS_NOPREFIX,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ hwndFrame,
+ NULL,
+ params->hInstance,
+ NULL);
+ if(dat->hwndToolTip!=NULL) {
+ SetWindowPos(dat->hwndToolTip,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ ZeroMemory(&ti,sizeof(ti));
+ ti.cbSize=sizeof(ti);
+ ti.hwnd=hwndFrame;
+ ti.uFlags=TTF_IDISHWND|TTF_SUBCLASS|TTF_TRANSPARENT;
+ ti.lpszText=LPSTR_TEXTCALLBACK; /* commctl 4.70+ */
+ ti.uId=(UINT)dat->hwndTime; /* in-place tooltip */
+ SendMessage(dat->hwndToolTip,TTM_ADDTOOL,0,(LPARAM)&ti);
+ ti.uFlags&=~TTF_TRANSPARENT;
+ ti.uId=(UINT)dat->hwndProgress;
+ SendMessage(dat->hwndToolTip,TTM_ADDTOOL,0,(LPARAM)&ti);
+ if(dat->hwndDesc!=NULL) {
+ ti.uId=(UINT)dat->hwndDesc;
SendMessage(dat->hwndToolTip,TTM_ADDTOOL,0,(LPARAM)&ti);
- ti.uFlags&=~TTF_TRANSPARENT;
- ti.uId=(UINT)dat->hwndProgress;
+ }
+ if(dat->hwndIcon!=NULL) {
+ ti.uId=(UINT)dat->hwndIcon;
SendMessage(dat->hwndToolTip,TTM_ADDTOOL,0,(LPARAM)&ti);
- if(dat->hwndDesc!=NULL) {
- ti.uId=(UINT)dat->hwndDesc;
- SendMessage(dat->hwndToolTip,TTM_ADDTOOL,0,(LPARAM)&ti);
- }
- if(dat->hwndIcon!=NULL) {
- ti.uId=(UINT)dat->hwndIcon;
- SendMessage(dat->hwndToolTip,TTM_ADDTOOL,0,(LPARAM)&ti);
- }
}
}
/* init layout */
@@ -471,7 +469,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA if(((NMHDR*)lParam)->hwndFrom==dat->hwndToolTip)
switch(((NMHDR*)lParam)->code) {
case TTN_SHOW: /* 'in-place' tooltip on dat->hwndTime */
- if(dat->flags&FWPDF_TIMEISCLIPPED && (HWND)wParam==dat->hwndTime && IsWinVer2000Plus()) {
+ if(dat->flags&FWPDF_TIMEISCLIPPED && (HWND)wParam==dat->hwndTime) {
RECT rc;
if(GetWindowRect(dat->hwndTime,&rc)) {
SetWindowLongPtr(dat->hwndToolTip, GWL_STYLE, GetWindowLongPtr(dat->hwndToolTip, GWL_STYLE) | TTS_NOANIMATE);
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index d22ed2e2f3..4228b56b32 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -94,7 +94,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) }
}
/* test privilege */
- if(bReturn && IsWinVerNT()) {
+ if(bReturn) {
bReturn=WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE);
if(bReturn) WinNT_SetPrivilege(SE_SHUTDOWN_NAME,FALSE);
}
@@ -127,7 +127,7 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) RegCloseKey(hKey);
}
}
- else if(IsWinVerNT()) /* for WinNT4 */
+ else
bReturn=SearchPath(NULL,_T("LOGIN.SCR"),NULL,0,NULL,NULL)!=0;
}
break;
@@ -142,11 +142,9 @@ static BOOL IsShutdownTypeEnabled(BYTE shutdownType) case SDSDT_REBOOT:
case SDSDT_SHUTDOWN:
/* test privileges */
- if(IsWinVerNT()) {
- bReturn=WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE);
- if(bReturn) WinNT_SetPrivilege(SE_SHUTDOWN_NAME,FALSE);
- }
- else bReturn=TRUE;
+ bReturn=WinNT_SetPrivilege(SE_SHUTDOWN_NAME,TRUE);
+ if(bReturn)
+ WinNT_SetPrivilege(SE_SHUTDOWN_NAME,FALSE);
break;
}
return bReturn;
@@ -192,7 +190,7 @@ static DWORD ShutdownNow(BYTE shutdownType) if(pfnLockWorkStation!=NULL) /* Win2000+ */
if(!pfnLockWorkStation() && !WinNT_IsWorkStationLocked())
dwErrCode=GetLastError();
- else if(IsWinVerNT()) { /* WinNT4 */
+ else {
HKEY hKey;
/* start LOGON.SCR screensaver (locks workstation on NT4) */
if(!SearchPath(NULL,_T("LOGIN.SCR"),NULL,0,NULL,NULL)) {
@@ -332,7 +330,7 @@ static DWORD ShutdownNow(BYTE shutdownType) case SDSDT_REBOOT: flags=EWX_REBOOT; break;
default: flags=EWX_SHUTDOWN|EWX_POWEROFF;
}
- if(shutdownType==SDSDT_LOGOFF && IsWinVer2000Plus() && !WinNT_IsWorkStationLocked())
+ if(shutdownType==SDSDT_LOGOFF && !WinNT_IsWorkStationLocked())
flags|=EWX_FORCEIFHUNG; /* only considered for WM_ENDSESSION messages */
else flags|=EWX_FORCE; /* must be used when workstation locked */
|