Readme for the xml creator v1.0 for 7Customizer component removal
What it does:
It creates a xml file for the component removal feature of 7Customizer. It does this by either searching for one or more keywords inside the Windows 7 source manifest files, or by using a provided manifest file list.
How to use it:
1) Open you windows installation sources and extract one image in the install.wim file (for example with 7-zip). Use the biggest image if possible (Ultimate) for best results. You will need at least the manifest files folder located under Windows\winsxs\Manifests and the registry hives DEFAULT, SOFTWARE, and SYSTEM located under Windows\System32\config. If you want to get the size attribute right and find (hopefully) all files for the xml, you will need everything
(this is recommended).
Alternatively, you can mount an image with dism or imagex. But I recommend using a fast computer for this. Otherwise, all searches are painfully slow.
2) Make sure the paths inside the settings.ini file point to the correct locations. Also, follow the comments inside the settings file.
3)
- Look inside your Windows 7 sources for the Windows\winsxs\Manifest folder. Browse through the manifest files and choose one or more suitable keywords.
or
- Create a file that has a list with full paths and manifest file names. Each line has to contain one manifest file.
4) Run create.exe from an elevated command promt (or disable uac). Here some examples:
create -k notepad -c Notepad
create -o microsoftgames -k "games gameexplorer" -x mines
create -o editors -m "notepad.xml wordpad.xml"
create -d xml/editors.xml
For more info, run it with -h.
5) Wait. Sometimes even longer. Seriously, this thing is marvellously inefficient. If you have a big component, This can easily last a few minutes. On my old Pentium M, it ran for several minutes for the keyword help.
6) Open your new xml file and check that eveything looks good. You have to fill in all the missing information you didn't give on the command line (for example for the <Componenet> and <Description> elements). The <Keys> and <values> elements should also be checked for redundancies and that not too much is removed.
[Optional: Run the tool with the -d option on the xml file after editing it. This will remove redundant elements. For example, if there is a <Key> element which you shortened, all elements under <Keys> and <Values> that contain that path will be removed. This makes editing big xml component files much easier.]
7) Test, and test some more. Make sure, that everything works as it should. It's best to only remove one component at a time with 7Customizer and then test the image thoroughly. Make sure that everything that is in some way related with the removed component still works correctly.
How to use -b option
-b lets you interfere in the creation of the xml (with options -k and -f) in a semiautomatic way. -b takes a file as an option that almost follows the ini file format. You can define elements that should be added or removed while building the xml. This is done before optimizing, so if you add the correct elements into the file, you won't need to edit the xml after it's creation.
This is mainly useful for batch files that use create.exe. I use it to recreate all working xmls after I fix bugs that have an effect on the xml files or when 7Customizer changes the way it handles the xml files. I provided an example file that explains and gives some examples on how to use this feature. The file has two sections, [add] and [remove]. There don't need to be both sections present. Each section can have any number of the following parameters: file, dir, key and value. Each parameter takes a path without quotes as a value. The only exeptions are the key and value parameters in the [add] section (see rules below). The basic syntax is as follows:
[section]
parameter = path
For example:
[add]
dir = Windows\Cursors
The following rules must be observed:
- all sections ([add], [remove]), parameters (file, dir, key, value) and
paths are case sensitive
- no quotes around paths except in the key and value parameters in the
[add] section.
- paths must be exaclty as they appear in the xml file
- there may be more than one of the same parameter in one section (e.g.
several file parameters in the [remove] section)
- the key parameter in the [add] section has the following syntax:
key = part "path" (where part is software, system, components or
default)
- the value parameter in the [add] section has the following syntax:
value = part "path" value
(where part is software, system, components or default)
- any parameter with empty values will be ignored
- otherwise the normal ini configuration file rules apply
How to drag and drop
There are two batch files supplied with the binary release starting with version 0.9.96. You can drag and drop manifest files from the Windows\winsxs\Manifests folder onto dnd_create.cmd and an xml file will be created for each manifest file. The second batch file merges already created xml files. Just drag and drop two or more xml files onto dnd_merge.cmd. Both of these only work correctly, if you have set up your your environment correctly (e.g. settings.ini and extracted Windows installation sources).
You should be aware, that there is a limit of how long command lines can be in Windows. Depending on the Windows version, this is somewhere in between 2048 and 4096 characters. This means, when you drop files that make up more than that in their filename length (including the path), then you will get an error at some point.
Some tips:
- Your success creating a working xml file with this tool depends mainly on your keyword[s]. Decide on the keyword[s] from the 'name' attribute of the first <assemblyIdentity> element inside the (or inside one of the) manifest files. You can also go by file name. Make sure your keyword[s] are not too short! Otherwise you will end up with a xml file that won't be usable because it removes way too much.
- The -f option is probably easiest to use, if you first use -k, then edit the log file and use that one with -f. Make sure you delete all status messages from the log and keep only manifest files!
- The -x option makes finding the right keyword much easier. Use -k, then look inside the log file. There, you will find the full names of the manifest components in the xml file. Note the ones you don't want in the xml file and use them in the -x option.
How it works:
It looks for one or several keywords inside all manifest files and selects the ones with at least one keyword in the 'name' attribute of the first <assemblyIdentity> element (-k option). Alternatively, it reads the manifest file information from a file (-f option). Then, it collects all relevant data from the <file>, <directories>, <memberships>, <Task>, <serviceData> and <registryKey> elements and puts it into a new xml file. Some things have to be searched for in the installations sources, that's why it's recommended to extract an entire image.
The last step checks for redundancies. First it checks whether a key or value actually exists in the registry. If a key, all its subkeys and all subvalues exist in both the xml and the registry, then we can safely put that key in the <Keys> element. Then, all redundant elements are removed. This last step can also be triggered seperately on an already created xml file using the -d option.
About the software:
This tool is written in perl. The binary version is so big, because all the perl libraries and modules have to be packted into the executable. The upside is, that it's portable. There will only be some files extracted into your temp folder. For those interested: I use strawberry perl 5.10.1. If you want to run the perl script directly you will need the following modules installed: XML::Twig, Config::IniFiles, Win32::TieRegistry, Getopt::Std, File::Path, File::Find::Rule, Win32::DirSize. The last module did not install correctly using cpan. The following command line works:
ppm install http://www.bribes.org/perl/ppm/Win32-DirSize.ppd
System requirements:
- At least Windows XP (tested on XP and 7 pro)
- Enough hard disk space for the extracted Windows 7 sources
(around 12 GB for 64bit version)
Please report any bugs to the msfn forum thread or pm me:
http://www.msfn.org/board/topic/153299-xml-creator-for-7customizer/
or to the sf.net project site:
https://sourceforge.net/p/w7cr
Changelog:
verion 1.0 - first stable release
- added -y and -z options for adding dependencies
- added option -r for setting requiredForStableSystem attribute to true
- added package deleteLine elements
- fixed bugs in optimization code by rewriting said functions
- changed check for extracted sources and settings; it's slower on the first run, but more reliable
- changed function for adding more deleteLine elements for other manifest
files; it performs a little slower but is more reliable
- changed: restructured code base for better modularity
- changed help text (-h) for more clarity
- changed: more valid command line switch combinations; see help text for info
version 0.9.96
- changed deleteLine format to include the parent of the line to delete;
this allows for much cleaner automatic editing of files and hopefully
a more intact component store. You need version 0.8 of the removal tool
for this to work properly.
- change: downgraded perl to 5.10.1 because of xml handling bugs
- added drag and drop batch files; see above for instructions.
version 0.9.95 - bugfix release
- fixed bug: too many packages added when processing only resource
manifest files (found by Moonchilde)
version 0.9.94 - bugfix release
- fix: rearranged packages into own xml element; you need version 0.7 of
the component removal utility for xmls generated with this version
version 0.9.93 - bugfix release
- fix: added detection and removal of packages for which all components
are added to the xml; this aleviates corrupted feature list and some
windows update errors
version 0.9.92
- change: remove .xml from logfile name
- fix: small adjustment to the <Manifests> section
version 0.9.91 - bugfix release
- fixed bug in optimization
- fix: too many registry entries were added
- fix: path for manifest files was missing a \
- fix: packaging error: libexpat-1_.dll not found (binary release)
version 0.9.90
- warning: xmls generated with this version are no longer compatible
with 7Customizer 0.5.0c
- changed xml format a little, so there are less redundancies and
removal catches more
- changed: removed workarounds for bugs in 7Customizer
- fix: a little code cleanup
version 0.9.20
- added option -b FILE: automatically add or remove elements defined
in FILE; see readme for more info
- added DriverStore\FileRepository directories; reduces the amount of
file elements for drivers
- fix: refined check for invalid file names
- fix: changed check for extracted install.wim
- fix: crash found by tommyp while moving Wow6432Node from <values> to
<keys> (there might be more)
version 0.9.11 - bugfix release
- fix: keyword search broke in 0.9.10
version 0.9.10
- warning: settings.ini options changed! Make sure to use the
provided one and adjust to your paths!
- added option -i: give a little more info on what's going on
- changed optimization to remove redundant entries quicker
- changed: reverted to the way pending.xml entries are added from
before v0.9; this should (hopefully) lead to less errors during
installation
- changed: Wow6432Node keys are now added to <Keys> if the equivalent
normal key is moved from <Values> to <Keys> during optimization
- changed search routine for files that don't have a path in the xml;
it should be much quicker now
- changed: removed all dependencies to external applications; this
reduces executable size considerably
- fix: regression where some component directories and keys were not
optimized
- fix: not all x86 manifest information was added to the xml if run on
a 64bit installation source
- fix: hang on some keywords that lead to invalid file names
version 0.9.3 - bugfix release
- changed: files for -d and -m options are now searched first in path
given and then in the xml output directory from settings.ini
- fix: some service registry entries were missing
- fix: ControlSet002 registry entries were missing
- fix: Task Scheduler entries were missing
- fix: too many entries were removed during optimization
version 0.9.2 - bugfix release
- fix: value elements are now correctly capitalized
version 0.9.1 - bugfix release
- fix: eliminated useless findstr.exe calls; keyword searches should
go much quicker now for 2 or more keywords
- fix: path for root folders and files was wrong
- fix: a few more redundant deleteLine entries are removed now
version 0.9
- added option -a DESCRIPTION: set description element in xml
- added option -g GROUP: set group attribute in xml
- added option -o OUTFILE: set output file name. This partly replaces
-c (component name). -c will not set the filename any more.
- changed optimization to remove more redundant entries quicker;
it should take less time on components with many manifest files
- fix: add only pending.xml entries that are actually needed
- fix: added some deleteLines for some other manifest files
version 0.8
- added option -n: do not remove redundant elements
- removed option -s (it's still there, it just doesn't do anything).
If the sources are extracted, the size is calculated automatically.
- log output is now a little more informative
- fix: files with $(build.nttree) path are now added correctly, if
they are found in the sources
- fix: files from wisxs\FileMaps are now added to the xml
- fix: some filenames under the <File> element were incorrect
version 0.7
- added option -m LIST_OF_XMLS: merges several xmls into one;
must be used with -c
- changed removal of value elements during duplicates removal.
You will have many more value elements now. This is especially true
for Wow6432Node since many of the values and keys in x86 manifest
files are not present in the actual registry (at least not
in mine anyway).
- changed a few status messages and help to be a little more informative
- fix: no more zero size attributes on components that are not
installed in the sources
-s can only be used with -k or -f now!
- fix: no more identical manifest file entries
- fix: a few new path conversions
version 0.6
- added option -x KEYWORD: exclude manifests with KEYWORD
- added option -d FILE: remove duplicate elements from xml FILE
- added option -s: calculate size of files to be removed
- added path to registry hive files to settings.ini
Please adjust your paths in settings.ini.
- fix: added missing $(runtime.drivers) path conversion
- fix: no more multiple pending.xml entries for identical strings
version 0.5
- initial release
This software is provided as is and without warranty. It is licensed under the GNU GPL. You can read it here: https://www.gnu.org/copyleft/gpl.html
Copyright (C) 2011, 2012 Daniel Just