1
0

options.hpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #ifndef _RAR_OPTIONS_
  2. #define _RAR_OPTIONS_
  3. #define DEFAULT_RECOVERY -3
  4. #define DEFAULT_RECVOLUMES -10
  5. #define VOLSIZE_AUTO INT64NDF // Automatically detect the volume size.
  6. enum PATH_EXCL_MODE {
  7. EXCL_UNCHANGED=0, // Process paths as is (default).
  8. EXCL_SKIPWHOLEPATH, // -ep (exclude the path completely)
  9. EXCL_BASEPATH, // -ep1 (exclude the base part of path)
  10. EXCL_SAVEFULLPATH, // -ep2 (the full path without the disk letter)
  11. EXCL_ABSPATH // -ep3 (the full path with the disk letter)
  12. };
  13. enum {SOLID_NONE=0,SOLID_NORMAL=1,SOLID_COUNT=2,SOLID_FILEEXT=4,
  14. SOLID_VOLUME_DEPENDENT=8,SOLID_VOLUME_INDEPENDENT=16};
  15. enum {ARCTIME_NONE=0,ARCTIME_KEEP,ARCTIME_LATEST};
  16. enum EXTTIME_MODE {
  17. EXTTIME_NONE=0,EXTTIME_1S,EXTTIME_MAX
  18. };
  19. enum {NAMES_ORIGINALCASE=0,NAMES_UPPERCASE,NAMES_LOWERCASE};
  20. enum MESSAGE_TYPE {MSG_STDOUT=0,MSG_STDERR,MSG_ERRONLY,MSG_NULL};
  21. enum RECURSE_MODE
  22. {
  23. RECURSE_NONE=0, // no recurse switches
  24. RECURSE_DISABLE, // switch -r-
  25. RECURSE_ALWAYS, // switch -r
  26. RECURSE_WILDCARDS, // switch -r0
  27. };
  28. enum OVERWRITE_MODE
  29. {
  30. OVERWRITE_DEFAULT=0, // Ask when extracting, silently overwrite when archiving.
  31. OVERWRITE_ALL,
  32. OVERWRITE_NONE,
  33. OVERWRITE_AUTORENAME,
  34. OVERWRITE_FORCE_ASK
  35. };
  36. enum QOPEN_MODE { QOPEN_NONE, QOPEN_AUTO, QOPEN_ALWAYS };
  37. enum RAR_CHARSET { RCH_DEFAULT=0,RCH_ANSI,RCH_OEM,RCH_UNICODE,RCH_UTF8 };
  38. #define MAX_FILTER_TYPES 16
  39. enum FilterState {FILTER_DEFAULT=0,FILTER_AUTO,FILTER_FORCE,FILTER_DISABLE};
  40. enum SAVECOPY_MODE {
  41. SAVECOPY_NONE=0, SAVECOPY_SILENT, SAVECOPY_LIST, SAVECOPY_LISTEXIT,
  42. SAVECOPY_DUPLISTEXIT
  43. };
  44. enum APPENDARCNAME_MODE
  45. {
  46. APPENDARCNAME_NONE=0,APPENDARCNAME_DESTPATH,APPENDARCNAME_OWNSUBDIR,
  47. APPENDARCNAME_OWNDIR
  48. };
  49. enum POWER_MODE {
  50. POWERMODE_KEEP=0,POWERMODE_OFF,POWERMODE_HIBERNATE,POWERMODE_SLEEP,
  51. POWERMODE_RESTART
  52. };
  53. // Need "forced off" state to turn off sound in GUI command line.
  54. enum SOUND_NOTIFY_MODE {SOUND_NOTIFY_DEFAULT=0,SOUND_NOTIFY_ON,SOUND_NOTIFY_OFF};
  55. struct FilterMode
  56. {
  57. FilterState State;
  58. int Param1;
  59. int Param2;
  60. };
  61. #define MAX_GENERATE_MASK 128
  62. class RAROptions
  63. {
  64. public:
  65. RAROptions();
  66. ~RAROptions();
  67. void Init();
  68. uint ExclFileAttr;
  69. uint InclFileAttr;
  70. // We handle -ed and -e+d with special flags instead of attribute mask,
  71. // so it works with both Windows and Unix archives.
  72. bool ExclDir;
  73. bool InclDir;
  74. bool InclAttrSet;
  75. size_t WinSize;
  76. wchar TempPath[NM];
  77. wchar SFXModule[NM];
  78. #ifdef USE_QOPEN
  79. QOPEN_MODE QOpenMode;
  80. #endif
  81. bool ConfigDisabled; // Switch -cfg-.
  82. wchar ExtrPath[NM];
  83. wchar CommentFile[NM];
  84. RAR_CHARSET CommentCharset;
  85. RAR_CHARSET FilelistCharset;
  86. RAR_CHARSET ErrlogCharset;
  87. RAR_CHARSET RedirectCharset;
  88. wchar ArcPath[NM]; // For -ap<path>.
  89. wchar ExclArcPath[NM]; // For -ep4<path> switch.
  90. SecPassword Password;
  91. bool EncryptHeaders;
  92. bool SkipEncrypted;
  93. bool ManualPassword; // Password entered manually during operation, might need to clean for next archive.
  94. wchar LogName[NM];
  95. MESSAGE_TYPE MsgStream;
  96. SOUND_NOTIFY_MODE Sound;
  97. OVERWRITE_MODE Overwrite;
  98. int Method;
  99. HASH_TYPE HashType;
  100. int Recovery;
  101. int RecVolNumber;
  102. bool DisablePercentage;
  103. bool DisableCopyright;
  104. bool DisableDone;
  105. bool DisableNames;
  106. bool PrintVersion;
  107. int Solid;
  108. int SolidCount;
  109. bool ClearArc;
  110. bool AddArcOnly;
  111. bool DisableComment;
  112. bool FreshFiles;
  113. bool UpdateFiles;
  114. PATH_EXCL_MODE ExclPath;
  115. RECURSE_MODE Recurse;
  116. int64 VolSize;
  117. Array<int64> NextVolSizes;
  118. uint CurVolNum;
  119. bool AllYes;
  120. bool VerboseOutput; // -iv, display verbose output, used only in "WinRAR t" now.
  121. bool DisableSortSolid;
  122. int ArcTime;
  123. int ConvertNames;
  124. bool ProcessOwners;
  125. bool SaveSymLinks;
  126. bool SaveHardLinks;
  127. bool AbsoluteLinks;
  128. int Priority;
  129. int SleepTime;
  130. bool KeepBroken;
  131. bool OpenShared;
  132. bool DeleteFiles;
  133. #ifdef _WIN_ALL
  134. bool AllowIncompatNames; // Allow names with trailing dots and spaces.
  135. #endif
  136. #ifndef SFX_MODULE
  137. bool GenerateArcName;
  138. wchar GenerateMask[MAX_GENERATE_MASK];
  139. wchar DefGenerateMask[MAX_GENERATE_MASK];
  140. #endif
  141. bool SyncFiles;
  142. bool ProcessEA;
  143. bool SaveStreams;
  144. bool SetCompressedAttr;
  145. bool IgnoreGeneralAttr;
  146. RarTime FileMtimeBefore,FileCtimeBefore,FileAtimeBefore;
  147. bool FileMtimeBeforeOR,FileCtimeBeforeOR,FileAtimeBeforeOR;
  148. RarTime FileMtimeAfter,FileCtimeAfter,FileAtimeAfter;
  149. bool FileMtimeAfterOR,FileCtimeAfterOR,FileAtimeAfterOR;
  150. int64 FileSizeLess;
  151. int64 FileSizeMore;
  152. bool Lock;
  153. bool Test;
  154. bool VolumePause;
  155. FilterMode FilterModes[MAX_FILTER_TYPES];
  156. wchar EmailTo[NM];
  157. uint VersionControl;
  158. APPENDARCNAME_MODE AppendArcNameToPath;
  159. POWER_MODE Shutdown;
  160. EXTTIME_MODE xmtime; // Extended time modes (time precision to store).
  161. EXTTIME_MODE xctime;
  162. EXTTIME_MODE xatime;
  163. bool PreserveAtime;
  164. // Read data from stdin and store in archive under a name specified here
  165. // when archiving. Read an archive from stdin if any non-empty string
  166. // is specified here when extracting.
  167. wchar UseStdin[NM];
  168. uint Threads; // We use it to init hash even if RAR_SMP is not defined.
  169. #ifdef RARDLL
  170. wchar DllDestName[NM];
  171. int DllOpMode;
  172. int DllError;
  173. LPARAM UserData;
  174. UNRARCALLBACK Callback;
  175. CHANGEVOLPROC ChangeVolProc;
  176. PROCESSDATAPROC ProcessDataProc;
  177. #endif
  178. };
  179. #endif