Raf's laboratory Abstracts Feed Raffaele Rialdi personal website

I am Raf logo

Essential WinRT part 2: The registration

October 18, 2011
http://www.iamraf.net/News/essential-winrt-part-2-the-registration

As the WinRT world is an evolution of COM, the registration is similar but uses only the HKCU registry keys. This means that you don't need administrative privileges to install an application.
Let's take a look to the most interesting registry keys involved during registration process:

The HKCU\Software\Classes\ActivatableClasses\Package key contains the list of package registered in the system.

Each subkey is named with the 'Full Package Name' that can be set from Visual Studio 11 opening the manifest file

image

The default name for the Package is a guid but it's more convienient to use a full name qualified by namespace and application name. For the javascript demo application, I used "IAmRaf.DemoApp" name that I can find in the registry with some additional information:

image

Under the ActivatableClassId key we can see the name of the class whose role is to "acivate" the application. We can consider this as an object oriented entry point.

  • "ActivationType" specifies whether the component is activated in-process (0) or out-of process (1).
  • "Server" attribute specifies the name of the underlying Server key (App.wwa)

As the picture shows, App.wwa is the default name that can be set only by opening the manifest as XML while "name" attribute of "identity" tag is the "Package name" that we visually changed with the Visual Studio editor.

image

In the registry we find the following values:

image

image

Under the key Server there is the same "App.wwa" specified above, where we can find the full path to the exe of the process that will host our application.

  • If we create the application in c #/VB/C ++ this is the exe that we generated by Visual Studio
  • If it is a javascript application, this will be a surrogate exe (analogous to dllhost in COM)

As the picture shows, the host for the sample application is WWAHost.exe which is the generic host a html5/javascript application.

image

The surrogate process is important for those languages that cannot provide to the classic method "main". Metro projects created with C# automatically provide the main method that instantiates the class "App" (Xaml) and calls the static method Run. Applications that use javascript need a surrogate process (WWAHost.exe) that knows how to render html5 and run javascript scripts. Explorer passes to WWAHost.exe the application id (App.wwa in our case) via command line.

The application entry-point can be found under the key CustomAttributes. The two images show the difference between the entry-point of the demo in javascript and another app written in C#:

imageimage

From the research I did, it looks like you can create an application or a contract provider as a dll in-process. In this case there is not a "main" and therefore the entry-point would be crucial.

The registration process is not interesting during the application development phase, but it can be foundamental for diagnostic reasons and to understand the impact of the various manifest values.

In the next post I will examine the essential steps in activating an application.



rated 5 by 1 users



Share this page on Twitter


Privacy | Legal Copyright © Raffaele Rialdi 2009, Senior Software Developer, Consultant, p.iva IT01741850992, hosted by Vevy Europe Advanced Technologies Division. Site created by Raffaele Rialdi, 2009 - 2015 Hosted by: © 2008-2015 Vevy Europe S.p.A. - via Semeria, 16A - 16131 Genova - Italia - P.IVA 00269300109