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/utils.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'plugins/AutoShutdown/src/utils.cpp') 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