Interface.h 6.1 KB

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