Shared.Struct.pas 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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 = 12;
  224. SetupFileEntryAnsiStrings = 1;
  225. type
  226. PSetupFileEntry = ^TSetupFileEntry;
  227. TSetupFileEntry = packed record
  228. SourceFilename, DestName, InstallFontName, StrongAssemblyName, Components,
  229. Tasks, Languages, Check, AfterInstall, BeforeInstall, Excludes,
  230. ExtractArchivePassword: String;
  231. ISSigAllowedKeys: AnsiString;
  232. MinVersion, OnlyBelowVersion: TSetupVersionData;
  233. LocationEntry: Integer;
  234. Attribs: Integer;
  235. ExternalSize: Integer64;
  236. PermissionsEntry: Smallint;
  237. Options: set of (foConfirmOverwrite, foUninsNeverUninstall, foRestartReplace,
  238. foDeleteAfterInstall, foRegisterServer, foRegisterTypeLib, foSharedFile,
  239. foCompareTimeStamp, foFontIsntTrueType,
  240. foSkipIfSourceDoesntExist, foOverwriteReadOnly, foOverwriteSameVersion,
  241. foCustomDestName, foOnlyIfDestFileExists, foNoRegError,
  242. foUninsRestartDelete, foOnlyIfDoesntExist, foIgnoreVersion,
  243. foPromptIfOlder, foDontCopy, foUninsRemoveReadOnly,
  244. foRecurseSubDirsExternal, foReplaceSameVersionIfContentsDiffer,
  245. foDontVerifyChecksum, foUninsNoSharedFilePrompt, foCreateAllSubDirs,
  246. fo32Bit, fo64Bit, foExternalSizePreset, foSetNTFSCompression,
  247. foUnsetNTFSCompression, foGacInstall, foISSigVerify, foExtractArchive);
  248. FileType: (ftUserFile, ftUninstExe);
  249. end;
  250. const
  251. SetupFileLocationEntryStrings = 0;
  252. SetupFileLocationEntryAnsiStrings = 0;
  253. type
  254. PSetupFileLocationEntry = ^TSetupFileLocationEntry;
  255. TSetupFileLocationEntry = packed record
  256. FirstSlice, LastSlice: Integer;
  257. StartOffset: Longint;
  258. ChunkSuboffset: Integer64;
  259. OriginalSize: Integer64;
  260. ChunkCompressedSize: Integer64;
  261. SHA256Sum: TSHA256Digest;
  262. SourceTimeStamp: TFileTime;
  263. FileVersionMS, FileVersionLS: DWORD;
  264. Flags: set of (floVersionInfoValid, floTimeStampInUTC, floCallInstructionOptimized,
  265. floChunkEncrypted, floChunkCompressed);
  266. end;
  267. const
  268. SetupIconEntryStrings = 13;
  269. SetupIconEntryAnsiStrings = 0;
  270. type
  271. TSetupIconCloseOnExit = (icNoSetting, icYes, icNo);
  272. PSetupIconEntry = ^TSetupIconEntry;
  273. TSetupIconEntry = packed record
  274. IconName, Filename, Parameters, WorkingDir, IconFilename, Comment: String;
  275. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  276. AppUserModelID: String;
  277. AppUserModelToastActivatorCLSID: TGUID;
  278. MinVersion, OnlyBelowVersion: TSetupVersionData;
  279. IconIndex, ShowCmd: Integer;
  280. CloseOnExit: TSetupIconCloseOnExit;
  281. HotKey: Word;
  282. Options: set of (ioUninsNeverUninstall, ioCreateOnlyIfFileExists,
  283. ioUseAppPaths, ioExcludeFromShowInNewInstall,
  284. ioPreventPinning, ioHasAppUserModelToastActivatorCLSID);
  285. end;
  286. const
  287. SetupIniEntryStrings = 10;
  288. SetupIniEntryAnsiStrings = 0;
  289. type
  290. PSetupIniEntry = ^TSetupIniEntry;
  291. TSetupIniEntry = packed record
  292. Filename, Section, Entry, Value: String;
  293. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  294. MinVersion, OnlyBelowVersion: TSetupVersionData;
  295. Options: set of (ioCreateKeyIfDoesntExist, ioUninsDeleteEntry,
  296. ioUninsDeleteEntireSection, ioUninsDeleteSectionIfEmpty,
  297. { internally used: }
  298. ioHasValue);
  299. end;
  300. const
  301. SetupRegistryEntryStrings = 9;
  302. SetupRegistryEntryAnsiStrings = 0;
  303. type
  304. PSetupRegistryEntry = ^TSetupRegistryEntry;
  305. TSetupRegistryEntry = packed record
  306. Subkey, ValueName, ValueData: String;
  307. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  308. MinVersion, OnlyBelowVersion: TSetupVersionData;
  309. RootKey: HKEY;
  310. PermissionsEntry: Smallint;
  311. Typ: (rtNone, rtString, rtExpandString, rtDWord, rtBinary, rtMultiString, rtQWord);
  312. Options: set of (roCreateValueIfDoesntExist, roUninsDeleteValue,
  313. roUninsClearValue, roUninsDeleteEntireKey, roUninsDeleteEntireKeyIfEmpty,
  314. roPreserveStringType, roDeleteKey, roDeleteValue, roNoError,
  315. roDontCreateKey, ro32Bit, ro64Bit);
  316. end;
  317. const
  318. SetupDeleteEntryStrings = 7;
  319. SetupDeleteEntryAnsiStrings = 0;
  320. type
  321. TSetupDeleteType = (dfFiles, dfFilesAndOrSubdirs, dfDirIfEmpty);
  322. PSetupDeleteEntry = ^TSetupDeleteEntry;
  323. TSetupDeleteEntry = packed record
  324. Name: String;
  325. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  326. MinVersion, OnlyBelowVersion: TSetupVersionData;
  327. DeleteType: TSetupDeleteType;
  328. end;
  329. const
  330. SetupRunEntryStrings = 13;
  331. SetupRunEntryAnsiStrings = 0;
  332. type
  333. PSetupRunEntry = ^TSetupRunEntry;
  334. TSetupRunEntry = packed record
  335. Name, Parameters, WorkingDir, RunOnceId, StatusMsg, Verb: String;
  336. Description, Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  337. MinVersion, OnlyBelowVersion: TSetupVersionData;
  338. ShowCmd: Integer;
  339. Wait: (rwWaitUntilTerminated, rwNoWait, rwWaitUntilIdle);
  340. Options: set of (roShellExec, roSkipIfDoesntExist,
  341. roPostInstall, roUnchecked, roSkipIfSilent, roSkipIfNotSilent,
  342. roHideWizard, roRun32Bit, roRun64Bit, roRunAsOriginalUser,
  343. roDontLogParameters, roLogOutput);
  344. end;
  345. const
  346. MaxGrantPermissionEntries = 32; { must keep in synch with Helper.c }
  347. type
  348. { TGrantPermissionEntry is stored inside string fields named 'Permissions' }
  349. TGrantPermissionSid = record { must keep in synch with Helper.c }
  350. Authority: TSIDIdentifierAuthority;
  351. SubAuthCount: Byte;
  352. SubAuth: array[0..1] of DWORD;
  353. end;
  354. TGrantPermissionEntry = record { must keep in synch with Helper.c }
  355. Sid: TGrantPermissionSid;
  356. AccessMask: DWORD;
  357. end;
  358. { A TDiskSliceHeader record follows DiskSliceID in a SETUP-*.BIN file }
  359. TDiskSliceHeader = packed record
  360. TotalSize: Cardinal;
  361. end;
  362. { A TMessageHeader record follows MessagesHdrID in a SETUP.MSG file }
  363. TMessagesHeader = packed record
  364. NumMessages: Cardinal;
  365. TotalSize: Cardinal;
  366. NotTotalSize: Cardinal;
  367. CRCMessages: Longint;
  368. end;
  369. { TSetupLdrOffsetTable is stored inside SetupLdr's SetupLdrOffsetTableResID
  370. RCDATA resource }
  371. PSetupLdrOffsetTable = ^TSetupLdrOffsetTable;
  372. TSetupLdrOffsetTable = packed record
  373. ID: array[1..12] of AnsiChar; { = SetupLdrOffsetTableID }
  374. Version: LongWord; { = SetupLdrOffsetTableVersion }
  375. TotalSize: LongWord; { Minimum expected size of setup.exe }
  376. OffsetEXE: LongWord; { Offset of compressed setup.e32 }
  377. UncompressedSizeEXE: LongWord; { Size of setup.e32 before compression }
  378. CRCEXE: Longint; { CRC of setup.e32 before compression }
  379. Offset0: LongWord; { Offset of embedded setup-0.bin data }
  380. Offset1: LongWord; { Offset of embedded setup-1.bin data,
  381. or 0 when DiskSpanning=yes }
  382. TableCRC: Longint; { CRC of all prior fields in this record }
  383. end;
  384. { TMessagesLangOptions is a simplified version of TSetupLanguageEntry that
  385. is used by the uninstaller and RegSvr }
  386. TMessagesLangOptions = packed record
  387. ID: TMessagesLangOptionsID;
  388. DialogFontName: array[0..31] of Char;
  389. DialogFontSize: Integer;
  390. Flags: set of (lfRightToLeft);
  391. end;
  392. TUninstallerMsgTail = packed record
  393. ID: Longint;
  394. Offset: Longint;
  395. end;
  396. const
  397. SetupLdrOffsetTableResID = 11111;
  398. SetupLdrOffsetTableID = 'rDlPtS'#$CD#$E6#$D7#$7B#$0B#$2A;
  399. SetupLdrOffsetTableVersion = 1;
  400. SetupExeModeOffset = $30;
  401. SetupExeModeUninstaller = $6E556E49;
  402. SetupExeModeRegSvr = $53526E49;
  403. UninstallerMsgTailID = $67734D49;
  404. implementation
  405. end.