Jump to content

xml creator for 7Customizer


Recommended Posts

Hi,

I've written a command line tool to create xml files for the component removal feature of 7Customizer. There are still a few steps required to get a good working xml file, but this tool helps considerably. The xml schema for 7Customizer can be located here. [Note: Since version 0.9.90, the xmls created with this tool are no longer corresponding to that format. There are two changes: a new element <Manifests> was introduced to remove bloat and make component removal more reliable; and you can use more than one wildcard in an element path name. Unfortunately, this makes xmls created with this tool incompatible with 7Customizer 0.5.0c. This might change in the future.]

The readme file from the download is below. Please read it carefully before downloading it!

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. 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

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)

Please report any bugs to this thread or pm me.

This software is provided as is and without warranty.

Download

There are two variants. One is the perl script itself and one is the binary. I recommend the binary version for anybody not currently having a perl interpreter running. But beware that the binary might not work. Perl scripts packet into a binary are not known for their protability.

New release (Warning: This version is not compatible with 7Customizer any more. This might change in the future. Use old version below)

Binary: Xml creator 0.9.96

Source: Xml creator 0.9.96 perl script

Old release (compatible with 7Customizer 0.5.0c)

Binary: Xml creator 0.9.20

Source: Xml creator 0.9.20 perl script

Features for future versions

- Ideas anybody?

Version history

version 0.9.96 - bugfix release

- 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 - bugfix release

- 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

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)

Cheers!

Edited by justibus
Link to comment
Share on other sites


Hi,

Great tool man. I thought no one was interested in the way I implemented components removal. Your tool will ease the components removal in 7customizer.

I will test it once I get back home and then I will post my feedback.

Thank you.

Regards

Link to comment
Share on other sites

Well, thanks!

@Blue: could you look into the 7Customizer components XML thread and look at my questions in the last post. Especially the one about localization is, I think, a show stopper right now.

I have a few new features in development that should make creating xml files easier.

Edit: I just released version 0.6. There are a few new features (see changelog in first post). Be aware that you will have to adjust the paths inside the settings.ini file (there are 2 more). Also, note the changes to point 1. on how to use the tool. If you want to automatically calculate the size of the component, you will have to decompress the install.wim (or one image therein).

Cheers

Edited by justibus
Link to comment
Share on other sites

Hi,

Great tool man. I thought no one was interested in the way I implemented components removal. Your tool will ease the components removal in 7customizer.

I will test it once I get back home and then I will post my feedback.

Thank you.

Regards

I've been very interested in component removal, I just don't know what to look for even with the guide. I guess I'm not really up to the task. Maybe the new tool will make it easier.

Link to comment
Share on other sites

@Moonchilde: Well, the easiest way to start is to look in your start menu or program files folder and note something you want removed. Then start playing around with keywords. Use your imagination. For example, if I wanted to build a xml for snipping tool, I'd try the keywords snipping or snippingtool. If you see, that there are too few files or registry keys, or too many for that matter, go poke around in the files in your system and find out to which component the files belong. They often have some abreviations with which you can achive much better results. This is somewhat tedious work, but we won't get around that.

It's true, that you need at least some understanding where what is located in Windows and a willingness to research a little bit (or sometimes more). Just give it a try and you'll dive deeper and deeper into the inner workings of the magic of Windows. :D

Link to comment
Share on other sites

  • 2 weeks later...

This looks incredibly useful. I had tried to create something similar (like many others no doubt) but my scripting knowledge is obviously lacking. Look forward to testing this at the weekend, hope Blue manages to devote some more time to this program to fix some of the bugs (which reminds me, need to dig out the files for one I found: selecting all the removal options currently built-in, install size increased by 3.5 GB :blink: )

Link to comment
Share on other sites

I also found a few bugs in the component removal feature. For one, files with spaces in their path won't be removed. I've posted them in the 7Customizer thread. I hope Blue fixes them soon. Otherwise this tool here is useless. :(

Edit: I released version 0.7. The biggest change is that you can merger already created xml files now (with -m). Run create.exe -h for more info and some examples.

Cheers!

Edited by justibus
Link to comment
Share on other sites

@justibus

Thanks man for waiting.

I read your comments and feedback. I am fixing the issues you reported. Let's discuss all the issues related to the components removal and the XML creator in this thread so we don't get confused.

I will update you as soon as I can (Maybe after tomorrow).

Thank you for your help.

Regards

Link to comment
Share on other sites

Thanks man for waiting.

No worry! As long as it's going forward, even at a slow pace, I'm happy. :)

I read your comments and feedback. I am fixing the issues you reported. Let's discuss all the issues related to the components removal and the XML creator in this thread so we don't get confused.

Ok.

Cheers

Link to comment
Share on other sites

  • 2 weeks later...

@blue

