xp-consoles/docs/web-wizards.md

124 lines
7.8 KiB
Markdown

# Web Wizards
Windows XP introduced [publishing wizards][pubwiz-intro], wizards that include a step in which you have to pick an online service provider. The wizard will then load a webpage for that provider and includes an XML file in `window.external.Property('TransferManifest')`, which can then be edited in JavaScript or VBScript to let the website include info on how to upload files or perform whatever action the user was trying to do.
In the Win32 API, this type of wizard is called a `WebWizard`. There are three known Web Wizards:
* The Add Network Places wizard
* The Web Publishing wizard
* The Internet Photo Printing wizard
The Visual Studio 2005 setup project provided in this repository allows you to register the JavaScript and VBScript consoles in all three wizards.
## Provider registration
Official docs: [Registering a Service][pubwiz-reg]
To register an online provider, you will need to add a new registry key under `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\[WIZARD NAME]\Providers\[PROVIDER NAME]`. The wizard name is one of the following:
* Add Network Places: `AddNetPlace`
* Web Publishing: `PublishingWizard`
* Internet Photo Printing: `InternetPhotoPrinting`
The provider name is an arbitrary string of your choice. The following values can be included:
`DisplayName`
: The name of the provider shown in the wizard's list.
`Description`
: A short description of the provider, also shown in the wizard's list.
`HREF`
: URL to the first page of the service. `file:///`, `https://` and `http://` are known to work. Other protocols have not yet been tested; please report your findings!
: If this is missing, then any wizard will instead display the remote location selection page as in the *Add Network Places* wizard. See *Default provider for Add Network Places* below.
`IconPath`
: Path to a local file holding an icon. This can use a local `.ico` file or find an icon a WinPE executable by appending an icon number, for example `shell32.dll,-172`.
`SupportedTypes`
: Not relevant to the *Add Network Places* wizard. This holds a list of supported file types, as patterns separated by semicolons: `*.htm; *.html; *.css`. If nothing is set, then the provider will always be shown. If this value is set, then the provider is only shown when the files selected for publication by the user all match those patterns.
## Other registry keys
Under `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\[WIZARD NAME]`, `Providers` is not the only key. A `DefaultProvider` string value may be found, storing the last provider ID the user selected, and a `LocationMRU` key holds a variable number of values used for autocompletion of the location selection page of the *Add Network Places* wizard. The `MRUList` value lists all the value names available, in the order they should appear; for example, `cba` means that there should be a `c` value, a `b` value and a `a` value present, and each of them should be shown in that order in the suggested locations.
Under `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard`, one key might be found for each wizard name. In that key, two values may be defined:
`ContentTypeFilter`
: A MIME type filter applied to files for this wizard before any provider is selected. This is used for `InternetPhotoPrinting`, to restrict it to `image/*`.
`DefaultIcon`
: A default icon, with the same syntax as `IconPath`, for providers that do not have an icon or have an invalid one.
## Default provider for Add Network Places
The *Add Network Places* wizard automatically gets a provider whose name is `other`. Its registry values do not include `HREF`, and this is what causes the wizard to display the remote location selection step instead of a web page.
Interestingly, if you remove `HREF` from a provider in the *Web Publishing* or *Internet Photo Printing* wizard, then those wizards can also show the remote location selection step even though it does not make sense there.
## Online provider fetching
Upon startup, all three wizards will fetch a file called the *provider manifest*. This behavior has been observed by inspecting HTTP requests and is not documented. The file is fetched from `http://shell.windows.com/publishwizard/[region].xml`, where `[region]` is a three-letter code. Known regions include:
`bra`
: Brazil. [Last archived version][pubwiz-bra]
`chn`
: China. [Last archived version][pubwiz-chn]
`deu`
: Germany. [Last archived version][pubwiz-deu]
`esp`
: Spain. [Last archived version][pubwiz-esp]
`fra`
: France. [Last archived version][pubwiz-fra]
`gbr`
: Great Britain. [Last archived version][pubwiz-gbr]
`hkg`
: Hong Kong. [Last archived version][pubwiz-hkg]
`jpn`
: Japan. [Last archived version][pubwiz-jpn]
`prt`
: Portugal. [Last archived version][pubwiz-prt]
`usa`
: United States. [Last archived version][pubwiz-usa]
Nowadays, all of these URLs return an HTTP 404 error. To be more precise, every single URL under `http://shell.windows.com/publishwizard/*` return an HTTP 404, where any other random URL outside of this directory will instead redirect to `bing.com`. It seems this behavior was intended to prevent the wizards from no longer functioning or timing out even after the online service providers were taken down.
When the fetching fails, the wizard falls back to an XML file built into its DLL, loading `res://netplwiz.dll/xml/providers.xml`. That XML file lists no providers for both the photo printing and web publishing wizards, but includes the default provider for the *Add Network Places* wizard. It is not using an absolute URL, which means it is theoretically possible to override that file without touching the system by providing your own modified `netplwiz.dll` somewhere else in your `PATH`.
## Provider Manifest
I wrote [an XSD file](../xsd/provider-manifest.xsd) to describe the provider manifest, including its failure modes when some expected attributes are missing or invalid, after a lot of testing with various broken XML files. Almost no validation is actually performed by the wizard; if you feed it an invalid file, it is likely to fail silently.
## Transfer Manifest
Official docs:
* [Using the Transfer Manifest][pubwiz-manifest]
* [Transfer Manifest Schema][manifest-schema]
The official schema is pretty imprecise and lots of experiments using the provided consoles will be required. I will soon write an XML Schema Definition to formalize the Transfer Manifest schema based on the official documentation and the experiment results.
[manifest-schema]: https://docs.microsoft.com/en-us/windows/win32/shell/manifest-schema
[pubwiz-bra]: http://web.archive.org/web/20090414051215/http://shell.windows.com:80/publishwizard/bra.xml
[pubwiz-chn]: http://web.archive.org/web/20051231051534/http://shell.windows.com:80/publishwizard/chn.xml
[pubwiz-deu]: http://web.archive.org/web/20041210182227/http://shell.windows.com:80/publishwizard/deu.xml
[pubwiz-esp]: http://web.archive.org/web/20100219221739/http://shell.windows.com:80/publishwizard/esp.xml
[pubwiz-fra]: http://web.archive.org/web/20020628090510/http://shell.windows.com:80/publishwizard/fra.xml
[pubwiz-gbr]: http://web.archive.org/web/20020112172552/http://shell.windows.com:80/publishwizard/gbr.xml
[pubwiz-hkg]: http://web.archive.org/web/20040206014021/http://shell.windows.com:80/publishwizard/hkg.xml
[pubwiz-intro]: https://docs.microsoft.com/en-us/windows/win32/lwef/pubwiz-intro
[pubwiz-jpn]: http://web.archive.org/web/20121222060648/http://shell.windows.com:80/publishwizard/jpn.xml
[pubwiz-manifest]: https://docs.microsoft.com/en-us/windows/win32/lwef/pubwiz-manifest
[pubwiz-prt]: http://web.archive.org/web/20041129111113/http://shell.windows.com:80/publishwizard/prt.xml
[pubwiz-reg]: https://docs.microsoft.com/en-us/windows/win32/lwef/pubwiz-reg
[pubwiz-usa]: http://web.archive.org/web/20130829081831/http://shell.windows.com:80/publishwizard/usa.xml