Struct.pas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. unit Struct;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2024 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, Int64Em, SHA1;
  13. const
  14. SetupTitle = 'Inno Setup';
  15. SetupVersion = '6.3.0';
  16. SetupBinVersion = (6 shl 24) + (3 shl 16) + (0 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.3.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.0.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. shWindowVisible, shWindowShowCaption, shWindowResizable,
  49. shWindowStartMaximized, shEnableDirDoesntExistWarning,
  50. shPassword, shAllowRootDirectory, shDisableFinishedPage, shUsePreviousAppDir,
  51. shBackColorHorizontal, shUsePreviousGroup, shUpdateUninstallLogAppName,
  52. shUsePreviousSetupType, shDisableReadyMemo, shAlwaysShowComponentsList,
  53. shFlatComponentsList, shShowComponentSizes, shUsePreviousTasks,
  54. shDisableReadyPage, shAlwaysShowDirOnReadyPage, shAlwaysShowGroupOnReadyPage,
  55. shAllowUNCPath, shUserInfoPage, shUsePreviousUserInfo,
  56. shUninstallRestartComputer, shRestartIfNeededByRun, shShowTasksTreeLines,
  57. shAllowCancelDuringInstall, shWizardImageStretch, shAppendDefaultDirName,
  58. shAppendDefaultGroupName, shEncryptionUsed, shSetupLogging,
  59. shSignedUninstaller, shUsePreviousLanguage, shDisableWelcomePage,
  60. shCloseApplications, shRestartApplications, shAllowNetworkDrive,
  61. shForceCloseApplications, shAppNameHasConsts, shUsePreviousPrivileges,
  62. shWizardResizable, shUninstallLogging);
  63. TSetupLanguageDetectionMethod = (ldUILanguage, ldLocale, ldNone);
  64. TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA, cmLZMA2);
  65. TSetupSalt = array[0..7] of Byte;
  66. TSetupProcessorArchitecture = (paUnknown, paX86, paX64, paIA64, paARM64);
  67. TSetupProcessorArchitectures = set of TSetupProcessorArchitecture;
  68. TSetupDisablePage = (dpAuto, dpNo, dpYes);
  69. TSetupPrivilegesRequired = (prNone, prPowerUser, prAdmin, prLowest);
  70. TSetupPrivilegesRequiredOverride = (proCommandLine, proDialog);
  71. TSetupPrivilegesRequiredOverrides = set of TSetupPrivilegesRequiredOverride;
  72. TSetupWizardStyle = (wsClassic, wsModern);
  73. const
  74. SetupProcessorArchitectureNames: array[TSetupProcessorArchitecture] of String =
  75. ('Unknown', 'x86', 'x64', 'Itanium', 'ARM64');
  76. const
  77. SetupHeaderStrings = 30;
  78. SetupHeaderAnsiStrings = 4;
  79. type
  80. TSetupHeader = packed record
  81. AppName, AppVerName, AppId, AppCopyright, AppPublisher, AppPublisherURL,
  82. AppSupportPhone, AppSupportURL, AppUpdatesURL, AppVersion, DefaultDirName,
  83. DefaultGroupName, BaseFilename, UninstallFilesDir, UninstallDisplayName,
  84. UninstallDisplayIcon, AppMutex, DefaultUserInfoName, DefaultUserInfoOrg,
  85. DefaultUserInfoSerial, AppReadmeFile, AppContact, AppComments,
  86. AppModifyPath, CreateUninstallRegKey, Uninstallable, CloseApplicationsFilter,
  87. SetupMutex, ChangesEnvironment, ChangesAssociations: String;
  88. LicenseText, InfoBeforeText, InfoAfterText, CompiledCodeText: AnsiString;
  89. NumLanguageEntries, NumCustomMessageEntries, NumPermissionEntries,
  90. NumTypeEntries, NumComponentEntries, NumTaskEntries, NumDirEntries,
  91. NumFileEntries, NumFileLocationEntries, NumIconEntries, NumIniEntries,
  92. NumRegistryEntries, NumInstallDeleteEntries, NumUninstallDeleteEntries,
  93. NumRunEntries, NumUninstallRunEntries: Integer;
  94. MinVersion, OnlyBelowVersion: TSetupVersionData;
  95. BackColor, BackColor2: Longint;
  96. WizardStyle: TSetupWizardStyle;
  97. WizardSizePercentX, WizardSizePercentY: Integer;
  98. WizardImageAlphaFormat: (afIgnored, afDefined, afPremultiplied); // Must be same as Graphics.TAlphaFormat
  99. PasswordHash: TSHA1Digest;
  100. PasswordSalt: TSetupSalt;
  101. ExtraDiskSpaceRequired: Integer64;
  102. SlicesPerDisk: Integer;
  103. UninstallLogMode: (lmAppend, lmNew, lmOverwrite);
  104. DirExistsWarning: (ddAuto, ddNo, ddYes);
  105. PrivilegesRequired: TSetupPrivilegesRequired;
  106. PrivilegesRequiredOverridesAllowed: TSetupPrivilegesRequiredOverrides;
  107. ShowLanguageDialog: (slYes, slNo, slAuto);
  108. LanguageDetectionMethod: TSetupLanguageDetectionMethod;
  109. CompressMethod: TSetupCompressMethod;
  110. ArchitecturesAllowed, ArchitecturesInstallIn64BitMode: TSetupProcessorArchitectures;
  111. DisableDirPage, DisableProgramGroupPage: TSetupDisablePage;
  112. UninstallDisplaySize: Integer64;
  113. Options: set of TSetupHeaderOption;
  114. end;
  115. const
  116. SetupPermissionEntryStrings = 0;
  117. SetupPermissionEntryAnsiStrings = 1;
  118. type
  119. PSetupPermissionEntry = ^TSetupPermissionEntry;
  120. TSetupPermissionEntry = packed record
  121. Permissions: AnsiString; { an array of TGrantPermissionEntry's }
  122. end;
  123. const
  124. SetupLanguageEntryStrings = 6;
  125. SetupLanguageEntryAnsiStrings = 4;
  126. type
  127. PSetupLanguageEntry = ^TSetupLanguageEntry;
  128. TSetupLanguageEntry = packed record
  129. Name, LanguageName, DialogFontName, TitleFontName, WelcomeFontName,
  130. CopyrightFontName: String;
  131. Data, LicenseText, InfoBeforeText, InfoAfterText: AnsiString;
  132. LanguageID: Cardinal;
  133. DialogFontSize: Integer;
  134. TitleFontSize: Integer;
  135. WelcomeFontSize: Integer;
  136. CopyrightFontSize: Integer;
  137. RightToLeft: Boolean;
  138. end;
  139. const
  140. SetupCustomMessageEntryStrings = 2;
  141. SetupCustomMessageEntryAnsiStrings = 0;
  142. type
  143. PSetupCustomMessageEntry = ^TSetupCustomMessageEntry;
  144. TSetupCustomMessageEntry = packed record
  145. Name, Value: String;
  146. LangIndex: Integer;
  147. end;
  148. const
  149. SetupTypeEntryStrings = 4;
  150. SetupTypeEntryAnsiStrings = 0;
  151. type
  152. TSetupTypeOption = (toIsCustom);
  153. TSetupTypeOptions = set of TSetupTypeOption;
  154. TSetupTypeType = (ttUser, ttDefaultFull, ttDefaultCompact, ttDefaultCustom);
  155. PSetupTypeEntry = ^TSetupTypeEntry;
  156. TSetupTypeEntry = packed record
  157. Name, Description, Languages, Check: String;
  158. MinVersion, OnlyBelowVersion: TSetupVersionData;
  159. Options: TSetupTypeOptions;
  160. Typ: TSetupTypeType;
  161. { internally used: }
  162. Size: Integer64;
  163. end;
  164. const
  165. SetupComponentEntryStrings = 5;
  166. SetupComponentEntryAnsiStrings = 0;
  167. type
  168. PSetupComponentEntry = ^TSetupComponentEntry;
  169. TSetupComponentEntry = packed record
  170. Name, Description, Types, Languages, Check: String;
  171. ExtraDiskSpaceRequired: Integer64;
  172. Level: Integer;
  173. Used: Boolean;
  174. MinVersion, OnlyBelowVersion: TSetupVersionData;
  175. Options: set of (coFixed, coRestart, coDisableNoUninstallWarning,
  176. coExclusive, coDontInheritCheck);
  177. { internally used: }
  178. Size: Integer64;
  179. end;
  180. const
  181. SetupTaskEntryStrings = 6;
  182. SetupTaskEntryAnsiStrings = 0;
  183. type
  184. PSetupTaskEntry = ^TSetupTaskEntry;
  185. TSetupTaskEntry = packed record
  186. Name, Description, GroupDescription, Components, Languages, Check: String;
  187. Level: Integer;
  188. Used: Boolean;
  189. MinVersion, OnlyBelowVersion: TSetupVersionData;
  190. Options: set of (toExclusive, toUnchecked, toRestart, toCheckedOnce,
  191. toDontInheritCheck);
  192. end;
  193. const
  194. SetupDirEntryStrings = 7;
  195. SetupDirEntryAnsiStrings = 0;
  196. type
  197. PSetupDirEntry = ^TSetupDirEntry;
  198. TSetupDirEntry = packed record
  199. DirName: String;
  200. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  201. Attribs: Integer;
  202. MinVersion, OnlyBelowVersion: TSetupVersionData;
  203. PermissionsEntry: Smallint;
  204. Options: set of (doUninsNeverUninstall, doDeleteAfterInstall,
  205. doUninsAlwaysUninstall, doSetNTFSCompression, doUnsetNTFSCompression);
  206. end;
  207. const
  208. SetupFileEntryStrings = 10;
  209. SetupFileEntryAnsiStrings = 0;
  210. type
  211. PSetupFileEntry = ^TSetupFileEntry;
  212. TSetupFileEntry = packed record
  213. SourceFilename, DestName, InstallFontName, StrongAssemblyName: String;
  214. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  215. MinVersion, OnlyBelowVersion: TSetupVersionData;
  216. LocationEntry: Integer;
  217. Attribs: Integer;
  218. ExternalSize: Integer64;
  219. PermissionsEntry: Smallint;
  220. Options: set of (foConfirmOverwrite, foUninsNeverUninstall, foRestartReplace,
  221. foDeleteAfterInstall, foRegisterServer, foRegisterTypeLib, foSharedFile,
  222. foCompareTimeStamp, foFontIsntTrueType,
  223. foSkipIfSourceDoesntExist, foOverwriteReadOnly, foOverwriteSameVersion,
  224. foCustomDestName, foOnlyIfDestFileExists, foNoRegError,
  225. foUninsRestartDelete, foOnlyIfDoesntExist, foIgnoreVersion,
  226. foPromptIfOlder, foDontCopy, foUninsRemoveReadOnly,
  227. foRecurseSubDirsExternal, foReplaceSameVersionIfContentsDiffer,
  228. foDontVerifyChecksum, foUninsNoSharedFilePrompt, foCreateAllSubDirs,
  229. fo32Bit, fo64Bit, foExternalSizePreset, foSetNTFSCompression,
  230. foUnsetNTFSCompression, foGacInstall);
  231. FileType: (ftUserFile, ftUninstExe);
  232. end;
  233. const
  234. SetupFileLocationEntryStrings = 0;
  235. SetupFileLocationEntryAnsiStrings = 0;
  236. type
  237. PSetupFileLocationEntry = ^TSetupFileLocationEntry;
  238. TSetupFileLocationEntry = packed record
  239. FirstSlice, LastSlice: Integer;
  240. StartOffset: Longint;
  241. ChunkSuboffset: Integer64;
  242. OriginalSize: Integer64;
  243. ChunkCompressedSize: Integer64;
  244. SHA1Sum: TSHA1Digest;
  245. SourceTimeStamp: TFileTime;
  246. FileVersionMS, FileVersionLS: DWORD;
  247. Flags: set of (foVersionInfoValid, foVersionInfoNotValid, foTimeStampInUTC,
  248. foIsUninstExe, foCallInstructionOptimized, foApplyTouchDateTime,
  249. foChunkEncrypted, foChunkCompressed, foSolidBreak, foSign, foSignOnce);
  250. end;
  251. TSetupIconCloseOnExit = (icNoSetting, icYes, icNo);
  252. const
  253. SetupIconEntryStrings = 13;
  254. SetupIconEntryAnsiStrings = 0;
  255. type
  256. PSetupIconEntry = ^TSetupIconEntry;
  257. TSetupIconEntry = packed record
  258. IconName, Filename, Parameters, WorkingDir, IconFilename, Comment: String;
  259. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  260. AppUserModelID: String;
  261. AppUserModelToastActivatorCLSID: TGUID;
  262. MinVersion, OnlyBelowVersion: TSetupVersionData;
  263. IconIndex, ShowCmd: Integer;
  264. CloseOnExit: TSetupIconCloseOnExit;
  265. HotKey: Word;
  266. Options: set of (ioUninsNeverUninstall, ioCreateOnlyIfFileExists,
  267. ioUseAppPaths, ioExcludeFromShowInNewInstall,
  268. ioPreventPinning, ioHasAppUserModelToastActivatorCLSID);
  269. end;
  270. const
  271. SetupIniEntryStrings = 10;
  272. SetupIniEntryAnsiStrings = 0;
  273. type
  274. PSetupIniEntry = ^TSetupIniEntry;
  275. TSetupIniEntry = packed record
  276. Filename, Section, Entry, Value: String;
  277. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  278. MinVersion, OnlyBelowVersion: TSetupVersionData;
  279. Options: set of (ioCreateKeyIfDoesntExist, ioUninsDeleteEntry,
  280. ioUninsDeleteEntireSection, ioUninsDeleteSectionIfEmpty,
  281. { internally used: }
  282. ioHasValue);
  283. end;
  284. const
  285. SetupRegistryEntryStrings = 9;
  286. SetupRegistryEntryAnsiStrings = 0;
  287. type
  288. PSetupRegistryEntry = ^TSetupRegistryEntry;
  289. TSetupRegistryEntry = packed record
  290. Subkey, ValueName, ValueData: String;
  291. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  292. MinVersion, OnlyBelowVersion: TSetupVersionData;
  293. RootKey: HKEY;
  294. PermissionsEntry: Smallint;
  295. Typ: (rtNone, rtString, rtExpandString, rtDWord, rtBinary, rtMultiString, rtQWord);
  296. Options: set of (roCreateValueIfDoesntExist, roUninsDeleteValue,
  297. roUninsClearValue, roUninsDeleteEntireKey, roUninsDeleteEntireKeyIfEmpty,
  298. roPreserveStringType, roDeleteKey, roDeleteValue, roNoError,
  299. roDontCreateKey, ro32Bit, ro64Bit);
  300. end;
  301. const
  302. SetupDeleteEntryStrings = 7;
  303. SetupDeleteEntryAnsiStrings = 0;
  304. type
  305. TSetupDeleteType = (dfFiles, dfFilesAndOrSubdirs, dfDirIfEmpty);
  306. PSetupDeleteEntry = ^TSetupDeleteEntry;
  307. TSetupDeleteEntry = packed record
  308. Name: String;
  309. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  310. MinVersion, OnlyBelowVersion: TSetupVersionData;
  311. DeleteType: TSetupDeleteType;
  312. end;
  313. const
  314. SetupRunEntryStrings = 13;
  315. SetupRunEntryAnsiStrings = 0;
  316. type
  317. PSetupRunEntry = ^TSetupRunEntry;
  318. TSetupRunEntry = packed record
  319. Name, Parameters, WorkingDir, RunOnceId, StatusMsg, Verb: String;
  320. Description, Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  321. MinVersion, OnlyBelowVersion: TSetupVersionData;
  322. ShowCmd: Integer;
  323. Wait: (rwWaitUntilTerminated, rwNoWait, rwWaitUntilIdle);
  324. Options: set of (roShellExec, roSkipIfDoesntExist,
  325. roPostInstall, roUnchecked, roSkipIfSilent, roSkipIfNotSilent,
  326. roHideWizard, roRun32Bit, roRun64Bit, roRunAsOriginalUser, roDontLogParameters);
  327. end;
  328. const
  329. MaxGrantPermissionEntries = 32; { must keep in synch with Helper.c }
  330. type
  331. { TGrantPermissionEntry is stored inside string fields named 'Permissions' }
  332. TGrantPermissionSid = record { must keep in synch with Helper.c }
  333. Authority: TSIDIdentifierAuthority;
  334. SubAuthCount: Byte;
  335. SubAuth: array[0..1] of DWORD;
  336. end;
  337. TGrantPermissionEntry = record { must keep in synch with Helper.c }
  338. Sid: TGrantPermissionSid;
  339. AccessMask: DWORD;
  340. end;
  341. { A TDiskSliceHeader record follows DiskSliceID in a SETUP-*.BIN file }
  342. TDiskSliceHeader = packed record
  343. TotalSize: Cardinal;
  344. end;
  345. { A TMessageHeader record follows MessagesHdrID in a SETUP.MSG file }
  346. TMessagesHeader = packed record
  347. NumMessages: Cardinal;
  348. TotalSize: Cardinal;
  349. NotTotalSize: Cardinal;
  350. CRCMessages: Longint;
  351. end;
  352. { TSetupLdrOffsetTable is stored inside SetupLdr's SetupLdrOffsetTableResID
  353. RCDATA resource }
  354. PSetupLdrOffsetTable = ^TSetupLdrOffsetTable;
  355. TSetupLdrOffsetTable = packed record
  356. ID: array[1..12] of AnsiChar; { = SetupLdrOffsetTableID }
  357. Version: LongWord; { = SetupLdrOffsetTableVersion }
  358. TotalSize: LongWord; { Minimum expected size of setup.exe }
  359. OffsetEXE: LongWord; { Offset of compressed setup.e32 }
  360. UncompressedSizeEXE: LongWord; { Size of setup.e32 before compression }
  361. CRCEXE: Longint; { CRC of setup.e32 before compression }
  362. Offset0: LongWord; { Offset of embedded setup-0.bin data }
  363. Offset1: LongWord; { Offset of embedded setup-1.bin data,
  364. or 0 when DiskSpanning=yes }
  365. TableCRC: Longint; { CRC of all prior fields in this record }
  366. end;
  367. { TMessagesLangOptions is a simplified version of TSetupLanguageEntry that
  368. is used by the uninstaller and RegSvr }
  369. TMessagesLangOptions = packed record
  370. ID: TMessagesLangOptionsID;
  371. DialogFontName: array[0..31] of Char;
  372. DialogFontSize: Integer;
  373. Flags: set of (lfRightToLeft);
  374. end;
  375. TUninstallerMsgTail = packed record
  376. ID: Longint;
  377. Offset: Longint;
  378. end;
  379. const
  380. SetupLdrOffsetTableResID = 11111;
  381. SetupLdrOffsetTableID = 'rDlPtS'#$CD#$E6#$D7#$7B#$0B#$2A;
  382. SetupLdrOffsetTableVersion = 1;
  383. SetupExeModeOffset = $30;
  384. SetupExeModeUninstaller = $6E556E49;
  385. SetupExeModeRegSvr = $53526E49;
  386. UninstallerMsgTailID = $67734D49;
  387. implementation
  388. end.