Posted by: Zeeshan Amjad | November 11, 2012

WinRT internals using C++. Part 2

Let’s further explore the WinRT and continue the discussion we started here. We created a simple program to see the ref class and simple class to compile in .Net. Let’s try to compile the same program in WinRT. Select Windows Store App Support from the project setting.


And type /ZW in the additional options text box when select the command line from C/C++


And type the following program.

Code Snippet
class A

ref class B

int main()
    int s1 = sizeof(A);

    int s2 = sizeof(B);


Now when we compile it we will get one compilation error.


This compilation error gives me some extra information i.e. name of one assembly required by the C++ program named platform.winmd. I searched this file on my computer and found it on multiple locations.

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcpackages

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral

Let’s try our old tool dumbin on this file. Type this at command prompt

dumpbin platform.winmd

Here is its output

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcpackages>dumpbin platfo
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file platform.winmd

File Type: DLL


        2000 .reloc
        2000 .rsrc
        6000 .text


It means that winmd file is simple Windows DLL as shown by the output of the program. But we couldn’t get any extra information from it. Let’s try to open the same file from ildasm to see if we can get some extra information. Idasm opens this file successfully and here is what we will get from ildasm.


This shows that winmd file contains the meta data that is compatible with .Net meta data because we are able to open it in .Net tool (ildasm). Let’s explore it little bit more and see what we can find under the Platform namespace. In our previous post we came across Object class in Platform namespace, lets see the meta data of that class using ildasm.

Here is the meta data of Object class.


But if we open any method then we couldn’t see any code because there is only meta data in winmd file no code.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: