Shared.Struct.pas 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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, Shared.Int64Em, SHA256;
  13. const
  14. SetupTitle = 'Inno Setup';
  15. SetupVersion = '6.5.0-dev';
  16. SetupBinVersion = (6 shl 24) + (4 shl 16) + (3 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.0)';
  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 = 'idska32'#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, shEncryptionUsed, 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. const
  82. SetupHeaderStrings = 34;
  83. SetupHeaderAnsiStrings = 4;
  84. type
  85. TSetupHeader = packed record
  86. AppName, AppVerName, AppId, AppCopyright, AppPublisher, AppPublisherURL,
  87. AppSupportPhone, AppSupportURL, AppUpdatesURL, AppVersion, DefaultDirName,
  88. DefaultGroupName, BaseFilename, UninstallFilesDir, UninstallDisplayName,
  89. UninstallDisplayIcon, AppMutex, DefaultUserInfoName, DefaultUserInfoOrg,
  90. DefaultUserInfoSerial, AppReadmeFile, AppContact, AppComments,
  91. AppModifyPath, CreateUninstallRegKey, Uninstallable, CloseApplicationsFilter,
  92. SetupMutex, ChangesEnvironment, ChangesAssociations,
  93. ArchitecturesAllowed, ArchitecturesInstallIn64BitMode, CloseApplicationsFilterExcludes,
  94. SevenZipLibraryName: String;
  95. LicenseText, InfoBeforeText, InfoAfterText, CompiledCodeText: AnsiString;
  96. NumLanguageEntries, NumCustomMessageEntries, NumPermissionEntries,
  97. NumTypeEntries, NumComponentEntries, NumTaskEntries, NumDirEntries,
  98. NumISSigKeyEntries, NumFileEntries, NumFileLocationEntries, NumIconEntries, NumIniEntries,
  99. NumRegistryEntries, NumInstallDeleteEntries, NumUninstallDeleteEntries,
  100. NumRunEntries, NumUninstallRunEntries: Integer;
  101. MinVersion, OnlyBelowVersion: TSetupVersionData;
  102. WizardStyle: TSetupWizardStyle;
  103. WizardSizePercentX, WizardSizePercentY: Integer;
  104. WizardImageAlphaFormat: (afIgnored, afDefined, afPremultiplied); // Must be same as Graphics.TAlphaFormat
  105. PasswordTest: Integer;
  106. EncryptionKDFSalt: TSetupKDFSalt;
  107. EncryptionKDFIterations: Integer;
  108. EncryptionBaseNonce: TSetupEncryptionNonce;
  109. ExtraDiskSpaceRequired: Integer64;
  110. SlicesPerDisk: Integer;
  111. UninstallLogMode: (lmAppend, lmNew, lmOverwrite);
  112. DirExistsWarning: (ddAuto, ddNo, ddYes);
  113. PrivilegesRequired: TSetupPrivilegesRequired;
  114. PrivilegesRequiredOverridesAllowed: TSetupPrivilegesRequiredOverrides;
  115. ShowLanguageDialog: (slYes, slNo, slAuto);
  116. LanguageDetectionMethod: TSetupLanguageDetectionMethod;
  117. CompressMethod: TSetupCompressMethod;
  118. DisableDirPage, DisableProgramGroupPage: TSetupDisablePage;
  119. UninstallDisplaySize: Integer64;
  120. Options: set of TSetupHeaderOption;
  121. end;
  122. const
  123. SetupPermissionEntryStrings = 0;
  124. SetupPermissionEntryAnsiStrings = 1;
  125. type
  126. PSetupPermissionEntry = ^TSetupPermissionEntry;
  127. TSetupPermissionEntry = packed record
  128. Permissions: AnsiString; { an array of TGrantPermissionEntry's }
  129. end;
  130. const
  131. SetupLanguageEntryStrings = 6;
  132. SetupLanguageEntryAnsiStrings = 4;
  133. type
  134. PSetupLanguageEntry = ^TSetupLanguageEntry;
  135. TSetupLanguageEntry = packed record
  136. Name, LanguageName, DialogFontName, TitleFontName, WelcomeFontName,
  137. CopyrightFontName: String;
  138. Data, LicenseText, InfoBeforeText, InfoAfterText: AnsiString;
  139. LanguageID: Cardinal;
  140. DialogFontSize: Integer;
  141. TitleFontSize: Integer;
  142. WelcomeFontSize: Integer;
  143. CopyrightFontSize: Integer;
  144. RightToLeft: Boolean;
  145. end;
  146. const
  147. SetupCustomMessageEntryStrings = 2;
  148. SetupCustomMessageEntryAnsiStrings = 0;
  149. type
  150. PSetupCustomMessageEntry = ^TSetupCustomMessageEntry;
  151. TSetupCustomMessageEntry = packed record
  152. Name, Value: String;
  153. LangIndex: Integer;
  154. end;
  155. const
  156. SetupTypeEntryStrings = 4;
  157. SetupTypeEntryAnsiStrings = 0;
  158. type
  159. TSetupTypeOption = (toIsCustom);
  160. TSetupTypeOptions = set of TSetupTypeOption;
  161. TSetupTypeType = (ttUser, ttDefaultFull, ttDefaultCompact, ttDefaultCustom);
  162. PSetupTypeEntry = ^TSetupTypeEntry;
  163. TSetupTypeEntry = packed record
  164. Name, Description, Languages, CheckOnce: String;
  165. MinVersion, OnlyBelowVersion: TSetupVersionData;
  166. Options: TSetupTypeOptions;
  167. Typ: TSetupTypeType;
  168. { internally used: }
  169. Size: Integer64;
  170. end;
  171. const
  172. SetupComponentEntryStrings = 5;
  173. SetupComponentEntryAnsiStrings = 0;
  174. type
  175. PSetupComponentEntry = ^TSetupComponentEntry;
  176. TSetupComponentEntry = packed record
  177. Name, Description, Types, Languages, CheckOnce: String;
  178. ExtraDiskSpaceRequired: Integer64;
  179. Level: Integer;
  180. Used: Boolean;
  181. MinVersion, OnlyBelowVersion: TSetupVersionData;
  182. Options: set of (coFixed, coRestart, coDisableNoUninstallWarning,
  183. coExclusive, coDontInheritCheck);
  184. { internally used: }
  185. Size: Integer64;
  186. end;
  187. const
  188. SetupTaskEntryStrings = 6;
  189. SetupTaskEntryAnsiStrings = 0;
  190. type
  191. PSetupTaskEntry = ^TSetupTaskEntry;
  192. TSetupTaskEntry = packed record
  193. Name, Description, GroupDescription, Components, Languages, Check: String;
  194. Level: Integer;
  195. Used: Boolean;
  196. MinVersion, OnlyBelowVersion: TSetupVersionData;
  197. Options: set of (toExclusive, toUnchecked, toRestart, toCheckedOnce,
  198. toDontInheritCheck);
  199. end;
  200. const
  201. SetupDirEntryStrings = 7;
  202. SetupDirEntryAnsiStrings = 0;
  203. type
  204. PSetupDirEntry = ^TSetupDirEntry;
  205. TSetupDirEntry = packed record
  206. DirName: String;
  207. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  208. Attribs: Integer;
  209. MinVersion, OnlyBelowVersion: TSetupVersionData;
  210. PermissionsEntry: Smallint;
  211. Options: set of (doUninsNeverUninstall, doDeleteAfterInstall,
  212. doUninsAlwaysUninstall, doSetNTFSCompression, doUnsetNTFSCompression);
  213. end;
  214. const
  215. SetupISSigKeyEntryStrings = 3;
  216. SetupISSigKeyEntryAnsiStrings = 0;
  217. type
  218. PSetupISSigKeyEntry = ^TSetupISSigKeyEntry;
  219. TSetupISSigKeyEntry = packed record
  220. PublicX, PublicY, RuntimeID: String;
  221. end;
  222. const
  223. SetupFileEntryStrings = 15;
  224. SetupFileEntryAnsiStrings = 1;
  225. type
  226. PSetupFileEntry = ^TSetupFileEntry;
  227. TSetupFileVerificationType = (fvNone, fvHash, fvISSig);
  228. TSetupFileVerification = packed record
  229. ISSigAllowedKeys: AnsiString; { Must be first }
  230. Hash: TSHA256Digest;
  231. Typ: TSetupFileVerificationType;
  232. end;
  233. TSetupFileEntry = packed record
  234. SourceFilename, DestName, InstallFontName, StrongAssemblyName, Components,
  235. Tasks, Languages, Check, AfterInstall, BeforeInstall, Excludes,
  236. DownloadISSigSource, DownloadUserName, DownloadPassword, ExtractArchivePassword: String;
  237. Verification: TSetupFileVerification; { Must be first after strings }
  238. MinVersion, OnlyBelowVersion: TSetupVersionData;
  239. LocationEntry: Integer;
  240. Attribs: Integer;
  241. ExternalSize: Integer64;
  242. PermissionsEntry: Smallint;
  243. Options: set of (foConfirmOverwrite, foUninsNeverUninstall, foRestartReplace,
  244. foDeleteAfterInstall, foRegisterServer, foRegisterTypeLib, foSharedFile,
  245. foCompareTimeStamp, foFontIsntTrueType,
  246. foSkipIfSourceDoesntExist, foOverwriteReadOnly, foOverwriteSameVersion,
  247. foCustomDestName, foOnlyIfDestFileExists, foNoRegError,
  248. foUninsRestartDelete, foOnlyIfDoesntExist, foIgnoreVersion,
  249. foPromptIfOlder, foDontCopy, foUninsRemoveReadOnly,
  250. foRecurseSubDirsExternal, foReplaceSameVersionIfContentsDiffer,
  251. foDontVerifyChecksum, foUninsNoSharedFilePrompt, foCreateAllSubDirs,
  252. fo32Bit, fo64Bit, foExternalSizePreset, foSetNTFSCompression,
  253. foUnsetNTFSCompression, foGacInstall, foDownload,
  254. foExtractArchive);
  255. FileType: (ftUserFile, ftUninstExe);
  256. end;
  257. const
  258. SetupFileLocationEntryStrings = 0;
  259. SetupFileLocationEntryAnsiStrings = 0;
  260. type
  261. PSetupFileLocationEntry = ^TSetupFileLocationEntry;
  262. TSetupFileLocationEntry = packed record
  263. FirstSlice, LastSlice: Integer;
  264. StartOffset: Longint;
  265. ChunkSuboffset: Integer64;
  266. OriginalSize: Integer64;
  267. ChunkCompressedSize: Integer64;
  268. SHA256Sum: TSHA256Digest;
  269. SourceTimeStamp: TFileTime;
  270. FileVersionMS, FileVersionLS: DWORD;
  271. Flags: set of (floVersionInfoValid, floTimeStampInUTC, floCallInstructionOptimized,
  272. floChunkEncrypted, floChunkCompressed);
  273. end;
  274. const
  275. SetupIconEntryStrings = 13;
  276. SetupIconEntryAnsiStrings = 0;
  277. type
  278. TSetupIconCloseOnExit = (icNoSetting, icYes, icNo);
  279. PSetupIconEntry = ^TSetupIconEntry;
  280. TSetupIconEntry = packed record
  281. IconName, Filename, Parameters, WorkingDir, IconFilename, Comment: String;
  282. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  283. AppUserModelID: String;
  284. AppUserModelToastActivatorCLSID: TGUID;
  285. MinVersion, OnlyBelowVersion: TSetupVersionData;
  286. IconIndex, ShowCmd: Integer;
  287. CloseOnExit: TSetupIconCloseOnExit;
  288. HotKey: Word;
  289. Options: set of (ioUninsNeverUninstall, ioCreateOnlyIfFileExists,
  290. ioUseAppPaths, ioExcludeFromShowInNewInstall,
  291. ioPreventPinning, ioHasAppUserModelToastActivatorCLSID);
  292. end;
  293. const
  294. SetupIniEntryStrings = 10;
  295. SetupIniEntryAnsiStrings = 0;
  296. type
  297. PSetupIniEntry = ^TSetupIniEntry;
  298. TSetupIniEntry = packed record
  299. Filename, Section, Entry, Value: String;
  300. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  301. MinVersion, OnlyBelowVersion: TSetupVersionData;
  302. Options: set of (ioCreateKeyIfDoesntExist, ioUninsDeleteEntry,
  303. ioUninsDeleteEntireSection, ioUninsDeleteSectionIfEmpty,
  304. { internally used: }
  305. ioHasValue);
  306. end;
  307. const
  308. SetupRegistryEntryStrings = 9;
  309. SetupRegistryEntryAnsiStrings = 0;
  310. type
  311. PSetupRegistryEntry = ^TSetupRegistryEntry;
  312. TSetupRegistryEntry = packed record
  313. Subkey, ValueName, ValueData: String;
  314. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  315. MinVersion, OnlyBelowVersion: TSetupVersionData;
  316. RootKey: HKEY;
  317. PermissionsEntry: Smallint;
  318. Typ: (rtNone, rtString, rtExpandString, rtDWord, rtBinary, rtMultiString, rtQWord);
  319. Options: set of (roCreateValueIfDoesntExist, roUninsDeleteValue,
  320. roUninsClearValue, roUninsDeleteEntireKey, roUninsDeleteEntireKeyIfEmpty,
  321. roPreserveStringType, roDeleteKey, roDeleteValue, roNoError,
  322. roDontCreateKey, ro32Bit, ro64Bit);
  323. end;
  324. const
  325. SetupDeleteEntryStrings = 7;
  326. SetupDeleteEntryAnsiStrings = 0;
  327. type
  328. TSetupDeleteType = (dfFiles, dfFilesAndOrSubdirs, dfDirIfEmpty);
  329. PSetupDeleteEntry = ^TSetupDeleteEntry;
  330. TSetupDeleteEntry = packed record
  331. Name: String;
  332. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  333. MinVersion, OnlyBelowVersion: TSetupVersionData;
  334. DeleteType: TSetupDeleteType;
  335. end;
  336. const
  337. SetupRunEntryStrings = 13;
  338. SetupRunEntryAnsiStrings = 0;
  339. type
  340. PSetupRunEntry = ^TSetupRunEntry;
  341. TSetupRunEntry = packed record
  342. Name, Parameters, WorkingDir, RunOnceId, StatusMsg, Verb: String;
  343. Description, Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  344. MinVersion, OnlyBelowVersion: TSetupVersionData;
  345. ShowCmd: Integer;
  346. Wait: (rwWaitUntilTerminated, rwNoWait, rwWaitUntilIdle);
  347. Options: set of (roShellExec, roSkipIfDoesntExist,
  348. roPostInstall, roUnchecked, roSkipIfSilent, roSkipIfNotSilent,
  349. roHideWizard, roRun32Bit, roRun64Bit, roRunAsOriginalUser,
  350. roDontLogParameters, roLogOutput);
  351. end;
  352. const
  353. MaxGrantPermissionEntries = 32; { must keep in synch with Helper.c }
  354. type
  355. { TGrantPermissionEntry is stored inside string fields named 'Permissions' }
  356. TGrantPermissionSid = record { must keep in synch with Helper.c }
  357. Authority: TSIDIdentifierAuthority;
  358. SubAuthCount: Byte;
  359. SubAuth: array[0..1] of DWORD;
  360. end;
  361. TGrantPermissionEntry = record { must keep in synch with Helper.c }
  362. Sid: TGrantPermissionSid;
  363. AccessMask: DWORD;
  364. end;
  365. { A TDiskSliceHeader record follows DiskSliceID in a SETUP-*.BIN file }
  366. TDiskSliceHeader = packed record
  367. TotalSize: Cardinal;
  368. end;
  369. { A TMessageHeader record follows MessagesHdrID in a SETUP.MSG file }
  370. TMessagesHeader = packed record
  371. NumMessages: Cardinal;
  372. TotalSize: Cardinal;
  373. NotTotalSize: Cardinal;
  374. CRCMessages: Longint;
  375. end;
  376. { TSetupLdrOffsetTable is stored inside SetupLdr's SetupLdrOffsetTableResID
  377. RCDATA resource }
  378. PSetupLdrOffsetTable = ^TSetupLdrOffsetTable;
  379. TSetupLdrOffsetTable = record
  380. ID: array[1..12] of AnsiChar; { = SetupLdrOffsetTableID }
  381. Version: UInt32; { = SetupLdrOffsetTableVersion }
  382. TotalSize: Int64; { Minimum expected size of setup.exe }
  383. OffsetEXE: Int64; { Offset of compressed setup.e32 }
  384. UncompressedSizeEXE: UInt32; { Size of setup.e32 before compression }
  385. CRCEXE: Int32; { CRC of setup.e32 before compression }
  386. Offset0: Int64; { Offset of embedded setup-0.bin data }
  387. Offset1: Int64; { Offset of embedded setup-1.bin data,
  388. or 0 when DiskSpanning=yes }
  389. ReservedPadding: UInt32; { Not set (just provides padding) }
  390. TableCRC: Int32; { CRC of all prior fields in this record }
  391. end;
  392. { TMessagesLangOptions is a simplified version of TSetupLanguageEntry that
  393. is used by the uninstaller and RegSvr }
  394. TMessagesLangOptions = packed record
  395. ID: TMessagesLangOptionsID;
  396. DialogFontName: array[0..31] of Char;
  397. DialogFontSize: Integer;
  398. Flags: set of (lfRightToLeft);
  399. end;
  400. TUninstallerMsgTail = packed record
  401. ID: Longint;
  402. Offset: Longint;
  403. end;
  404. const
  405. SetupLdrOffsetTableResID = 11111;
  406. SetupLdrOffsetTableID = 'rDlPtS'#$CD#$E6#$D7#$7B#$0B#$2A;
  407. SetupLdrOffsetTableVersion = 2;
  408. SetupExeModeOffset = $30;
  409. SetupExeModeUninstaller = $6E556E49;
  410. SetupExeModeRegSvr = $53526E49;
  411. UninstallerMsgTailID = $67734D49;
  412. implementation
  413. end.