2017-08-02 12:50:53 +00:00
|
|
|
#pragma once
|
2017-08-15 19:36:23 +00:00
|
|
|
|
2017-08-02 12:50:53 +00:00
|
|
|
#include <windef.h>
|
2018-02-03 22:42:46 +00:00
|
|
|
#include <atlstr.h>
|
2017-08-02 12:50:53 +00:00
|
|
|
#include <atlsimpcoll.h>
|
|
|
|
#include <atlcoll.h>
|
2017-09-03 20:37:14 +00:00
|
|
|
|
2017-08-15 19:36:23 +00:00
|
|
|
#include "misc.h"
|
2017-08-02 12:50:53 +00:00
|
|
|
|
2017-09-03 20:37:14 +00:00
|
|
|
enum LicenseType
|
2017-08-02 12:50:53 +00:00
|
|
|
{
|
2017-09-03 20:37:14 +00:00
|
|
|
LICENSE_NONE,
|
|
|
|
LICENSE_OPENSOURCE,
|
|
|
|
LICENSE_FREEWARE,
|
|
|
|
LICENSE_TRIAL,
|
|
|
|
LICENSE_MIN = LICENSE_NONE,
|
|
|
|
LICENSE_MAX = LICENSE_TRIAL
|
|
|
|
};
|
|
|
|
|
|
|
|
inline BOOL IsLicenseType(INT x)
|
|
|
|
{
|
2017-09-10 21:02:06 +00:00
|
|
|
return (x >= LICENSE_MIN && x <= LICENSE_MAX);
|
2017-09-03 20:37:14 +00:00
|
|
|
}
|
2017-08-02 12:50:53 +00:00
|
|
|
|
2017-08-26 22:43:05 +00:00
|
|
|
struct CAvailableApplicationInfo
|
2017-08-02 12:50:53 +00:00
|
|
|
{
|
2017-09-03 20:37:14 +00:00
|
|
|
INT m_Category;
|
2018-01-02 20:45:59 +00:00
|
|
|
BOOL m_IsSelected;
|
2017-09-03 20:37:14 +00:00
|
|
|
LicenseType m_LicenseType;
|
|
|
|
ATL::CStringW m_szName;
|
|
|
|
ATL::CStringW m_szRegName;
|
|
|
|
ATL::CStringW m_szVersion;
|
|
|
|
ATL::CStringW m_szLicense;
|
|
|
|
ATL::CStringW m_szDesc;
|
|
|
|
ATL::CStringW m_szSize;
|
|
|
|
ATL::CStringW m_szUrlSite;
|
|
|
|
ATL::CStringW m_szUrlDownload;
|
|
|
|
ATL::CStringW m_szCDPath;
|
|
|
|
ATL::CSimpleArray<LCID> m_LanguageLCIDs;
|
2017-08-02 12:50:53 +00:00
|
|
|
|
|
|
|
// Caching mechanism related entries
|
2017-09-03 20:37:14 +00:00
|
|
|
ATL::CStringW m_sFileName;
|
|
|
|
FILETIME m_ftCacheStamp;
|
2017-08-02 12:50:53 +00:00
|
|
|
|
|
|
|
// Optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form)
|
2017-09-03 20:37:14 +00:00
|
|
|
ATL::CStringW m_szSHA1;
|
|
|
|
ATL::CStringW m_szInstalledVersion;
|
2017-08-26 22:43:05 +00:00
|
|
|
|
2017-10-21 21:00:50 +00:00
|
|
|
// Create an object from file
|
2017-08-02 12:50:53 +00:00
|
|
|
CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam);
|
|
|
|
|
|
|
|
// Load all info from the file
|
|
|
|
VOID RefreshAppInfo();
|
|
|
|
BOOL HasLanguageInfo() const;
|
|
|
|
BOOL HasNativeLanguage() const;
|
|
|
|
BOOL HasEnglishLanguage() const;
|
|
|
|
BOOL IsInstalled() const;
|
|
|
|
BOOL HasInstalledVersion() const;
|
|
|
|
BOOL HasUpdate() const;
|
|
|
|
|
|
|
|
// Set a timestamp
|
|
|
|
VOID SetLastWriteTime(FILETIME* ftTime);
|
|
|
|
|
|
|
|
private:
|
2017-09-10 21:02:06 +00:00
|
|
|
BOOL m_IsInstalled;
|
|
|
|
BOOL m_HasLanguageInfo;
|
|
|
|
BOOL m_HasInstalledVersion;
|
2017-10-21 21:52:49 +00:00
|
|
|
CConfigParser* m_Parser;
|
2017-08-02 12:50:53 +00:00
|
|
|
|
2017-08-14 17:00:20 +00:00
|
|
|
inline BOOL GetString(LPCWSTR lpKeyName, ATL::CStringW& ReturnedString);
|
2017-08-02 12:50:53 +00:00
|
|
|
|
|
|
|
// Lazily load general info from the file
|
|
|
|
VOID RetrieveGeneralInfo();
|
|
|
|
VOID RetrieveInstalledStatus();
|
|
|
|
VOID RetrieveInstalledVersion();
|
|
|
|
VOID RetrieveLanguages();
|
|
|
|
VOID RetrieveLicenseType();
|
2018-04-07 16:17:22 +00:00
|
|
|
VOID RetrieveSize();
|
2017-08-02 12:50:53 +00:00
|
|
|
inline BOOL FindInLanguages(LCID what) const;
|
|
|
|
};
|
|
|
|
|
2017-08-26 22:43:05 +00:00
|
|
|
typedef BOOL(CALLBACK *AVAILENUMPROC)(CAvailableApplicationInfo *Info, LPCWSTR szFolderPath);
|
|
|
|
|
2018-01-02 00:07:12 +00:00
|
|
|
struct AvailableStrings
|
2017-08-02 12:50:53 +00:00
|
|
|
{
|
2018-01-02 00:07:12 +00:00
|
|
|
ATL::CStringW szPath;
|
|
|
|
ATL::CStringW szCabPath;
|
|
|
|
ATL::CStringW szAppsPath;
|
|
|
|
ATL::CStringW szSearchPath;
|
2018-02-25 13:20:00 +00:00
|
|
|
ATL::CStringW szCabName;
|
|
|
|
ATL::CStringW szCabDir;
|
2017-08-24 22:04:44 +00:00
|
|
|
|
2018-01-02 00:07:12 +00:00
|
|
|
AvailableStrings();
|
|
|
|
};
|
2017-09-10 21:02:06 +00:00
|
|
|
|
2018-01-02 00:07:12 +00:00
|
|
|
class CAvailableApps
|
|
|
|
{
|
|
|
|
static AvailableStrings m_Strings;
|
2017-09-09 20:38:06 +00:00
|
|
|
ATL::CAtlList<CAvailableApplicationInfo*> m_InfoList;
|
2017-08-02 12:50:53 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CAvailableApps();
|
2017-08-24 22:04:44 +00:00
|
|
|
|
|
|
|
static BOOL UpdateAppsDB();
|
|
|
|
static BOOL ForceUpdateAppsDB();
|
2017-09-03 20:37:14 +00:00
|
|
|
static VOID DeleteCurrentAppsDB();
|
2017-08-24 22:04:44 +00:00
|
|
|
|
2017-08-02 12:50:53 +00:00
|
|
|
VOID FreeCachedEntries();
|
2017-09-03 20:37:14 +00:00
|
|
|
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc);
|
|
|
|
|
|
|
|
CAvailableApplicationInfo* FindInfo(const ATL::CStringW& szAppName) const;
|
2017-10-21 21:00:50 +00:00
|
|
|
ATL::CSimpleArray<CAvailableApplicationInfo> FindInfoList(const ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const;
|
2018-01-02 20:45:59 +00:00
|
|
|
ATL::CSimpleArray<CAvailableApplicationInfo> GetSelected() const;
|
2017-09-03 20:37:14 +00:00
|
|
|
|
|
|
|
const ATL::CStringW& GetFolderPath() const;
|
|
|
|
const ATL::CStringW& GetAppPath() const;
|
|
|
|
const ATL::CStringW& GetCabPath() const;
|
2017-08-15 22:35:45 +00:00
|
|
|
};
|