📄 struct.pas
字号:
unit Struct;
{
Inno Setup
Copyright (C) 1997-2004 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
Various records and other types that are shared by the ISCmplr, Setup,
SetupLdr, and Uninst projects
$jrsoftware: issrc/Projects/Struct.pas,v 1.170 2004/12/24 09:46:09 jr Exp $
}
interface
uses
Windows, Int64Em, MD5;
const
SetupTitle = 'Inno Setup';
SetupVersion = '5.0.6';
SetupBinVersion = (5 shl 24) + (0 shl 16) + (6 shl 8) + 0;
type
TSetupID = array[0..63] of Char;
TUninstallLogID = array[0..63] of Char;
TMessagesHdrID = array[0..63] of Char;
TUninstLangOptionsID = array[1..8] of Char;
TCompID = array[1..4] of Char;
TDiskSliceID = array[1..8] of Char;
const
{ SetupID is used by the Setup program to check if the SETUP.0 file is
compatible with with it. If you make any modifications to the records in
this file it's recommended you change SetupID. Any change will do (like
changing the letters or numbers), as long as your format is
unrecognizable by the standard Inno Setup. }
SetupID: TSetupID = 'Inno Setup Setup Data (5.0.4)';
UninstallLogID: TUninstallLogID = 'Inno Setup Uninstall Log (b)';
MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (4.1.4)';
UninstLangOptionsID: TUninstLangOptionsID = '!ulo!000';
ZLIBID: TCompID = 'zlb'#26;
DiskSliceID: TDiskSliceID = 'idska32'#26;
type
TSetupVersionDataVersion = packed record
Build: Word;
Minor, Major: Byte;
end;
TSetupVersionData = packed record
WinVersion, NTVersion: Cardinal;
NTServicePack: Word;
end;
TSetupHeaderOption = (shDisableStartupPrompt, shUninstallable, shCreateAppDir,
shDisableDirPage, shDisableProgramGroupPage,
shAllowNoIcons, shAlwaysRestart, shAlwaysUsePersonalGroup,
shWindowVisible, shWindowShowCaption, shWindowResizable,
shWindowStartMaximized, shEnableDirDoesntExistWarning,
shPassword, shAllowRootDirectory, shDisableFinishedPage,
shChangesAssociations, shCreateUninstallRegKey, shUsePreviousAppDir,
shBackColorHorizontal, shUsePreviousGroup, shUpdateUninstallLogAppName,
shUsePreviousSetupType, shDisableReadyMemo, shAlwaysShowComponentsList,
shFlatComponentsList, shShowComponentSizes, shUsePreviousTasks,
shDisableReadyPage, shAlwaysShowDirOnReadyPage, shAlwaysShowGroupOnReadyPage,
shAllowUNCPath, shUserInfoPage, shUsePreviousUserInfo,
shUninstallRestartComputer, shRestartIfNeededByRun, shShowTasksTreeLines,
shAllowCancelDuringInstall, shWizardImageStretch, shAppendDefaultDirName,
shAppendDefaultGroupName, shEncryptionUsed, shChangesEnvironment);
TSetupCompressMethod = (cmStored, cmZip, cmBzip, cmLZMA);
TSetupSalt = array[0..7] of Byte;
const
SetupHeaderStrings = 27;
type
TSetupHeader = packed record
AppName, AppVerName, AppId, AppCopyright, AppPublisher, AppPublisherURL,
AppSupportURL, AppUpdatesURL, AppVersion, DefaultDirName,
DefaultGroupName, BaseFilename, LicenseText,
InfoBeforeText, InfoAfterText, UninstallFilesDir, UninstallDisplayName,
UninstallDisplayIcon, AppMutex, DefaultUserInfoName,
DefaultUserInfoOrg, DefaultUserInfoSerial, CompiledCodeText,
AppReadmeFile, AppContact, AppComments, AppModifyPath: String;
LeadBytes: set of Char;
NumLanguageEntries, NumCustomMessageEntries, NumPermissionEntries,
NumTypeEntries, NumComponentEntries, NumTaskEntries, NumDirEntries,
NumFileEntries, NumFileLocationEntries, NumIconEntries, NumIniEntries,
NumRegistryEntries, NumInstallDeleteEntries, NumUninstallDeleteEntries,
NumRunEntries, NumUninstallRunEntries: Integer;
MinVersion, OnlyBelowVersion: TSetupVersionData;
BackColor, BackColor2, WizardImageBackColor: Longint;
PasswordHash: TMD5Digest;
PasswordSalt: TSetupSalt;
ExtraDiskSpaceRequired: Integer64;
SlicesPerDisk: Integer;
UninstallLogMode: (lmAppend, lmNew, lmOverwrite);
DirExistsWarning: (ddAuto, ddNo, ddYes);
PrivilegesRequired: (prNone, prPowerUser, prAdmin);
ShowLanguageDialog: (slYes, slNo, slAuto);
LanguageDetectionMethod: (ldUILanguage, ldLocale, ldNone);
CompressMethod: TSetupCompressMethod;
Options: set of TSetupHeaderOption;
end;
const
SetupPermissionEntryStrings = 1;
type
PSetupPermissionEntry = ^TSetupPermissionEntry;
TSetupPermissionEntry = packed record
Permissions: AnsiString; { an array of TGrantPermissionEntry's }
end;
const
SetupLanguageEntryStrings = 10;
type
PSetupLanguageEntry = ^TSetupLanguageEntry;
TSetupLanguageEntry = packed record
{ Note: LanguageName is Unicode }
Name, LanguageName, DialogFontName, TitleFontName, WelcomeFontName,
CopyrightFontName, Data, LicenseText, InfoBeforeText,
InfoAfterText: String;
LanguageID, LanguageCodePage: Cardinal;
DialogFontSize: Integer;
TitleFontSize: Integer;
WelcomeFontSize: Integer;
CopyrightFontSize: Integer;
end;
const
SetupCustomMessageEntryStrings = 2;
type
PSetupCustomMessageEntry = ^TSetupCustomMessageEntry;
TSetupCustomMessageEntry = packed record
Name, Value: String;
LangIndex: Integer;
end;
const
SetupTypeEntryStrings = 4;
type
TSetupTypeOption = (toIsCustom);
TSetupTypeOptions = set of TSetupTypeOption;
TSetupTypeType = (ttUser, ttDefaultFull, ttDefaultCompact, ttDefaultCustom);
PSetupTypeEntry = ^TSetupTypeEntry;
TSetupTypeEntry = packed record
Name, Description, Languages, Check: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
Options: TSetupTypeOptions;
Typ: TSetupTypeType;
{ internally used: }
Size: Integer64;
end;
const
SetupComponentEntryStrings = 5;
type
PSetupComponentEntry = ^TSetupComponentEntry;
TSetupComponentEntry = packed record
Name, Description, Types, Languages, Check: String;
ExtraDiskSpaceRequired: Integer64;
Level: Integer;
Used: Boolean;
MinVersion, OnlyBelowVersion: TSetupVersionData;
Options: set of (coFixed, coRestart, coDisableNoUninstallWarning,
coExclusive, coDontInheritCheck);
{ internally used: }
Size: Integer64;
end;
const
SetupTaskEntryStrings = 6;
type
PSetupTaskEntry = ^TSetupTaskEntry;
TSetupTaskEntry = packed record
Name, Description, GroupDescription, Components, Languages, Check: String;
Level: Integer;
Used: Boolean;
MinVersion, OnlyBelowVersion: TSetupVersionData;
Options: set of (toExclusive, toUnchecked, toRestart, toCheckedOnce,
toDontInheritCheck);
end;
const
SetupDirEntryStrings = 7;
type
PSetupDirEntry = ^TSetupDirEntry;
TSetupDirEntry = packed record
DirName: String;
Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
Attribs: Integer;
MinVersion, OnlyBelowVersion: TSetupVersionData;
PermissionsEntry: Smallint;
Options: set of (doUninsNeverUninstall, doDeleteAfterInstall,
doUninsAlwaysUninstall);
end;
const
SetupFileEntryStrings = 9;
type
PSetupFileEntry = ^TSetupFileEntry;
TSetupFileEntry = packed record
SourceFilename, DestName, InstallFontName: String;
Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
LocationEntry: Integer;
Attribs: Integer;
ExternalSize: Integer64;
PermissionsEntry: Smallint;
Options: set of (foConfirmOverwrite, foUninsNeverUninstall, foRestartReplace,
foDeleteAfterInstall, foRegisterServer, foRegisterTypeLib, foSharedFile,
foCompareTimeStamp, foFontIsntTrueType,
foSkipIfSourceDoesntExist, foOverwriteReadOnly, foOverwriteSameVersion,
foCustomDestName, foOnlyIfDestFileExists, foNoRegError,
foUninsRestartDelete, foOnlyIfDoesntExist, foIgnoreVersion,
foPromptIfOlder, foDontCopy, foUninsRemoveReadOnly,
foRecurseSubDirsExternal, foReplaceSameVersionIfContentsDiffer,
foDontVerifyChecksum, foUninsNoSharedFilePrompt, foCreateAllSubDirs);
FileType: (ftUserFile, ftUninstExe);
end;
const
SetupFileLocationEntryStrings = 0;
type
PSetupFileLocationEntry = ^TSetupFileLocationEntry;
TSetupFileLocationEntry = packed record
FirstSlice, LastSlice: Integer;
StartOffset: Longint;
ChunkSuboffset: Integer64;
OriginalSize: Integer64;
ChunkCompressedSize: Integer64;
MD5Sum: TMD5Digest;
TimeStamp: TFileTime;
FileVersionMS, FileVersionLS: DWORD;
Flags: set of (foVersionInfoValid, foVersionInfoNotValid, foTimeStampInUTC,
foIsUninstExe, foCallInstructionOptimized, foTouch, foChunkEncrypted,
foChunkCompressed);
end;
TSetupIconCloseOnExit = (icNoSetting, icYes, icNo);
const
SetupIconEntryStrings = 12;
type
PSetupIconEntry = ^TSetupIconEntry;
TSetupIconEntry = packed record
IconName, Filename, Parameters, WorkingDir, IconFilename, Comment: String;
Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
IconIndex, ShowCmd: Integer;
CloseOnExit: TSetupIconCloseOnExit;
HotKey: Word;
Options: set of (ioUninsNeverUninstall, ioCreateOnlyIfFileExists,
ioUseAppPaths, ioFolderShortcut);
end;
const
SetupIniEntryStrings = 10;
type
PSetupIniEntry = ^TSetupIniEntry;
TSetupIniEntry = packed record
Filename, Section, Entry, Value: String;
Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
Options: set of (ioCreateKeyIfDoesntExist, ioUninsDeleteEntry,
ioUninsDeleteEntireSection, ioUninsDeleteSectionIfEmpty,
{ internally used: }
ioHasValue);
end;
const
SetupRegistryEntryStrings = 9;
type
PSetupRegistryEntry = ^TSetupRegistryEntry;
TSetupRegistryEntry = packed record
Subkey, ValueName, ValueData: String;
Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
RootKey: HKEY;
PermissionsEntry: Smallint;
Typ: (rtNone, rtString, rtExpandString, rtDWord, rtBinary, rtMultiString);
Options: set of (roCreateValueIfDoesntExist, roUninsDeleteValue,
roUninsClearValue, roUninsDeleteEntireKey, roUninsDeleteEntireKeyIfEmpty,
roPreserveStringType, roDeleteKey, roDeleteValue, roNoError,
roDontCreateKey);
end;
const
SetupDeleteEntryStrings = 7;
type
TSetupDeleteType = (dfFiles, dfFilesAndOrSubdirs, dfDirIfEmpty);
PSetupDeleteEntry = ^TSetupDeleteEntry;
TSetupDeleteEntry = packed record
Name: String;
Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
DeleteType: TSetupDeleteType;
end;
const
SetupRunEntryStrings = 12;
type
PSetupRunEntry = ^TSetupRunEntry;
TSetupRunEntry = packed record
Name, Parameters, WorkingDir, RunOnceId, StatusMsg: String;
Description, Components, Tasks, Languages, Check, AfterInstall, BeforeInstall: String;
MinVersion, OnlyBelowVersion: TSetupVersionData;
ShowCmd: Integer;
Wait: (rwWaitUntilTerminated, rwNoWait, rwWaitUntilIdle);
Options: set of (roShellExec, roSkipIfDoesntExist,
roPostInstall, roUnchecked, roSkipIfSilent, roSkipIfNotSilent,
roHideWizard);
end;
{ TGrantPermissionEntry is stored inside string fields named 'Permissions' }
TGrantPermissionSid = record
Authority: TSIDIdentifierAuthority;
SubAuthCount: Byte;
SubAuth: array[0..1] of DWORD;
end;
TGrantPermissionEntry = record
Sid: TGrantPermissionSid;
AccessMask: DWORD;
end;
{ A TDiskSliceHeader record follows DiskSliceID in a SETUP-*.BIN file }
TDiskSliceHeader = packed record
TotalSize: Cardinal;
end;
{ A TMessageHeader record follows MessagesHdrID in a SETUP.MSG file }
TMessagesHeader = packed record
NumMessages: Cardinal;
TotalSize: Cardinal;
NotTotalSize: Cardinal;
CRCMessages: Longint;
end;
{ TSetupLdrExeHeader is written inside a SetupLdr-enabled setup.exe at
offset SetupLdrExeHeaderOffset) }
TSetupLdrExeHeader = packed record
ID: Longint; { = SetupLdrExeHeaderID }
OffsetTableOffset: Longint; { Offset of a TSetupLdrOffsetTable record }
NotOffsetTableOffset: Longint; { = not OffsetTableOffset }
end;
TSetupLdrOffsetTable = packed record
ID: array[1..12] of Char; { = SetupLdrOffsetTableID }
TotalSize: Longint; { Minimum expected size of setup.exe }
OffsetEXE: Longint; { Offset of compressed setup.e32 }
UncompressedSizeEXE: Longint; { Size of setup.e32 before compression }
CRCEXE: Longint; { CRC of setup.e32 before compression }
Offset0: Longint; { Offset of embedded setup-0.bin data }
Offset1: Longint; { Offset of embedded setup-1.bin data,
or 0 when DiskSpanning=yes }
TableCRC: Longint; { CRC of all prior fields in this record }
end;
{ TUninstLangOptions is a simplified version of TSetupLangOptions that is
used by the uninstaller }
TUninstLangOptions = packed record
ID: TUninstLangOptionsID;
DialogFontName: String[31];
DialogFontSize: Integer;
end;
TUninstallerMsgTail = packed record
ID: Longint;
Offset: Longint;
end;
const
SetupLdrExeHeaderOffset = $30;
SetupLdrExeHeaderID = $6F6E6E49;
SetupLdrOffsetTableID = 'rDlPtS07'#$87#$65#$56#$78;
SetupExeModeOffset = $30;
SetupExeModeUninstaller = $6E556E49;
SetupExeModeRegSvr = $53526E49;
UninstallerMsgTailID = $67734D49;
implementation
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -