64 changed files with 2527 additions and 2306 deletions
@ -1,59 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_ICONENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_ICONENTRY_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/SetupItem.hpp" |
||||
#include "setup/version.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
struct IconEntry : public SetupItem { |
||||
|
||||
FLAGS(Options, |
||||
NeverUninstall, |
||||
CreateOnlyIfFileExists, |
||||
UseAppPaths, |
||||
FolderShortcut, |
||||
ExcludeFromShowInNewInstall, |
||||
// obsolete options:
|
||||
RunMinimized |
||||
); |
||||
|
||||
enum CloseOnExit { |
||||
NoSetting, |
||||
Yes, |
||||
No, |
||||
}; |
||||
|
||||
std::string name; |
||||
std::string filename; |
||||
std::string parameters; |
||||
std::string workingDir; |
||||
std::string iconFilename; |
||||
std::string comment; |
||||
std::string appUserModelId; |
||||
|
||||
int iconIndex; |
||||
|
||||
int showCmd; |
||||
|
||||
CloseOnExit closeOnExit; |
||||
|
||||
uint16_t hotkey; |
||||
|
||||
Options options; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(IconEntry::Options) |
||||
NAMED_ENUM(IconEntry::Options) |
||||
|
||||
NAMED_ENUM(IconEntry::CloseOnExit) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_ICONENTRY_HPP
|
||||
@ -1,37 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_INIENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_INIENTRY_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/SetupItem.hpp" |
||||
#include "setup/version.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
struct IniEntry : public SetupItem { |
||||
|
||||
FLAGS(Options, |
||||
CreateKeyIfDoesntExist, |
||||
UninsDeleteEntry, |
||||
UninsDeleteEntireSection, |
||||
UninsDeleteSectionIfEmpty, |
||||
HasValue |
||||
); |
||||
|
||||
std::string inifile; |
||||
std::string section; |
||||
std::string key; |
||||
std::string value; |
||||
|
||||
Options options; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(IniEntry::Options) |
||||
NAMED_ENUM(IniEntry::Options) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_INIENTRY_HPP
|
||||
@ -1,67 +0,0 @@
|
||||
|
||||
#include "setup/LanguageEntry.hpp" |
||||
|
||||
#include <sstream> |
||||
#include <iconv.h> |
||||
|
||||
#include "util/load.hpp" |
||||
|
||||
void convert(iconv_t converter, const std::string & from, std::string & to); |
||||
|
||||
void LanguageEntry::load(std::istream & is, const inno_version & version) { |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
is >> encoded_string(name, version.codepage()); |
||||
} else { |
||||
name = "default"; |
||||
} |
||||
|
||||
is >> encoded_string(languageName, (version >= INNO_VERSION(4, 2, 2)) ? 1200 : 1252); |
||||
|
||||
is >> encoded_string(dialogFontName, version.codepage()); |
||||
is >> encoded_string(titleFontName, version.codepage()); |
||||
is >> encoded_string(welcomeFontName, version.codepage()); |
||||
is >> encoded_string(copyrightFontName, version.codepage()); |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
is >> binary_string(data); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 1)) { |
||||
is >> ansi_string(licenseText); |
||||
is >> ansi_string(infoBeforeText); |
||||
is >> ansi_string(infoAfterText); |
||||
} else { |
||||
licenseText.clear(), infoBeforeText.clear(), infoAfterText.clear(); |
||||
} |
||||
|
||||
languageId = load_number<uint32_t>(is); |
||||
|
||||
if(version >= INNO_VERSION(4, 2, 2) && (version < INNO_VERSION(5, 3, 0) || !version.unicode)) { |
||||
codepage = load_number<uint32_t>(is); |
||||
} else { |
||||
codepage = 0; |
||||
} |
||||
if(!codepage) { |
||||
codepage = version.codepage(); |
||||
} |
||||
|
||||
dialogFontSize = load_number<uint32_t>(is); |
||||
|
||||
if(version < INNO_VERSION(4, 1, 0)) { |
||||
dialogFontStandardHeight = load_number<uint32_t>(is); |
||||
} else { |
||||
dialogFontStandardHeight = 0; |
||||
} |
||||
|
||||
titleFontSize = load_number<uint32_t>(is); |
||||
welcomeFontSize = load_number<uint32_t>(is); |
||||
copyrightFontSize = load_number<uint32_t>(is); |
||||
|
||||
if(version >= INNO_VERSION(5, 2, 3)) { |
||||
rightToLeft = ::load<uint8_t>(is); |
||||
} else { |
||||
rightToLeft = false; |
||||
} |
||||
|
||||
} |
||||
@ -1,40 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_LANGUAGEENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_LANGUAGEENTRY_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/version.hpp" |
||||
|
||||
struct LanguageEntry { |
||||
|
||||
// introduced in 2.0.1
|
||||
|
||||
std::string name; |
||||
std::string languageName; |
||||
std::string dialogFontName; |
||||
std::string titleFontName; |
||||
std::string welcomeFontName; |
||||
std::string copyrightFontName; |
||||
std::string data; |
||||
std::string licenseText; |
||||
std::string infoBeforeText; |
||||
std::string infoAfterText; |
||||
|
||||
uint32_t languageId; |
||||
uint32_t codepage; |
||||
size_t dialogFontSize; |
||||
size_t dialogFontStandardHeight; |
||||
size_t titleFontSize; |
||||
size_t welcomeFontSize; |
||||
size_t copyrightFontSize; |
||||
|
||||
bool rightToLeft; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
#endif // INNOEXTRACT_SETUP_LANGUAGEENTRY_HPP
|
||||
@ -1,12 +0,0 @@
|
||||
|
||||
#include "setup/PermissionEntry.hpp" |
||||
|
||||
#include "util/load.hpp" |
||||
|
||||
void PermissionEntry::load(std::istream & is, const inno_version & version) { |
||||
|
||||
(void)version; |
||||
|
||||
is >> binary_string(permissions); // an array of TGrantPermissionEntry's
|
||||
|
||||
} |
||||
@ -1,20 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_PERMISSIONENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_PERMISSIONENTRY_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/version.hpp" |
||||
|
||||
struct PermissionEntry { |
||||
|
||||
// introduced in 4.1.0
|
||||
|
||||
std::string permissions; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
#endif // INNOEXTRACT_SETUP_PERMISSIONENTRY_HPP
|
||||
@ -1,57 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_RUNENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_RUNENTRY_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/SetupItem.hpp" |
||||
#include "setup/version.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
struct RunEntry : public SetupItem { |
||||
|
||||
FLAGS(Options, |
||||
ShellExec, |
||||
SkipIfDoesntExist, |
||||
PostInstall, |
||||
Unchecked, |
||||
SkipIfSilent, |
||||
Skipif_not_equalSilent, |
||||
HideWizard, |
||||
Bits32, |
||||
Bits64, |
||||
RunAsOriginalUser |
||||
); |
||||
|
||||
enum Wait { |
||||
WaitUntilTerminated, |
||||
NoWait, |
||||
WaitUntilIdle, |
||||
}; |
||||
|
||||
std::string name; |
||||
std::string parameters; |
||||
std::string workingDir; |
||||
std::string runOnceId; |
||||
std::string statusMessage; |
||||
std::string verb; |
||||
std::string description; |
||||
|
||||
int showCmd; |
||||
|
||||
Wait wait; |
||||
|
||||
Options options; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(RunEntry::Options) |
||||
NAMED_ENUM(RunEntry::Options) |
||||
|
||||
NAMED_ENUM(RunEntry::Wait) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_RUNENTRY_HPP
|
||||
@ -1,83 +0,0 @@
|
||||
|
||||
#include "setup/SetupComponentEntry.hpp" |
||||
|
||||
#include "util/load.hpp" |
||||
#include "util/storedenum.hpp" |
||||
|
||||
namespace { |
||||
|
||||
STORED_FLAGS_MAP(StoredSetupComponentOptions0, |
||||
SetupComponentEntry::Fixed, |
||||
SetupComponentEntry::Restart, |
||||
SetupComponentEntry::DisableNoUninstallWarning, |
||||
); |
||||
|
||||
// starting with version 3.0.8
|
||||
STORED_FLAGS_MAP(StoredSetupComponentOptions1, |
||||
SetupComponentEntry::Fixed, |
||||
SetupComponentEntry::Restart, |
||||
SetupComponentEntry::DisableNoUninstallWarning, |
||||
SetupComponentEntry::Exclusive, |
||||
); |
||||
|
||||
// starting with version 4.2.3
|
||||
STORED_FLAGS_MAP(StoredSetupComponentOptions2, |
||||
SetupComponentEntry::Fixed, |
||||
SetupComponentEntry::Restart, |
||||
SetupComponentEntry::DisableNoUninstallWarning, |
||||
SetupComponentEntry::Exclusive, |
||||
SetupComponentEntry::DontInheritCheck, |
||||
); |
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void SetupComponentEntry::load(std::istream & is, const inno_version & version) { |
||||
|
||||
is >> encoded_string(name, version.codepage()); |
||||
is >> encoded_string(description, version.codepage()); |
||||
is >> encoded_string(types, version.codepage()); |
||||
if(version >= INNO_VERSION(4, 0, 1)) { |
||||
is >> encoded_string(languages, version.codepage()); |
||||
} else { |
||||
languages.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 8)) { |
||||
is >> encoded_string(check, version.codepage()); |
||||
} else { |
||||
check.clear(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
extraDiskSpaceRequired = load_number<uint64_t>(is); |
||||
} else { |
||||
extraDiskSpaceRequired = load_number<uint32_t>(is); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(3, 0, 8)) { |
||||
level = load_number<int32_t>(is); |
||||
used = load_number<uint8_t>(is); |
||||
} else { |
||||
level = 0, used = true; |
||||
} |
||||
|
||||
minVersion.load(is, version); |
||||
onlyBelowVersion.load(is, version); |
||||
|
||||
if(version >= INNO_VERSION(4, 2, 3)) { |
||||
options = stored_flags<StoredSetupComponentOptions2>(is).get(); |
||||
} else if(version >= INNO_VERSION(3, 0, 8)) { |
||||
options = stored_flags<StoredSetupComponentOptions1>(is).get(); |
||||
} else { |
||||
options = stored_flags<StoredSetupComponentOptions0>(is).get(); |
||||
} |
||||
|
||||
size = (version >= INNO_VERSION(4, 0, 0)) ? load_number<uint64_t>(is) : load_number<uint32_t>(is); |
||||
} |
||||
|
||||
ENUM_NAMES(SetupComponentEntry::Options, "Setup Component Option", |
||||
"fixed", |
||||
"restart", |
||||
"disable no uninstall warning", |
||||
"exclusive", |
||||
"don't inherit check", |
||||
) |
||||
@ -1,51 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_SETUPCOMPONENTENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_SETUPCOMPONENTENTRY_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "setup/WindowsVersion.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
struct SetupComponentEntry { |
||||
|
||||
// introduced in 2.0.0
|
||||
|
||||
FLAGS(Options, |
||||
Fixed, |
||||
Restart, |
||||
DisableNoUninstallWarning, |
||||
Exclusive, |
||||
DontInheritCheck |
||||
); |
||||
|
||||
std::string name; |
||||
std::string description; |
||||
std::string types; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
uint64_t extraDiskSpaceRequired; |
||||
|
||||
int level; |
||||
bool used; |
||||
|
||||
WindowsVersion minVersion; |
||||
WindowsVersion onlyBelowVersion; |
||||
|
||||
Options options; |
||||
|
||||
uint64_t size; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(SetupComponentEntry::Options) |
||||
NAMED_ENUM(SetupComponentEntry::Options) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_SETUPCOMPONENTENTRY_HPP
|
||||
@ -1,664 +0,0 @@
|
||||
|
||||
#include "SetupHeader.hpp" |
||||
|
||||
#include <cstdio> |
||||
#include <cstring> |
||||
|
||||
#include <boost/static_assert.hpp> |
||||
|
||||
#include "util/load.hpp" |
||||
#include "util/storedenum.hpp" |
||||
|
||||
namespace { |
||||
|
||||
STORED_ENUM_MAP(StoredInstallMode, SetupHeader::NormalInstallMode, |
||||
SetupHeader::NormalInstallMode, |
||||
SetupHeader::SilentInstallMode, |
||||
SetupHeader::VerySilentInstallMode |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredUninstallLogMode, SetupHeader::AppendLog, |
||||
SetupHeader::AppendLog, |
||||
SetupHeader::NewLog, |
||||
SetupHeader::OverwriteLog |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredUninstallStyle, SetupHeader::ClassicStyle, |
||||
SetupHeader::ClassicStyle, |
||||
SetupHeader::ModernStyle |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredDirExistsWarning, SetupHeader::Auto, |
||||
SetupHeader::Auto, |
||||
SetupHeader::No, |
||||
SetupHeader::Yes |
||||
); |
||||
|
||||
// pre- 5.3.7
|
||||
STORED_ENUM_MAP(StoredPrivileges0, SetupHeader::NoPrivileges, |
||||
SetupHeader::NoPrivileges, |
||||
SetupHeader::PowerUserPrivileges, |
||||
SetupHeader::AdminPriviliges, |
||||
); |
||||
|
||||
// post- 5.3.7
|
||||
STORED_ENUM_MAP(StoredPrivileges1, SetupHeader::NoPrivileges, |
||||
SetupHeader::NoPrivileges, |
||||
SetupHeader::PowerUserPrivileges, |
||||
SetupHeader::AdminPriviliges, |
||||
SetupHeader::LowestPrivileges |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredShowLanguageDialog, SetupHeader::Yes, |
||||
SetupHeader::Yes, |
||||
SetupHeader::No, |
||||
SetupHeader::Auto |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredLanguageDetectionMethod, SetupHeader::UILanguage, |
||||
SetupHeader::UILanguage, |
||||
SetupHeader::LocaleLanguage, |
||||
SetupHeader::NoLanguageDetection |
||||
); |
||||
|
||||
STORED_FLAGS_MAP(StoredArchitectures, |
||||
SetupHeader::ArchitectureUnknown, |
||||
SetupHeader::X86, |
||||
SetupHeader::Amd64, |
||||
SetupHeader::IA64 |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredRestartComputer, SetupHeader::Auto, |
||||
SetupHeader::Auto, |
||||
SetupHeader::No, |
||||
SetupHeader::Yes |
||||
); |
||||
|
||||
// pre-4.2.5
|
||||
STORED_ENUM_MAP(StoredCompressionMethod0, stream::chunk::Unknown, |
||||
stream::chunk::Zlib, |
||||
stream::chunk::BZip2, |
||||
stream::chunk::LZMA1 |
||||
); |
||||
|
||||
// 4.2.5
|
||||
STORED_ENUM_MAP(StoredCompressionMethod1, stream::chunk::Unknown, |
||||
stream::chunk::Stored, |
||||
stream::chunk::BZip2, |
||||
stream::chunk::LZMA1 |
||||
); |
||||
|
||||
// [4.2.6 5.3.9)
|
||||
STORED_ENUM_MAP(StoredCompressionMethod2, stream::chunk::Unknown, |
||||
stream::chunk::Stored, |
||||
stream::chunk::Zlib, |
||||
stream::chunk::BZip2, |
||||
stream::chunk::LZMA1 |
||||
); |
||||
|
||||
// 5.3.9+
|
||||
STORED_ENUM_MAP(StoredCompressionMethod3, stream::chunk::Unknown, |
||||
stream::chunk::Stored, |
||||
stream::chunk::Zlib, |
||||
stream::chunk::BZip2, |
||||
stream::chunk::LZMA1, |
||||
stream::chunk::LZMA2 |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredDisablePage, SetupHeader::Auto, |
||||
SetupHeader::Auto, |
||||
SetupHeader::No, |
||||
SetupHeader::Yes |
||||
); |
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void SetupHeader::load(std::istream & is, const inno_version & version) { |
||||
|
||||
options = 0; |
||||
|
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
::load<uint32_t>(is); // uncompressed size of the setup header structure
|
||||
} |
||||
|
||||
is >> encoded_string(appName, version.codepage()); |
||||
is >> encoded_string(appVerName, version.codepage()); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
is >> encoded_string(appId, version.codepage()); |
||||
} |
||||
is >> encoded_string(appCopyright, version.codepage()); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
is >> encoded_string(appPublisher, version.codepage()); |
||||
is >> encoded_string(appPublisherURL, version.codepage()); |
||||
} else { |
||||
appPublisher.clear(), appPublisherURL.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 1, 13)) { |
||||
is >> encoded_string(appSupportPhone, version.codepage()); |
||||
} else { |
||||
appSupportPhone.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
is >> encoded_string(appSupportURL, version.codepage()); |
||||
is >> encoded_string(appUpdatesURL, version.codepage()); |
||||
is >> encoded_string(appVersion, version.codepage()); |
||||
} else { |
||||
appSupportURL.clear(), appUpdatesURL.clear(), appVersion.clear(); |
||||
} |
||||
is >> encoded_string(defaultDirName, version.codepage()); |
||||
is >> encoded_string(defaultGroupName, version.codepage()); |
||||
if(version < INNO_VERSION(3, 0, 0)) { |
||||
is >> ansi_string(uninstallIconName); |
||||
} else { |
||||
uninstallIconName.clear(); |
||||
} |
||||
is >> encoded_string(baseFilename, version.codepage()); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
if(version < INNO_VERSION(5, 2, 5)) { |
||||
is >> ansi_string(licenseText); |
||||
is >> ansi_string(infoBeforeText); |
||||
is >> ansi_string(infoAfterText); |
||||
} |
||||
is >> encoded_string(uninstallFilesDir, version.codepage()); |
||||
is >> encoded_string(uninstallDisplayName, version.codepage()); |
||||
is >> encoded_string(uninstallDisplayIcon, version.codepage()); |
||||
is >> encoded_string(appMutex, version.codepage()); |
||||
} else { |
||||
licenseText.clear(), infoBeforeText.clear(), infoAfterText.clear(); |
||||
uninstallFilesDir.clear(), uninstallDisplayName.clear(); |
||||
uninstallDisplayIcon.clear(), appMutex.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 0)) { |
||||
is >> encoded_string(defaultUserInfoName, version.codepage()); |
||||
is >> encoded_string(defaultUserInfoOrg, version.codepage()); |
||||
} else { |
||||
defaultUserInfoName.clear(), defaultUserInfoOrg.clear(); |
||||
} |
||||
if(version >= INNO_VERSION_EXT(3, 0, 6, 1)) { |
||||
is >> encoded_string(defaultUserInfoSerial, version.codepage()); |
||||
if(version < INNO_VERSION(5, 2, 5)) { |
||||
is >> binary_string(compiledCodeText); |
||||
} |
||||
} else { |
||||
defaultUserInfoSerial.clear(), compiledCodeText.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(4, 2, 4)) { |
||||
is >> encoded_string(appReadmeFile, version.codepage()); |
||||
is >> encoded_string(appContact, version.codepage()); |
||||
is >> encoded_string(appComments, version.codepage()); |
||||
is >> encoded_string(appModifyPath, version.codepage()); |
||||
} else { |
||||
appReadmeFile.clear(), appContact.clear(); |
||||
appComments.clear(), appModifyPath.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 8)) { |
||||
is >> encoded_string(createUninstallRegKey, version.codepage()); |
||||
} else { |
||||
createUninstallRegKey.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 10)) { |
||||
is >> encoded_string(uninstallable, version.codepage()); |
||||
} else { |
||||
uninstallable.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 5)) { |
||||
is >> ansi_string(licenseText); |
||||
is >> ansi_string(infoBeforeText); |
||||
is >> ansi_string(infoAfterText); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 1) && version < INNO_VERSION(5, 3, 10)) { |
||||
is >> binary_string(signedUninstallerSignature); |
||||
} else { |
||||
signedUninstallerSignature.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 5)) { |
||||
is >> binary_string(compiledCodeText); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 6) && !version.unicode) { |
||||
leadBytes = stored_char_set(is); |
||||
} else { |
||||
leadBytes = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
numLanguageEntries = load_number<uint32_t>(is); |
||||
} else if(version >= INNO_VERSION(2, 0, 1)) { |
||||
numLanguageEntries = 1; |
||||
} else { |
||||
numLanguageEntries = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 2, 1)) { |
||||
numCustomMessageEntries = load_number<uint32_t>(is); |
||||
} else { |
||||
numCustomMessageEntries = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 1, 0)) { |
||||
numPermissionEntries = load_number<uint32_t>(is); |
||||
} else { |
||||
numPermissionEntries = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 0)) { |
||||
numTypeEntries = load_number<uint32_t>(is); |
||||
numComponentEntries = load_number<uint32_t>(is); |
||||
numTaskEntries = load_number<uint32_t>(is); |
||||
} else { |
||||
numTypeEntries = 0, numComponentEntries = 0, numTaskEntries = 0; |
||||
} |
||||
|
||||
numDirectoryEntries = load_number<uint32_t>(is, version.bits); |
||||
numFileEntries = load_number<uint32_t>(is, version.bits); |
||||
numFileLocationEntries = load_number<uint32_t>(is, version.bits); |
||||
numIconEntries = load_number<uint32_t>(is, version.bits); |
||||
numIniEntries = load_number<uint32_t>(is, version.bits); |
||||
numRegistryEntries = load_number<uint32_t>(is, version.bits); |
||||
numDeleteEntries = load_number<uint32_t>(is, version.bits); |
||||
numUninstallDeleteEntries = load_number<uint32_t>(is, version.bits); |
||||
numRunEntries = load_number<uint32_t>(is, version.bits); |
||||
numUninstallRunEntries = load_number<uint32_t>(is, version.bits); |
||||
|
||||
int32_t licenseSize; |
||||
int32_t infoBeforeSize; |
||||
int32_t infoAfterSize; |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
licenseSize = load_number<int32_t>(is, version.bits); |
||||
infoBeforeSize = load_number<int32_t>(is, version.bits); |
||||
infoAfterSize = load_number<int32_t>(is, version.bits); |
||||
} |
||||
|
||||
minVersion.load(is, version); |
||||
onlyBelowVersion.load(is, version); |
||||
|
||||
backColor = load_number<uint32_t>(is); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
backColor2 = load_number<uint32_t>(is); |
||||
} else { |
||||
backColor2 = 0; |
||||
} |
||||
wizardImageBackColor = load_number<uint32_t>(is); |
||||
if(version >= INNO_VERSION(2, 0, 0) && version < INNO_VERSION(5, 0, 4)) { |
||||
wizardSmallImageBackColor = load_number<uint32_t>(is); |
||||
} else { |
||||
wizardSmallImageBackColor = 0; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 2, 0)) { |
||||
password.crc32 = load_number<uint32_t>(is), password.type = crypto::CRC32; |
||||
} else if(version < INNO_VERSION(5, 3, 9)) { |
||||
is.read(password.md5, sizeof(password.md5)), password.type = crypto::MD5; |
||||
} else { |
||||
is.read(password.sha1, sizeof(password.sha1)), password.type = crypto::SHA1; |
||||
} |
||||
if(version >= INNO_VERSION(4, 2, 2)) { |
||||
is.read(passwordSalt, sizeof(passwordSalt)); |
||||
} else { |
||||
memset(passwordSalt, 0, sizeof(passwordSalt)); |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 0, 0)) { |
||||
extraDiskSpaceRequired = load_number<int32_t>(is); |
||||
slicesPerDisk = 1; |
||||
} else { |
||||
extraDiskSpaceRequired = load_number<int64_t>(is); |
||||
slicesPerDisk = load_number<uint32_t>(is); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 0) && version < INNO_VERSION(5, 0, 0)) { |
||||
installMode = stored_enum<StoredInstallMode>(is).get(); |
||||
} else { |
||||
installMode = NormalInstallMode; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
uninstallLogMode = stored_enum<StoredUninstallLogMode>(is).get(); |
||||
} else { |
||||
uninstallLogMode = AppendLog; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 0) && version < INNO_VERSION(5, 0, 0)) { |
||||
uninstallStyle = stored_enum<StoredUninstallStyle>(is).get(); |
||||
} else { |
||||
uninstallStyle = (version < INNO_VERSION(5, 0, 0)) ? ClassicStyle : ModernStyle; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
dirExistsWarning = stored_enum<StoredDirExistsWarning>(is).get(); |
||||
} else { |
||||
dirExistsWarning = Auto; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(3, 0, 0) && version < INNO_VERSION(3, 0, 3)) { |
||||
AutoBoolean val = stored_enum<StoredRestartComputer>(is).get(); |
||||
switch(val) { |
||||
case Yes: options |= AlwaysRestart; break; |
||||
case Auto: options |= RestartIfNeededByRun; break; |
||||
case No: break; |
||||
} |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 7)) { |
||||
privilegesRequired = stored_enum<StoredPrivileges1>(is).get(); |
||||
} else if(version >= INNO_VERSION(3, 0, 4)) { |
||||
privilegesRequired = stored_enum<StoredPrivileges0>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 10)) { |
||||
showLanguageDialog = stored_enum<StoredShowLanguageDialog>(is).get(); |
||||
languageDetectionMethod = stored_enum<StoredLanguageDetectionMethod>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 9)) { |
||||
compressMethod = stored_enum<StoredCompressionMethod3>(is).get(); |
||||
} else if(version >= INNO_VERSION(4, 2, 6)) { |
||||
compressMethod = stored_enum<StoredCompressionMethod2>(is).get(); |
||||
} else if(version >= INNO_VERSION(4, 2, 5)) { |
||||
compressMethod = stored_enum<StoredCompressionMethod1>(is).get(); |
||||
} else if(version >= INNO_VERSION(4, 1, 5)) { |
||||
compressMethod = stored_enum<StoredCompressionMethod0>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 1, 0)) { |
||||
architecturesAllowed = stored_flags<StoredArchitectures>(is).get(); |
||||
architecturesInstallIn64BitMode = stored_flags<StoredArchitectures>(is).get(); |
||||
} else { |
||||
architecturesAllowed = Architectures::all(); |
||||
architecturesInstallIn64BitMode = Architectures::all(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 2, 1) && version < INNO_VERSION(5, 3, 10)) { |
||||
signedUninstallerOrigSize = load_number<uint32_t>(is); |
||||
signedUninstallerHdrChecksum = load_number<uint32_t>(is); |
||||
} else { |
||||
signedUninstallerOrigSize = signedUninstallerHdrChecksum = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 3)) { |
||||
disableDirPage = stored_enum<StoredDisablePage>(is).get(); |
||||
disableProgramGroupPage = stored_enum<StoredDisablePage>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 6)) { |
||||
uninstallDisplaySize = load_number<uint32_t>(is); |
||||
} else { |
||||
uninstallDisplaySize = 0; |
||||
} |
||||
|
||||
|
||||
stored_flag_reader<Options> flags(is); |
||||
|
||||
flags.add(DisableStartupPrompt); |
||||
if(version < INNO_VERSION(5, 3, 10)) { |
||||
flags.add(Uninstallable); |
||||
} |
||||
flags.add(CreateAppDir); |
||||
if(version < INNO_VERSION(5, 3, 3)) { |
||||
flags.add(DisableDirPage); |
||||
} |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
flags.add(DisableDirExistsWarning); |
||||
} |
||||
if(version < INNO_VERSION(5, 3, 3)) { |
||||
flags.add(DisableProgramGroupPage); |
||||
} |
||||
flags.add(AllowNoIcons); |
||||
if(version < INNO_VERSION(3, 0, 0) || version >= INNO_VERSION(3, 0, 3)) { |
||||
flags.add(AlwaysRestart); |
||||
} |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
flags.add(BackSolid); |
||||
} |
||||
flags.add(AlwaysUsePersonalGroup); |
||||
flags.add(WindowVisible); |
||||
flags.add(WindowShowCaption); |
||||
flags.add(WindowResizable); |
||||
flags.add(WindowStartMaximized); |
||||
flags.add(EnableDirDoesntExistWarning); |
||||
if(version < INNO_VERSION(4, 1, 2)) { |
||||
flags.add(DisableAppendDir); |
||||
} |
||||
flags.add(Password); |
||||
flags.add(AllowRootDirectory); |
||||
flags.add(DisableFinishedPage); |
||||
if(version.bits != 16) { |
||||
if(version < INNO_VERSION(3, 0, 4)) { |
||||
flags.add(AdminPrivilegesRequired); |
||||
} |
||||
if(version < INNO_VERSION(3, 0, 0)) { |
||||
flags.add(AlwaysCreateUninstallIcon); |
||||
} |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
flags.add(OverwriteUninstRegEntries); |
||||
} |
||||
flags.add(ChangesAssociations); |
||||
} |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
if(version < INNO_VERSION(5, 3, 8)) { |
||||
flags.add(CreateUninstallRegKey); |
||||
} |
||||
flags.add(UsePreviousAppDir); |
||||
flags.add(BackColorHorizontal); |
||||
flags.add(UsePreviousGroup); |
||||
flags.add(UpdateUninstallLogAppName); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 0)) { |
||||
flags.add(UsePreviousSetupType); |
||||
flags.add(DisableReadyMemo); |
||||
flags.add(AlwaysShowComponentsList); |
||||
flags.add(FlatComponentsList); |
||||
flags.add(ShowComponentSizes); |
||||
flags.add(UsePreviousTasks); |
||||
flags.add(DisableReadyPage); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 7)) { |
||||
flags.add(AlwaysShowDirOnReadyPage); |
||||
flags.add(AlwaysShowGroupOnReadyPage); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 17) && version < INNO_VERSION(4, 1, 5)) { |
||||
flags.add(BzipUsed); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 18)) { |
||||
flags.add(AllowUNCPath); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 0)) { |
||||
flags.add(UserInfoPage); |
||||
flags.add(UsePreviousUserInfo); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 1)) { |
||||
flags.add(UninstallRestartComputer); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 3)) { |
||||
flags.add(RestartIfNeededByRun); |
||||
} |
||||
if(version >= INNO_VERSION_EXT(3, 0, 6, 1)) { |
||||
flags.add(ShowTasksTreeLines); |
||||
} |
||||
if(version >= INNO_VERSION(4, 0, 0) && version < INNO_VERSION(4, 0, 10)) { |
||||
flags.add(ShowLanguageDialog); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 1) && version < INNO_VERSION(4, 0, 10)) { |
||||
flags.add(DetectLanguageUsingLocale); |
||||
} |
||||
if(version >= INNO_VERSION(4, 0, 9)) { |
||||
flags.add(AllowCancelDuringInstall); |
||||
} else { |
||||
options |= AllowCancelDuringInstall; |
||||
} |
||||
if(version >= INNO_VERSION(4, 1, 3)) { |
||||
flags.add(WizardImageStretch); |
||||
} |
||||
if(version >= INNO_VERSION(4, 1, 8)) { |
||||
flags.add(AppendDefaultDirName); |
||||
flags.add(AppendDefaultGroupName); |
||||
} |
||||
if(version >= INNO_VERSION(4, 2, 2)) { |
||||
flags.add(EncryptionUsed); |
||||
} |
||||
if(version >= INNO_VERSION(5, 0, 4)) { |
||||
flags.add(ChangesEnvironment); |
||||
} |
||||
if(version >= INNO_VERSION(5, 1, 7) && !version.unicode) { |
||||
flags.add(ShowUndisplayableLanguages); |
||||
} |
||||
if(version >= INNO_VERSION(5, 1, 13)) { |
||||
flags.add(SetupLogging); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 1)) { |
||||
flags.add(SignedUninstaller); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 8)) { |
||||
flags.add(UsePreviousLanguage); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 9)) { |
||||
flags.add(DisableWelcomePage); |
||||
} |
||||
|
||||
options |= flags; |
||||
|
||||
if(version < INNO_VERSION(3, 0, 4)) { |
||||
privilegesRequired = (options & AdminPrivilegesRequired) ? AdminPriviliges : NoPrivileges; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 0, 10)) { |
||||
showLanguageDialog = (options & ShowLanguageDialog) ? Yes : No; |
||||
languageDetectionMethod = (options & DetectLanguageUsingLocale) ? LocaleLanguage : UILanguage; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 1, 5)) { |
||||
compressMethod = (options & BzipUsed) ? stream::chunk::BZip2 : stream::chunk::Zlib; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(5, 3, 3)) { |
||||
disableDirPage = (options & DisableDirPage) ? Yes : No; |
||||
disableProgramGroupPage = (options & DisableProgramGroupPage) ? Yes : No; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
if(licenseSize > 0) { |
||||
std::string temp; |
||||
temp.resize(size_t(licenseSize)); |
||||
is.read(&temp[0], licenseSize); |
||||
to_utf8(temp, licenseText); |
||||
} |
||||
if(infoBeforeSize > 0) { |
||||
std::string temp; |
||||
temp.resize(size_t(infoBeforeSize)); |
||||
is.read(&temp[0], infoBeforeSize); |
||||
to_utf8(temp, infoBeforeText); |
||||
} |
||||
if(infoAfterSize > 0) { |
||||
std::string temp; |
||||
temp.resize(size_t(infoAfterSize)); |
||||
is.read(&temp[0], infoAfterSize); |
||||
to_utf8(temp, infoAfterText); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
ENUM_NAMES(SetupHeader::Options, "Setup Option", |
||||
"disable startup prompt", |
||||
"create app dir", |
||||
"allow no icons", |
||||
"always restart", |
||||
"always use personal group", |
||||
"window visible", |
||||
"window show caption", |
||||
"window resizable", |
||||
"window start maximized", |
||||
"enable dir doesn't exist warning", |
||||
"password", |
||||
"allow root directory", |
||||
"disable finished page", |
||||
"changes associations", |
||||
"use previous app dir", |
||||
"back color horizontal", |
||||
"use previous group", |
||||
"update uninstall log app name", |
||||
"use previous setup type", |
||||
"disable ready memo", |
||||
"always show components list", |
||||
"flat components list", |
||||
"show component sizes", |
||||
"use previous tasks", |
||||
"disable ready page", |
||||
"always show dir on ready page", |
||||
"always show group on ready page", |
||||
"allow unc path", |
||||
"user info page", |
||||
"use previous user info", |
||||
"uninstall restart computer", |
||||
"restart if needed by run", |
||||
"show tasks tree lines", |
||||
"allow cancel during install", |
||||
"wizard image stretch", |
||||
"append default dir name", |
||||
"append default group name", |
||||
"encrypted", |
||||
"changes environment", |
||||
"show undisplayable languages", |
||||
"setup logging", |
||||
"signed uninstaller", |
||||
"use previous language", |
||||
"disable welcome page", |
||||
"uninstallable", |
||||
"disable dir page", |
||||
"disable program group page", |
||||
"disable append dir", |
||||
"admin privilegesrequired", |
||||
"always create uninstall icon", |
||||
"create uninstall reg key", |
||||
"bzip used", |
||||
"show language dialog", |
||||
"detect language using locale", |
||||
"disable dir exists warning", |
||||
"back solid", |
||||
"overwrite uninst reg entries", |
||||
) |
||||
BOOST_STATIC_ASSERT(SetupHeader::Options::bits == enum_names<SetupHeader::Options::Enum>::count); |
||||
|
||||
ENUM_NAMES(SetupHeader::Architectures, "Architecture", |
||||
"unknown", |
||||
"x86", |
||||
"amd64", |
||||
"IA64", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupHeader::InstallMode, "Install Mode", |
||||
"normal", |
||||
"silent", |
||||
"very silent", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupHeader::UninstallLogMode, "Uninstall Log Mode", |
||||
"append", |
||||
"new log", |
||||
"overwrite", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupHeader::UninstallStyle, "Uninstall Style", |
||||
"classic", |
||||
"modern", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupHeader::AutoBoolean, "Auto Boolean", |
||||
"auto", |
||||
"no", |
||||
"yes", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupHeader::Privileges, "Privileges", |
||||
"none", |
||||
"power user", |
||||
"admin", |
||||
"lowest", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupHeader::LanguageDetection, "Language Detection", |
||||
"ui language", |
||||
"locale", |
||||
"none", |
||||
) |
||||
@ -1,243 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_SETUPHEADER_HPP |
||||
#define INNOEXTRACT_SETUP_SETUPHEADER_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <stddef.h> |
||||
#include <bitset> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "crypto/checksum.hpp" |
||||
#include "setup/version.hpp" |
||||
#include "setup/WindowsVersion.hpp" |
||||
#include "stream/chunk.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
typedef char SetupSalt[8]; |
||||
|
||||
struct SetupHeader { |
||||
|
||||
// Setup data header.
|
||||
|
||||
FLAGS(Options, |
||||
|
||||
DisableStartupPrompt, |
||||
CreateAppDir, |
||||
AllowNoIcons, |
||||
AlwaysRestart, |
||||
AlwaysUsePersonalGroup, |
||||
WindowVisible, |
||||
WindowShowCaption, |
||||
WindowResizable, |
||||
WindowStartMaximized, |
||||
EnableDirDoesntExistWarning, |
||||
Password, |
||||
AllowRootDirectory, |
||||
DisableFinishedPage, |
||||
ChangesAssociations, |
||||
UsePreviousAppDir, |
||||
BackColorHorizontal, |
||||
UsePreviousGroup, |
||||
UpdateUninstallLogAppName, |
||||
UsePreviousSetupType, |
||||
DisableReadyMemo, |
||||
AlwaysShowComponentsList, |
||||
FlatComponentsList, |
||||
ShowComponentSizes, |
||||
UsePreviousTasks, |
||||
DisableReadyPage, |
||||
AlwaysShowDirOnReadyPage, |
||||
AlwaysShowGroupOnReadyPage, |
||||
AllowUNCPath, |
||||
UserInfoPage, |
||||
UsePreviousUserInfo, |
||||
UninstallRestartComputer, |
||||
RestartIfNeededByRun, |
||||
ShowTasksTreeLines, |
||||
AllowCancelDuringInstall, |
||||
WizardImageStretch, |
||||
AppendDefaultDirName, |
||||
AppendDefaultGroupName, |
||||
EncryptionUsed, |
||||
ChangesEnvironment, |
||||
ShowUndisplayableLanguages, |
||||
SetupLogging, |
||||
SignedUninstaller, |
||||
UsePreviousLanguage, |
||||
DisableWelcomePage, |
||||
|
||||
// Obsolete flags
|
||||
Uninstallable, |
||||
DisableDirPage, |
||||
DisableProgramGroupPage, |
||||
DisableAppendDir, |
||||
AdminPrivilegesRequired, |
||||
AlwaysCreateUninstallIcon, |
||||
CreateUninstallRegKey, |
||||
BzipUsed, |
||||
ShowLanguageDialog, |
||||
DetectLanguageUsingLocale, |
||||
DisableDirExistsWarning, |
||||
BackSolid, |
||||
OverwriteUninstRegEntries |
||||
); |
||||
|
||||
FLAGS(Architectures, |
||||
ArchitectureUnknown, |
||||
X86, |
||||
Amd64, |
||||
IA64 |
||||
); |
||||
|
||||
std::string appName; |
||||
std::string appVerName; |
||||
std::string appId; |
||||
std::string appCopyright; |
||||
std::string appPublisher; |
||||
std::string appPublisherURL; |
||||
std::string appSupportPhone; |
||||
std::string appSupportURL; |
||||
std::string appUpdatesURL; |
||||
std::string appVersion; |
||||
std::string defaultDirName; |
||||
std::string defaultGroupName; |
||||
std::string uninstallIconName; |
||||
std::string baseFilename; |
||||
std::string uninstallFilesDir; |
||||
std::string uninstallDisplayName; |
||||
std::string uninstallDisplayIcon; |
||||
std::string appMutex; |
||||
std::string defaultUserInfoName; |
||||
std::string defaultUserInfoOrg; |
||||
std::string defaultUserInfoSerial; |
||||
std::string appReadmeFile; |
||||
std::string appContact; |
||||
std::string appComments; |
||||
std::string appModifyPath; |
||||
std::string createUninstallRegKey; |
||||
std::string uninstallable; |
||||
std::string licenseText; |
||||
std::string infoBeforeText; |
||||
std::string infoAfterText; |
||||
std::string signedUninstallerSignature; |
||||
std::string compiledCodeText; |
||||
|
||||
std::bitset<256> leadBytes; |
||||
|
||||
size_t numLanguageEntries; |
||||
size_t numCustomMessageEntries; |
||||
size_t numPermissionEntries; |
||||
size_t numTypeEntries; |
||||
size_t numComponentEntries; |
||||
size_t numTaskEntries; |
||||
size_t numDirectoryEntries; |
||||
size_t numFileEntries; |
||||
size_t numFileLocationEntries; |
||||
size_t numIconEntries; |
||||
size_t numIniEntries; |
||||
size_t numRegistryEntries; |
||||
size_t numDeleteEntries; |
||||
size_t numUninstallDeleteEntries; |
||||
size_t numRunEntries; |
||||
size_t numUninstallRunEntries; |
||||
|
||||
WindowsVersion minVersion; |
||||
WindowsVersion onlyBelowVersion; |
||||
|
||||
typedef uint32_t Color; |
||||
Color backColor; |
||||
Color backColor2; |
||||
Color wizardImageBackColor; |
||||
Color wizardSmallImageBackColor; |
||||
|
||||
crypto::checksum password; |
||||
SetupSalt passwordSalt; |
||||
|
||||
int64_t extraDiskSpaceRequired; |
||||
size_t slicesPerDisk; |
||||
|
||||
enum InstallMode { |
||||
NormalInstallMode, |
||||
SilentInstallMode, |
||||
VerySilentInstallMode, |
||||
}; |
||||
InstallMode installMode; |
||||
|
||||
enum UninstallLogMode { |
||||
AppendLog, |
||||
NewLog, |
||||
OverwriteLog |
||||
}; |
||||
UninstallLogMode uninstallLogMode; |
||||
|
||||
enum UninstallStyle { |
||||
ClassicStyle, |
||||
ModernStyle |
||||
}; |
||||
UninstallStyle uninstallStyle; |
||||
|
||||
enum AutoBoolean { |
||||
Auto, |
||||
No, |
||||
Yes |
||||
}; |
||||
|
||||
AutoBoolean dirExistsWarning; |
||||
|
||||
enum Privileges { |
||||
NoPrivileges, |
||||
PowerUserPrivileges, |
||||
AdminPriviliges, |
||||
LowestPrivileges |
||||
}; |
||||
Privileges privilegesRequired; |
||||
|
||||
AutoBoolean showLanguageDialog; |
||||
|
||||
enum LanguageDetection { |
||||
UILanguage, |
||||
LocaleLanguage, |
||||
NoLanguageDetection |
||||
}; |
||||
LanguageDetection languageDetectionMethod; |
||||
|
||||
stream::chunk::compression_method compressMethod; |
||||
|
||||
Architectures architecturesAllowed; |
||||
Architectures architecturesInstallIn64BitMode; |
||||
|
||||
uint32_t signedUninstallerOrigSize; |
||||
uint32_t signedUninstallerHdrChecksum; |
||||
|
||||
AutoBoolean disableDirPage; |
||||
AutoBoolean disableProgramGroupPage; |
||||
|
||||
size_t uninstallDisplaySize; |
||||
|
||||
Options options; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(SetupHeader::Options) |
||||
NAMED_ENUM(SetupHeader::Options) |
||||
|
||||
FLAGS_OVERLOADS(SetupHeader::Architectures) |
||||
NAMED_ENUM(SetupHeader::Architectures) |
||||
|
||||
NAMED_ENUM(SetupHeader::InstallMode) |
||||
|
||||
NAMED_ENUM(SetupHeader::UninstallLogMode) |
||||
|
||||
NAMED_ENUM(SetupHeader::UninstallStyle) |
||||
|
||||
NAMED_ENUM(SetupHeader::AutoBoolean) |
||||
|
||||
NAMED_ENUM(SetupHeader::Privileges) |
||||
|
||||
NAMED_ENUM(SetupHeader::LanguageDetection) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_SETUPHEADER_HPP
|
||||
@ -1,32 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_SETUPCONDITION_HPP |
||||
#define INNOEXTRACT_SETUP_SETUPCONDITION_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "setup/WindowsVersion.hpp" |
||||
|
||||
struct SetupItem { |
||||
|
||||
std::string components; |
||||
std::string tasks; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
std::string afterInstall; |
||||
std::string beforeInstall; |
||||
|
||||
WindowsVersion minVersion; |
||||
WindowsVersion onlyBelowVersion; |
||||
|
||||
protected: |
||||
|
||||
void load_condition_data(std::istream & is, const inno_version & version); |
||||
|
||||
void load_version_data(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
#endif // INNOEXTRACT_SETUP_SETUPCONDITION_HPP
|
||||
@ -1,47 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_SETUPTASKENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_SETUPTASKENTRY_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "setup/WindowsVersion.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
struct SetupTaskEntry { |
||||
|
||||
// introduced in 2.0.0
|
||||
|
||||
FLAGS(Options, |
||||
Exclusive, |
||||
Unchecked, |
||||
Restart, |
||||
CheckedOnce, |
||||
DontInheritCheck |
||||
); |
||||
|
||||
std::string name; |
||||
std::string description; |
||||
std::string groupDescription; |
||||
std::string components; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
int level; |
||||
bool used; |
||||
|
||||
WindowsVersion minVersion; |
||||
WindowsVersion onlyBelowVersion; |
||||
|
||||
Options options; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(SetupTaskEntry::Options) |
||||
NAMED_ENUM(SetupTaskEntry::Options) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_SETUPTASKENTRY_HPP
|
||||
@ -1,60 +0,0 @@
|
||||
|
||||
#include "setup/SetupTypeEntry.hpp" |
||||
|
||||
#include "util/load.hpp" |
||||
#include "util/storedenum.hpp" |
||||
|
||||
namespace { |
||||
|
||||
STORED_FLAGS_MAP(StoredSetupTypeOptions, |
||||
SetupTypeEntry::CustomSetupType, |
||||
); |
||||
|
||||
STORED_ENUM_MAP(StoredSetupType, SetupTypeEntry::User, |
||||
SetupTypeEntry::User, |
||||
SetupTypeEntry::DefaultFull, |
||||
SetupTypeEntry::DefaultCompact, |
||||
SetupTypeEntry::DefaultCustom, |
||||
); |
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void SetupTypeEntry::load(std::istream & is, const inno_version & version) { |
||||
|
||||
is >> encoded_string(name, version.codepage()); |
||||
is >> encoded_string(description, version.codepage()); |
||||
if(version >= INNO_VERSION(4, 0, 1)) { |
||||
is >> encoded_string(languages, version.codepage()); |
||||
} else { |
||||
languages.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 8)) { |
||||
is >> encoded_string(check, version.codepage()); |
||||
} else { |
||||
check.clear(); |
||||
} |
||||
|
||||
minVersion.load(is, version); |
||||
onlyBelowVersion.load(is, version); |
||||
|
||||
options = stored_flags<StoredSetupTypeOptions>(is).get(); |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 3)) { |
||||
type = stored_enum<StoredSetupType>(is).get(); |
||||
} else { |
||||
type = User; |
||||
} |
||||
|
||||
size = (version >= INNO_VERSION(4, 0, 0)) ? load_number<uint64_t>(is) : load_number<uint32_t>(is); |
||||
} |
||||
|
||||
ENUM_NAMES(SetupTypeEntry::Options, "Setyp Type Option", |
||||
"is custom", |
||||
) |
||||
|
||||
ENUM_NAMES(SetupTypeEntry::Type, "Setyp Type", |
||||
"user", |
||||
"default full", |
||||
"default compact", |
||||
"default custom", |
||||
) |
||||
@ -1,52 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_SETUPTYPEENTRY_HPP |
||||
#define INNOEXTRACT_SETUP_SETUPTYPEENTRY_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "setup/WindowsVersion.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
struct SetupTypeEntry { |
||||
|
||||
// introduced in 2.0.0
|
||||
|
||||
FLAGS(Options, |
||||
CustomSetupType |
||||
); |
||||
|
||||
enum Type { |
||||
User, |
||||
DefaultFull, |
||||
DefaultCompact, |
||||
DefaultCustom |
||||
}; |
||||
|
||||
std::string name; |
||||
std::string description; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
WindowsVersion minVersion; |
||||
WindowsVersion onlyBelowVersion; |
||||
|
||||
Options options; |
||||
|
||||
Type type; |
||||
|
||||
uint64_t size; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
FLAGS_OVERLOADS(SetupTypeEntry::Options) |
||||
NAMED_ENUM(SetupTypeEntry::Options) |
||||
|
||||
NAMED_ENUM(SetupTypeEntry::Type) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_SETUPTYPEENTRY_HPP
|
||||
@ -1,128 +0,0 @@
|
||||
|
||||
#include "setup/WindowsVersion.hpp" |
||||
|
||||
#include <stdint.h> |
||||
|
||||
#include "util/load.hpp" |
||||
#include "util/util.hpp" |
||||
|
||||
const WindowsVersion WindowsVersion::none = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0 } }; |
||||
|
||||
void WindowsVersion::Version::load(std::istream& is, const inno_version& version) { |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
build = load_number<uint16_t>(is); |
||||
} else { |
||||
build = 0; |
||||
} |
||||
|
||||
minor = load_number<uint8_t>(is); |
||||
major = load_number<uint8_t>(is); |
||||
|
||||
} |
||||
|
||||
void WindowsVersion::load(std::istream & is, const inno_version & version) { |
||||
|
||||
winVersion.load(is, version); |
||||
ntVersion.load(is, version); |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
ntServicePack.minor = load_number<uint8_t>(is); |
||||
ntServicePack.major = load_number<uint8_t>(is); |
||||
} else { |
||||
ntServicePack.major = 0, ntServicePack.minor = 0; |
||||
} |
||||
|
||||
} |
||||
|
||||
namespace { |
||||
|
||||
struct WindowsVersionName { |
||||
|
||||
const char * name; |
||||
|
||||
WindowsVersion::Version version; |
||||
|
||||
}; |
||||
|
||||
WindowsVersionName windowsVersionNames[] = { |
||||
{ "Windows 1.0", { 1, 4, 0 } }, |
||||
{ "Windows 2.0", { 2, 11, 0 } }, |
||||
{ "Windows 3.0", { 3, 0, 0 } }, |
||||
{ "Windows for Workgroups 3.11", { 3, 11, 0 } }, |
||||
{ "Windows 95", { 4, 0, 950 } }, |
||||
{ "Windows 98", { 4, 1, 1998 } }, |
||||
{ "Windows 98 Second Edition", { 4, 1, 2222 } }, |
||||
{ "Windows ME", { 4, 90, 3000 } }, |
||||
}; |
||||
|
||||
WindowsVersionName windowsNtVersionNames[] = { |
||||
{ "Windows NT Workstation 3.5", { 3, 5, 807 } }, |
||||
{ "Windows NT 3.1", { 3, 10, 528 } }, |
||||
{ "Windows NT Workstation 3.51", { 3, 51, 1057 } }, |
||||
{ "Windows NT Workstation 4.0", { 4, 0, 1381 } }, |
||||
{ "Windows 2000", { 5, 0, 2195 } }, |
||||
{ "Windows XP", { 5, 1, 2600 } }, |
||||
{ "Windows XP x64", { 5, 2, 3790 } }, |
||||
{ "Windows Vista", { 6, 0, 6000 } }, |
||||
{ "Windows 7", { 6, 1, 7600 } } |
||||
}; |
||||
|
||||
const char * getVersionName(const WindowsVersion::Version & version, bool nt = false) { |
||||
|
||||
WindowsVersionName * names; |
||||
size_t count; |
||||
if(nt) { |
||||
names = windowsNtVersionNames, count = ARRAY_SIZE(windowsNtVersionNames); |
||||
} else { |
||||
names = windowsVersionNames, count = ARRAY_SIZE(windowsVersionNames); |
||||
} |
||||
|
||||
for(size_t i = 0; i < count; i++) { |
||||
const WindowsVersionName & v = names[i]; |
||||
if(v.version.major != version.major || v.version.minor < version.minor) { |
||||
continue; |
||||
} |
||||
return v.name; |
||||
}; |
||||
return NULL; |
||||
} |
||||
|
||||
} |
||||
|
||||
std::ostream & operator<<(std::ostream & os, const WindowsVersion::Version & v) { |
||||
os << v.major << '.' << v.minor; |
||||
if(v.build) { |
||||
os << v.build; |
||||
} |
||||
return os; |
||||
} |
||||
|
||||
std::ostream & operator<<(std::ostream & os, const WindowsVersion & v) { |
||||
os << v.winVersion; |
||||
if(v.ntVersion != v.winVersion) { |
||||
os << " nt " << v.ntVersion; |
||||
} |
||||
const char * winName = getVersionName(v.winVersion); |
||||
const char * ntName = getVersionName(v.ntVersion, true); |
||||
if(winName || ntName) { |
||||
os << " ("; |
||||
if(winName) { |
||||
os << winName; |
||||
} |
||||
if(ntName && ntName != winName) { |
||||
if(winName) { |
||||
os << " / "; |
||||
} |
||||
os << ntName; |
||||
} |
||||
os << ')'; |
||||
} |
||||
if(v.ntServicePack.major || v.ntServicePack.minor) { |
||||
os << " service pack " << v.ntServicePack.major; |
||||
if(v.ntServicePack.minor) { |
||||
os << '.' << v.ntServicePack.minor; |
||||
} |
||||
} |
||||
return os; |
||||
} |
||||
@ -1,67 +0,0 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_WINDOWSVERSION_HPP |
||||
#define INNOEXTRACT_SETUP_WINDOWSVERSION_HPP |
||||
|
||||
#include <ostream> |
||||
#include "setup/version.hpp" |
||||
|
||||
struct WindowsVersion { |
||||
|
||||
struct Version { |
||||
|
||||
unsigned major; |
||||
unsigned minor; |
||||
unsigned build; |
||||
|
||||
inline bool operator==(const Version & o) const { |
||||
return (build == o.build && major == o.major && minor == o.minor); |
||||
} |
||||
|
||||
inline bool operator!=(const Version & o) const { |
||||
return !(*this == o); |
||||
} |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
}; |
||||
|
||||
Version winVersion; |
||||
Version ntVersion; |
||||
|
||||
struct ServicePack { |
||||
|
||||
unsigned major; |
||||
unsigned minor; |
||||
|
||||
inline bool operator==(const ServicePack & o) const { |
||||
return (major == o.major && minor == o.minor); |
||||
} |
||||
|
||||
inline bool operator!=(const ServicePack & o) const { |
||||
return !(*this == o); |
||||
} |
||||
|
||||
}; |
||||
|
||||
ServicePack ntServicePack; |
||||
|
||||
void load(std::istream & is, const inno_version & version); |
||||
|
||||
inline bool operator==(const WindowsVersion & o) const { |
||||
return (winVersion == o.winVersion |
||||
&& ntServicePack == o.ntServicePack |
||||
&& ntServicePack == o.ntServicePack); |
||||
} |
||||
|
||||
inline bool operator!=(const WindowsVersion & o) const { |
||||
return !(*this == o); |
||||
} |
||||
|
||||
static const WindowsVersion none; |
||||
|
||||
}; |
||||
|
||||
std::ostream & operator<<(std::ostream & os, const WindowsVersion::Version & svd); |
||||
std::ostream & operator<<(std::ostream & os, const WindowsVersion & svd); |
||||
|
||||
#endif // INNOEXTRACT_SETUP_WINDOWSVERSION_HPP
|
||||
@ -0,0 +1,87 @@
|
||||
|
||||
#include "setup/component.hpp" |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "util/load.hpp" |
||||
#include "util/storedenum.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
namespace { |
||||
|
||||
STORED_FLAGS_MAP(stored_component_flags_0, |
||||
component_entry::Fixed, |
||||
component_entry::Restart, |
||||
component_entry::DisableNoUninstallWarning, |
||||
); |
||||
|
||||
// starting with version 3.0.8
|
||||
STORED_FLAGS_MAP(stored_component_flags_1, |
||||
component_entry::Fixed, |
||||
component_entry::Restart, |
||||
component_entry::DisableNoUninstallWarning, |
||||
component_entry::Exclusive, |
||||
); |
||||
|
||||
// starting with version 4.2.3
|
||||
STORED_FLAGS_MAP(stored_component_flags_2, |
||||
component_entry::Fixed, |
||||
component_entry::Restart, |
||||
component_entry::DisableNoUninstallWarning, |
||||
component_entry::Exclusive, |
||||
component_entry::DontInheritCheck, |
||||
); |
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void component_entry::load(std::istream & is, const version & version) { |
||||
|
||||
is >> encoded_string(name, version.codepage()); |
||||
is >> encoded_string(description, version.codepage()); |
||||
is >> encoded_string(types, version.codepage()); |
||||
if(version >= INNO_VERSION(4, 0, 1)) { |
||||
is >> encoded_string(languages, version.codepage()); |
||||
} else { |
||||
languages.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 8)) { |
||||
is >> encoded_string(check, version.codepage()); |
||||
} else { |
||||
check.clear(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
extra_disk_pace_required = load_number<uint64_t>(is); |
||||
} else { |
||||
extra_disk_pace_required = load_number<uint32_t>(is); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(3, 0, 8)) { |
||||
level = load_number<int32_t>(is); |
||||
used = load_number<uint8_t>(is); |
||||
} else { |
||||
level = 0, used = true; |
||||
} |
||||
|
||||
winver.load(is, version); |
||||
|
||||
if(version >= INNO_VERSION(4, 2, 3)) { |
||||
options = stored_flags<stored_component_flags_2>(is).get(); |
||||
} else if(version >= INNO_VERSION(3, 0, 8)) { |
||||
options = stored_flags<stored_component_flags_1>(is).get(); |
||||
} else { |
||||
options = stored_flags<stored_component_flags_0>(is).get(); |
||||
} |
||||
|
||||
size = (version >= INNO_VERSION(4, 0, 0)) ? load_number<uint64_t>(is) : load_number<uint32_t>(is); |
||||
} |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMES(setup::component_entry::flags, "Setup Component Option", |
||||
"fixed", |
||||
"restart", |
||||
"disable no uninstall warning", |
||||
"exclusive", |
||||
"don't inherit check", |
||||
) |
||||
@ -0,0 +1,54 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_COMPONENT_HPP |
||||
#define INNOEXTRACT_SETUP_COMPONENT_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/windows.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct component_entry { |
||||
|
||||
// introduced in 2.0.0
|
||||
|
||||
FLAGS(flags, |
||||
Fixed, |
||||
Restart, |
||||
DisableNoUninstallWarning, |
||||
Exclusive, |
||||
DontInheritCheck |
||||
); |
||||
|
||||
std::string name; |
||||
std::string description; |
||||
std::string types; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
uint64_t extra_disk_pace_required; |
||||
|
||||
int level; |
||||
bool used; |
||||
|
||||
windows_version_range winver; |
||||
|
||||
flags options; |
||||
|
||||
uint64_t size; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::component_entry::flags) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_COMPONENT_HPP
|
||||
@ -0,0 +1,655 @@
|
||||
|
||||
#include "setup/header.hpp" |
||||
|
||||
#include <cstdio> |
||||
#include <cstring> |
||||
|
||||
#include <boost/static_assert.hpp> |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "util/load.hpp" |
||||
#include "util/storedenum.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
namespace { |
||||
|
||||
STORED_ENUM_MAP(stored_install_verbosity, header::NormalInstallMode, |
||||
header::NormalInstallMode, |
||||
header::SilentInstallMode, |
||||
header::VerySilentInstallMode |
||||
); |
||||
|
||||
STORED_ENUM_MAP(stored_log_mode, header::AppendLog, |
||||
header::AppendLog, |
||||
header::NewLog, |
||||
header::OverwriteLog |
||||
); |
||||
|
||||
STORED_ENUM_MAP(stored_setup_style, header::ClassicStyle, |
||||
header::ClassicStyle, |
||||
header::ModernStyle |
||||
); |
||||
|
||||
STORED_ENUM_MAP(stored_bool_auto_no_yes, header::Auto, |
||||
header::Auto, |
||||
header::No, |
||||
header::Yes |
||||
); |
||||
|
||||
// pre- 5.3.7
|
||||
STORED_ENUM_MAP(stored_privileges_0, header::NoPrivileges, |
||||
header::NoPrivileges, |
||||
header::PowerUserPrivileges, |
||||
header::AdminPriviliges, |
||||
); |
||||
|
||||
// post- 5.3.7
|
||||
STORED_ENUM_MAP(stored_privileges_1, header::NoPrivileges, |
||||
header::NoPrivileges, |
||||
header::PowerUserPrivileges, |
||||
header::AdminPriviliges, |
||||
header::LowestPrivileges |
||||
); |
||||
|
||||
STORED_ENUM_MAP(stored_bool_yes_no_auto, header::Yes, |
||||
header::Yes, |
||||
header::No, |
||||
header::Auto |
||||
); |
||||
|
||||
STORED_ENUM_MAP(stored_language_detection_method, header::UILanguage, |
||||
header::UILanguage, |
||||
header::LocaleLanguage, |
||||
header::NoLanguageDetection |
||||
); |
||||
|
||||
STORED_FLAGS_MAP(stored_architectures, |
||||
header::ArchitectureUnknown, |
||||
header::X86, |
||||
header::Amd64, |
||||
header::IA64 |
||||
); |
||||
|
||||
// pre-4.2.5
|
||||
STORED_ENUM_MAP(stored_compression_method_0, stream::UnknownCompression, |
||||
stream::Zlib, |
||||
stream::BZip2, |
||||
stream::LZMA1 |
||||
); |
||||
|
||||
// 4.2.5
|
||||
STORED_ENUM_MAP(stored_compression_method_1, stream::UnknownCompression, |
||||
stream::Stored, |
||||
stream::BZip2, |
||||
stream::LZMA1 |
||||
); |
||||
|
||||
// [4.2.6 5.3.9)
|
||||
STORED_ENUM_MAP(stored_compression_method_2, stream::UnknownCompression, |
||||
stream::Stored, |
||||
stream::Zlib, |
||||
stream::BZip2, |
||||
stream::LZMA1 |
||||
); |
||||
|
||||
// 5.3.9+
|
||||
STORED_ENUM_MAP(stored_compression_method_3, stream::UnknownCompression, |
||||
stream::Stored, |
||||
stream::Zlib, |
||||
stream::BZip2, |
||||
stream::LZMA1, |
||||
stream::LZMA2 |
||||
); |
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void header::load(std::istream & is, const version & version) { |
||||
|
||||
options = 0; |
||||
|
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
::load<uint32_t>(is); // uncompressed size of the setup header structure
|
||||
} |
||||
|
||||
is >> encoded_string(app_name, version.codepage()); |
||||
is >> encoded_string(app_versioned_name, version.codepage()); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
is >> encoded_string(app_id, version.codepage()); |
||||
} |
||||
is >> encoded_string(app_copyright, version.codepage()); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
is >> encoded_string(app_publisher, version.codepage()); |
||||
is >> encoded_string(app_publisher_url, version.codepage()); |
||||
} else { |
||||
app_publisher.clear(), app_publisher_url.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 1, 13)) { |
||||
is >> encoded_string(app_support_phone, version.codepage()); |
||||
} else { |
||||
app_support_phone.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
is >> encoded_string(app_support_url, version.codepage()); |
||||
is >> encoded_string(app_updates_url, version.codepage()); |
||||
is >> encoded_string(app_version, version.codepage()); |
||||
} else { |
||||
app_support_url.clear(), app_updates_url.clear(), app_version.clear(); |
||||
} |
||||
is >> encoded_string(default_dir_name, version.codepage()); |
||||
is >> encoded_string(default_group_name, version.codepage()); |
||||
if(version < INNO_VERSION(3, 0, 0)) { |
||||
is >> ansi_string(uninstall_icon_name); |
||||
} else { |
||||
uninstall_icon_name.clear(); |
||||
} |
||||
is >> encoded_string(base_filename, version.codepage()); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
if(version < INNO_VERSION(5, 2, 5)) { |
||||
is >> ansi_string(license_text); |
||||
is >> ansi_string(info_before); |
||||
is >> ansi_string(info_after); |
||||
} |
||||
is >> encoded_string(uninstall_files_dir, version.codepage()); |
||||
is >> encoded_string(uninstall_name, version.codepage()); |
||||
is >> encoded_string(uninstall_icon, version.codepage()); |
||||
is >> encoded_string(app_mutex, version.codepage()); |
||||
} else { |
||||
license_text.clear(), info_before.clear(), info_after.clear(); |
||||
uninstall_files_dir.clear(), uninstall_name.clear(); |
||||
uninstall_icon.clear(), app_mutex.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 0)) { |
||||
is >> encoded_string(default_user_name, version.codepage()); |
||||
is >> encoded_string(default_user_organisation, version.codepage()); |
||||
} else { |
||||
default_user_name.clear(), default_user_organisation.clear(); |
||||
} |
||||
if(version >= INNO_VERSION_EXT(3, 0, 6, 1)) { |
||||
is >> encoded_string(default_serial, version.codepage()); |
||||
if(version < INNO_VERSION(5, 2, 5)) { |
||||
is >> binary_string(compiled_code); |
||||
} |
||||
} else { |
||||
default_serial.clear(), compiled_code.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(4, 2, 4)) { |
||||
is >> encoded_string(app_readme_file, version.codepage()); |
||||
is >> encoded_string(app_contact, version.codepage()); |
||||
is >> encoded_string(app_comments, version.codepage()); |
||||
is >> encoded_string(app_modify_path, version.codepage()); |
||||
} else { |
||||
app_readme_file.clear(), app_contact.clear(); |
||||
app_comments.clear(), app_modify_path.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 8)) { |
||||
is >> encoded_string(create_uninstall_registry_key, version.codepage()); |
||||
} else { |
||||
create_uninstall_registry_key.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 10)) { |
||||
is >> encoded_string(uninstallable, version.codepage()); |
||||
} else { |
||||
uninstallable.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 5)) { |
||||
is >> ansi_string(license_text); |
||||
is >> ansi_string(info_before); |
||||
is >> ansi_string(info_after); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 1) && version < INNO_VERSION(5, 3, 10)) { |
||||
is >> binary_string(uninstaller_signature); |
||||
} else { |
||||
uninstaller_signature.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 5)) { |
||||
is >> binary_string(compiled_code); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 6) && !version.unicode) { |
||||
lead_bytes = stored_char_set(is); |
||||
} else { |
||||
lead_bytes = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
language_count = load_number<uint32_t>(is); |
||||
} else if(version >= INNO_VERSION(2, 0, 1)) { |
||||
language_count = 1; |
||||
} else { |
||||
language_count = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 2, 1)) { |
||||
message_count = load_number<uint32_t>(is); |
||||
} else { |
||||
message_count = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 1, 0)) { |
||||
permission_count = load_number<uint32_t>(is); |
||||
} else { |
||||
permission_count = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 0)) { |
||||
type_count = load_number<uint32_t>(is); |
||||
component_count = load_number<uint32_t>(is); |
||||
task_count = load_number<uint32_t>(is); |
||||
} else { |
||||
type_count = 0, component_count = 0, task_count = 0; |
||||
} |
||||
|
||||
directory_count = load_number<uint32_t>(is, version.bits); |
||||
file_count = load_number<uint32_t>(is, version.bits); |
||||
data_entry_count = load_number<uint32_t>(is, version.bits); |
||||
icon_count = load_number<uint32_t>(is, version.bits); |
||||
ini_entry_count = load_number<uint32_t>(is, version.bits); |
||||
registry_entry_count = load_number<uint32_t>(is, version.bits); |
||||
delete_entry_count = load_number<uint32_t>(is, version.bits); |
||||
uninstall_delete_entry_count = load_number<uint32_t>(is, version.bits); |
||||
run_entry_count = load_number<uint32_t>(is, version.bits); |
||||
uninstall_run_entry_count = load_number<uint32_t>(is, version.bits); |
||||
|
||||
int32_t license_size; |
||||
int32_t info_before_size; |
||||
int32_t info_after_size; |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
license_size = load_number<int32_t>(is, version.bits); |
||||
info_before_size = load_number<int32_t>(is, version.bits); |
||||
info_after_size = load_number<int32_t>(is, version.bits); |
||||
} |
||||
|
||||
winver.load(is, version); |
||||
|
||||
back_color = load_number<uint32_t>(is); |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
back_color2 = load_number<uint32_t>(is); |
||||
} else { |
||||
back_color2 = 0; |
||||
} |
||||
image_back_color = load_number<uint32_t>(is); |
||||
if(version >= INNO_VERSION(2, 0, 0) && version < INNO_VERSION(5, 0, 4)) { |
||||
small_image_back_color = load_number<uint32_t>(is); |
||||
} else { |
||||
small_image_back_color = 0; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 2, 0)) { |
||||
password.crc32 = load_number<uint32_t>(is), password.type = crypto::CRC32; |
||||
} else if(version < INNO_VERSION(5, 3, 9)) { |
||||
is.read(password.md5, sizeof(password.md5)), password.type = crypto::MD5; |
||||
} else { |
||||
is.read(password.sha1, sizeof(password.sha1)), password.type = crypto::SHA1; |
||||
} |
||||
if(version >= INNO_VERSION(4, 2, 2)) { |
||||
is.read(password_salt, sizeof(password_salt)); |
||||
} else { |
||||
memset(password_salt, 0, sizeof(password_salt)); |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 0, 0)) { |
||||
extra_disk_space_required = load_number<int32_t>(is); |
||||
slices_per_disk = 1; |
||||
} else { |
||||
extra_disk_space_required = load_number<int64_t>(is); |
||||
slices_per_disk = load_number<uint32_t>(is); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 0) && version < INNO_VERSION(5, 0, 0)) { |
||||
install_mode = stored_enum<stored_install_verbosity>(is).get(); |
||||
} else { |
||||
install_mode = NormalInstallMode; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
uninstall_log_mode = stored_enum<stored_log_mode>(is).get(); |
||||
} else { |
||||
uninstall_log_mode = AppendLog; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(2, 0, 0) && version < INNO_VERSION(5, 0, 0)) { |
||||
uninstall_style = stored_enum<stored_setup_style>(is).get(); |
||||
} else { |
||||
uninstall_style = (version < INNO_VERSION(5, 0, 0)) ? ClassicStyle : ModernStyle; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
dir_exists_warning = stored_enum<stored_bool_auto_no_yes>(is).get(); |
||||
} else { |
||||
dir_exists_warning = Auto; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(3, 0, 0) && version < INNO_VERSION(3, 0, 3)) { |
||||
auto_bool val = stored_enum<stored_bool_auto_no_yes>(is).get(); |
||||
switch(val) { |
||||
case Yes: options |= AlwaysRestart; break; |
||||
case Auto: options |= RestartIfNeededByRun; break; |
||||
case No: break; |
||||
} |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 7)) { |
||||
privileges_required = stored_enum<stored_privileges_1>(is).get(); |
||||
} else if(version >= INNO_VERSION(3, 0, 4)) { |
||||
privileges_required = stored_enum<stored_privileges_0>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 10)) { |
||||
show_language_dialog = stored_enum<stored_bool_yes_no_auto>(is).get(); |
||||
language_detection = stored_enum<stored_language_detection_method>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 9)) { |
||||
compression = stored_enum<stored_compression_method_3>(is).get(); |
||||
} else if(version >= INNO_VERSION(4, 2, 6)) { |
||||
compression = stored_enum<stored_compression_method_2>(is).get(); |
||||
} else if(version >= INNO_VERSION(4, 2, 5)) { |
||||
compression = stored_enum<stored_compression_method_1>(is).get(); |
||||
} else if(version >= INNO_VERSION(4, 1, 5)) { |
||||
compression = stored_enum<stored_compression_method_0>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 1, 0)) { |
||||
architectures_allowed = stored_flags<stored_architectures>(is).get(); |
||||
architectures_installed_in_64bit_mode = stored_flags<stored_architectures>(is).get(); |
||||
} else { |
||||
architectures_allowed = architecture_types::all(); |
||||
architectures_installed_in_64bit_mode = architecture_types::all(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 2, 1) && version < INNO_VERSION(5, 3, 10)) { |
||||
signed_uninstaller_original_size = load_number<uint32_t>(is); |
||||
signed_uninstaller_header_checksum = load_number<uint32_t>(is); |
||||
} else { |
||||
signed_uninstaller_original_size = signed_uninstaller_header_checksum = 0; |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 3)) { |
||||
disable_dir_page = stored_enum<stored_bool_auto_no_yes>(is).get(); |
||||
disable_program_group_page = stored_enum<stored_bool_auto_no_yes>(is).get(); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(5, 3, 6)) { |
||||
uninstall_display_size = load_number<uint32_t>(is); |
||||
} else { |
||||
uninstall_display_size = 0; |
||||
} |
||||
|
||||
|
||||
stored_flag_reader<flags> flags(is); |
||||
|
||||
flags.add(DisableStartupPrompt); |
||||
if(version < INNO_VERSION(5, 3, 10)) { |
||||
flags.add(Uninstallable); |
||||
} |
||||
flags.add(CreateAppDir); |
||||
if(version < INNO_VERSION(5, 3, 3)) { |
||||
flags.add(DisableDirPage); |
||||
} |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
flags.add(DisableDirExistsWarning); |
||||
} |
||||
if(version < INNO_VERSION(5, 3, 3)) { |
||||
flags.add(DisableProgramGroupPage); |
||||
} |
||||
flags.add(AllowNoIcons); |
||||
if(version < INNO_VERSION(3, 0, 0) || version >= INNO_VERSION(3, 0, 3)) { |
||||
flags.add(AlwaysRestart); |
||||
} |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
flags.add(BackSolid); |
||||
} |
||||
flags.add(AlwaysUsePersonalGroup); |
||||
flags.add(WindowVisible); |
||||
flags.add(WindowShowCaption); |
||||
flags.add(WindowResizable); |
||||
flags.add(WindowStartMaximized); |
||||
flags.add(EnableDirDoesntExistWarning); |
||||
if(version < INNO_VERSION(4, 1, 2)) { |
||||
flags.add(DisableAppendDir); |
||||
} |
||||
flags.add(Password); |
||||
flags.add(AllowRootDirectory); |
||||
flags.add(DisableFinishedPage); |
||||
if(version.bits != 16) { |
||||
if(version < INNO_VERSION(3, 0, 4)) { |
||||
flags.add(AdminPrivilegesRequired); |
||||
} |
||||
if(version < INNO_VERSION(3, 0, 0)) { |
||||
flags.add(AlwaysCreateUninstallIcon); |
||||
} |
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
flags.add(OverwriteUninstRegEntries); |
||||
} |
||||
flags.add(ChangesAssociations); |
||||
} |
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
if(version < INNO_VERSION(5, 3, 8)) { |
||||
flags.add(CreateUninstallRegKey); |
||||
} |
||||
flags.add(UsePreviousAppDir); |
||||
flags.add(BackColorHorizontal); |
||||
flags.add(UsePreviousGroup); |
||||
flags.add(UpdateUninstallLogAppName); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 0)) { |
||||
flags.add(UsePreviousSetupType); |
||||
flags.add(DisableReadyMemo); |
||||
flags.add(AlwaysShowComponentsList); |
||||
flags.add(FlatComponentsList); |
||||
flags.add(ShowComponentSizes); |
||||
flags.add(UsePreviousTasks); |
||||
flags.add(DisableReadyPage); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 7)) { |
||||
flags.add(AlwaysShowDirOnReadyPage); |
||||
flags.add(AlwaysShowGroupOnReadyPage); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 17) && version < INNO_VERSION(4, 1, 5)) { |
||||
flags.add(BzipUsed); |
||||
} |
||||
if(version >= INNO_VERSION(2, 0, 18)) { |
||||
flags.add(AllowUNCPath); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 0)) { |
||||
flags.add(UserInfoPage); |
||||
flags.add(UsePreviousUserInfo); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 1)) { |
||||
flags.add(UninstallRestartComputer); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 3)) { |
||||
flags.add(RestartIfNeededByRun); |
||||
} |
||||
if(version >= INNO_VERSION_EXT(3, 0, 6, 1)) { |
||||
flags.add(ShowTasksTreeLines); |
||||
} |
||||
if(version >= INNO_VERSION(4, 0, 0) && version < INNO_VERSION(4, 0, 10)) { |
||||
flags.add(ShowLanguageDialog); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 1) && version < INNO_VERSION(4, 0, 10)) { |
||||
flags.add(DetectLanguageUsingLocale); |
||||
} |
||||
if(version >= INNO_VERSION(4, 0, 9)) { |
||||
flags.add(AllowCancelDuringInstall); |
||||
} else { |
||||
options |= AllowCancelDuringInstall; |
||||
} |
||||
if(version >= INNO_VERSION(4, 1, 3)) { |
||||
flags.add(WizardImageStretch); |
||||
} |
||||
if(version >= INNO_VERSION(4, 1, 8)) { |
||||
flags.add(AppendDefaultDirName); |
||||
flags.add(AppendDefaultGroupName); |
||||
} |
||||
if(version >= INNO_VERSION(4, 2, 2)) { |
||||
flags.add(EncryptionUsed); |
||||
} |
||||
if(version >= INNO_VERSION(5, 0, 4)) { |
||||
flags.add(ChangesEnvironment); |
||||
} |
||||
if(version >= INNO_VERSION(5, 1, 7) && !version.unicode) { |
||||
flags.add(ShowUndisplayableLanguages); |
||||
} |
||||
if(version >= INNO_VERSION(5, 1, 13)) { |
||||
flags.add(SetupLogging); |
||||
} |
||||
if(version >= INNO_VERSION(5, 2, 1)) { |
||||
flags.add(SignedUninstaller); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 8)) { |
||||
flags.add(UsePreviousLanguage); |
||||
} |
||||
if(version >= INNO_VERSION(5, 3, 9)) { |
||||
flags.add(DisableWelcomePage); |
||||
} |
||||
|
||||
options |= flags; |
||||
|
||||
if(version < INNO_VERSION(3, 0, 4)) { |
||||
privileges_required = (options & AdminPrivilegesRequired) ? AdminPriviliges : NoPrivileges; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 0, 10)) { |
||||
show_language_dialog = (options & ShowLanguageDialog) ? Yes : No; |
||||
language_detection = (options & DetectLanguageUsingLocale) ? LocaleLanguage : UILanguage; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(4, 1, 5)) { |
||||
compression = (options & BzipUsed) ? stream::BZip2 : stream::Zlib; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(5, 3, 3)) { |
||||
disable_dir_page = (options & DisableDirPage) ? Yes : No; |
||||
disable_program_group_page = (options & DisableProgramGroupPage) ? Yes : No; |
||||
} |
||||
|
||||
if(version < INNO_VERSION(1, 3, 21)) { |
||||
if(license_size > 0) { |
||||
std::string temp; |
||||
temp.resize(size_t(license_size)); |
||||
is.read(&temp[0], license_size); |
||||
to_utf8(temp, license_text); |
||||
} |
||||
if(info_before_size > 0) { |
||||
std::string temp; |
||||
temp.resize(size_t(info_before_size)); |
||||
is.read(&temp[0], info_before_size); |
||||
to_utf8(temp, info_before); |
||||
} |
||||
if(info_after_size > 0) { |
||||
std::string temp; |
||||
temp.resize(size_t(info_after_size)); |
||||
is.read(&temp[0], info_after_size); |
||||
to_utf8(temp, info_after); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMES(setup::header::flags, "Setup Option", |
||||
"disable startup prompt", |
||||
"create app dir", |
||||
"allow no icons", |
||||
"always restart", |
||||
"always use personal group", |
||||
"window visible", |
||||
"window show caption", |
||||
"window resizable", |
||||
"window start maximized", |
||||
"enable dir doesn't exist warning", |
||||
"password", |
||||
"allow root directory", |
||||
"disable finished page", |
||||
"changes associations", |
||||
"use previous app dir", |
||||
"back color horizontal", |
||||
"use previous group", |
||||
"update uninstall log app name", |
||||
"use previous setup type", |
||||
"disable ready memo", |
||||
"always show components list", |
||||
"flat components list", |
||||
"show component sizes", |
||||
"use previous tasks", |
||||
"disable ready page", |
||||
"always show dir on ready page", |
||||
"always show group on ready page", |
||||
"allow unc path", |
||||
"user info page", |
||||
"use previous user info", |
||||
"uninstall restart computer", |
||||
"restart if needed by run", |
||||
"show tasks tree lines", |
||||
"allow cancel during install", |
||||
"wizard image stretch", |
||||
"append default dir name", |
||||
"append default group name", |
||||
"encrypted", |
||||
"changes environment", |
||||
"show undisplayable languages", |
||||
"setup logging", |
||||
"signed uninstaller", |
||||
"use previous language", |
||||
"disable welcome page", |
||||
"uninstallable", |
||||
"disable dir page", |
||||
"disable program group page", |
||||
"disable append dir", |
||||
"admin privilegesrequired", |
||||
"always create uninstall icon", |
||||
"create uninstall reg key", |
||||
"bzip used", |
||||
"show language dialog", |
||||
"detect language using locale", |
||||
"disable dir exists warning", |
||||
"back solid", |
||||
"overwrite uninst reg entries", |
||||
) |
||||
|
||||
NAMES(setup::header::architecture_types, "Architecture", |
||||
"unknown", |
||||
"x86", |
||||
"amd64", |
||||
"IA64", |
||||
) |
||||
|
||||
NAMES(setup::header::install_verbosity, "Install Mode", |
||||
"normal", |
||||
"silent", |
||||
"very silent", |
||||
) |
||||
|
||||
NAMES(setup::header::log_mode, "Uninstall Log Mode", |
||||
"append", |
||||
"new log", |
||||
"overwrite", |
||||
) |
||||
|
||||
NAMES(setup::header::style, "Uninstall Style", |
||||
"classic", |
||||
"modern", |
||||
) |
||||
|
||||
NAMES(setup::header::auto_bool, "Auto Boolean", |
||||
"auto", |
||||
"no", |
||||
"yes", |
||||
) |
||||
|
||||
NAMES(setup::header::privilege_level, "Privileges", |
||||
"none", |
||||
"power user", |
||||
"admin", |
||||
"lowest", |
||||
) |
||||
|
||||
NAMES(setup::header::language_detection_method, "Language Detection", |
||||
"ui language", |
||||
"locale", |
||||
"none", |
||||
) |
||||
@ -0,0 +1,238 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_HEADER_HPP |
||||
#define INNOEXTRACT_SETUP_HEADER_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <stddef.h> |
||||
#include <bitset> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "crypto/checksum.hpp" |
||||
#include "setup/windows.hpp" |
||||
#include "stream/chunk.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
typedef char salt[8]; |
||||
|
||||
struct header { |
||||
|
||||
// Setup data header.
|
||||
|
||||
FLAGS(flags, |
||||
|
||||
DisableStartupPrompt, |
||||
CreateAppDir, |
||||
AllowNoIcons, |
||||
AlwaysRestart, |
||||
AlwaysUsePersonalGroup, |
||||
WindowVisible, |
||||
WindowShowCaption, |
||||
WindowResizable, |
||||
WindowStartMaximized, |
||||
EnableDirDoesntExistWarning, |
||||
Password, |
||||
AllowRootDirectory, |
||||
DisableFinishedPage, |
||||
ChangesAssociations, |
||||
UsePreviousAppDir, |
||||
BackColorHorizontal, |
||||
UsePreviousGroup, |
||||
UpdateUninstallLogAppName, |
||||
UsePreviousSetupType, |
||||
DisableReadyMemo, |
||||
AlwaysShowComponentsList, |
||||
FlatComponentsList, |
||||
ShowComponentSizes, |
||||
UsePreviousTasks, |
||||
DisableReadyPage, |
||||
AlwaysShowDirOnReadyPage, |
||||
AlwaysShowGroupOnReadyPage, |
||||
AllowUNCPath, |
||||
UserInfoPage, |
||||
UsePreviousUserInfo, |
||||
UninstallRestartComputer, |
||||
RestartIfNeededByRun, |
||||
ShowTasksTreeLines, |
||||
AllowCancelDuringInstall, |
||||
WizardImageStretch, |
||||
AppendDefaultDirName, |
||||
AppendDefaultGroupName, |
||||
EncryptionUsed, |
||||
ChangesEnvironment, |
||||
ShowUndisplayableLanguages, |
||||
SetupLogging, |
||||
SignedUninstaller, |
||||
UsePreviousLanguage, |
||||
DisableWelcomePage, |
||||
|
||||
// Obsolete flags
|
||||
Uninstallable, |
||||
DisableDirPage, |
||||
DisableProgramGroupPage, |
||||
DisableAppendDir, |
||||
AdminPrivilegesRequired, |
||||
AlwaysCreateUninstallIcon, |
||||
CreateUninstallRegKey, |
||||
BzipUsed, |
||||
ShowLanguageDialog, |
||||
DetectLanguageUsingLocale, |
||||
DisableDirExistsWarning, |
||||
BackSolid, |
||||
OverwriteUninstRegEntries |
||||
); |
||||
|
||||
FLAGS(architecture_types, |
||||
ArchitectureUnknown, |
||||
X86, |
||||
Amd64, |
||||
IA64 |
||||
); |
||||
|
||||
std::string app_name; |
||||
std::string app_versioned_name; |
||||
std::string app_id; |
||||
std::string app_copyright; |
||||
std::string app_publisher; |
||||
std::string app_publisher_url; |
||||
std::string app_support_phone; |
||||
std::string app_support_url; |
||||
std::string app_updates_url; |
||||
std::string app_version; |
||||
std::string default_dir_name; |
||||
std::string default_group_name; |
||||
std::string uninstall_icon_name; |
||||
std::string base_filename; |
||||
std::string uninstall_files_dir; |
||||
std::string uninstall_name; |
||||
std::string uninstall_icon; |
||||
std::string app_mutex; |
||||
std::string default_user_name; |
||||
std::string default_user_organisation; |
||||
std::string default_serial; |
||||
std::string app_readme_file; |
||||
std::string app_contact; |
||||
std::string app_comments; |
||||
std::string app_modify_path; |
||||
std::string create_uninstall_registry_key; |
||||
std::string uninstallable; |
||||
std::string license_text; |
||||
std::string info_before; |
||||
std::string info_after; |
||||
std::string uninstaller_signature; |
||||
std::string compiled_code; |
||||
|
||||
std::bitset<256> lead_bytes; |
||||
|
||||
size_t language_count; |
||||
size_t message_count; |
||||
size_t permission_count; |
||||
size_t type_count; |
||||
size_t component_count; |
||||
size_t task_count; |
||||
size_t directory_count; |
||||
size_t file_count; |
||||
size_t data_entry_count; |
||||
size_t icon_count; |
||||
size_t ini_entry_count; |
||||
size_t registry_entry_count; |
||||
size_t delete_entry_count; |
||||
size_t uninstall_delete_entry_count; |
||||
size_t run_entry_count; |
||||
size_t uninstall_run_entry_count; |
||||
|
||||
windows_version_range winver; |
||||
|
||||
typedef uint32_t Color; |
||||
Color back_color; |
||||
Color back_color2; |
||||
Color image_back_color; |
||||
Color small_image_back_color; |
||||
|
||||
crypto::checksum password; |
||||
salt password_salt; |
||||
|
||||
int64_t extra_disk_space_required; |
||||
size_t slices_per_disk; |
||||
|
||||
enum install_verbosity { |
||||
NormalInstallMode, |
||||
SilentInstallMode, |
||||
VerySilentInstallMode, |
||||
}; |
||||
install_verbosity install_mode; |
||||
|
||||
enum log_mode { |
||||
AppendLog, |
||||
NewLog, |
||||
OverwriteLog |
||||
}; |
||||
log_mode uninstall_log_mode; |
||||
|
||||
enum style { |
||||
ClassicStyle, |
||||
ModernStyle |
||||
}; |
||||
style uninstall_style; |
||||
|
||||
enum auto_bool { |
||||
Auto, |
||||
No, |
||||
Yes |
||||
}; |
||||
|
||||
auto_bool dir_exists_warning; |
||||
|
||||
enum privilege_level { |
||||
NoPrivileges, |
||||
PowerUserPrivileges, |
||||
AdminPriviliges, |
||||
LowestPrivileges |
||||
}; |
||||
privilege_level privileges_required; |
||||
|
||||
auto_bool show_language_dialog; |
||||
|
||||
enum language_detection_method { |
||||
UILanguage, |
||||
LocaleLanguage, |
||||
NoLanguageDetection |
||||
}; |
||||
language_detection_method language_detection; |
||||
|
||||
stream::compression_method compression; |
||||
|
||||
architecture_types architectures_allowed; |
||||
architecture_types architectures_installed_in_64bit_mode; |
||||
|
||||
uint32_t signed_uninstaller_original_size; |
||||
uint32_t signed_uninstaller_header_checksum; |
||||
|
||||
auto_bool disable_dir_page; |
||||
auto_bool disable_program_group_page; |
||||
|
||||
size_t uninstall_display_size; |
||||
|
||||
flags options; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::header::flags) |
||||
NAMED_FLAGS(setup::header::architecture_types) |
||||
NAMED_ENUM(setup::header::install_verbosity) |
||||
NAMED_ENUM(setup::header::log_mode) |
||||
NAMED_ENUM(setup::header::style) |
||||
NAMED_ENUM(setup::header::auto_bool) |
||||
NAMED_ENUM(setup::header::privilege_level) |
||||
NAMED_ENUM(setup::header::language_detection_method) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_HEADER_HPP
|
||||
@ -0,0 +1,62 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_ICON_HPP |
||||
#define INNOEXTRACT_SETUP_ICON_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/item.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct icon_entry : public item { |
||||
|
||||
FLAGS(flags, |
||||
NeverUninstall, |
||||
CreateOnlyIfFileExists, |
||||
UseAppPaths, |
||||
FolderShortcut, |
||||
ExcludeFromShowInNewInstall, |
||||
// obsolete options:
|
||||
RunMinimized |
||||
); |
||||
|
||||
enum close_setting { |
||||
NoSetting, |
||||
CloseOnExit, |
||||
DontCloseOnExit, |
||||
}; |
||||
|
||||
std::string name; |
||||
std::string filename; |
||||
std::string parameters; |
||||
std::string working_dir; |
||||
std::string icon_file; |
||||
std::string comment; |
||||
std::string app_user_model_id; |
||||
|
||||
int icon_index; |
||||
|
||||
int show_command; |
||||
|
||||
close_setting close_on_exit; |
||||
|
||||
uint16_t hotkey; |
||||
|
||||
flags options; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::icon_entry::flags) |
||||
NAMED_ENUM(setup::icon_entry::close_setting) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_ICON_HPP
|
||||
@ -0,0 +1,41 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_INI_HPP |
||||
#define INNOEXTRACT_SETUP_INI_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/item.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct ini_entry : public item { |
||||
|
||||
FLAGS(flags, |
||||
CreateKeyIfDoesntExist, |
||||
UninsDeleteEntry, |
||||
UninsDeleteEntireSection, |
||||
UninsDeleteSectionIfEmpty, |
||||
HasValue |
||||
); |
||||
|
||||
std::string inifile; |
||||
std::string section; |
||||
std::string key; |
||||
std::string value; |
||||
|
||||
flags options; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::ini_entry::flags) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_INI_HPP
|
||||
@ -0,0 +1,38 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_ITEM_HPP |
||||
#define INNOEXTRACT_SETUP_ITEM_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/windows.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct item { |
||||
|
||||
std::string components; |
||||
std::string tasks; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
std::string after_install; |
||||
std::string before_install; |
||||
|
||||
windows_version_range winver; |
||||
|
||||
protected: |
||||
|
||||
void load_condition_data(std::istream & is, const version & version); |
||||
|
||||
inline void load_version_data(std::istream & is, const version & version) { |
||||
winver.load(is, version); |
||||
} |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
#endif // INNOEXTRACT_SETUP_ITEM_HPP
|
||||
@ -0,0 +1,67 @@
|
||||
|
||||
#include "setup/language.hpp" |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "util/load.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
void language_entry::load(std::istream & is, const version & version) { |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
is >> encoded_string(name, version.codepage()); |
||||
} else { |
||||
name = "default"; |
||||
} |
||||
|
||||
is >> encoded_string(language_name, (version >= INNO_VERSION(4, 2, 2)) ? 1200 : 1252); |
||||
|
||||
is >> encoded_string(dialog_font, version.codepage()); |
||||
is >> encoded_string(title_font, version.codepage()); |
||||
is >> encoded_string(welcome_font, version.codepage()); |
||||
is >> encoded_string(copyright_font, version.codepage()); |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 0)) { |
||||
is >> binary_string(data); |
||||
} |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 1)) { |
||||
is >> ansi_string(license_text); |
||||
is >> ansi_string(info_before); |
||||
is >> ansi_string(info_after); |
||||
} else { |
||||
license_text.clear(), info_before.clear(), info_after.clear(); |
||||
} |
||||
|
||||
language_id = load_number<uint32_t>(is); |
||||
|
||||
if(version >= INNO_VERSION(4, 2, 2) && (version < INNO_VERSION(5, 3, 0) || !version.unicode)) { |
||||
codepage = load_number<uint32_t>(is); |
||||
} else { |
||||
codepage = 0; |
||||
} |
||||
if(!codepage) { |
||||
codepage = version.codepage(); |
||||
} |
||||
|
||||
dialog_font_size = load_number<uint32_t>(is); |
||||
|
||||
if(version < INNO_VERSION(4, 1, 0)) { |
||||
dialog_font_standard_height = load_number<uint32_t>(is); |
||||
} else { |
||||
dialog_font_standard_height = 0; |
||||
} |
||||
|
||||
title_font_size = load_number<uint32_t>(is); |
||||
welcome_font_size = load_number<uint32_t>(is); |
||||
copyright_font_size = load_number<uint32_t>(is); |
||||
|
||||
if(version >= INNO_VERSION(5, 2, 3)) { |
||||
right_to_left = ::load<uint8_t>(is); |
||||
} else { |
||||
right_to_left = false; |
||||
} |
||||
|
||||
} |
||||
|
||||
} // namespace setup
|
||||
@ -0,0 +1,44 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_LANGUAGE_HPP |
||||
#define INNOEXTRACT_SETUP_LANGUAGE_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct language_entry { |
||||
|
||||
// introduced in 2.0.1
|
||||
|
||||
std::string name; |
||||
std::string language_name; |
||||
std::string dialog_font; |
||||
std::string title_font; |
||||
std::string welcome_font; |
||||
std::string copyright_font; |
||||
std::string data; |
||||
std::string license_text; |
||||
std::string info_before; |
||||
std::string info_after; |
||||
|
||||
uint32_t language_id; |
||||
uint32_t codepage; |
||||
size_t dialog_font_size; |
||||
size_t dialog_font_standard_height; |
||||
size_t title_font_size; |
||||
size_t welcome_font_size; |
||||
size_t copyright_font_size; |
||||
|
||||
bool right_to_left; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
#endif // INNOEXTRACT_SETUP_LANGUAGE_HPP
|
||||
@ -0,0 +1,16 @@
|
||||
|
||||
#include "setup/permission.hpp" |
||||
|
||||
#include "util/load.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
void permission_entry::load(std::istream & is, const version & version) { |
||||
|
||||
(void)version; |
||||
|
||||
is >> binary_string(permissions); // an array of TGrantPermissionEntry's
|
||||
|
||||
} |
||||
|
||||
} // namespace setup
|
||||
@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_PERMISSION_HPP |
||||
#define INNOEXTRACT_SETUP_PERMISSION_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct permission_entry { |
||||
|
||||
// introduced in 4.1.0
|
||||
|
||||
std::string permissions; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
#endif // INNOEXTRACT_SETUP_PERMISSION_HPP
|
||||
@ -0,0 +1,60 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_RUN_HPP |
||||
#define INNOEXTRACT_SETUP_RUN_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/item.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct run_entry : public item { |
||||
|
||||
FLAGS(flags, |
||||
ShellExec, |
||||
SkipIfDoesntExist, |
||||
PostInstall, |
||||
Unchecked, |
||||
SkipIfSilent, |
||||
Skipif_not_equalSilent, |
||||
HideWizard, |
||||
Bits32, |
||||
Bits64, |
||||
RunAsOriginalUser |
||||
); |
||||
|
||||
enum wait_condition { |
||||
WaitUntilTerminated, |
||||
NoWait, |
||||
WaitUntilIdle, |
||||
}; |
||||
|
||||
std::string name; |
||||
std::string parameters; |
||||
std::string working_dir; |
||||
std::string run_once_id; |
||||
std::string status_message; |
||||
std::string verb; |
||||
std::string description; |
||||
|
||||
int show_command; |
||||
|
||||
wait_condition wait; |
||||
|
||||
flags options; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::run_entry::flags) |
||||
NAMED_ENUM(setup::run_entry::wait_condition) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_RUN_HPP
|
||||
@ -0,0 +1,50 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_TASK_HPP |
||||
#define INNOEXTRACT_SETUP_TASK_HPP |
||||
|
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/windows.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct task_entry { |
||||
|
||||
// introduced in 2.0.0
|
||||
|
||||
FLAGS(flags, |
||||
Exclusive, |
||||
Unchecked, |
||||
Restart, |
||||
CheckedOnce, |
||||
DontInheritCheck |
||||
); |
||||
|
||||
std::string name; |
||||
std::string description; |
||||
std::string group_description; |
||||
std::string components; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
int level; |
||||
bool used; |
||||
|
||||
windows_version_range winver; |
||||
|
||||
flags options; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::task_entry::flags) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_TASK_HPP
|
||||
@ -0,0 +1,75 @@
|
||||
|
||||
#include "setup/type.hpp" |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "util/load.hpp" |
||||
#include "util/storedenum.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
namespace { |
||||
|
||||
FLAGS(type_flags, |
||||
CustomSetupType |
||||
); |
||||
|
||||
STORED_FLAGS_MAP(stored_type_flags, |
||||
CustomSetupType, |
||||
); |
||||
|
||||
STORED_ENUM_MAP(stored_setup_type, type_entry::User, |
||||
type_entry::User, |
||||
type_entry::DefaultFull, |
||||
type_entry::DefaultCompact, |
||||
type_entry::DefaultCustom, |
||||
); |
||||
|
||||
} // anonymous namespace
|
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_FLAGS(setup::type_flags) |
||||
|
||||
namespace setup { |
||||
|
||||
void type_entry::load(std::istream & is, const version & version) { |
||||
|
||||
is >> encoded_string(name, version.codepage()); |
||||
is >> encoded_string(description, version.codepage()); |
||||
if(version >= INNO_VERSION(4, 0, 1)) { |
||||
is >> encoded_string(languages, version.codepage()); |
||||
} else { |
||||
languages.clear(); |
||||
} |
||||
if(version >= INNO_VERSION(3, 0, 8)) { |
||||
is >> encoded_string(check, version.codepage()); |
||||
} else { |
||||
check.clear(); |
||||
} |
||||
|
||||
winver.load(is, version); |
||||
|
||||
type_flags options = stored_flags<stored_type_flags>(is).get(); |
||||
custom_type = (options & CustomSetupType); |
||||
|
||||
if(version >= INNO_VERSION(4, 0, 3)) { |
||||
type = stored_enum<stored_setup_type>(is).get(); |
||||
} else { |
||||
type = User; |
||||
} |
||||
|
||||
size = (version >= INNO_VERSION(4, 0, 0)) ? load_number<uint64_t>(is) : load_number<uint32_t>(is); |
||||
} |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMES(setup::type_flags, "Setyp Type Option", |
||||
"is custom", |
||||
) |
||||
|
||||
NAMES(setup::type_entry::setup_type, "Setyp Type", |
||||
"user", |
||||
"default full", |
||||
"default compact", |
||||
"default custom", |
||||
) |
||||
@ -0,0 +1,49 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_TYPE_HPP |
||||
#define INNOEXTRACT_SETUP_TYPE_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string> |
||||
#include <iosfwd> |
||||
|
||||
#include "setup/windows.hpp" |
||||
#include "util/enum.hpp" |
||||
#include "util/flags.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct type_entry { |
||||
|
||||
// introduced in 2.0.0
|
||||
|
||||
enum setup_type { |
||||
User, |
||||
DefaultFull, |
||||
DefaultCompact, |
||||
DefaultCustom |
||||
}; |
||||
|
||||
std::string name; |
||||
std::string description; |
||||
std::string languages; |
||||
std::string check; |
||||
|
||||
windows_version_range winver; |
||||
|
||||
bool custom_type; |
||||
|
||||
setup_type type; |
||||
|
||||
uint64_t size; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
} // namespace setup
|
||||
|
||||
NAMED_ENUM(setup::type_entry::setup_type) |
||||
|
||||
#endif // INNOEXTRACT_SETUP_TYPE_HPP
|
||||
@ -0,0 +1,145 @@
|
||||
|
||||
#include "setup/windows.hpp" |
||||
|
||||
#include <stdint.h> |
||||
#include <ostream> |
||||
|
||||
#include "setup/version.hpp" |
||||
#include "util/load.hpp" |
||||
#include "util/util.hpp" |
||||
|
||||
namespace setup { |
||||
|
||||
const windows_version windows_version::none = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0 } }; |
||||
|
||||
void windows_version::data::load(std::istream & is, const version & version) { |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
build = load_number<uint16_t>(is); |
||||
} else { |
||||
build = 0; |
||||
} |
||||
|
||||
minor = load_number<uint8_t>(is); |
||||
major = load_number<uint8_t>(is); |
||||
|
||||
} |
||||
|
||||
void windows_version::load(std::istream & is, const version & version) { |
||||
|
||||
win_version.load(is, version); |
||||
nt_version.load(is, version); |
||||
|
||||
if(version >= INNO_VERSION(1, 3, 21)) { |
||||
nt_service_pack.minor = load_number<uint8_t>(is); |
||||
nt_service_pack.major = load_number<uint8_t>(is); |
||||
} else { |
||||
nt_service_pack.major = 0, nt_service_pack.minor = 0; |
||||
} |
||||
|
||||
} |
||||
|
||||
void windows_version_range::load(std::istream & is, const version & version) { |
||||
begin.load(is, version); |
||||
end.load(is, version); |
||||
} |
||||
|
||||
|
||||
namespace { |
||||
|
||||
struct windows_version_name { |
||||
|
||||
const char * name; |
||||
|
||||
windows_version::data version; |
||||
|
||||
}; |
||||
|
||||
windows_version_name windows_version_names[] = { |
||||
{ "Windows 1.0", { 1, 4, 0 } }, |
||||
{ "Windows 2.0", { 2, 11, 0 } }, |
||||
{ "Windows 3.0", { 3, 0, 0 } }, |
||||
{ "Windows for Workgroups 3.11", { 3, 11, 0 } }, |
||||
{ "Windows 95", { 4, 0, 950 } }, |
||||
{ "Windows 98", { 4, 1, 1998 } }, |
||||
{ "Windows 98 Second Edition", { 4, 1, 2222 } }, |
||||
{ "Windows ME", { 4, 90, 3000 } }, |
||||
}; |
||||
|
||||
windows_version_name windows_nt_version_names[] = { |
||||
{ "Windows NT Workstation 3.5", { 3, 5, 807 } }, |
||||
{ "Windows NT 3.1", { 3, 10, 528 } }, |
||||
{ "Windows NT Workstation 3.51", { 3, 51, 1057 } }, |
||||
{ "Windows NT Workstation 4.0", { 4, 0, 1381 } }, |
||||
{ "Windows 2000", { 5, 0, 2195 } }, |
||||
{ "Windows XP", { 5, 1, 2600 } }, |
||||
{ "Windows XP x64", { 5, 2, 3790 } }, |
||||
{ "Windows Vista", { 6, 0, 6000 } }, |
||||
{ "Windows 7", { 6, 1, 7600 } } |
||||
}; |
||||
|
||||
const char * get_version_name(const windows_version::data & version, bool nt = false) { |
||||
|
||||
windows_version_name * names; |
||||
size_t count; |
||||
if(nt) { |
||||
names = windows_nt_version_names, count = ARRAY_SIZE(windows_nt_version_names); |
||||
} else { |
||||
names = windows_version_names, count = ARRAY_SIZE(windows_version_names); |
||||
} |
||||
|
||||
for(size_t i = 0; i < count; i++) { |
||||
const windows_version_name & v = names[i]; |
||||
if(v.version.major != version.major || v.version.minor < version.minor) { |
||||
continue; |
||||
} |
||||
return v.name; |
||||
}; |
||||
return NULL; |
||||
} |
||||
|
||||
} // nanonymous namespace
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, const windows_version::data & v) { |
||||
os << v.major << '.' << v.minor; |
||||
if(v.build) { |
||||
os << v.build; |
||||
} |
||||
return os; |
||||
} |
||||
|
||||
std::ostream & operator<<(std::ostream & os, const windows_version & v) { |
||||
|
||||
os << v.win_version; |
||||
if(v.nt_version != v.win_version) { |
||||
os << " nt " << v.nt_version; |
||||
} |
||||
|
||||
const char * win_name = get_version_name(v.win_version); |
||||
const char * nt_name = get_version_name(v.nt_version, true); |
||||
|
||||
if(win_name || nt_name) { |
||||
os << " ("; |
||||
if(win_name) { |
||||
os << win_name; |
||||
} |
||||
if(nt_name && nt_name != win_name) { |
||||
if(win_name) { |
||||
os << " / "; |
||||
} |
||||
os << nt_name; |
||||
} |
||||
os << ')'; |
||||
} |
||||
|
||||
if(v.nt_service_pack.major || v.nt_service_pack.minor) { |
||||
os << " service pack " << v.nt_service_pack.major; |
||||
if(v.nt_service_pack.minor) { |
||||
os << '.' << v.nt_service_pack.minor; |
||||
} |
||||
} |
||||
|
||||
return os; |
||||
} |
||||
|
||||
} // namespace setup
|
||||
@ -0,0 +1,81 @@
|
||||
|
||||
#ifndef INNOEXTRACT_SETUP_WINDOWS_HPP |
||||
#define INNOEXTRACT_SETUP_WINDOWS_HPP |
||||
|
||||
#include <iosfwd> |
||||
|
||||
namespace setup { |
||||
|
||||
struct version; |
||||
|
||||
struct windows_version { |
||||
|
||||
struct data { |
||||
|
||||
unsigned major; |
||||
unsigned minor; |
||||
unsigned build; |
||||
|
||||
inline bool operator==(const data & o) const { |
||||
return (build == o.build && major == o.major && minor == o.minor); |
||||
} |
||||
|
||||
inline bool operator!=(const data & o) const { |
||||
return !(*this == o); |
||||
} |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
data win_version; |
||||
data nt_version; |
||||
|
||||
struct service_pack { |
||||
|
||||
unsigned major; |
||||
unsigned minor; |
||||
|
||||
inline bool operator==(const service_pack & o) const { |
||||
return (major == o.major && minor == o.minor); |
||||
} |
||||
|
||||
inline bool operator!=(const service_pack & o) const { |
||||
return !(*this == o); |
||||
} |
||||
|
||||
}; |
||||
|
||||
service_pack nt_service_pack; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
inline bool operator==(const windows_version & o) const { |
||||
return (win_version == o.win_version |
||||
&& nt_version == o.nt_version |
||||
&& nt_service_pack == o.nt_service_pack); |
||||
} |
||||
|
||||
inline bool operator!=(const windows_version & o) const { |
||||
return !(*this == o); |
||||
} |
||||
|
||||
static const windows_version none; |
||||
|
||||
}; |
||||
|
||||
struct windows_version_range { |
||||
|
||||
windows_version begin; |
||||
windows_version end; |
||||
|
||||
void load(std::istream & is, const version & version); |
||||
|
||||
}; |
||||
|
||||
std::ostream & operator<<(std::ostream & os, const windows_version::data & svd); |
||||
std::ostream & operator<<(std::ostream & os, const windows_version & svd); |
||||
|
||||
} // namespace setup
|
||||
|
||||
#endif // INNOEXTRACT_SETUP_WINDOWS_HPP
|
||||
Loading…
Reference in new issue