[Windows Phone 7 Development and Hacking] GoodDayToDie:
HKEY_CLASSES_ROOT is present on WP7, although it works a little differently than on desktop Windows. One thing worth noting is that built-in software, such as IE, is invoked differently from installable apps. Built-in software is compiled to actual EXEs, which of course have a standard way to be passed parameters. WP7 apps are DLLs, invoked by a hosting EXE. Also, the way apps are specified is a bit weird; it's by GUID instead of by path.

There is one installable app which is registered as the handler for a file extension (Adobe Reader for PDF). By picking apart its registry entries, I have at least a partial view of how it works.

HKCR\.pdf:

Default = PDFFile

Content Type = application/pdf

HKCR\PDFFile

AppID = "BC4F319A-9A9A-DF11-A490-00237DE2DB9E"

Application Task = "app://BC4F319A-9A9A-DF11-A490-00237DE2DB9E/_default?"

EditFlags = d:0x00010000

HKCR\PDFFile\shell\open\command

Default = "app://5B04B775-356B-4AA0-AAF8-6491FFEA5665/_default?type=PDFFile&file=%s"

There are some interesting hings here. First of all, the BC4F GUID is the one for the Adobe Reader app. Therefore, AppID is the GUID for an installed app that handles a file or protocol association.

Second of all, the shell\open\command\Default value is present for every openable type, but the GUIDs it contains are *not* in the Applications list (note the difference between it and the AppID value). This appears to be how the OS specifies native applications.

Third, it *is* possible to pass parameters to installable apps. See the %s on the end of the value? That gets replaced by the filename, I suspect. Anybody want do pull apart the Adobe Reader or YouTube apps (the only ones with AppID values) and see how they do it?

Fourth, I'm pretty sure we can use this to add our own associations even if we can't get it to open files in them. I'm not sure how easy it will be, but it should be possible.

For those interested in browsers:

HKCR\http

Default = "HyperText Transfer Protocol"

Source Filter = "{97e7c245-4d6f-483b-a772-de22b15fa999}"

URL Protocol = ""

HKCR\http\Extensions

.3g2 = "{97e7c245-4d6f-483b-a772-de22b15fa999}"

.3gp = "{97e7c245-4d6f-483b-a772-de22b15fa999}"

.aif = "{e436ebb6-524f-11ce-9f53-0020af0ba770}"

... and 20-odd more like this

HKCR\http\Shell\Open\Command

Default = "app://5B04B775-356B-4AA0-AAF8-6491FFEA5665/_default?StartURL=%s"

HKCR\PROTOCOLS\Handler\about

CLSID = "{3050F406-98B5-11CF-BB82-00AA00BDCE0B}"

HKCR\PROTOCOLS\Handler\javascript

CLSID = "{3050F3B2-98B5-11CF-BB82-00AA00BDCE0B}"

HKCR\PROTOCOLS\Handler\mailto

CLSID = "{3050f3DA-98B5-11CF-BB82-00AA00BDCE0B}"

HKCR\PROTOCOLS\Handler\res

CLSID = "{3050F3BC-98B5-11CF-BB82-00AA00BDCE0B}"

... note that these GUIDs are very similar but not the same.

HKCR\.html

Default = "htmlfile"

Content Type = "text/html"

HKCR\htmlfile

Default = "HTML Document"

EditFlags = d:0x00010000

HKCR\htmlfile\CLSID

Default = "{25336920-03F9-11cF-8FD0-00AA00686F13}"

HKCR\htmlfile\Shell\Open\Command

Default = "app://FB04B775-356B-4AA0-AAF8-6491FFEA5660/_default?StartURL=file://%s

HKCR\MIME\Database\Content Type\text/html

CLSID = "{25336920-03F9-11cf-8FD0-00AA00686F13}"

Encoding = 08-00-00-00 (binary)

Extension = ".htm"

I'm omitting a few fairly irrelevant keys, like DefaultIcon. This FB04B775 app is interesting - it seems to serve as a launcher, although that's just a guess for now. In any case, it accepts parameters like StartURL, Type, and File (with the last two coming together) and file substitution (the %s that stands in for the URL or file).

Anybody want to have a go at detangling this?