A look behind the Windows 8 curtain

Tuesday, February 19, 2013 gc 0 Comments

Windows 8 provides new kind of touch first apps available from the Windows Store. These Window Store apps use WinRT—the new windows runtime—not to be confused with Surface RT (the new ARM based tablet from Microsoft). WinRT provides language projections (bindings) for C#, Visual Basic, C++, and Javascript.

Loosely speaking, WinRT can be thought of as an object-oriented sandboxed secure replacement for Win32.

In my view, you will like Windows 8 Store apps even on a desktop or laptop. Give them a try. The Modern UI style that Windows 8 Store apps use can provide a better experience.

This quick look behind the curtain for Windows 8 Store apps answers these basic questions:
  • Where are the Windows Store apps located?
  • Where do the apps run?
  • Where do apps store your data?
  • Where is the WinRT?
  • Where do XAML apps get their style?

Where are the Windows Store apps located?


Windows Store apps are stored in the directory C:\Program Files\WindowsApps.

Each app will have its own subdirectory.  

Now, you will not be able to open the directory without first changing the ownership of the directory, so I have included terse instructions at the bottom of this post: [How To] change permission on the WindowsApps directory.
 

Once you dig deeper into the WindowsApps directory, you will notice a directory for each app (and an additional one for updates).

Digging further, you will notice that the majority of apps are written with XAML/C# apps, not HTML5/Javascript.

As you will see, one of the disturbing things about HTML5/JavaScript apps is that you can read the JavaScript code. While you can decompile C# code as well, it is a bit more disturbing just to see the source sitting there. This is a good reason to obfuscate and minimize your Javascript before shipping. Most JavaScript developers are already used to this since the majority is delivered to web browsers.

Where do the apps run?  


If the app was developed using HTML5/JavaScript, then it runs in a host process called WWAHost.exe. This host process runs Trident and Chakra engines along with the JavaScript projections to WinRT. You will have to view the command line parameters via ProcessExplorer or Task Manager to view the command line parameters to narrow down the app.

.NET Language C#, VB, and C++ are compiled into their own binary. MyApp.exe for example.   

Where do apps store data?


There are three main types of app storage:
  • Local: Persistent data that exists only on the current device   
    • Typical location: C:\Users\{username}\AppData\Local\Packages\{app_id}\LocalState

  • Roaming: Data that exists on all devices on which the user has installed the app. The current limit is 100K. The limit can be founding using the following WinRT call: ApplicationData.Current.RoamingQuotaLimit
    • Typical location: C:\Users\{username}\AppData\Local\Packages\{app_id}\RoamingState  

  • Temporary: Data that could be removed by the system any time the app isn't running
    • Typical location: C:\Users\{username}\AppData\Local\Packages\{app_id}\TempState  

Where is WinRT?


The API is specified in the following directory using but the code runs elsewhere winmd:

C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral

The Windows Store apps (Metro) .NET profile can be found in the following directory:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\

Where do XAML apps get their style?


When styling your XAML apps, you will likely edit StandardStyles.xaml located in the Common directory of your app—by default. As you will notice, these styles reference other styles that do not seem to exist. You can find these referenced (default) styles in the following directory:

c:\Program Files (x86)\Windows Kits\8.0\Include\WinRT\Xaml\Design\themeresources.xaml". Generic.xaml

You can redefine the desired styles such as Font color from the default in your StandardStyles.xaml.

I find it useful to put them into corresponding sections called Standard Styles Overrides.       

Sidebar: [How To] take ownership of the Windows App directory
In order to take ownership of the Windows App directory, you will have to be Administrator.
 
You might also first need to set the option to display hidden directories. Once you can see the directory, then select the "Windows App" folder and select Properties of the following directory: C:\Program Files\Windows Apps\.
 
Select the "Security Tab" from the Properties window and select advanced. Change the owner using the "Change" link. Give yourself ownership. You will have to be Administrator in order to do this. 
 
Sorry for the terse description. If you need more help, you can search the web for how to take ownership of Windows directory.


I hope that this quick peek behind the Windows 8 curtain helps you understand how apps run, store data, and get their style.

Enjoy.

You Might Also Like

0 comments: