Struct.pas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. unit Struct;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2020 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.2.1';
  16. SetupBinVersion = (6 shl 24) + (2 shl 16) + (1 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.1.0)'{$IFDEF UNICODE}+' (u)'{$ENDIF};
  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)'{$IFDEF UNICODE}+' (u)'{$ENDIF};
  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,
  59. {$IFNDEF UNICODE}shShowUndisplayableLanguages, {$ENDIF}shSetupLogging,
  60. shSignedUninstaller, shUsePreviousLanguage, shDisableWelcomePage,
  61. shCloseApplications, shRestartApplications, shAllowNetworkDrive,
  62. shForceCloseApplications, shAppNameHasConsts, shUsePreviousPrivileges,
  63. shWizardResizable);
  64. TSetupLanguageDetectionMethod = (ldUILanguage, ldLocale, ldNone);
  65. TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA, cmLZMA2);
  66. TSetupSalt = array[0..7] of Byte;
  67. TSetupProcessorArchitecture = (paUnknown, paX86, paX64, paIA64, paARM64);
  68. TSetupProcessorArchitectures = set of TSetupProcessorArchitecture;
  69. TSetupDisablePage = (dpAuto, dpNo, dpYes);
  70. TSetupPrivilegesRequired = (prNone, prPowerUser, prAdmin, prLowest);
  71. TSetupPrivilegesRequiredOverride = (proCommandLine, proDialog);
  72. TSetupPrivilegesRequiredOverrides = set of TSetupPrivilegesRequiredOverride;
  73. TSetupWizardStyle = (wsClassic, wsModern);
  74. const
  75. SetupProcessorArchitectureNames: array[TSetupProcessorArchitecture] of String =
  76. ('Unknown', 'x86', 'x64', 'Itanium', 'ARM64');
  77. const
  78. SetupHeaderStrings = 30;
  79. SetupHeaderAnsiStrings = 4;
  80. type
  81. TSetupHeader = packed record
  82. AppName, AppVerName, AppId, AppCopyright, AppPublisher, AppPublisherURL,
  83. AppSupportPhone, AppSupportURL, AppUpdatesURL, AppVersion, DefaultDirName,
  84. DefaultGroupName, BaseFilename, UninstallFilesDir, UninstallDisplayName,
  85. UninstallDisplayIcon, AppMutex, DefaultUserInfoName, DefaultUserInfoOrg,
  86. DefaultUserInfoSerial, AppReadmeFile, AppContact, AppComments,
  87. AppModifyPath, CreateUninstallRegKey, Uninstallable, CloseApplicationsFilter,
  88. SetupMutex, ChangesEnvironment, ChangesAssociations: String;
  89. LicenseText, InfoBeforeText, InfoAfterText, CompiledCodeText: AnsiString;
  90. {$IFNDEF UNICODE}
  91. LeadBytes: set of AnsiChar;
  92. {$ENDIF}
  93. NumLanguageEntries, NumCustomMessageEntries, NumPermissionEntries,
  94. NumTypeEntries, NumComponentEntries, NumTaskEntries, NumDirEntries,
  95. NumFileEntries, NumFileLocationEntries, NumIconEntries, NumIniEntries,
  96. NumRegistryEntries, NumInstallDeleteEntries, NumUninstallDeleteEntries,
  97. NumRunEntries, NumUninstallRunEntries: Integer;
  98. MinVersion, OnlyBelowVersion: TSetupVersionData;
  99. BackColor, BackColor2: Longint;
  100. WizardStyle: TSetupWizardStyle;
  101. WizardSizePercentX, WizardSizePercentY: Integer;
  102. WizardImageAlphaFormat: (afIgnored, afDefined, afPremultiplied); // Must be same as Graphics.TAlphaFormat
  103. PasswordHash: TSHA1Digest;
  104. PasswordSalt: TSetupSalt;
  105. ExtraDiskSpaceRequired: Integer64;
  106. SlicesPerDisk: Integer;
  107. UninstallLogMode: (lmAppend, lmNew, lmOverwrite);
  108. DirExistsWarning: (ddAuto, ddNo, ddYes);
  109. PrivilegesRequired: TSetupPrivilegesRequired;
  110. PrivilegesRequiredOverridesAllowed: TSetupPrivilegesRequiredOverrides;
  111. ShowLanguageDialog: (slYes, slNo, slAuto);
  112. LanguageDetectionMethod: TSetupLanguageDetectionMethod;
  113. CompressMethod: TSetupCompressMethod;
  114. ArchitecturesAllowed, ArchitecturesInstallIn64BitMode: TSetupProcessorArchitectures;
  115. DisableDirPage, DisableProgramGroupPage: TSetupDisablePage;
  116. UninstallDisplaySize: Integer64;
  117. Options: set of TSetupHeaderOption;
  118. end;
  119. const
  120. SetupPermissionEntryStrings = 0;
  121. SetupPermissionEntryAnsiStrings = 1;
  122. type
  123. PSetupPermissionEntry = ^TSetupPermissionEntry;
  124. TSetupPermissionEntry = packed record
  125. Permissions: AnsiString; { an array of TGrantPermissionEntry's }
  126. end;
  127. const
  128. SetupLanguageEntryStrings = 6;
  129. SetupLanguageEntryAnsiStrings = 4;
  130. type
  131. PSetupLanguageEntry = ^TSetupLanguageEntry;
  132. TSetupLanguageEntry = packed record
  133. {$IFNDEF UNICODE}
  134. { Note: LanguageName is Unicode }
  135. {$ENDIF}
  136. Name, LanguageName, DialogFontName, TitleFontName, WelcomeFontName,
  137. CopyrightFontName: String;
  138. Data, LicenseText, InfoBeforeText, InfoAfterText: AnsiString;
  139. LanguageID{$IFNDEF UNICODE}, LanguageCodePage{$ENDIF}: 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, Check: 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, Check: 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. SetupFileEntryStrings = 10;
  216. SetupFileEntryAnsiStrings = 0;
  217. type
  218. PSetupFileEntry = ^TSetupFileEntry;
  219. TSetupFileEntry = packed record
  220. SourceFilename, DestName, InstallFontName, StrongAssemblyName: String;
  221. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  222. MinVersion, OnlyBelowVersion: TSetupVersionData;
  223. LocationEntry: Integer;
  224. Attribs: Integer;
  225. ExternalSize: Integer64;
  226. PermissionsEntry: Smallint;
  227. Options: set of (foConfirmOverwrite, foUninsNeverUninstall, foRestartReplace,
  228. foDeleteAfterInstall, foRegisterServer, foRegisterTypeLib, foSharedFile,
  229. foCompareTimeStamp, foFontIsntTrueType,
  230. foSkipIfSourceDoesntExist, foOverwriteReadOnly, foOverwriteSameVersion,
  231. foCustomDestName, foOnlyIfDestFileExists, foNoRegError,
  232. foUninsRestartDelete, foOnlyIfDoesntExist, foIgnoreVersion,
  233. foPromptIfOlder, foDontCopy, foUninsRemoveReadOnly,
  234. foRecurseSubDirsExternal, foReplaceSameVersionIfContentsDiffer,
  235. foDontVerifyChecksum, foUninsNoSharedFilePrompt, foCreateAllSubDirs,
  236. fo32Bit, fo64Bit, foExternalSizePreset, foSetNTFSCompression,
  237. foUnsetNTFSCompression, foGacInstall);
  238. FileType: (ftUserFile, ftUninstExe);
  239. end;
  240. const
  241. SetupFileLocationEntryStrings = 0;
  242. SetupFileLocationEntryAnsiStrings = 0;
  243. type
  244. PSetupFileLocationEntry = ^TSetupFileLocationEntry;
  245. TSetupFileLocationEntry = packed record
  246. FirstSlice, LastSlice: Integer;
  247. StartOffset: Longint;
  248. ChunkSuboffset: Integer64;
  249. OriginalSize: Integer64;
  250. ChunkCompressedSize: Integer64;
  251. SHA1Sum: TSHA1Digest;
  252. SourceTimeStamp: TFileTime;
  253. FileVersionMS, FileVersionLS: DWORD;
  254. Flags: set of (foVersionInfoValid, foVersionInfoNotValid, foTimeStampInUTC,
  255. foIsUninstExe, foCallInstructionOptimized, foApplyTouchDateTime,
  256. foChunkEncrypted, foChunkCompressed, foSolidBreak, foSign, foSignOnce);
  257. end;
  258. TSetupIconCloseOnExit = (icNoSetting, icYes, icNo);
  259. const
  260. SetupIconEntryStrings = 13;
  261. SetupIconEntryAnsiStrings = 0;
  262. type
  263. PSetupIconEntry = ^TSetupIconEntry;
  264. TSetupIconEntry = packed record
  265. IconName, Filename, Parameters, WorkingDir, IconFilename, Comment: String;
  266. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  267. AppUserModelID: String;
  268. AppUserModelToastActivatorCLSID: TGUID;
  269. MinVersion, OnlyBelowVersion: TSetupVersionData;
  270. IconIndex, ShowCmd: Integer;
  271. CloseOnExit: TSetupIconCloseOnExit;
  272. HotKey: Word;
  273. Options: set of (ioUninsNeverUninstall, ioCreateOnlyIfFileExists,
  274. ioUseAppPaths, ioFolderShortcut, ioExcludeFromShowInNewInstall,
  275. ioPreventPinning, ioHasAppUserModelToastActivatorCLSID);
  276. end;
  277. const
  278. SetupIniEntryStrings = 10;
  279. SetupIniEntryAnsiStrings = 0;
  280. type
  281. PSetupIniEntry = ^TSetupIniEntry;
  282. TSetupIniEntry = packed record
  283. Filename, Section, Entry, Value: String;
  284. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  285. MinVersion, OnlyBelowVersion: TSetupVersionData;
  286. Options: set of (ioCreateKeyIfDoesntExist, ioUninsDeleteEntry,
  287. ioUninsDeleteEntireSection, ioUninsDeleteSectionIfEmpty,
  288. { internally used: }
  289. ioHasValue);
  290. end;
  291. const
  292. SetupRegistryEntryStrings = 9;
  293. SetupRegistryEntryAnsiStrings = 0;
  294. type
  295. PSetupRegistryEntry = ^TSetupRegistryEntry;
  296. TSetupRegistryEntry = packed record
  297. Subkey, ValueName, ValueData: String;
  298. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  299. MinVersion, OnlyBelowVersion: TSetupVersionData;
  300. RootKey: HKEY;
  301. PermissionsEntry: Smallint;
  302. Typ: (rtNone, rtString, rtExpandString, rtDWord, rtBinary, rtMultiString, rtQWord);
  303. Options: set of (roCreateValueIfDoesntExist, roUninsDeleteValue,
  304. roUninsClearValue, roUninsDeleteEntireKey, roUninsDeleteEntireKeyIfEmpty,
  305. roPreserveStringType, roDeleteKey, roDeleteValue, roNoError,
  306. roDontCreateKey, ro32Bit, ro64Bit);
  307. end;
  308. const
  309. SetupDeleteEntryStrings = 7;
  310. SetupDeleteEntryAnsiStrings = 0;
  311. type
  312. TSetupDeleteType = (dfFiles, dfFilesAndOrSubdirs, dfDirIfEmpty);
  313. PSetupDeleteEntry = ^TSetupDeleteEntry;
  314. TSetupDeleteEntry = packed record
  315. Name: String;
  316. Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  317. MinVersion, OnlyBelowVersion: TSetupVersionData;
  318. DeleteType: TSetupDeleteType;
  319. end;
  320. const
  321. SetupRunEntryStrings = 13;
  322. SetupRunEntryAnsiStrings = 0;
  323. type
  324. PSetupRunEntry = ^TSetupRunEntry;
  325. TSetupRunEntry = packed record
  326. Name, Parameters, WorkingDir, RunOnceId, StatusMsg, Verb: String;
  327. Description, Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
  328. MinVersion, OnlyBelowVersion: TSetupVersionData;
  329. ShowCmd: Integer;
  330. Wait: (rwWaitUntilTerminated, rwNoWait, rwWaitUntilIdle);
  331. Options: set of (roShellExec, roSkipIfDoesntExist,
  332. roPostInstall, roUnchecked, roSkipIfSilent, roSkipIfNotSilent,
  333. roHideWizard, roRun32Bit, roRun64Bit, roRunAsOriginalUser, roDontLogParameters);
  334. end;
  335. const
  336. MaxGrantPermissionEntries = 32; { must keep in synch with Helper.c }
  337. type
  338. { TGrantPermissionEntry is stored inside string fields named 'Permissions' }
  339. TGrantPermissionSid = record { must keep in synch with Helper.c }
  340. Authority: TSIDIdentifierAuthority;
  341. SubAuthCount: Byte;
  342. SubAuth: array[0..1] of DWORD;
  343. end;
  344. TGrantPermissionEntry = record { must keep in synch with Helper.c }
  345. Sid: TGrantPermissionSid;
  346. AccessMask: DWORD;
  347. end;
  348. { A TDiskSliceHeader record follows DiskSliceID in a SETUP-*.BIN file }
  349. TDiskSliceHeader = packed record
  350. TotalSize: Cardinal;
  351. end;
  352. { A TMessageHeader record follows MessagesHdrID in a SETUP.MSG file }
  353. TMessagesHeader = packed record
  354. NumMessages: Cardinal;
  355. TotalSize: Cardinal;
  356. NotTotalSize: Cardinal;
  357. CRCMessages: Longint;
  358. end;
  359. { TSetupLdrOffsetTable is stored inside SetupLdr's SetupLdrOffsetTableResID
  360. RCDATA resource }
  361. PSetupLdrOffsetTable = ^TSetupLdrOffsetTable;
  362. TSetupLdrOffsetTable = packed record
  363. ID: array[1..12] of AnsiChar; { = SetupLdrOffsetTableID }
  364. Version: LongWord; { = SetupLdrOffsetTableVersion }
  365. TotalSize: LongWord; { Minimum expected size of setup.exe }
  366. OffsetEXE: LongWord; { Offset of compressed setup.e32 }
  367. UncompressedSizeEXE: LongWord; { Size of setup.e32 before compression }
  368. CRCEXE: Longint; { CRC of setup.e32 before compression }
  369. Offset0: LongWord; { Offset of embedded setup-0.bin data }
  370. Offset1: LongWord; { Offset of embedded setup-1.bin data,
  371. or 0 when DiskSpanning=yes }
  372. TableCRC: Longint; { CRC of all prior fields in this record }
  373. end;
  374. { TMessagesLangOptions is a simplified version of TSetupLanguageEntry that
  375. is used by the uninstaller and RegSvr }
  376. TMessagesLangOptions = packed record
  377. ID: TMessagesLangOptionsID;
  378. DialogFontName: array[0..31] of Char;
  379. DialogFontSize: Integer;
  380. Flags: set of (lfRightToLeft);
  381. end;
  382. TUninstallerMsgTail = packed record
  383. ID: Longint;
  384. Offset: Longint;
  385. end;
  386. const
  387. SetupLdrOffsetTableResID = 11111;
  388. SetupLdrOffsetTableID = 'rDlPtS'#$CD#$E6#$D7#$7B#$0B#$2A;
  389. SetupLdrOffsetTableVersion = 1;
  390. SetupExeModeOffset = $30;
  391. SetupExeModeUninstaller = $6E556E49;
  392. SetupExeModeRegSvr = $53526E49;
  393. UninstallerMsgTailID = $67734D49;
  394. implementation
  395. end.