| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 | 
							- //---------------------------------------------------------------------------
 
- #ifndef ConfigurationH
 
- #define ConfigurationH
 
- #include <set>
 
- #include "RemoteFiles.h"
 
- #include "FileBuffer.h"
 
- #include "HierarchicalStorage.h"
 
- #include "Usage.h"
 
- //---------------------------------------------------------------------------
 
- #define SET_CONFIG_PROPERTY_EX(PROPERTY, APPLY) \
 
-   if (PROPERTY != value) { F ## PROPERTY = value; Changed(); APPLY; }
 
- #define SET_CONFIG_PROPERTY(PROPERTY) \
 
-   SET_CONFIG_PROPERTY_EX(PROPERTY, )
 
- //---------------------------------------------------------------------------
 
- extern const wchar_t * AutoSwitchNames;
 
- extern const wchar_t * NotAutoSwitchNames;
 
- enum TAutoSwitch { asOn, asOff, asAuto };
 
- enum TAssemblyLanguage { alCSharp, alVBNET, alPowerShell };
 
- //---------------------------------------------------------------------------
 
- class TStoredSessionList;
 
- //---------------------------------------------------------------------------
 
- class TConfiguration : public TObject
 
- {
 
- private:
 
-   bool FDontSave;
 
-   bool FChanged;
 
-   int FUpdating;
 
-   TNotifyEvent FOnChange;
 
-   void * FApplicationInfo;
 
-   TUsage * FUsage;
 
-   bool FLogging;
 
-   bool FPermanentLogging;
 
-   UnicodeString FLogFileName;
 
-   UnicodeString FPermanentLogFileName;
 
-   int FLogWindowLines;
 
-   bool FLogFileAppend;
 
-   bool FLogSensitive;
 
-   bool FPermanentLogSensitive;
 
-   int FLogProtocol;
 
-   int FPermanentLogProtocol;
 
-   int FActualLogProtocol;
 
-   bool FLogActions;
 
-   bool FPermanentLogActions;
 
-   UnicodeString FActionsLogFileName;
 
-   UnicodeString FPermanentActionsLogFileName;
 
-   bool FConfirmOverwriting;
 
-   bool FConfirmResume;
 
-   bool FAutoReadDirectoryAfterOp;
 
-   int FSessionReopenAuto;
 
-   int FSessionReopenBackground;
 
-   int FSessionReopenTimeout;
 
-   int FSessionReopenAutoStall;
 
-   UnicodeString FIniFileStorageName;
 
-   UnicodeString FVirtualIniFileStorageName;
 
-   std::unique_ptr<TStrings> FOptionsStorage;
 
-   int FProgramIniPathWrittable;
 
-   int FTunnelLocalPortNumberLow;
 
-   int FTunnelLocalPortNumberHigh;
 
-   int FCacheDirectoryChangesMaxSize;
 
-   bool FShowFtpWelcomeMessage;
 
-   UnicodeString FDefaultRandomSeedFile;
 
-   UnicodeString FRandomSeedFile;
 
-   UnicodeString FPuttyRegistryStorageKey;
 
-   UnicodeString FExternalIpAddress;
 
-   bool FTryFtpWhenSshFails;
 
-   bool FScripting;
 
-   bool FDisablePasswordStoring;
 
-   bool FForceBanners;
 
-   bool FDisableAcceptingHostKeys;
 
-   bool FDefaultCollectUsage;
 
-   UnicodeString __fastcall GetOSVersionStr();
 
-   TVSFixedFileInfo *__fastcall GetFixedApplicationInfo();
 
-   void * __fastcall GetApplicationInfo();
 
-   virtual UnicodeString __fastcall GetVersionStr();
 
-   virtual UnicodeString __fastcall GetVersion();
 
-   UnicodeString __fastcall GetProductVersion();
 
-   UnicodeString __fastcall GetProductName();
 
-   UnicodeString __fastcall GetCompanyName();
 
-   UnicodeString __fastcall GetFileVersion(TVSFixedFileInfo * Info);
 
-   UnicodeString __fastcall GetStoredSessionsSubKey();
 
-   UnicodeString __fastcall GetPuttySessionsKey();
 
-   void __fastcall SetRandomSeedFile(UnicodeString value);
 
-   UnicodeString __fastcall GetRandomSeedFileName();
 
-   void __fastcall SetPuttyRegistryStorageKey(UnicodeString value);
 
-   UnicodeString __fastcall GetSshHostKeysSubKey();
 
-   UnicodeString __fastcall GetRootKeyStr();
 
-   UnicodeString __fastcall GetConfigurationSubKey();
 
-   TEOLType __fastcall GetLocalEOLType();
 
-   void __fastcall SetLogging(bool value);
 
-   void __fastcall SetLogFileName(UnicodeString value);
 
-   bool __fastcall GetLogToFile();
 
-   void __fastcall SetLogWindowLines(int value);
 
-   void __fastcall SetLogWindowComplete(bool value);
 
-   bool __fastcall GetLogWindowComplete();
 
-   void __fastcall SetLogFileAppend(bool value);
 
-   void __fastcall SetLogSensitive(bool value);
 
-   void __fastcall SetLogProtocol(int value);
 
-   void __fastcall SetLogActions(bool value);
 
-   void __fastcall SetActionsLogFileName(UnicodeString value);
 
-   UnicodeString __fastcall GetDefaultLogFileName();
 
-   UnicodeString __fastcall GetTimeFormat();
 
-   void __fastcall SetStorage(TStorage value);
 
-   UnicodeString __fastcall GetRegistryStorageKey();
 
-   UnicodeString __fastcall GetIniFileStorageNameForReadingWriting();
 
-   UnicodeString __fastcall GetIniFileStorageNameForReading();
 
-   UnicodeString __fastcall GetIniFileStorageName(bool ReadingOnly);
 
-   void __fastcall SetIniFileStorageName(UnicodeString value);
 
-   void __fastcall SetOptionsStorage(TStrings * value);
 
-   TStrings * __fastcall GetOptionsStorage();
 
-   UnicodeString __fastcall GetPartialExt() const;
 
-   UnicodeString __fastcall GetFileInfoString(const UnicodeString Key);
 
-   void __fastcall SetSessionReopenAuto(int value);
 
-   void __fastcall SetSessionReopenBackground(int value);
 
-   void __fastcall SetSessionReopenTimeout(int value);
 
-   void __fastcall SetSessionReopenAutoStall(int value);
 
-   void __fastcall SetTunnelLocalPortNumberLow(int value);
 
-   void __fastcall SetTunnelLocalPortNumberHigh(int value);
 
-   void __fastcall SetCacheDirectoryChangesMaxSize(int value);
 
-   void __fastcall SetShowFtpWelcomeMessage(bool value);
 
-   int __fastcall GetCompoundVersion();
 
-   void __fastcall UpdateActualLogProtocol();
 
-   void __fastcall SetExternalIpAddress(UnicodeString value);
 
-   void __fastcall SetTryFtpWhenSshFails(bool value);
 
-   bool __fastcall GetCollectUsage();
 
-   void __fastcall SetCollectUsage(bool value);
 
-   bool __fastcall GetIsUnofficial();
 
-   bool __fastcall GetPersistent();
 
- protected:
 
-   TStorage FStorage;
 
-   TCriticalSection * FCriticalSection;
 
-   virtual TStorage __fastcall GetStorage();
 
-   virtual void __fastcall Changed();
 
-   virtual void __fastcall SaveData(THierarchicalStorage * Storage, bool All);
 
-   virtual void __fastcall LoadData(THierarchicalStorage * Storage);
 
-   virtual void __fastcall LoadFrom(THierarchicalStorage * Storage);
 
-   virtual void __fastcall CopyData(THierarchicalStorage * Source, THierarchicalStorage * Target);
 
-   virtual void __fastcall LoadAdmin(THierarchicalStorage * Storage);
 
-   virtual UnicodeString __fastcall GetDefaultKeyFile();
 
-   virtual void __fastcall Saved();
 
-   void __fastcall CleanupRegistry(UnicodeString CleanupSubKey);
 
-   UnicodeString __fastcall BannerHash(const UnicodeString & Banner);
 
-   static UnicodeString __fastcall PropertyToKey(const UnicodeString & Property);
 
-   virtual void __fastcall DoSave(bool All, bool Explicit);
 
-   UnicodeString __fastcall FormatFingerprintKey(const UnicodeString & SiteKey, const UnicodeString & FingerprintType);
 
-   virtual bool __fastcall GetConfirmOverwriting();
 
-   virtual void __fastcall SetConfirmOverwriting(bool value);
 
-   bool __fastcall GetConfirmResume();
 
-   void __fastcall SetConfirmResume(bool value);
 
-   bool __fastcall GetAutoReadDirectoryAfterOp();
 
-   void __fastcall SetAutoReadDirectoryAfterOp(bool value);
 
-   virtual bool __fastcall GetRememberPassword();
 
-   UnicodeString __fastcall GetReleaseType();
 
-   virtual UnicodeString __fastcall ModuleFileName();
 
-   UnicodeString __fastcall GetFileFileInfoString(const UnicodeString Key,
 
-     const UnicodeString FileName, bool AllowEmpty = false);
 
-   void * __fastcall GetFileApplicationInfo(const UnicodeString FileName);
 
-   UnicodeString __fastcall GetFileProductVersion(const UnicodeString FileName);
 
-   UnicodeString __fastcall GetFileProductName(const UnicodeString FileName);
 
-   UnicodeString __fastcall GetFileCompanyName(const UnicodeString FileName);
 
-   __property bool PermanentLogging  = { read=FPermanentLogging, write=SetLogging };
 
-   __property UnicodeString PermanentLogFileName  = { read=FPermanentLogFileName, write=SetLogFileName };
 
-   __property bool PermanentLogActions  = { read=FPermanentLogActions, write=SetLogActions };
 
-   __property UnicodeString PermanentActionsLogFileName  = { read=FPermanentActionsLogFileName, write=SetActionsLogFileName };
 
-   __property int PermanentLogProtocol  = { read=FPermanentLogProtocol, write=SetLogProtocol };
 
-   __property bool PermanentLogSensitive  = { read=FPermanentLogSensitive, write=SetLogSensitive };
 
- public:
 
-   __fastcall TConfiguration();
 
-   virtual __fastcall ~TConfiguration();
 
-   virtual void __fastcall Default();
 
-   virtual void __fastcall UpdateStaticUsage();
 
-   void __fastcall Load(THierarchicalStorage * Storage);
 
-   void __fastcall Save();
 
-   void __fastcall SaveExplicit();
 
-   void __fastcall SetNulStorage();
 
-   void __fastcall SetDefaultStorage();
 
-   void __fastcall Export(const UnicodeString & FileName);
 
-   void __fastcall Import(const UnicodeString & FileName);
 
-   void __fastcall CleanupConfiguration();
 
-   void __fastcall CleanupIniFile();
 
-   void __fastcall CleanupHostKeys();
 
-   void __fastcall CleanupRandomSeedFile();
 
-   void __fastcall BeginUpdate();
 
-   void __fastcall EndUpdate();
 
-   void __fastcall DontSave();
 
-   void __fastcall LoadDirectoryChangesCache(const UnicodeString SessionKey,
 
-     TRemoteDirectoryChangesCache * DirectoryChangesCache);
 
-   void __fastcall SaveDirectoryChangesCache(const UnicodeString SessionKey,
 
-     TRemoteDirectoryChangesCache * DirectoryChangesCache);
 
-   bool __fastcall ShowBanner(const UnicodeString SessionKey, const UnicodeString & Banner);
 
-   void __fastcall NeverShowBanner(const UnicodeString SessionKey, const UnicodeString & Banner);
 
-   void __fastcall RememberLastFingerprint(const UnicodeString & SiteKey, const UnicodeString & FingerprintType, const UnicodeString & Fingerprint);
 
-   UnicodeString __fastcall LastFingerprint(const UnicodeString & SiteKey, const UnicodeString & FingerprintType);
 
-   THierarchicalStorage * CreateConfigStorage();
 
-   virtual THierarchicalStorage * CreateScpStorage(bool & SessionList);
 
-   void __fastcall TemporaryLogging(const UnicodeString ALogFileName);
 
-   void __fastcall TemporaryActionsLogging(const UnicodeString ALogFileName);
 
-   void __fastcall TemporaryLogProtocol(int ALogProtocol);
 
-   void __fastcall TemporaryLogSensitive(bool ALogSensitive);
 
-   virtual RawByteString __fastcall EncryptPassword(UnicodeString Password, UnicodeString Key);
 
-   virtual UnicodeString __fastcall DecryptPassword(RawByteString Password, UnicodeString Key);
 
-   virtual RawByteString __fastcall StronglyRecryptPassword(RawByteString Password, UnicodeString Key);
 
-   UnicodeString __fastcall GetFileDescription(const UnicodeString & FileName);
 
-   UnicodeString __fastcall GetFileVersion(const UnicodeString & FileName);
 
-   TStoredSessionList * __fastcall SelectFilezillaSessionsForImport(
 
-     TStoredSessionList * Sessions, UnicodeString & Error);
 
-   bool __fastcall AnyFilezillaSessionForImport(TStoredSessionList * Sessions);
 
-   __property TVSFixedFileInfo *FixedApplicationInfo  = { read=GetFixedApplicationInfo };
 
-   __property void * ApplicationInfo  = { read=GetApplicationInfo };
 
-   __property TUsage * Usage = { read = FUsage };
 
-   __property bool CollectUsage = { read = GetCollectUsage, write = SetCollectUsage };
 
-   __property UnicodeString StoredSessionsSubKey = {read=GetStoredSessionsSubKey};
 
-   __property UnicodeString PuttyRegistryStorageKey  = { read=FPuttyRegistryStorageKey, write=SetPuttyRegistryStorageKey };
 
-   __property UnicodeString PuttySessionsKey  = { read=GetPuttySessionsKey };
 
-   __property UnicodeString RandomSeedFile  = { read=FRandomSeedFile, write=SetRandomSeedFile };
 
-   __property UnicodeString RandomSeedFileName  = { read=GetRandomSeedFileName };
 
-   __property UnicodeString SshHostKeysSubKey  = { read=GetSshHostKeysSubKey };
 
-   __property UnicodeString RootKeyStr  = { read=GetRootKeyStr };
 
-   __property UnicodeString ConfigurationSubKey  = { read=GetConfigurationSubKey };
 
-   __property TEOLType LocalEOLType = { read = GetLocalEOLType };
 
-   __property UnicodeString VersionStr = { read=GetVersionStr };
 
-   __property UnicodeString Version = { read=GetVersion };
 
-   __property int CompoundVersion = { read=GetCompoundVersion };
 
-   __property UnicodeString ProductVersion = { read=GetProductVersion };
 
-   __property UnicodeString ProductName = { read=GetProductName };
 
-   __property UnicodeString CompanyName = { read=GetCompanyName };
 
-   __property UnicodeString OSVersionStr = { read = GetOSVersionStr };
 
-   __property bool IsUnofficial = { read = GetIsUnofficial };
 
-   __property bool Logging  = { read=FLogging, write=SetLogging };
 
-   __property UnicodeString LogFileName  = { read=FLogFileName, write=SetLogFileName };
 
-   __property bool LogToFile  = { read=GetLogToFile };
 
-   __property bool LogFileAppend  = { read=FLogFileAppend, write=SetLogFileAppend };
 
-   __property bool LogSensitive  = { read=FLogSensitive, write=SetLogSensitive };
 
-   __property int LogProtocol  = { read=FLogProtocol, write=SetLogProtocol };
 
-   __property int ActualLogProtocol  = { read=FActualLogProtocol };
 
-   __property bool LogActions  = { read=FLogActions, write=SetLogActions };
 
-   __property UnicodeString ActionsLogFileName  = { read=FActionsLogFileName, write=SetActionsLogFileName };
 
-   __property int LogWindowLines  = { read=FLogWindowLines, write=SetLogWindowLines };
 
-   __property bool LogWindowComplete  = { read=GetLogWindowComplete, write=SetLogWindowComplete };
 
-   __property UnicodeString DefaultLogFileName  = { read=GetDefaultLogFileName };
 
-   __property TNotifyEvent OnChange = { read = FOnChange, write = FOnChange };
 
-   __property bool ConfirmOverwriting = { read = GetConfirmOverwriting, write = SetConfirmOverwriting};
 
-   __property bool ConfirmResume = { read = GetConfirmResume, write = SetConfirmResume};
 
-   __property bool AutoReadDirectoryAfterOp = { read = GetAutoReadDirectoryAfterOp, write = SetAutoReadDirectoryAfterOp};
 
-   __property bool RememberPassword = { read = GetRememberPassword };
 
-   __property UnicodeString PartialExt = {read=GetPartialExt};
 
-   __property int SessionReopenAuto = { read = FSessionReopenAuto, write = SetSessionReopenAuto };
 
-   __property int SessionReopenBackground = { read = FSessionReopenBackground, write = SetSessionReopenBackground };
 
-   __property int SessionReopenTimeout = { read = FSessionReopenTimeout, write = SetSessionReopenTimeout };
 
-   __property int SessionReopenAutoStall = { read = FSessionReopenAutoStall, write = SetSessionReopenAutoStall };
 
-   __property int TunnelLocalPortNumberLow = { read = FTunnelLocalPortNumberLow, write = SetTunnelLocalPortNumberLow };
 
-   __property int TunnelLocalPortNumberHigh = { read = FTunnelLocalPortNumberHigh, write = SetTunnelLocalPortNumberHigh };
 
-   __property int CacheDirectoryChangesMaxSize = { read = FCacheDirectoryChangesMaxSize, write = SetCacheDirectoryChangesMaxSize };
 
-   __property bool ShowFtpWelcomeMessage = { read = FShowFtpWelcomeMessage, write = SetShowFtpWelcomeMessage };
 
-   __property UnicodeString ExternalIpAddress = { read = FExternalIpAddress, write = SetExternalIpAddress };
 
-   __property bool TryFtpWhenSshFails = { read = FTryFtpWhenSshFails, write = SetTryFtpWhenSshFails };
 
-   __property UnicodeString TimeFormat = { read = GetTimeFormat };
 
-   __property TStorage Storage  = { read=GetStorage, write=SetStorage };
 
-   __property UnicodeString RegistryStorageKey  = { read=GetRegistryStorageKey };
 
-   __property UnicodeString IniFileStorageName  = { read=GetIniFileStorageNameForReadingWriting, write=SetIniFileStorageName };
 
-   __property UnicodeString IniFileStorageNameForReading  = { read=GetIniFileStorageNameForReading };
 
-   __property TStrings * OptionsStorage = { read = GetOptionsStorage, write = SetOptionsStorage };
 
-   __property bool Persistent = { read = GetPersistent };
 
-   __property bool Scripting = { read = FScripting, write = FScripting };
 
-   __property UnicodeString DefaultKeyFile = { read = GetDefaultKeyFile };
 
-   __property bool DisablePasswordStoring = { read = FDisablePasswordStoring };
 
-   __property bool ForceBanners = { read = FForceBanners };
 
-   __property bool DisableAcceptingHostKeys = { read = FDisableAcceptingHostKeys };
 
- };
 
- //---------------------------------------------------------------------------
 
- class TShortCuts
 
- {
 
- public:
 
-   void __fastcall Add(TShortCut ShortCut);
 
-   bool __fastcall Has(TShortCut ShortCut) const;
 
- private:
 
-   std::set<TShortCut> FShortCuts;
 
- };
 
- //---------------------------------------------------------------------------
 
- extern const UnicodeString OriginalPuttyRegistryStorageKey;
 
- extern const UnicodeString KittyRegistryStorageKey;
 
- extern const UnicodeString OriginalPuttyExecutable;
 
- extern const UnicodeString KittyExecutable;
 
- //---------------------------------------------------------------------------
 
- extern const UnicodeString Sha1ChecksumAlg;
 
- extern const UnicodeString Sha224ChecksumAlg;
 
- extern const UnicodeString Sha256ChecksumAlg;
 
- extern const UnicodeString Sha384ChecksumAlg;
 
- extern const UnicodeString Sha512ChecksumAlg;
 
- extern const UnicodeString Md5ChecksumAlg;
 
- extern const UnicodeString Crc32ChecksumAlg;
 
- //---------------------------------------------------------------------------
 
- extern const UnicodeString SshFingerprintType;
 
- extern const UnicodeString TlsFingerprintType;
 
- //---------------------------------------------------------------------------
 
- #endif
 
 
  |