Interface.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 GetExceptionDebugInfo();
  37. UnicodeString __fastcall GetCompanyRegistryKey();
  38. UnicodeString __fastcall GetRegistryKey();
  39. void * __fastcall BusyStart();
  40. void __fastcall BusyEnd(void * Token);
  41. const unsigned int GUIUpdateInterval = 100;
  42. void __fastcall SetNoGUI();
  43. bool __fastcall ProcessGUI(bool Force = false);
  44. UnicodeString __fastcall AppNameString();
  45. UnicodeString __fastcall SshVersionString();
  46. void __fastcall CopyToClipboard(UnicodeString Text);
  47. int __fastcall StartThread(void * SecurityAttributes, unsigned StackSize,
  48. TThreadFunc ThreadFunc, void * Parameter, unsigned CreationFlags,
  49. TThreadID & ThreadId);
  50. // Order of the values also define order of the buttons/answers on the prompts
  51. // MessageDlg relies on these to be <= 0x0000FFFF
  52. const unsigned int qaYes = 0x00000001;
  53. // MessageDlg relies that answer do not conflict with mrCancel (=0x2)
  54. const unsigned int qaNo = 0x00000004;
  55. const unsigned int qaOK = 0x00000008;
  56. const unsigned int qaCancel = 0x00000010;
  57. const unsigned int qaYesToAll = 0x00000020;
  58. const unsigned int qaNoToAll = 0x00000040;
  59. const unsigned int qaAbort = 0x00000080;
  60. const unsigned int qaRetry = 0x00000100;
  61. const unsigned int qaIgnore = 0x00000200;
  62. const unsigned int qaSkip = 0x00000400;
  63. const unsigned int qaAll = 0x00000800;
  64. const unsigned int qaHelp = 0x00001000;
  65. const unsigned int qaReport = 0x00002000;
  66. const unsigned int qaFirst = qaYes;
  67. const unsigned int qaLast = qaReport;
  68. const unsigned int qaNeverAskAgain = 0x00010000;
  69. const int qpFatalAbort = 0x01;
  70. const int qpNeverAskAgainCheck = 0x02;
  71. const int qpAllowContinueOnError = 0x04;
  72. const int qpIgnoreAbort = 0x08;
  73. const int qpWaitInBatch = 0x10;
  74. struct TQueryButtonAlias
  75. {
  76. TQueryButtonAlias();
  77. unsigned int Button;
  78. UnicodeString Alias;
  79. TNotifyEvent OnClick;
  80. int GroupWith;
  81. TShiftState GrouppedShiftState;
  82. bool ElevationRequired;
  83. };
  84. typedef void __fastcall (__closure *TQueryParamsTimerEvent)(unsigned int & Result);
  85. enum TQueryType { qtConfirmation, qtWarning, qtError, qtInformation };
  86. struct TQueryParams
  87. {
  88. TQueryParams(unsigned int AParams = 0, UnicodeString AHelpKeyword = HELP_NONE);
  89. TQueryParams(const TQueryParams & Source);
  90. void Assign(const TQueryParams & Source);
  91. const TQueryButtonAlias * Aliases;
  92. unsigned int AliasesCount;
  93. unsigned int Params;
  94. unsigned int Timer;
  95. TQueryParamsTimerEvent TimerEvent;
  96. UnicodeString TimerMessage;
  97. unsigned int TimerAnswers;
  98. TQueryType TimerQueryType;
  99. unsigned int Timeout;
  100. unsigned int TimeoutAnswer;
  101. unsigned int NoBatchAnswers;
  102. UnicodeString HelpKeyword;
  103. };
  104. enum TPromptKind
  105. {
  106. pkPrompt,
  107. pkFileName,
  108. pkUserName,
  109. pkPassphrase,
  110. pkTIS,
  111. pkCryptoCard,
  112. pkKeybInteractive,
  113. pkPassword,
  114. pkNewPassword
  115. };
  116. enum TPromptUserParam { pupEcho = 0x01, pupRemember = 0x02 };
  117. bool __fastcall IsAuthenticationPrompt(TPromptKind Kind);
  118. bool __fastcall IsPasswordOrPassphrasePrompt(TPromptKind Kind, TStrings * Prompts);
  119. bool __fastcall IsPasswordPrompt(TPromptKind Kind, TStrings * Prompts);
  120. //---------------------------------------------------------------------------
  121. typedef void __fastcall (__closure *TFileFoundEvent)
  122. (TTerminal * Terminal, const UnicodeString FileName, const TRemoteFile * File,
  123. bool & Cancel);
  124. typedef void __fastcall (__closure *TFindingFileEvent)
  125. (TTerminal * Terminal, const UnicodeString Directory, bool & Cancel);
  126. //---------------------------------------------------------------------------
  127. class TOperationVisualizer
  128. {
  129. public:
  130. __fastcall TOperationVisualizer(bool UseBusyCursor = true);
  131. __fastcall ~TOperationVisualizer();
  132. private:
  133. bool FUseBusyCursor;
  134. void * FToken;
  135. };
  136. //---------------------------------------------------------------------------
  137. class TInstantOperationVisualizer : public TOperationVisualizer
  138. {
  139. public:
  140. __fastcall TInstantOperationVisualizer();
  141. __fastcall ~TInstantOperationVisualizer();
  142. private:
  143. TDateTime FStart;
  144. };
  145. //---------------------------------------------------------------------------
  146. struct TClipboardHandler
  147. {
  148. UnicodeString Text;
  149. void __fastcall Copy(TObject * /*Sender*/)
  150. {
  151. TInstantOperationVisualizer Visualizer;
  152. CopyToClipboard(Text);
  153. }
  154. };
  155. //---------------------------------------------------------------------------
  156. #endif