Interface.h 5.7 KB

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