Shared.Struct.pas 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. unit Shared.Struct;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2025 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Various records and other types that are shared by the ISCmplr, Setup,
  8. SetupLdr, and Uninst projects
  9. }
  10. interface
  11. uses
  12. Windows, SHA256;
  13. const
  14. SetupTitle = 'Inno Setup';
  15. SetupVersion = '6.5.2';
  16. SetupBinVersion = (6 shl 24) + (5 shl 16) + (2 shl 8) + 0;
  17. type
  18. TSetupID = array[0..63] of AnsiChar;
  19. TUninstallLogID = array[0..63] of AnsiChar;
  20. TMessagesHdrID = array[0..63] of AnsiChar;
  21. TMessagesLangOptionsID = array[1..8] of AnsiChar;
  22. TCompID = array[1..4] of AnsiChar;
  23. TDiskSliceID = array[1..8] of AnsiChar;
  24. const
  25. { SetupID is used by the Setup program to check if the Setup.0 file is
  26. compatible with it. If you make any modifications to the records in
  27. this file it's recommended you change SetupID. Any change will do (like
  28. changing the letters or numbers), as long as your format is
  29. unrecognizable by the standard Inno Setup. }
  30. SetupID: TSetupID = 'Inno Setup Setup Data (6.5.2)';
  31. UninstallLogID: array[Boolean] of TUninstallLogID =
  32. ('Inno Setup Uninstall Log (b)', 'Inno Setup Uninstall Log (b) 64-bit');
  33. MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (6.5.0) (u)';
  34. MessagesLangOptionsID: TMessagesLangOptionsID = '!mlo!001';
  35. ZLIBID: TCompID = 'zlb'#26;
  36. DiskSliceID: TDiskSliceID = 'idskb32'#26;
  37. type
  38. TSetupVersionDataVersion = packed record
  39. Build: Word;
  40. Minor, Major: Byte;
  41. end;
  42. TSetupVersionData = packed record
  43. WinVersion, NTVersion: Cardinal;
  44. NTServicePack: Word;
  45. end;
  46. TSetupHeaderOption = (shDisableStartupPrompt, shCreateAppDir,
  47. shAllowNoIcons, shAlwaysRestart, shAlwaysUsePersonalGroup,
  48. shEnableDirDoesntExistWarning,
  49. shPassword, shAllowRootDirectory, shDisableFinishedPage, shUsePreviousAppDir,
  50. shUsePreviousGroup, shUpdateUninstallLogAppName,
  51. shUsePreviousSetupType, shDisableReadyMemo, shAlwaysShowComponentsList,
  52. shFlatComponentsList, shShowComponentSizes, shUsePreviousTasks,
  53. shDisableReadyPage, shAlwaysShowDirOnReadyPage, shAlwaysShowGroupOnReadyPage,
  54. shAllowUNCPath, shUserInfoPage, shUsePreviousUserInfo,
  55. shUninstallRestartComputer, shRestartIfNeededByRun, shShowTasksTreeLines,
  56. shAllowCancelDuringInstall, shWizardImageStretch, shAppendDefaultDirName,
  57. shAppendDefaultGroupName, shSetupLogging,
  58. shSignedUninstaller, shUsePreviousLanguage, shDisableWelcomePage,
  59. shCloseApplications, shRestartApplications, shAllowNetworkDrive,
  60. shForceCloseApplications, shAppNameHasConsts, shUsePreviousPrivileges,
  61. shWizardResizable, shUninstallLogging);
  62. TSetupLanguageDetectionMethod = (ldUILanguage, ldLocale, ldNone);
  63. TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA, cmLZMA2);
  64. TSetupKDFSalt = array[0..15] of Byte;
  65. TSetupEncryptionKey = array[0..31] of Byte;
  66. TSetupEncryptionNonce = record
  67. RandomXorStartOffset: Int64;
  68. RandomXorFirstSlice: Int32;
  69. RemainingRandom: array[0..2] of Int32;
  70. end;
  71. TSetupProcessorArchitecture = (paUnknown, paX86, paX64, paArm32, paArm64);
  72. TSetupProcessorArchitectures = set of TSetupProcessorArchitecture;
  73. TSetupDisablePage = (dpAuto, dpNo, dpYes);
  74. TSetupPrivilegesRequired = (prNone, prPowerUser, prAdmin, prLowest);
  75. TSetupPrivilegesRequiredOverride = (proCommandLine, proDialog);
  76. TSetupPrivilegesRequiredOverrides = set of TSetupPrivilegesRequiredOverride;
  77. TSetupWizardStyle = (wsClassic, wsModern);
  78. const
  79. SetupProcessorArchitectureNames: array[TSetupProcessorArchitecture] of String =
  80. ('Unknown', 'x86', 'x64', 'Arm32', 'Arm64');
  81. type
  82. { Should not contain strings }
  83. TSetupEncryptionHeader = packed record
  84. EncryptionUse: (euNone, euFiles, euFull);
  85. KDFSalt: TSetupKDFSalt;
  86. KDFIterations: Integer;
  87. BaseNonce: TSetupEncryptionNonce;
  88. PasswordTest: Integer;
  89. end;
  90. const
  91. SetupHeaderStrings = 34;
  92. SetupHeaderAnsiStrings = 4;
  93. type
  94. TSetupHeader = packed record
  95. AppName, AppVerName, AppId, AppCopyright, AppPublisher, AppPublisherURL,
  96. AppSupportPhone, AppSupportURL, AppUpdatesURL, AppVersion, DefaultDirName,
  97. DefaultGroupName, BaseFilename, UninstallFilesDir, UninstallDisplayName,
  98. UninstallDisplayIcon, AppMutex, DefaultUserInfoName, DefaultUserInfoOrg,
  99. DefaultUserInfoSerial, AppReadmeFile, AppContact, AppComments,
  100. AppModifyPath, CreateUninstallRegKey, Uninstallable, CloseApplicationsFilter,
  101. SetupMutex, ChangesEnvironment, ChangesAssociations,
  102. ArchitecturesAllowed, ArchitecturesInstallIn64BitMode, CloseApplicationsFilterExcludes,
  103. SevenZipLibraryName: String;
  104. LicenseText, InfoBeforeText, InfoAfterText, CompiledCodeText: AnsiString;
  105. NumLanguageEntries, NumCustomMessageEntries, NumPermissionEntries,
  106. NumTypeEntries, NumComponentEntries, NumTaskEntries, NumDirEntries,
  107. NumISSigKeyEntries, NumFileEntries, NumFileLocationEntries, NumIconEntries, NumIniEntries,
  108. NumRegistryEntries, NumInstallDeleteEntries, NumUninstallDeleteEntries,
  109. NumRunEntries, NumUninstallRunEntries: Integer;
  110. MinVersion, OnlyBelowVersion: TSetupVersionData;
  111. WizardStyle: TSetupWizardStyle;
  112. WizardSizePercentX, WizardSizePercentY: Integer;
  113. WizardImageAlphaFormat: (afIgnored, afDefined, afPremultiplied); // Must be same as Graphics.TAlphaFormat
  114. WizardImageBackColor, WizardSmallImageBackColor: LongInt;
  115. ExtraDiskSpaceRequired: Int64;
  116. SlicesPerDisk: Integer;
  117. UninstallLogMode: (lmAppend, lmNew, lmOverwrite);
  118. DirExistsWarning: (ddAuto, ddNo, ddYes);
  119. PrivilegesRequired: TSetupPrivilegesRequired;
  120. PrivilegesRequiredOverridesAllowed: TSetupPrivilegesRequiredOverrides;
  121. ShowLanguageDialog: (slYes, slNo, slAuto);
  122. LanguageDetectionMethod: TSetupLanguageDetectionMethod;
  123. CompressMethod: TSetupCompressMethod;
  124. DisableDirPage, DisableProgramGroupPage: TSetupDisablePage;
  125. UninstallDisplaySize: Int64;
  126. Options: set of TSetupHeaderOption;
  127. end;
  128. const
  129. SetupPermissionEntryStrings = 0;
  130. SetupPermissionEntryAnsiStrings = 1;
  131. type
  132. PSetupPermissionEntry = ^TSetupPermissionEntry;
  133. TSetupPermissionEntry = packed record
  134. Permissions: AnsiString; { an array of TGrantPermissionEntry's }
  135. end;
  136. const
  137. SetupLanguageEntryStrings = 6;
  138. SetupLanguageEntryAnsiStrings = 4;
  139. type
  140. PSetupLanguageEntry = ^TSetupLanguageEntry;
  141. TSetupLanguageEntry = packed record
  142. Name, LanguageName, DialogFontName, TitleFontName, WelcomeFontName,
  143. CopyrightFontName: String;
  144. Data, LicenseText, InfoBeforeText, InfoAfterText: AnsiString;
  145. LanguageID: Cardinal;
  146. DialogFontSize: Integer;
  147. TitleFontSize: Integer;
  148. WelcomeFontSize: Integer;
  149. CopyrightFontSize: Integer;
  150. RightToLeft: Boolean;
  151. end;
  152. const
  153. SetupCustomMessageEntryStrings = 2;
  154. SetupCustomMessageEntryAnsiStrings = 0;
  155. type
  156. PSetupCustomMessageEntry = ^TSetupCustomMessageEntry;
  157. TSetupCustomMessageEntry = packed record
  158. Name, Value: String;
  159. LangIndex: Integer;
  160. end;
  161. const
  162. SetupTypeEntryStrings = 4;
  163. SetupTypeEntryAnsiStrings = 0;
  164. type
  165. TSetupTypeOption = (toIsCustom);
  166. TSetupTypeOptions = set of TSetupTypeOption;
  167. TSetupTypeType = (ttUser, ttDefaultFull, ttDefaultCompact, ttDefaultCustom);
  168. PSetupTypeEntry = ^TSetupTypeEntry;
  169. TSetupTypeEntry = packed record
  170. Name, Description, Languages, CheckOnce: String;
  171. MinVersion, OnlyBelowVersion: TSetupVersionData;
  172. Options: TSetupTypeOptions;
  173. Typ: TSetupTypeType;
  174. { internally used: }
  175. Size: Int64;
  176. end;
  177. const
  178. SetupComponentEntryStrings = 5;
  179. SetupComponentEntryAnsiStrings = 0;
  180. type
  181. PSetupComponentEntry = ^TSetupComponentEntry;
  182. TSetupComponentEntry = packed record
  183. Name, Description, Types, Languages, CheckOnce: String;
  184. ExtraDiskSpaceRequired: Int64;
  185. Level: Integer;
  186. Used: Boolean;
  187. MinVersion, OnlyBelowVersion: TSetupVersionData;
  188. Options: set of (coFixed, coRestart, coDisableNoUninstallWarning,
  189. coExclusive, coDontInheritCheck);
  190. { internally used: }
  191. Size: Int64;
  192. end;
  193. const
  194. SetupTaskEntryStrings = 6;
  195. SetupTaskEntryAnsiStrings = 0;
  196. type
  197. PSetupTaskEntry = ^TSetupTaskEntry;
  198. TSetupTaskEntry = packed record
  199. Name, Description, GroupDescription, Components, Languages, Check: String;
  200. Level: Integer;
  201. Used: Boolean;
  202. MinVersion, OnlyBelowVersion: TSetupVersionData;
  203. Options: set of (toExclusive, toUnchecked, toRestart, toCheckedOnce,
  204. toDontInheritCheck);
  205. end;
  206. const
  207. SetupDirEntryStrings = 7;
  208. SetupDirEntryAnsiStrings = 0;
  209. type
  210. PSetupDirEntry = ^TSetupDirEntry;
  211. TSetupDirEntry = packed record
  212. DirName: String;
  213. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  214. Attribs: Integer;
  215. MinVersion, OnlyBelowVersion: TSetupVersionData;
  216. PermissionsEntry: Smallint;
  217. Options: set of (doUninsNeverUninstall, doDeleteAfterInstall,
  218. doUninsAlwaysUninstall, doSetNTFSCompression, doUnsetNTFSCompression);
  219. end;
  220. const
  221. SetupISSigKeyEntryStrings = 3;
  222. SetupISSigKeyEntryAnsiStrings = 0;
  223. type
  224. PSetupISSigKeyEntry = ^TSetupISSigKeyEntry;
  225. TSetupISSigKeyEntry = packed record
  226. PublicX, PublicY, RuntimeID: String;
  227. end;
  228. const
  229. SetupFileEntryStrings = 15;
  230. SetupFileEntryAnsiStrings = 1;
  231. type
  232. PSetupFileEntry = ^TSetupFileEntry;
  233. TSetupFileVerificationType = (fvNone, fvHash, fvISSig);
  234. TSetupFileVerification = packed record
  235. ISSigAllowedKeys: AnsiString; { Must be first }
  236. Hash: TSHA256Digest;
  237. Typ: TSetupFileVerificationType;
  238. end;
  239. TSetupFileEntry = packed record
  240. SourceFilename, DestName, InstallFontName, StrongAssemblyName, Components,
  241. Tasks, Languages, Check, AfterInstall, BeforeInstall, Excludes,
  242. DownloadISSigSource, DownloadUserName, DownloadPassword, ExtractArchivePassword: String;
  243. Verification: TSetupFileVerification; { Must be first after strings }
  244. MinVersion, OnlyBelowVersion: TSetupVersionData;
  245. LocationEntry: Integer;
  246. Attribs: Integer;
  247. ExternalSize: Int64;
  248. PermissionsEntry: Smallint;
  249. Options: set of (foConfirmOverwrite, foUninsNeverUninstall, foRestartReplace,
  250. foDeleteAfterInstall, foRegisterServer, foRegisterTypeLib, foSharedFile,
  251. foCompareTimeStamp, foFontIsntTrueType,
  252. foSkipIfSourceDoesntExist, foOverwriteReadOnly, foOverwriteSameVersion,
  253. foCustomDestName, foOnlyIfDestFileExists, foNoRegError,
  254. foUninsRestartDelete, foOnlyIfDoesntExist, foIgnoreVersion,
  255. foPromptIfOlder, foDontCopy, foUninsRemoveReadOnly,
  256. foRecurseSubDirsExternal, foReplaceSameVersionIfContentsDiffer,
  257. foDontVerifyChecksum, foUninsNoSharedFilePrompt, foCreateAllSubDirs,
  258. fo32Bit, fo64Bit, foExternalSizePreset, foSetNTFSCompression,
  259. foUnsetNTFSCompression, foGacInstall, foDownload,
  260. foExtractArchive);
  261. FileType: (ftUserFile, ftUninstExe);
  262. end;
  263. const
  264. SetupFileLocationEntryStrings = 0;
  265. SetupFileLocationEntryAnsiStrings = 0;
  266. type
  267. PSetupFileLocationEntry = ^TSetupFileLocationEntry;
  268. TSetupFileLocationEntry = packed record
  269. FirstSlice, LastSlice: Integer;
  270. StartOffset: Int64;
  271. ChunkSuboffset: Int64;
  272. OriginalSize: Int64;
  273. ChunkCompressedSize: Int64;
  274. SHA256Sum: TSHA256Digest;
  275. SourceTimeStamp: TFileTime;
  276. FileVersionMS, FileVersionLS: DWORD;
  277. Flags: set of (floVersionInfoValid, floTimeStampInUTC, floCallInstructionOptimized,
  278. floChunkEncrypted, floChunkCompressed);
  279. end;
  280. const
  281. SetupIconEntryStrings = 13;
  282. SetupIconEntryAnsiStrings = 0;
  283. type
  284. TSetupIconCloseOnExit = (icNoSetting, icYes, icNo);
  285. PSetupIconEntry = ^TSetupIconEntry;
  286. TSetupIconEntry = packed record
  287. IconName, Filename, Parameters, WorkingDir, IconFilename, Comment: String;
  288. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  289. AppUserModelID: String;
  290. AppUserModelToastActivatorCLSID: TGUID;
  291. MinVersion, OnlyBelowVersion: TSetupVersionData;
  292. IconIndex, ShowCmd: Integer;
  293. CloseOnExit: TSetupIconCloseOnExit;
  294. HotKey: Word;
  295. Options: set of (ioUninsNeverUninstall, ioCreateOnlyIfFileExists,
  296. ioUseAppPaths, ioExcludeFromShowInNewInstall,
  297. ioPreventPinning, ioHasAppUserModelToastActivatorCLSID);
  298. end;
  299. const
  300. SetupIniEntryStrings = 10;
  301. SetupIniEntryAnsiStrings = 0;
  302. type
  303. PSetupIniEntry = ^TSetupIniEntry;
  304. TSetupIniEntry = packed record
  305. Filename, Section, Entry, Value: String;
  306. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  307. MinVersion, OnlyBelowVersion: TSetupVersionData;
  308. Options: set of (ioCreateKeyIfDoesntExist, ioUninsDeleteEntry,
  309. ioUninsDeleteEntireSection, ioUninsDeleteSectionIfEmpty,
  310. { internally used: }
  311. ioHasValue);
  312. end;
  313. const
  314. SetupRegistryEntryStrings = 9;
  315. SetupRegistryEntryAnsiStrings = 0;
  316. type
  317. PSetupRegistryEntry = ^TSetupRegistryEntry;
  318. TSetupRegistryEntry = packed record
  319. Subkey, ValueName, ValueData: String;
  320. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  321. MinVersion, OnlyBelowVersion: TSetupVersionData;
  322. RootKey: HKEY;
  323. PermissionsEntry: Smallint;
  324. Typ: (rtNone, rtString, rtExpandString, rtDWord, rtBinary, rtMultiString, rtQWord);
  325. Options: set of (roCreateValueIfDoesntExist, roUninsDeleteValue,
  326. roUninsClearValue, roUninsDeleteEntireKey, roUninsDeleteEntireKeyIfEmpty,
  327. roPreserveStringType, roDeleteKey, roDeleteValue, roNoError,
  328. roDontCreateKey, ro32Bit, ro64Bit);
  329. end;
  330. const
  331. SetupDeleteEntryStrings = 7;
  332. SetupDeleteEntryAnsiStrings = 0;
  333. type
  334. TSetupDeleteType = (dfFiles, dfFilesAndOrSubdirs, dfDirIfEmpty);
  335. PSetupDeleteEntry = ^TSetupDeleteEntry;
  336. TSetupDeleteEntry = packed record
  337. Name: String;
  338. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  339. MinVersion, OnlyBelowVersion: TSetupVersionData;
  340. DeleteType: TSetupDeleteType;
  341. end;
  342. const
  343. SetupRunEntryStrings = 13;
  344. SetupRunEntryAnsiStrings = 0;
  345. type
  346. PSetupRunEntry = ^TSetupRunEntry;
  347. TSetupRunEntry = packed record
  348. Name, Parameters, WorkingDir, RunOnceId, StatusMsg, Verb: String;
  349. Description, Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  350. MinVersion, OnlyBelowVersion: TSetupVersionData;
  351. ShowCmd: Integer;
  352. Wait: (rwWaitUntilTerminated, rwNoWait, rwWaitUntilIdle);
  353. Options: set of (roShellExec, roSkipIfDoesntExist,
  354. roPostInstall, roUnchecked, roSkipIfSilent, roSkipIfNotSilent,
  355. roHideWizard, roRun32Bit, roRun64Bit, roRunAsOriginalUser,
  356. roDontLogParameters, roLogOutput);
  357. end;
  358. const
  359. MaxGrantPermissionEntries = 32; { must keep in synch with Helper.c }
  360. type
  361. { TGrantPermissionEntry is stored inside string fields named 'Permissions' }
  362. TGrantPermissionSid = record { must keep in synch with Helper.c }
  363. Authority: TSIDIdentifierAuthority;
  364. SubAuthCount: Byte;
  365. SubAuth: array[0..1] of DWORD;
  366. end;
  367. TGrantPermissionEntry = record { must keep in synch with Helper.c }
  368. Sid: TGrantPermissionSid;
  369. AccessMask: DWORD;
  370. end;
  371. { A TDiskSliceHeader record follows DiskSliceID in a Setup-*.bin file }
  372. TDiskSliceHeader = packed record
  373. TotalSize: Int64;
  374. end;
  375. { A TMessageHeader record follows MessagesHdrID in a Setup.msg file }
  376. TMessagesHeader = packed record
  377. NumMessages: Cardinal;
  378. TotalSize: Cardinal;
  379. NotTotalSize: Cardinal;
  380. CRCMessages: Longint;
  381. end;
  382. { TSetupLdrOffsetTable is stored inside SetupLdr's SetupLdrOffsetTableResID
  383. RCDATA resource }
  384. PSetupLdrOffsetTable = ^TSetupLdrOffsetTable;
  385. TSetupLdrOffsetTable = record
  386. ID: array[1..12] of AnsiChar; { = SetupLdrOffsetTableID }
  387. Version: UInt32; { = SetupLdrOffsetTableVersion }
  388. TotalSize: Int64; { Minimum expected size of setup.exe }
  389. OffsetEXE: Int64; { Offset of compressed setup.e32 }
  390. UncompressedSizeEXE: UInt32; { Size of setup.e32 before compression }
  391. CRCEXE: Int32; { CRC of setup.e32 before compression }
  392. Offset0: Int64; { Offset of embedded setup-0.bin data }
  393. Offset1: Int64; { Offset of embedded setup-1.bin data,
  394. or 0 when DiskSpanning=yes }
  395. ReservedPadding: UInt32; { Not set (just provides padding) }
  396. TableCRC: Int32; { CRC of all prior fields in this record }
  397. end;
  398. { TMessagesLangOptions is a simplified version of TSetupLanguageEntry that
  399. is used by the uninstaller and RegSvr }
  400. TMessagesLangOptions = packed record
  401. ID: TMessagesLangOptionsID;
  402. DialogFontName: array[0..31] of Char;
  403. DialogFontSize: Integer;
  404. Flags: set of (lfRightToLeft);
  405. end;
  406. TUninstallerMsgTail = packed record
  407. ID: Longint;
  408. Offset: Longint;
  409. end;
  410. const
  411. SetupLdrOffsetTableResID = 11111;
  412. SetupLdrOffsetTableID = 'rDlPtS'#$CD#$E6#$D7#$7B#$0B#$2A;
  413. SetupLdrOffsetTableVersion = 2;
  414. SetupExeModeOffset = $30;
  415. SetupExeModeUninstaller = $6E556E49;
  416. SetupExeModeRegSvr = $53526E49;
  417. UninstallerMsgTailID = $67734D49;
  418. implementation
  419. end.