1 #pragma once 2 3 #include <windef.h> 4 #include <atlstr.h> 5 6 #define EPOCH_DIFF 116444736000000000 //FILETIME starts from 1601-01-01 UTC, UnixTime starts from 1970-01-01 7 #define RATE_DIFF 10000000 8 9 #ifdef _M_IX86 10 #define CurrentArchitecture L"x86" 11 #elif defined(_M_AMD64) 12 #define CurrentArchitecture L"amd64" 13 #elif defined(_M_ARM) 14 #define CurrentArchitecture L"arm" 15 #elif defined(_M_ARM64) 16 #define CurrentArchitecture L"arm64" 17 #elif defined(_M_IA64) 18 #define CurrentArchitecture L"ia64" 19 #elif defined(_M_PPC) 20 #define CurrentArchitecture L"ppc" 21 #endif 22 23 INT GetWindowWidth(HWND hwnd); 24 INT GetWindowHeight(HWND hwnd); 25 INT GetClientWindowWidth(HWND hwnd); 26 INT GetClientWindowHeight(HWND hwnd); 27 28 VOID CopyTextToClipboard(LPCWSTR lpszText); 29 VOID ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem); 30 VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem); 31 BOOL StartProcess(ATL::CStringW &Path, BOOL Wait); 32 BOOL StartProcess(LPWSTR lpPath, BOOL Wait); 33 BOOL GetStorageDirectory(ATL::CStringW &lpDirectory); 34 35 VOID InitLogs(); 36 VOID FreeLogs(); 37 BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg); 38 BOOL GetInstalledVersion(ATL::CStringW *pszVersion, const ATL::CStringW &szRegName); 39 40 BOOL ExtractFilesFromCab(const ATL::CStringW& szCabName, 41 const ATL::CStringW& szCabDir, 42 const ATL::CStringW& szOutputDir); 43 44 class CConfigParser 45 { 46 // Locale names cache 47 const static INT m_cchLocaleSize = 5; 48 49 ATL::CStringW m_szLocaleID; 50 ATL::CStringW m_szCachedINISectionLocale; 51 ATL::CStringW m_szCachedINISectionLocaleNeutral; 52 53 const ATL::CStringW szConfigPath; 54 55 ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName); 56 VOID CacheINILocale(); 57 BOOL GetStringWorker(const ATL::CStringW& KeyName, PCWSTR Suffix, ATL::CStringW& ResultString); 58 59 public: 60 CConfigParser(const ATL::CStringW& FileName = ""); 61 62 BOOL GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString); 63 BOOL GetInt(const ATL::CStringW& KeyName, INT& iResult); 64 }; 65 66 BOOL PathAppendNoDirEscapeW(LPWSTR pszPath, LPCWSTR pszMore); 67 68 BOOL IsSystem64Bit(); 69 70 INT GetSystemColorDepth(); 71 72 void UnixTimeToFileTime(DWORD dwUnixTime, LPFILETIME pFileTime); 73 74 BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle); 75 76 template<class T> 77 class CLocalPtr : public CHeapPtr<T, CLocalAllocator> 78 { 79 }; 80 81