Shared.Struct.pas 16 KB

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