Configuration.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <FileInfo.h>
  5. #include "Exceptions.h"
  6. #include "Common.h"
  7. #include "Configuration.h"
  8. #include "PuttyIntf.h"
  9. #include "TextsCore.h"
  10. #include "Interface.h"
  11. #define GSSAPIDLL "gssapi32"
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. //---------------------------------------------------------------------------
  15. __fastcall TConfiguration::TConfiguration()
  16. {
  17. FCriticalSection = new TCriticalSection();
  18. FUpdating = 0;
  19. FStorage = stDetect;
  20. DontSave = false;
  21. RandomSeedSave = true;
  22. FApplicationInfo = NULL;
  23. FGSSAPIInstalled = -1;
  24. }
  25. //---------------------------------------------------------------------------
  26. void __fastcall TConfiguration::Default()
  27. {
  28. TGuard Guard(FCriticalSection);
  29. AnsiString ARandomSeedFile = RandomSeedFile;
  30. // This works correct only when Default() is called before first
  31. // change to RandomSeedFile property
  32. RandomSeedFile = StringReplace(ExtractFilePath(ARandomSeedFile) +
  33. "winscp" + ExtractFileExt(ARandomSeedFile), "\\\\", "\\",
  34. TReplaceFlags() << rfReplaceAll);
  35. FConfirmOverwriting = true;
  36. FConfirmResume = true;
  37. FRememberPassword = false;
  38. FLogging = false;
  39. FLogFileName = "";
  40. FLogFileAppend = true;
  41. FLogWindowLines = 100;
  42. FLogProtocol = false;
  43. FDisablePasswordStoring = false;
  44. Changed();
  45. }
  46. //---------------------------------------------------------------------------
  47. __fastcall TConfiguration::~TConfiguration()
  48. {
  49. assert(!FUpdating);
  50. if (RandomSeedSave) random_save_seed();
  51. if (FApplicationInfo) FreeFileInfo(FApplicationInfo);
  52. delete FCriticalSection;
  53. }
  54. //---------------------------------------------------------------------------
  55. THierarchicalStorage * TConfiguration::CreateScpStorage(bool /*SessionList*/)
  56. {
  57. if (Storage == stRegistry)
  58. {
  59. return new TRegistryStorage(RegistryStorageKey);
  60. }
  61. else
  62. {
  63. return new TIniFileStorage(IniFileStorageName);
  64. }
  65. }
  66. //---------------------------------------------------------------------------
  67. #define LASTELEM(ELEM) \
  68. ELEM.SubString(ELEM.LastDelimiter(".>")+1, ELEM.Length() - ELEM.LastDelimiter(".>"))
  69. #define BLOCK(KEY, CANCREATE, BLOCK) \
  70. if (Storage->OpenSubKey(KEY, CANCREATE)) try { BLOCK } __finally { Storage->CloseSubKey(); }
  71. #define REGCONFIG(ACCESS, CANCREATE, ADDON) \
  72. THierarchicalStorage * Storage = CreateScpStorage(false); \
  73. try { \
  74. Storage->AccessMode = ACCESS; \
  75. if (Storage->OpenSubKey(ConfigurationSubKey, CANCREATE)) { \
  76. BLOCK("Interface", CANCREATE, \
  77. KEY(String, RandomSeedFile); \
  78. KEY(Bool, ConfirmOverwriting); \
  79. KEY(Bool, ConfirmResume); \
  80. KEY(Bool, RememberPassword); \
  81. ); \
  82. BLOCK("Logging", CANCREATE, \
  83. KEY(Bool, Logging); \
  84. KEY(String, LogFileName); \
  85. KEY(Bool, LogFileAppend); \
  86. KEY(Integer, LogWindowLines); \
  87. KEY(Integer, LogProtocol); \
  88. ); \
  89. ADDON(Storage); \
  90. }; \
  91. } __finally { \
  92. delete Storage; \
  93. }
  94. //---------------------------------------------------------------------------
  95. void __fastcall TConfiguration::SaveSpecial(THierarchicalStorage * /*Storage*/)
  96. {
  97. }
  98. //---------------------------------------------------------------------------
  99. void __fastcall TConfiguration::Save()
  100. {
  101. if (DontSave) return;
  102. if (Storage == stRegistry) CleanupIniFile();
  103. #define KEY(TYPE, VAR) Storage->Write ## TYPE(LASTELEM(AnsiString(#VAR)), VAR)
  104. REGCONFIG(smReadWrite, true, SaveSpecial);
  105. #undef KEY
  106. }
  107. //---------------------------------------------------------------------------
  108. void __fastcall TConfiguration::LoadSpecial(THierarchicalStorage * /*Storage*/)
  109. {
  110. }
  111. //---------------------------------------------------------------------------
  112. void __fastcall TConfiguration::LoadAdmin(THierarchicalStorage * Storage)
  113. {
  114. FDisablePasswordStoring = Storage->ReadBool("DisablePasswordStoring", FDisablePasswordStoring);
  115. }
  116. //---------------------------------------------------------------------------
  117. void __fastcall TConfiguration::Load()
  118. {
  119. TGuard Guard(FCriticalSection);
  120. #define KEY(TYPE, VAR) VAR = Storage->Read ## TYPE(LASTELEM(AnsiString(#VAR)), VAR)
  121. #pragma warn -eas
  122. REGCONFIG(smRead, false, LoadSpecial);
  123. #pragma warn +eas
  124. #undef KEY
  125. TRegistryStorage * AdminStorage;
  126. AdminStorage = new TRegistryStorage(RegistryStorageKey, HKEY_LOCAL_MACHINE);
  127. try
  128. {
  129. if (AdminStorage->OpenRootKey(false))
  130. {
  131. LoadAdmin(AdminStorage);
  132. AdminStorage->CloseSubKey();
  133. }
  134. }
  135. __finally
  136. {
  137. delete AdminStorage;
  138. }
  139. }
  140. //---------------------------------------------------------------------------
  141. void __fastcall TConfiguration::LoadDirectoryChangesCache(const AnsiString SessionKey,
  142. TRemoteDirectoryChangesCache * DirectoryChangesCache)
  143. {
  144. THierarchicalStorage * Storage = CreateScpStorage(false);
  145. try
  146. {
  147. Storage->AccessMode = smRead;
  148. if (Storage->OpenSubKey(ConfigurationSubKey, false) &&
  149. Storage->OpenSubKey("CDCache", false) &&
  150. Storage->ValueExists(SessionKey))
  151. {
  152. DirectoryChangesCache->Deserialize(Storage->ReadBinaryData(SessionKey));
  153. }
  154. }
  155. __finally
  156. {
  157. delete Storage;
  158. }
  159. }
  160. //---------------------------------------------------------------------------
  161. void __fastcall TConfiguration::SaveDirectoryChangesCache(const AnsiString SessionKey,
  162. TRemoteDirectoryChangesCache * DirectoryChangesCache)
  163. {
  164. THierarchicalStorage * Storage = CreateScpStorage(false);
  165. try
  166. {
  167. Storage->AccessMode = smReadWrite;
  168. if (Storage->OpenSubKey(ConfigurationSubKey, true) &&
  169. Storage->OpenSubKey("CDCache", true))
  170. {
  171. AnsiString Data;
  172. DirectoryChangesCache->Serialize(Data);
  173. Storage->WriteBinaryData(SessionKey, Data);
  174. }
  175. }
  176. __finally
  177. {
  178. delete Storage;
  179. }
  180. }
  181. //---------------------------------------------------------------------------
  182. void __fastcall TConfiguration::Changed()
  183. {
  184. if (FUpdating == 0)
  185. {
  186. if (OnChange)
  187. {
  188. OnChange(this);
  189. }
  190. }
  191. else
  192. {
  193. FChanged = true;
  194. }
  195. }
  196. //---------------------------------------------------------------------------
  197. void __fastcall TConfiguration::BeginUpdate()
  198. {
  199. if (FUpdating == 0)
  200. {
  201. FChanged = false;
  202. }
  203. FUpdating++;
  204. // Greater value would probably indicate some nesting problem in code
  205. assert(FUpdating < 6);
  206. }
  207. //---------------------------------------------------------------------------
  208. void __fastcall TConfiguration::EndUpdate()
  209. {
  210. assert(FUpdating > 0);
  211. FUpdating--;
  212. if ((FUpdating == 0) && FChanged)
  213. {
  214. FChanged = false;
  215. Changed();
  216. }
  217. }
  218. //---------------------------------------------------------------------------
  219. void __fastcall TConfiguration::CleanupConfiguration()
  220. {
  221. try
  222. {
  223. CleanupRegistry(ConfigurationSubKey);
  224. if (Storage == stRegistry)
  225. {
  226. DontSave = true;
  227. }
  228. }
  229. catch (Exception &E)
  230. {
  231. throw ExtException(&E, CLEANUP_CONFIG_ERROR);
  232. }
  233. }
  234. //---------------------------------------------------------------------------
  235. void __fastcall TConfiguration::CleanupRegistry(AnsiString CleanupSubKey)
  236. {
  237. TRegistryStorage *Registry = new TRegistryStorage(RegistryStorageKey);
  238. try
  239. {
  240. Registry->RecursiveDeleteSubKey(CleanupSubKey);
  241. }
  242. __finally
  243. {
  244. delete Registry;
  245. }
  246. }
  247. //---------------------------------------------------------------------------
  248. void __fastcall TConfiguration::CleanupHostKeys()
  249. {
  250. try
  251. {
  252. CleanupRegistry(SshHostKeysSubKey);
  253. }
  254. catch (Exception &E)
  255. {
  256. throw ExtException(&E, CLEANUP_HOSTKEYS_ERROR);
  257. }
  258. }
  259. //---------------------------------------------------------------------------
  260. void __fastcall TConfiguration::CleanupRandomSeedFile()
  261. {
  262. try
  263. {
  264. RandomSeedSave = false;
  265. if (FileExists(RandomSeedFile))
  266. {
  267. if (!DeleteFile(RandomSeedFile)) Abort();
  268. }
  269. }
  270. catch (Exception &E)
  271. {
  272. throw ExtException(&E, CLEANUP_SEEDFILE_ERROR);
  273. }
  274. }
  275. //---------------------------------------------------------------------------
  276. void __fastcall TConfiguration::CleanupIniFile()
  277. {
  278. try
  279. {
  280. if (FileExists(IniFileStorageName))
  281. {
  282. if (!DeleteFile(IniFileStorageName)) Abort();
  283. }
  284. if (Storage == stIniFile)
  285. {
  286. DontSave = true;
  287. }
  288. }
  289. catch (Exception &E)
  290. {
  291. throw ExtException(&E, CLEANUP_INIFILE_ERROR);
  292. }
  293. }
  294. //---------------------------------------------------------------------------
  295. AnsiString __fastcall TConfiguration::GetOSVersionStr()
  296. {
  297. AnsiString Result;
  298. OSVERSIONINFO OSVersionInfo;
  299. OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVersionInfo);
  300. if (GetVersionEx(&OSVersionInfo) != 0)
  301. {
  302. Result = FORMAT("%d.%d.%d %s", (int(OSVersionInfo.dwMajorVersion),
  303. int(OSVersionInfo.dwMinorVersion), int(OSVersionInfo.dwBuildNumber),
  304. OSVersionInfo.szCSDVersion)).Trim();
  305. }
  306. return Result;
  307. }
  308. //---------------------------------------------------------------------------
  309. TVSFixedFileInfo *__fastcall TConfiguration::GetFixedApplicationInfo()
  310. {
  311. return GetFixedFileInfo(ApplicationInfo);
  312. }
  313. //---------------------------------------------------------------------------
  314. AnsiString __fastcall TConfiguration::ModuleFileName()
  315. {
  316. return ParamStr(0);
  317. }
  318. //---------------------------------------------------------------------------
  319. void * __fastcall TConfiguration::GetFileApplicationInfo(const AnsiString FileName)
  320. {
  321. void * Result;
  322. if (FileName.IsEmpty())
  323. {
  324. if (!FApplicationInfo)
  325. {
  326. FApplicationInfo = CreateFileInfo(ModuleFileName());
  327. }
  328. Result = FApplicationInfo;
  329. }
  330. else
  331. {
  332. Result = CreateFileInfo(FileName);
  333. }
  334. return Result;
  335. }
  336. //---------------------------------------------------------------------------
  337. void * __fastcall TConfiguration::GetApplicationInfo()
  338. {
  339. return GetFileApplicationInfo("");
  340. }
  341. //---------------------------------------------------------------------------
  342. AnsiString __fastcall TConfiguration::GetFileProductName(const AnsiString FileName)
  343. {
  344. return GetFileFileInfoString("ProductName", FileName);
  345. }
  346. //---------------------------------------------------------------------------
  347. AnsiString __fastcall TConfiguration::GetFileCompanyName(const AnsiString FileName)
  348. {
  349. return GetFileFileInfoString("CompanyName", FileName);
  350. }
  351. //---------------------------------------------------------------------------
  352. AnsiString __fastcall TConfiguration::GetProductName()
  353. {
  354. return GetFileProductName("");
  355. }
  356. //---------------------------------------------------------------------------
  357. AnsiString __fastcall TConfiguration::GetCompanyName()
  358. {
  359. return GetFileCompanyName("");
  360. }
  361. //---------------------------------------------------------------------------
  362. AnsiString __fastcall TConfiguration::GetFileProductVersion(const AnsiString FileName)
  363. {
  364. return TrimVersion(GetFileFileInfoString("ProductVersion", FileName));
  365. }
  366. //---------------------------------------------------------------------------
  367. AnsiString __fastcall TConfiguration::GetProductVersion()
  368. {
  369. return GetFileProductVersion("");
  370. }
  371. //---------------------------------------------------------------------------
  372. AnsiString __fastcall TConfiguration::TrimVersion(AnsiString Version)
  373. {
  374. while ((Version.Pos(".") != Version.LastDelimiter(".")) &&
  375. (Version.SubString(Version.Length() - 1, 2) == ".0"))
  376. {
  377. Version.SetLength(Version.Length() - 2);
  378. }
  379. return Version;
  380. }
  381. //---------------------------------------------------------------------------
  382. AnsiString __fastcall TConfiguration::GetVersionStr()
  383. {
  384. TGuard Guard(FCriticalSection);
  385. try
  386. {
  387. return FmtLoadStr(VERSION, ARRAYOFCONST((
  388. HIWORD(FixedApplicationInfo->dwFileVersionMS),
  389. LOWORD(FixedApplicationInfo->dwFileVersionMS),
  390. HIWORD(FixedApplicationInfo->dwFileVersionLS),
  391. LOWORD(FixedApplicationInfo->dwFileVersionLS))));
  392. }
  393. catch (Exception &E)
  394. {
  395. throw ExtException(&E, "Can't get application version");
  396. }
  397. }
  398. //---------------------------------------------------------------------------
  399. AnsiString __fastcall TConfiguration::GetVersion()
  400. {
  401. TGuard Guard(FCriticalSection);
  402. try
  403. {
  404. AnsiString Result;
  405. Result = TrimVersion(FORMAT("%d.%d.%d", (
  406. HIWORD(FixedApplicationInfo->dwFileVersionMS),
  407. LOWORD(FixedApplicationInfo->dwFileVersionMS),
  408. HIWORD(FixedApplicationInfo->dwFileVersionLS))));
  409. return Result;
  410. }
  411. catch (Exception &E)
  412. {
  413. throw ExtException(&E, "Can't get application version");
  414. }
  415. }
  416. //---------------------------------------------------------------------------
  417. AnsiString __fastcall TConfiguration::GetFileFileInfoString(const AnsiString Key,
  418. const AnsiString FileName)
  419. {
  420. TGuard Guard(FCriticalSection);
  421. AnsiString Result;
  422. void * Info = GetFileApplicationInfo(FileName);
  423. try
  424. {
  425. if ((Info != NULL) && (GetTranslationCount(Info) > 0))
  426. {
  427. TTranslation Translation;
  428. Translation = GetTranslation(Info, 0);
  429. Result = ::GetFileInfoString(Info, Translation, Key);
  430. }
  431. else
  432. {
  433. assert(!FileName.IsEmpty());
  434. }
  435. }
  436. __finally
  437. {
  438. if (!FileName.IsEmpty())
  439. {
  440. FreeFileInfo(Info);
  441. }
  442. }
  443. return Result;
  444. }
  445. //---------------------------------------------------------------------------
  446. AnsiString __fastcall TConfiguration::GetFileInfoString(const AnsiString Key)
  447. {
  448. return GetFileFileInfoString(Key, "");
  449. }
  450. //---------------------------------------------------------------------------
  451. AnsiString __fastcall TConfiguration::GetRegistryStorageKey()
  452. {
  453. return GetRegistryKey();
  454. }
  455. //---------------------------------------------------------------------------
  456. void __fastcall TConfiguration::SetIniFileStorageName(AnsiString value)
  457. {
  458. if (!value.IsEmpty() && !FileExists(value))
  459. {
  460. throw Exception(FMTLOAD(FILE_NOT_EXISTS, (value)));
  461. }
  462. FIniFileStorageName = value;
  463. FStorage = stIniFile;
  464. }
  465. //---------------------------------------------------------------------------
  466. AnsiString __fastcall TConfiguration::GetIniFileStorageName()
  467. {
  468. if (FIniFileStorageName.IsEmpty())
  469. {
  470. return ChangeFileExt(ParamStr(0), ".ini");
  471. }
  472. else
  473. {
  474. return FIniFileStorageName;
  475. }
  476. }
  477. //---------------------------------------------------------------------------
  478. AnsiString __fastcall TConfiguration::GetPuttyRegistryStorageKey()
  479. {
  480. return PUTTY_REG_POS;
  481. }
  482. //---------------------------------------------------------------------------
  483. AnsiString __fastcall TConfiguration::GetPuttySessionsKey()
  484. {
  485. return PuttyRegistryStorageKey + "\\Sessions";
  486. }
  487. //---------------------------------------------------------------------------
  488. AnsiString __fastcall TConfiguration::GetStoredSessionsSubKey()
  489. {
  490. return "Sessions";
  491. }
  492. //---------------------------------------------------------------------------
  493. AnsiString __fastcall TConfiguration::GetSshHostKeysSubKey()
  494. {
  495. return "SshHostKeys";
  496. }
  497. //---------------------------------------------------------------------------
  498. AnsiString __fastcall TConfiguration::GetConfigurationSubKey()
  499. {
  500. return "Configuration";
  501. }
  502. //---------------------------------------------------------------------------
  503. AnsiString __fastcall TConfiguration::GetRootKeyStr()
  504. {
  505. return RootKeyToStr(HKEY_CURRENT_USER);
  506. }
  507. //---------------------------------------------------------------------------
  508. bool __fastcall TConfiguration::GetGSSAPIInstalled()
  509. {
  510. if (FGSSAPIInstalled < 0)
  511. {
  512. HINSTANCE Library = LoadLibrary(GSSAPIDLL);
  513. FGSSAPIInstalled = (Library != NULL ? 1 : 0);
  514. FreeLibrary(Library);
  515. }
  516. return (FGSSAPIInstalled > 0);
  517. }
  518. //---------------------------------------------------------------------------
  519. void __fastcall TConfiguration::SetStorage(TStorage value)
  520. {
  521. if (FStorage != value)
  522. {
  523. FStorage = value;
  524. ModifyAll();
  525. Save();
  526. }
  527. }
  528. //---------------------------------------------------------------------------
  529. void __fastcall TConfiguration::ModifyAll()
  530. {
  531. // nothing
  532. }
  533. //---------------------------------------------------------------------------
  534. TStorage __fastcall TConfiguration::GetStorage()
  535. {
  536. if (FStorage == stDetect)
  537. {
  538. FStorage = FileExists(IniFileStorageName) ? stIniFile : stRegistry;
  539. }
  540. return FStorage;
  541. }
  542. //---------------------------------------------------------------------------
  543. void __fastcall TConfiguration::SetRandomSeedFile(AnsiString value)
  544. {
  545. char *seedpath = seedpath_ptr();
  546. if (value.Length() >= seedpath_size())
  547. {
  548. value.SetLength(seedpath_size() - 1);
  549. }
  550. strcpy(seedpath, StripPathQuotes(value).c_str());
  551. }
  552. //---------------------------------------------------------------------------
  553. AnsiString __fastcall TConfiguration::GetRandomSeedFile()
  554. {
  555. return AnsiString(seedpath_ptr());
  556. }
  557. //---------------------------------------------------------------------------
  558. TEOLType __fastcall TConfiguration::GetLocalEOLType()
  559. {
  560. return eolCRLF;
  561. }
  562. //---------------------------------------------------------------------
  563. void __fastcall TConfiguration::SetLogging(bool value)
  564. {
  565. SET_CONFIG_PROPERTY(Logging);
  566. }
  567. //---------------------------------------------------------------------
  568. void __fastcall TConfiguration::SetLogFileName(AnsiString value)
  569. {
  570. SET_CONFIG_PROPERTY(LogFileName);
  571. }
  572. //---------------------------------------------------------------------
  573. void __fastcall TConfiguration::SetLogToFile(bool value)
  574. {
  575. if (value != LogToFile)
  576. {
  577. LogFileName = value ? DefaultLogFileName : AnsiString("");
  578. Changed();
  579. }
  580. }
  581. //---------------------------------------------------------------------
  582. bool __fastcall TConfiguration::GetLogToFile()
  583. {
  584. return !LogFileName.IsEmpty();
  585. }
  586. //---------------------------------------------------------------------
  587. void __fastcall TConfiguration::SetLogProtocol(bool value)
  588. {
  589. SET_CONFIG_PROPERTY(LogProtocol);
  590. }
  591. //---------------------------------------------------------------------
  592. void __fastcall TConfiguration::SetLogFileAppend(bool value)
  593. {
  594. SET_CONFIG_PROPERTY(LogFileAppend);
  595. }
  596. //---------------------------------------------------------------------
  597. void __fastcall TConfiguration::SetLogWindowLines(int value)
  598. {
  599. SET_CONFIG_PROPERTY(LogWindowLines);
  600. }
  601. //---------------------------------------------------------------------
  602. void __fastcall TConfiguration::SetLogWindowComplete(bool value)
  603. {
  604. if (value != LogWindowComplete)
  605. {
  606. LogWindowLines = value ? 0 : 50;
  607. Changed();
  608. }
  609. }
  610. //---------------------------------------------------------------------
  611. bool __fastcall TConfiguration::GetLogWindowComplete()
  612. {
  613. return (bool)(LogWindowLines == 0);
  614. }
  615. //---------------------------------------------------------------------
  616. AnsiString __fastcall TConfiguration::GetDefaultLogFileName()
  617. {
  618. return IncludeTrailingBackslash(SystemTemporaryDirectory()) + "winscp.log";
  619. }
  620. //---------------------------------------------------------------------------
  621. void __fastcall TConfiguration::SetConfirmOverwriting(bool value)
  622. {
  623. TGuard Guard(FCriticalSection);
  624. SET_CONFIG_PROPERTY(ConfirmOverwriting);
  625. }
  626. //---------------------------------------------------------------------------
  627. bool __fastcall TConfiguration::GetConfirmOverwriting()
  628. {
  629. TGuard Guard(FCriticalSection);
  630. return FConfirmOverwriting;
  631. }
  632. //---------------------------------------------------------------------------
  633. void __fastcall TConfiguration::SetConfirmResume(bool value)
  634. {
  635. TGuard Guard(FCriticalSection);
  636. SET_CONFIG_PROPERTY(ConfirmResume);
  637. }
  638. //---------------------------------------------------------------------------
  639. bool __fastcall TConfiguration::GetConfirmResume()
  640. {
  641. TGuard Guard(FCriticalSection);
  642. return FConfirmResume;
  643. }
  644. //---------------------------------------------------------------------------
  645. AnsiString __fastcall TConfiguration::GetTimeFormat()
  646. {
  647. return "h:nn:ss";
  648. }
  649. //---------------------------------------------------------------------------
  650. AnsiString __fastcall TConfiguration::GetPartialExt() const
  651. {
  652. return ".filepart";
  653. }
  654. //---------------------------------------------------------------------------
  655. AnsiString __fastcall TConfiguration::GetDefaultKeyFile()
  656. {
  657. return "";
  658. }
  659. //---------------------------------------------------------------------------
  660. AnsiString __fastcall TConfiguration::GetLocalInvalidChars()
  661. {
  662. return "/\\:*?\"<>|";
  663. }