Interface.h 5.9 KB

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