From 4917567d0e33f20b07b004c368cd66e301115db0 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 23 Sep 2013 15:13:53 +0000 Subject: small plugins cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6193 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoShutdown/src/common.h | 1 + plugins/AutoShutdown/src/utils.cpp | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'plugins/AutoShutdown/src') diff --git a/plugins/AutoShutdown/src/common.h b/plugins/AutoShutdown/src/common.h index 8752f1d0aa..2eae1b9bab 100644 --- a/plugins/AutoShutdown/src/common.h +++ b/plugins/AutoShutdown/src/common.h @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include /* for mktime(),time() */ #include #include +#include /* WinXP+: shutdown reason codes */ #if defined(EWX_RESTARTAPPS) /* new MS Platform SDK */ diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 18c893a77d..b510fbd17c 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -160,15 +160,10 @@ BOOL TimeStampToSystemTime(time_t timestamp,SYSTEMTIME *st) BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown) { static BOOL fInited=FALSE; - static int (WINAPI *pfnStrFromTimeInterval)(TCHAR*,UINT,DWORD,int); static int (WINAPI *pfnGetDurationFormat)(LCID,DWORD,const SYSTEMTIME*,double,WCHAR*,WCHAR*,int); /* Init */ - if(!fInited) { + if(!fInited && IsWinVerVistaPlus()) { *(PROC*)&pfnGetDurationFormat=GetProcAddress(GetModuleHandleA("KERNEL32"),"GetDurationFormat"); - if(pfnGetDurationFormat==NULL) { - HMODULE hShlwDLL=LoadLibraryA("SHLWAPI"); /* all ascii */ - *(PROC*)&pfnStrFromTimeInterval=GetProcAddress(hShlwDLL,"StrFromTimeIntervalW"); - } fInited=TRUE; } /* WinVista */ @@ -180,10 +175,9 @@ BOOL GetFormatedCountdown(TCHAR *pszOut,int nSize,time_t countdown) if(pfnGetDurationFormat(locale,0,&st,0,NULL,pszOut,nSize)) return TRUE; return FALSE; - } + } else /* Win9x/NT/XP */ - if(pfnStrFromTimeInterval!=NULL) - return pfnStrFromTimeInterval(pszOut,nSize,(countdown>(MAXDWORD/1000))?MAXDWORD:(countdown*1000),10)!=0; + return StrFromTimeInterval(pszOut,nSize,(countdown>(MAXDWORD/1000))?MAXDWORD:(countdown*1000),10)!=0; return FALSE; } -- cgit v1.2.3