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
|
|
|
|
2020-06-14 13:22:58 +00:00
|
|
|
|
2020-06-21 16:20:45 +00:00
|
|
|
#define MAX_SCRNSHOT_NUM 16
|
2020-06-14 13:22:58 +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
|
|
|
|
2020-06-14 13:22:58 +00:00
|
|
|
struct AvailableStrings
|
|
|
|
{
|
|
|
|
ATL::CStringW szPath;
|
|
|
|
ATL::CStringW szCabPath;
|
|
|
|
ATL::CStringW szAppsPath;
|
|
|
|
ATL::CStringW szSearchPath;
|
|
|
|
ATL::CStringW szCabName;
|
|
|
|
ATL::CStringW szCabDir;
|
|
|
|
|
|
|
|
AvailableStrings();
|
|
|
|
};
|
|
|
|
|
2020-07-21 14:13:39 +00:00
|
|
|
class CAvailableApplicationInfo
|
2017-08-02 12:50:53 +00:00
|
|
|
{
|
2020-07-21 14:13:39 +00:00
|
|
|
public:
|
2017-09-03 20:37:14 +00:00
|
|
|
INT m_Category;
|
2020-07-21 14:13:39 +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::CSimpleArray<LCID> m_LanguageLCIDs;
|
2020-06-21 16:20:45 +00:00
|
|
|
ATL::CSimpleArray<ATL::CStringW> m_szScrnshotLocation;
|
2020-06-29 20:40:40 +00:00
|
|
|
ATL::CStringW m_szIconLocation;
|
2020-06-14 13:22:58 +00:00
|
|
|
|
2020-03-17 19:54:45 +00:00
|
|
|
ULONG m_SizeBytes;
|
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
|
2020-06-14 13:22:58 +00:00
|
|
|
CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam, AvailableStrings& m_Strings);
|
2017-08-02 12:50:53 +00:00
|
|
|
|
|
|
|
// Load all info from the file
|
2020-06-14 13:22:58 +00:00
|
|
|
VOID RefreshAppInfo(AvailableStrings& m_Strings);
|
2017-08-02 12:50:53 +00:00
|
|
|
BOOL HasLanguageInfo() const;
|
|
|
|
BOOL HasNativeLanguage() const;
|
|
|
|
BOOL HasEnglishLanguage() const;
|
|
|
|
BOOL IsInstalled() const;
|
|
|
|
BOOL HasInstalledVersion() const;
|
|
|
|
BOOL HasUpdate() const;
|
2020-06-21 16:20:45 +00:00
|
|
|
BOOL RetrieveScrnshot(UINT Index, ATL::CStringW& ScrnshotLocation) const;
|
2020-06-29 20:40:40 +00:00
|
|
|
BOOL RetrieveIcon(ATL::CStringW& IconLocation) const;
|
2017-08-02 12:50:53 +00:00
|
|
|
// 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
|
2020-06-14 13:22:58 +00:00
|
|
|
VOID RetrieveGeneralInfo(AvailableStrings& m_Strings);
|
2017-08-02 12:50:53 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2020-07-21 14:13:39 +00:00
|
|
|
typedef BOOL(CALLBACK *AVAILENUMPROC)(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param);
|
2017-08-26 22:43:05 +00:00
|
|
|
|
2018-01-02 00:07:12 +00:00
|
|
|
class CAvailableApps
|
|
|
|
{
|
2017-09-09 20:38:06 +00:00
|
|
|
ATL::CAtlList<CAvailableApplicationInfo*> m_InfoList;
|
2020-07-21 14:13:39 +00:00
|
|
|
ATL::CAtlList< CAvailableApplicationInfo*> m_SelectedList;
|
2017-08-02 12:50:53 +00:00
|
|
|
|
|
|
|
public:
|
2020-06-21 10:26:41 +00:00
|
|
|
static AvailableStrings m_Strings;
|
|
|
|
|
2017-08-02 12:50:53 +00:00
|
|
|
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();
|
2019-04-28 03:39:02 +00:00
|
|
|
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param);
|
2017-09-03 20:37:14 +00:00
|
|
|
|
2020-07-21 14:13:39 +00:00
|
|
|
BOOL AddSelected(CAvailableApplicationInfo *AvlbInfo);
|
|
|
|
BOOL RemoveSelected(CAvailableApplicationInfo *AvlbInfo);
|
|
|
|
|
|
|
|
VOID RemoveAllSelected();
|
|
|
|
int GetSelectedCount();
|
|
|
|
|
2017-09-03 20:37:14 +00:00
|
|
|
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;
|
2020-07-21 14:13:39 +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
|
|
|
};
|