Jon TURNEY [Tue, 22 Apr 2014 17:40:03 +0000 (17:40 +0000)]
* site.cc (PopulateListBox): Select listbox items by finding the
index of the item with a matching full URL, not by LB_FINDSTRING
which does an inexact match on the displayed URL.
Jon TURNEY [Tue, 22 Apr 2014 17:35:50 +0000 (17:35 +0000)]
* msg.cc (mbox): Generalize to a MessageBox wrapper which knows
what to do in unattended mode.
* msg.h: Add prototype.
* ini.cc (IniParseFeedback): Use here rather than MessageBox.
* mount.cc (is_admin): Drop function. It's incorrectly implemented
and redundant.
(create_install_root): If installing the setup rootdir entry to HKLM
results in ERROR_ACCESS_DENIED, fall back to installing into HKCU.
Don't exit with a fatal error if writing the registry key fails. Just
pop up an informative message box instead. Also log access denied.
(read_mounts): call nt_sec.isRunAsAdmin instead of removed is_admin.
(NTSecurity::isRunAsAdmin): Fix formatting.
Corinna Vinschen [Mon, 10 Mar 2014 11:10:35 +0000 (11:10 +0000)]
* main.cc (WaitOption): New -W/--wait option.
(WinMain): Rearrange code to make sure only the actual worker
instance of setup logs into the setup.log and setup.log.full files.
Call NTSecurity::initialiseWellKnownSIDs explicitely. Explain why.
If WaitOption is given, let the parent process wait for the elevated
child process.
* win32.cc (NTSecurity::initialiseWellKnownSIDs): Drop generating
log messages.
(NTSecurity::setDefaultSecurity): Drop call to initialiseWellKnownSIDs.
* win32.h (NTSecurity::initialiseWellKnownSIDs): Make public.
Corinna Vinschen [Fri, 15 Nov 2013 10:22:16 +0000 (10:22 +0000)]
* mount.cc (read_mounts): Drop setting root_text.
* res.rc: Set content of root dir dialog correctly right from the start.
Remove unused items.
* resource.h (IDC_ROOT_TEXT): Remove.
(IDC_ROOT_BINARY): Ditto.
(IDC_FILEMODES_LINK): Ditto.
(IDC_MODE_GRP): Ditto.
(IDC_MODE_TEXT): Ditto.
(IDC_MODE_BIN): Ditto.
* root.cc (Root): Set "Install For" group items to CP_STRETCH.
Remove all "text/binary" items.
(rb): Remove.
(check_if_enable_next): Drop test for root_text.
(load_dialog): Remove all code setting items differently to what's
specified as default in the resources, in favor of setting this
correctly in the resources.
(save_dialog): Drop setting root_text.
(RootPage::OnMessageCmd): Drop IDC_ROOT_TEXT/IDC_ROOT_BINARY handling.
(RootPage::OnInit): Drop IDC_FILEMODES_LINK handling.
(RootPage::OnNext): Drop "text"/"binary" state from debug output.
* state.cc (root_text): Remove.
Corinna Vinschen [Wed, 13 Nov 2013 20:57:16 +0000 (20:57 +0000)]
* desktop.cc (STARTMENUDIR): Define.
(check_startmenu): Use STARTMENUDIR instead of constant string.
(DesktopSetupPage::OnActivate): Use TARGET and TERMINALTITLE defines
to simplify calls to check_startmenu and check_desktop.
Corinna Vinschen [Wed, 13 Nov 2013 20:47:50 +0000 (20:47 +0000)]
* desktop.cc: Drop dependency on static variable and order of
initialization. Allow easier reconfiguration.
(iconname): Drop static variable.
(make_link): Add parameter to specify icon path.
(start_menu): Ditto. Call make_link accordingly.
(desktop_icon): Ditto.
(save_icon): Take windows path as first parameter. Drop setting
global iconname variable.
(TARGET): Define.
(DEFAULTICON): Define.
(TERMINALICON): Define.
(TERMINALTITLE): Define.
(do_desktop_setup): Rearrange code to use aforementioned defines and
align function calls to aforementioned changes.
* LogFile.cc (LogFile::exit): Don't print ending message after
successful elevation.
* res.rc (IDS_ELEVATED): New string.
* resource.h (IDS_ELEVATED): New string resource number.
* LogFile.cc (LogFile::flushAll): New function to flush log all logging
to files without exiting (as LogFile::exit does).
* LogFile.h: Declare new method closeAll.
* main.cc (NoAdminOption): Add new CLI options -B/--no-admin. This
option allows the user to suppress privilege elevation (in tandem with
"asInvoker" requestedExecutionLevel changes to exe manifests).
(WinMain): check if setup run with Administrator privilege and if the
NoAdminOption has not been specified, attempt to elevate privilege to an
Administrator via WINAPI ShellExecuteEx().
* setup.exe.manifest: Add requestedExecutionLevel of asInvoker to allow
suppression of privilege elevation.
* setup64.exe.manifest: Modify requestedExecutionLevel from
requireAdministrator to asInvoker to allow suppression of privilege
elevation. Continuity of privilege elevation attempt on startup is
implemented by main.cc changes to WinMain().
* win32.cc (NTSecurity::isRunAsAdmin): New function to allow main.cc to
check if setup.exe has been run with privilege elevated to Administrator
level.
* win32.h: Declare new method isRunAsAdmin.
Corinna Vinschen [Mon, 12 Aug 2013 11:44:53 +0000 (11:44 +0000)]
* include/getopt++/DefaultFormatter.h (DefaultFormatter):
Introduce private data members and use them, adjust comment
accordingly. Split the line 35/45 instead of 40/40 by default
to get less linebreaks. Add default initializers for data
members to the constructor. Add a second constructor that
offers parameters for initialization of the private data
members.
(DefaultFormatter::operator ()): Remove automatic variable
output and directly put the data on the output stream instead.
Use private data members to construct the output rather than
Corinna Vinschen [Mon, 12 Aug 2013 10:53:24 +0000 (10:53 +0000)]
* csu_util/MD5Sum.h (MD5Sum): Remove declaration for conversion
operator std::string(). Remove implementation of member
function str() using the conversion operator.
* csu_util/MD5Sum.cc (MD5Sum::str): Reuse implementation of conversion
operator std::String to implement member function str() with.
* choose.cc (UpgradeAlsoOption): Add new CLI option -g/--upgrade-also.
(CleanOrphansOption): Add new CLI option -o/--delete-orphans.
(OnInit): Implement -g/--upgrade-also, considers all installed packages
as candidates for upgrades (the default when no CLI package or category
options have been given) also when manual additions or removals are
requested at the same time. Implement -o/--delete-orphans, considers
installed packages that do not exist anymore in the package repositories
as candidates for deletion.
* choose.h (hasManualSelections): Declare new variable.
* choose.cc (ChooserPage::OnInit): Re-implement package handling
depending on options given on CLI using package actions instead of
package_meta low-level functions. When no CLI package or category
options have been given, upgrade installed packages. Do not check for
updates when packages are to be added or removed from the CLI, but this
behaviour can be requested with --upgrade-also. A package that is
requested to be removed and also added at the same time gets reinstalled
or upgraded (when version curr != installed). Uninstalled packages in
categories "Base" or "Misc" are always selected for installation;
installed packages in these categories are not eligible for deletion
and will be reinstalled or upgraded instead.
* package_meta.h (packagemeta::ismanuallyDeleted): Declare new method.
* package_meta.cc (DeletePackageOption): Add new CLI option
-x/--remove-packages, packages listed here are considered candidates
for deletion.
(DeleteCategoryOption): Add new CLI option -c/--remove-categories,
packages belonging to categories listed here are considered candidates
for deletion.
(hasManualSelections): Additional boolean to record if any manual
installations or deletions have been requested.
(packagemeta::isManuallyDeleted): Implement along the same lines as
isManuallyWanted, but for deletion candidates.
Jon TURNEY [Wed, 24 Jul 2013 08:26:06 +0000 (08:26 +0000)]
* install.cc (_custom_MessageBox): Restore custom message box.
(installOne): If processList is empty, use the custom message box
to ask if we should retry or continue.
* res.rc (IDD_FILE_INUSE): Use IDCONTINUE for continue buttom, to be
the same custom message box.
* root.cc (directory_contains_wrong_version): Check cygwin1.dll's
machine type. If that fails, fall back to testing of cygcheck.exe's
binary type. Tweak message text slightly for clearness. Add comment
to explain wht this function does.
* root.cc (directory_contains_wrong_version): New function to check
setup machine type against installation machine type.
(RootPage::OnNext): Call directory_contains_wrong_version and refuse to
continue if it returns != 0.
* IniParseFindVisitor.cc (iniParseFindVisitor::visitFile): Relax check for
SETUP_INI_DIR slightly. Remove trailing SETUP_INI_DIR from mirror directory or
local downloaded packages will never be found.
* choose.cc (ChooserPage::OnInit): Fix some formatting.
* fromcwd.cc (SetupFindVisitor::visitFile): Relax check for SETUP_INI_DIR
slightly.
(ChooserPage::OnInit): Fix some formatting.
* ini.cc (do_local_ini): Remove name from unused parameter. Fix some
formatting.
(do_ini_thread): Fix some formatting.
* package_version.cc (dumpAndList): Temporarily (?) just return from this
debugging function since it SEGVs otherwise.
* IniDBBuilder.h (IniDBBuilder::set_arch): New function.
(IniDBBuilder::set_release): New function.
(IniDBBuilder::arch): New storage for arch:.
(IniDBBuilder::arch): New storage for release:.
* IniDBBuilderPackage.cc (IniDBBuilderPackage::autodep): Fix cut/paste error
which ended up calling the wrong thing.
* ScanFindVisitor.cc (ScanFindVisitor::visitFile): Remove old code.
* cygpackage.cc (cygpackage::set_autodep): Implement to satisfy setup's insane
class hierarchy.
* cygpackage.h (cygpackage::set_autodep): See above.
(std::string autodep_regex): Ditto.
* package_version.cc (packageversion::set_autodep): Ditto.
* package_version.h (packageversion::set_autodep): Ditto.
* inilex.ll: Tokenize "arch:" and "release:".
* iniparse.yy: Parse ARCH and RELEASE.
* FindVisitor.cc (FindVisitor::visitDirectory): Check tracking level
argument to limit the search depth.
* FindVisitor.h (FindVisitor::visitDirectory): Add tracking level
argument to declaration.
* IniParseFindVisitor.cc (IniParseFindVisitor::visitFile): Check
found file's basePath to end in SETUP_INI_DIR.
* find.cc (Find::accept): Accept additional tracking level argument
and submit to FindVisitor::visitDirectory.
* find.h (Find::accept): Add tracking level argument to declaration.
* fromcwd.cc (SetupFindVisitor::visitFile): Check found file's basePath
to end in SETUP_INI_DIR.
(do_fromcwd): Only search ini file two directory levels deep.
* ini.cc (do_local_ini): Ditto.
(do_remote_ini): Add SETUP_INI_DIR to current_ini_name.
* ini.h (SETUP_INI_DIR): New macro.
(SETUP_INI_FILENAME): Just define filename.
(SETUP_BZ2_FILENAME): Ditto.
* mount.cc (LFSTAB): Define.
(from_fstab): Use LFSTAB constant where appropriate. Properly size path array
to include \etc\fstab. Change len argument of mklongpath to reflect the actual
size of the destination argument.
* archive.cc (archive::extract_file): Use named constants for return values.
* archive.h (archive::extract_results): New enum.
(archive::extract_file): Use extract_results for return value.
* install.cc (Installer::installOne): Use archive::extract_results to make
decisions about archive::extract_file return.
* io_stream_cygfile.cc: Add a comment making return value clear.
* mkdir.cc: Ditto.
Corinna Vinschen [Wed, 26 Jun 2013 12:39:17 +0000 (12:39 +0000)]
* io_stream_cygfile.cc: Rearrange inclusion of headers to workaround
bug in older mingw-w64 system headers. Drop unneeded include files.
* io_stream_file.cc: Drop unneeded include files.
Corinna Vinschen [Tue, 25 Jun 2013 11:25:54 +0000 (11:25 +0000)]
* Makefile.am (AM_CXXFLAGS): Add source file specific CXXFLAGS.
(inilex_CXXFLAGS): Add -Wno-sign-compare to workaround failing build
on Fedora 18 due to bison creating sign comparison mismatches in
generic yylex wrapper code.
* ini.h (SETUP_BZ2_FILENAME): Reflect new architecture layout in ftp.
(SETUP_INI_FILENAME): Ditto.
* main.cc (Arch): New option. Include StringOption.h for this.
(WinMain): Change is_64bit calculation to allow overriding from command-line.
Issue error if bad value provided.
* res.rc: Move some text closer together.
* splash.cc: Include ini.h. Add architecture to opening screen.
* UserSettings.cc (UserSettings::get): Don't try to open a filename with the
name of the key. That's old behavior.
Corinna Vinschen [Fri, 22 Mar 2013 13:05:06 +0000 (13:05 +0000)]
* desktop.cc (do_desktop_setup): Install "Cygwin64 Terminal" link on
64 bit.
(DesktopSetupPage::OnActivate): Check for "Cygwin64 Terminal" link on
64 bit.
* main.cc (main_display): Avoid compiler warning on 64 bit.
* mount.cc (from_fstab): Take 2nd parameter as const by reference to
avoid potential crash due to scope issue.
Yaakov Selkowitz [Thu, 14 Mar 2013 09:21:06 +0000 (09:21 +0000)]
* configure.ac: Remove check for libmingw32.
(SETUP): Define EXE name based on host_cpu.
(MINGWTARGET): Remove.
* Makefile.am: Use SETUP throughout. Remove MINGWTARGET conditional.
Add -lmingw32 to LDFLAGS.
* ini.h (is_64bit): Declare.
(SETUP_INI_FILENAME): Make dependent on value of is_64bit.
(SETUP_BZ2_FILENAME): Ditto.
* main.cc (is_64bit): Define based on compiler target.
* mount.h (SETUP_KEY_WOW64): Define based on value of is_64bit.
* install.cc (create_allow_protected_renames): Add SETUP_KEY_WOW64
flag to RegOpenKeyEx call.
* mount.cc: Throughout, add SETUP_KEY_WOW64 flag to all RegOpenKeyEx
and RegCreateKeyEx calls.
(read_mounts): Change default Cygwin root depending on is_64bit.
* Makefile.am: Add regex.c to list of sources.
(iniparse.hh): Rename if a iniparse.h has been created.
* regex/config.h: New file.
* regex/re_comp.h: New file.
* regex/regcomp.c: New file.
* regex/regex.c: New file.
* regex/regex.h: New file.
* regex/regex_internal.c: New file.
* regex/regex_internal.h: New file.
* regex/regexec.c: New file.
* processlist.cc (Process::isModuleLoadedInProcess): Avoid compiler warning by
changing 'i' to unsigned.
Jon TURNEY [Fri, 8 Feb 2013 16:57:34 +0000 (16:57 +0000)]
2013-01-25 Achim Gratz <Stromeko@nexgo.de>
* README (HOW TO BUILD): Cross compiler package is now named
mingw-gcc-g++, also mention package upx as an optional dependency.
Jon TURNEY [Fri, 8 Feb 2013 15:55:01 +0000 (15:55 +0000)]
List and offer to kill processes preventing a file from being written
2013-02-01 Jon TURNEY <jon.turney@dronecode.org.uk>
* install.cc ( _custom_MessageBox): Remove custom message box.
(FileInuseDlgProc): Add file-in-use dialog box.
(installOne): Use processlist to list processes using a file, and
offer to kill them with the file-in-use dialog.
* res.rc (IDD_FILE_INUSE) : New dialog.
* resource.h (IDD_FILE_INUSE, IDC_FILE_INUSE_EDIT)
(IDC_FILE_INUSE_MSG, IDC_FILE_INUSE_HELP): Define corresponding
resource ID numbers.
* processlist.h: New file.
* processlist.cc: New file.
* Makefile.am (setup_LDADD): Add -lpsapi.
(setup_SOURCES): Add new files.
Jon TURNEY [Fri, 8 Feb 2013 15:38:50 +0000 (15:38 +0000)]
Refactor ::run() so it's more generally useful
2013-02-01 Jon TURNEY <jon.turney@dronecode.org.uk>
* script.cc (::run, Script::run): Move the formatting of the command
line used for postinstall script running out to Script::run. Move the
logging of the command and it's output into ::run.
* script.h: Add ::run() prototype.
Jon TURNEY [Thu, 17 Jan 2013 13:34:12 +0000 (13:34 +0000)]
Report progress correctly when amount of data is more than 2GB
2013-01-16 Jon TURNEY <jon.turney@dronecode.org.uk>
* threebar.cc (ThreeBarProgressPage::SetBar2): Change from long int to
long long int to handle more than 2GB of data.
* threebar.h (ThreeBarProgressPage::SetBar2): Update prototype.
* install.cc: Change md5sum and install counters to long long int.
* geturl.cc: Change download counter to long long int.
* geturl.h: Ditto.
Fix build with mingw-w64 headers.
* autoload.c: Define DECLSPEC_IMPORT for mingw-w64 headers.
* filemanip.h: Include <sys/types.h> to fix missing mode_t typedef
error with mingw-w64 headers.
* gpg-packet.cc: Include "win32.h" to avoid macro redefinition
errors with mingw-w64 headers.
(ARRAYSIZE): Do not redefine.
* main.cc (_argv): Declare if using mingw-w64 headers.
(WinMain): Move up _argv definition to before it is first used.
* ntdll.h: Include PSDK headers with mingw-w64 instead of DDK.
* package_message.h: Include "win32.h" instead of <windows.h>.
* propsheet.cc (PROPSHEETHEADER_V1_SIZE): Do not redefine.
* win32.h: Include <sys/types.h> to fix missing mode_t typedef
error with mingw-w64 headers.
Define DECLSPEC_IMPORT for mingw-w64 headers.
Yaakov Selkowitz [Thu, 30 Aug 2012 22:23:02 +0000 (22:23 +0000)]
* main.cc: Remove CINTERFACE define.
(main_display): Use C++ syntax for COM.
* mklink2.cc: Remove CINTERFACE define.
(make_link_2): Use C++ syntax for COM.
* io_stream_file.cc (io_stream_file::exists): Properly treat return from
GetFileAttributesW as a bit field so that a directory will not be seen as
"existing".
Corinna Vinschen [Wed, 29 Feb 2012 09:00:39 +0000 (09:00 +0000)]
* win32.cc (NTSecurity::GetPosixPerms): Don't allow write permissions
in inheritable default permission ACEs for group and other if the
directory is an S_ISVTX dir.
Corinna Vinschen [Fri, 24 Feb 2012 20:04:13 +0000 (20:04 +0000)]
* main.cc (WinMain): Move call to nt_sec.setDefaultSecurity here so
it's called earlier in the process. This avoids spurious error
messages in --help output.
Jon TURNEY [Fri, 24 Feb 2012 18:48:30 +0000 (18:48 +0000)]
2012-02-23 Jon TURNEY <jon.turney@dronecode.org.uk>
* main.cc (main_display): Move --help output from here ...
(WinMain): ... to here, so we don't logging of the current directory and
any errors from constructing a UserSettings object preceding the --help output.
Jon TURNEY [Thu, 23 Feb 2012 14:31:23 +0000 (14:31 +0000)]
Add infrastructure for handling string options which are repeated
2011-05-30 SZAVAI Gyula <szgyg@ludens.elte.hu>
* libgetopt++/src/StringArrayOption.cc: New file.
* libgetopt++/include/getopt++/StringArrayOption.h: New file.
* libgetopt++/Makefile.am: Add new files.
Jon TURNEY [Sat, 13 Aug 2011 14:43:31 +0000 (14:43 +0000)]
* choose.cc (OnInit, createListview): Build the initial list of packages
to install in OnInit() not in CreateListView(). If packages were selected
on command line in unattended mode, just install those packages.
* package_db.h (packagedb):Add addCommandLinePackages() method
* package_db.cc (addCommandLinePackages): Add separate method to add these
so we can indicate if packages were added on the command line
Jon TURNEY [Sat, 13 Aug 2011 14:22:17 +0000 (14:22 +0000)]
* PickView.cc (defaultTrust): Move implementation which deals with
package db from here...
* package_db.cc (defaultTrust): ... to here.
* package_db.h (packagedb): ... a new member function.