Interface.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. //---------------------------------------------------------------------------
  2. #ifndef InterfaceH
  3. #define InterfaceH
  4. //---------------------------------------------------------------------------
  5. #include "Configuration.h"
  6. #include "SessionData.h"
  7. #include <typeinfo>
  8. #define HELP_NONE ""
  9. #define SCRIPT_SWITCH "script"
  10. #define COMMAND_SWITCH L"Command"
  11. #define SESSIONNAME_SWICH L"SessionName"
  12. #define INI_NUL L"nul"
  13. #define PRESERVETIME_SWITCH L"preservetime"
  14. #define PRESERVETIMEDIRS_SWITCH_VALUE L"all"
  15. #define NOPRESERVETIME_SWITCH L"nopreservetime"
  16. #define PERMISSIONS_SWITCH L"permissions"
  17. #define NOPERMISSIONS_SWITCH L"nopermissions"
  18. #define SPEED_SWITCH L"speed"
  19. #define TRANSFER_SWITCH L"transfer"
  20. #define FILEMASK_SWITCH L"filemask"
  21. #define RESUMESUPPORT_SWITCH L"resumesupport"
  22. #define NEWERONLY_SWICH L"neweronly"
  23. #define NONEWERONLY_SWICH L"noneweronly"
  24. #define DELETE_SWITCH L"delete"
  25. extern const wchar_t * TransferModeNames[];
  26. extern const int TransferModeNamesCount;
  27. extern const wchar_t * ToggleNames[];
  28. enum TToggle { ToggleOff, ToggleOn };
  29. //---------------------------------------------------------------------------
  30. TConfiguration * __fastcall CreateConfiguration();
  31. class TOptions;
  32. TOptions * __fastcall GetGlobalOptions();
  33. void __fastcall ShowExtendedException(Exception * E);
  34. bool __fastcall AppendExceptionStackTraceAndForget(TStrings *& MoreMessages);
  35. void __fastcall IgnoreException(const std::type_info & ExceptionType);
  36. UnicodeString __fastcall GetCompanyRegistryKey();
  37. UnicodeString __fastcall GetRegistryKey();
  38. void * __fastcall BusyStart();
  39. void __fastcall BusyEnd(void * Token);
  40. const unsigned int GUIUpdateInterval = 100;
  41. void __fastcall SetNoGUI();
  42. bool __fastcall ProcessGUI(bool Force = false);
  43. UnicodeString __fastcall AppNameString();
  44. UnicodeString __fastcall SshVersionString();
  45. void __fastcall CopyToClipboard(UnicodeString Text);
  46. int __fastcall StartThread(void * SecurityAttributes, unsigned StackSize,
  47. TThreadFunc ThreadFunc, void * Parameter, unsigned CreationFlags,
  48. TThreadID & ThreadId);
  49. // Order of the values also define order of the buttons/answers on the prompts
  50. // MessageDlg relies on these to be <= 0x0000FFFF
  51. const unsigned int qaYes = 0x00000001;
  52. // MessageDlg relies that answer do not conflict with mrCancel (=0x2)
  53. const unsigned int qaNo = 0x00000004;
  54. const unsigned int qaOK = 0x00000008;
  55. const unsigned int qaCancel = 0x00000010;
  56. const unsigned int qaYesToAll = 0x00000020;
  57. const unsigned int qaNoToAll = 0x00000040;
  58. const unsigned int qaAbort = 0x00000080;
  59. const unsigned int qaRetry = 0x00000100;
  60. const unsigned int qaIgnore = 0x00000200;
  61. const unsigned int qaSkip = 0x00000400;
  62. const unsigned int qaAll = 0x00000800;
  63. const unsigned int qaHelp = 0x00001000;
  64. const unsigned int qaReport = 0x00002000;
  65. const unsigned int qaFirst = qaYes;
  66. const unsigned int qaLast = qaReport;
  67. const unsigned int qaNeverAskAgain = 0x00010000;
  68. const int qpFatalAbort = 0x01;
  69. const int qpNeverAskAgainCheck = 0x02;
  70. const int qpAllowContinueOnError = 0x04;
  71. const int qpIgnoreAbort = 0x08;
  72. const int qpWaitInBatch = 0x10;
  73. struct TQueryButtonAlias
  74. {
  75. TQueryButtonAlias();
  76. unsigned int Button;
  77. UnicodeString Alias;
  78. TNotifyEvent OnClick;
  79. int GroupWith;
  80. TShiftState GrouppedShiftState;
  81. bool ElevationRequired;
  82. };
  83. typedef void __fastcall (__closure *TQueryParamsTimerEvent)(unsigned int & Result);
  84. enum TQueryType { qtConfirmation, qtWarning, qtError, qtInformation };
  85. struct TQueryParams
  86. {
  87. TQueryParams(unsigned int AParams = 0, UnicodeString AHelpKeyword = HELP_NONE);
  88. TQueryParams(const TQueryParams & Source);
  89. void Assign(const TQueryParams & Source);
  90. const TQueryButtonAlias * Aliases;
  91. unsigned int AliasesCount;
  92. unsigned int Params;
  93. unsigned int Timer;
  94. TQueryParamsTimerEvent TimerEvent;
  95. UnicodeString TimerMessage;
  96. unsigned int TimerAnswers;
  97. TQueryType TimerQueryType;
  98. unsigned int Timeout;
  99. unsigned int TimeoutAnswer;
  100. unsigned int NoBatchAnswers;
  101. UnicodeString HelpKeyword;
  102. };
  103. enum TPromptKind
  104. {
  105. pkPrompt,
  106. pkFileName,
  107. pkUserName,
  108. pkPassphrase,
  109. pkTIS,
  110. pkCryptoCard,
  111. pkKeybInteractive,
  112. pkPassword,
  113. pkNewPassword
  114. };
  115. enum TPromptUserParam { pupEcho = 0x01, pupRemember = 0x02 };
  116. bool __fastcall IsAuthenticationPrompt(TPromptKind Kind);
  117. bool __fastcall IsPasswordOrPassphrasePrompt(TPromptKind Kind, TStrings * Prompts);
  118. bool __fastcall IsPasswordPrompt(TPromptKind Kind, TStrings * Prompts);
  119. //---------------------------------------------------------------------------
  120. typedef void __fastcall (__closure *TFileFoundEvent)
  121. (TTerminal * Terminal, const UnicodeString FileName, const TRemoteFile * File,
  122. bool & Cancel);
  123. typedef void __fastcall (__closure *TFindingFileEvent)
  124. (TTerminal * Terminal, const UnicodeString Directory, bool & Cancel);
  125. //---------------------------------------------------------------------------
  126. class TOperationVisualizer
  127. {
  128. public:
  129. __fastcall TOperationVisualizer(bool UseBusyCursor = true);
  130. __fastcall ~TOperationVisualizer();
  131. private:
  132. bool FUseBusyCursor;
  133. void * FToken;
  134. };
  135. //---------------------------------------------------------------------------
  136. class TInstantOperationVisualizer : public TOperationVisualizer
  137. {
  138. public:
  139. __fastcall TInstantOperationVisualizer();
  140. __fastcall ~TInstantOperationVisualizer();
  141. private:
  142. TDateTime FStart;
  143. };
  144. //---------------------------------------------------------------------------
  145. struct TClipboardHandler
  146. {
  147. UnicodeString Text;
  148. void __fastcall Copy(TObject * /*Sender*/)
  149. {
  150. TInstantOperationVisualizer Visualizer;
  151. CopyToClipboard(Text);
  152. }
  153. };
  154. //---------------------------------------------------------------------------
  155. #endif