I think I made a mistake there. I Thought that, since some folders in an installed, say german version of Windows 7 have different folder names than the english version, they must also be different in the install.wim file (so instead of "Program Files" we'd have a folder called "Programme"). But I just got my hand on a german install dvd and these folders have the same names as in the english version. I guess the names are changed during install somehow (MUI probably?).

So there's nothing wrong. Sorry about that.

I will post more xml files in the xml thread.


I've released version 0.8 of xml creator. It's mostly bug fixes and a litte less tedious to use (less switches to muck about). See the release notes in the first post.

Cheers!

Link to comment
Share on other sites

@blue,

I actually found another bug. There are registry keys that actually end with an asterisk (*). Notably I have found this one (but there are a lot of others in the same registry tree):

HKLM\SYSTEM\ControlSet001\Control\WDI\Scenarios\{fd5aa730-b53f-4b39-84e5-cb4303621d74}\Instrumentation\{13480a22-d79f-4334-9d32-aa239398ad3c};*

The error is as follows (from the log):

Registry key pathControlSet001\Control\WDI\Scenarios\{fd5aa730-b53f-4b39-84e5-cb4303621d74}\Instrumentation\{13480a22-d79f-4334-9d32-aa239398ad3c};*
Registry part7system
Registry contains wildcard
Unexpected error: Requested registry access is not allowed.

=====FINISHED RemoveComponenetsLog.txt========

I am not sure why this happens, but I guess its some kind of conflict with 7Customizer trying to resolve the path (because of the *) and sending some wrong path to setaclx64.

The problem is that this is actually not the last key that should be removed but 7Customizer stops adding keys to the delete list and jumps straight to executing the .bat file. This also skips any following selected components.

I have attached the xml file with which this happens and a log.

Edit: I have done some research. It seems that the components.bat file is not written correctly (the following code is from another xml, but it shows the same problem):

work\setaclx64 -on "HKLM\7software\Microsoft\CTF\TIP\{3697C5FA-60DD-4B56-92D4-74A569205C16}\LanguageProfile\0x0000ffff\{B77BF1FB-C8B4-490F-A5FE-AFE99BBBB490}" -ot reg -actn setowner -ownr "n:S-1-5-32-544;s:y" -rec yes
work\setaclx64 -on "HKLM\7software\Microsoft\CTF\TIP\{3697C5FA-60DD-4B56-92D4-74A569205C16}\LanguageProfile\0x0000ffff\{B77BF1FB-C8B4-490F-A5FE-AFE99BBBB490}" -ot reg -actn ace -ace "n:S-1-5-32-544;p:full;s:y;i:so,sc;m:set;w:dacl" -rec yes
reg delete "HKLM\7software\Microsoft\CTF\TIP\{3697C5FA-60DD-4B56-92D4-74A569205C16}\LanguageProfile\0x0000ffff\{B77BF1FB-C8B4-490F-A5FE-AFE99BBBB490}" /f
work\setaclx64 -on "HKLM\7system\ControlSe

The first three lines are from another key that is removed successfully. The last line is from the key with ";*" at the end. I have tried the commands manually. The setaclx64 commands work but unfortunately the reg delete command does nothing. What does work however, is deleting it with a reg file:

Windows Registry Editor Version 5.00

[-HKEY_LOCAL_MACHINE\7system\ControlSet001\Control\WDI\Scenarios\{fd5aa730-b53f-4b39-84e5-cb4303621d74}\Instrumentation\{13480a22-d79f-4334-9d32-aa239398ad3c};*]

The workaround for now is to omit these keys from the xml files.

speechsupport.xml

log.txt.zip

Edited by justibus
Link to comment
Share on other sites

  • 2 weeks later...

@blue

I have a little feature request for the xml format. Or actually two. There are some manifest files that contain references to other manifest files or components. These should probably be removed also. We have the method="deleteLine" for this, but it is limited in two ways.

First, you have to include the full name of the manifest file from which you want to delete a line (so there is no wildcard '*' support for deleteLine elements). For example, in this element I have to include the full manifest file name for the deleteLine to work.

<File method="deleteLine" path="Windows\winsxs\Manifests\amd64_microsoft-windows-c..oyment-languagepack_31bf3856ad364e35_6.1.7601.17514_en-us_51f66c2a6018a344.manifest" string="Microsoft-Windows-wordpad"/>

This is bothersome and has the problem of being language specific to, in this case, "en-us". So it wouldn't work for any other languages of windows. I have tested using a wildcard in the manifest file name like in the other file elements, but 7Customizer threw an error there.

So, it would be nice to be able to use a wildcard as in the other file element entries.

Second, this method only deletes one line. But the manifest files have 5 lines for each component entry (below is an excerpt from the file mentioned above):

  <dependency discoverable="yes">
<dependentAssembly dependencyType="install">
<assemblyIdentity name="Microsoft-Windows-wordpad.Resources" version="6.1.7600.16385" processorArchitecture="amd64" language="en-US" buildType="release" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" />
</dependentAssembly>
</dependency>

The Windows 7 installation still works even if only the third line is deleted from the example above, but it's a rather incomplete solution.

A better solution could be to add two attributes, say 'above="2"' and 'below="2"' that indicate how many lines above and below the found string should be deleted as well.

I have attached a new version of wordpad.xml to demonstrate this issue.

Cheers!


Edit: I've updated the xml creator to version 0.9. I mainly optimized the check for redundancies. It should be a bit quicker now. And I added some more command line options. See the changelog in the first post.

Note: This version adds some elements to the xml that are language specific that only fully work for the language of windows with which this tool was used on. This is not really a problem, because these entries are not vital for the removal of components. So, you can still use these xmls on other languages of Windows.

wordpad.xml

Edited by justibus
Link to comment
Share on other sites

  • 2 weeks later...

@ justibus

Regarding the registry with the* in its name. I am suggesting to replace the wildcard char from "*" to something else? What do you think?

Regarding your suggestions, I will try tom implement them and I will update you with that.

Regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...