<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ArmsOfSorrow</title>
    <description>The latest articles on DEV Community by ArmsOfSorrow (@armsofsorrow).</description>
    <link>https://dev.to/armsofsorrow</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F317201%2F3ac6c7c2-75e9-4a0f-9e63-a2dea71e5e91.png</url>
      <title>DEV Community: ArmsOfSorrow</title>
      <link>https://dev.to/armsofsorrow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/armsofsorrow"/>
    <language>en</language>
    <item>
      <title>Taking a look inside the HoloLens 2 emulator</title>
      <dc:creator>ArmsOfSorrow</dc:creator>
      <pubDate>Sun, 26 Apr 2020 13:25:22 +0000</pubDate>
      <link>https://dev.to/armsofsorrow/taking-a-look-inside-the-hololens-2-emulator-36e7</link>
      <guid>https://dev.to/armsofsorrow/taking-a-look-inside-the-hololens-2-emulator-36e7</guid>
      <description>&lt;p&gt;I've always been interested in how things work under the hood, and since my journey in software development started in 2012 on Windows Phone 7, I have a soft spot for mobile Windows devices. &lt;br&gt;
This also includes HoloLens, which from a development perspective feels very similar to Windows Phone.&lt;/p&gt;

&lt;p&gt;To set expectations, this blog post will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show you how to install the HoloLens 2 emulator&lt;/li&gt;
&lt;li&gt;Explain which tools are needed to open its virtual hard disk&lt;/li&gt;
&lt;li&gt;Show you how to explore the system files on said disk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So let's get started, shall we?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows 10 Pro, version 1909 or later&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK"&gt;Windows Insider ADK&lt;/a&gt;, version 2004&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br&gt;
You can download the emulator from &lt;a href="https://docs.microsoft.com/en-us/windows/mixed-reality/using-the-hololens-emulator#installing-the-hololens-emulator"&gt;this page&lt;/a&gt;. Depending on the speed of your internet connection, this might take a while. Same goes for the ADK. Grab a cup of your favorite hot beverage in the meantime. :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Minor caveats concerning the ADK download&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
So, at the time of writing I was having a hard time getting hold of the ADK for Windows 10 version 2004. The Windows Insider ADK download page already got updated for a future Windows build, whereas the official (non-preview) download page wasn't yet updated to include that version.&lt;/p&gt;

&lt;p&gt;I didn't want to try older/newer versions because I already knew that the 2004 one was working, so I had to resort to some hacks to get it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;a href="https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK"&gt;Windows Insider ADK page&lt;/a&gt; and log in.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SyMz6Lio--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pp6m67iup20yotg8c7fl.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Right-click the download button and select "Inspect Element". You should see some HTML and the &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; element selected.

&lt;ul&gt;
&lt;li&gt;I'm using Firefox here, not sure how this option is called in other browsers
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VIHq1dAd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fwbst4k90uh95j4mwfs5.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Change the version number in the file name to 19041 and press the download button. You should get a download prompt now.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4xRh43R---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/480xjkp9qdnto7zy1is2.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the ADK installer, make sure to select &lt;strong&gt;Imaging and Configuration Designer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emulator files&lt;/strong&gt;&lt;br&gt;
After the emulator is installed, you'll likely find it in your Windows SDK installation folder; for me that is &lt;code&gt;C:\Program Files (x86)\Windows Kits\10\Emulation\HoloLens&lt;/code&gt;.&lt;br&gt;
There is a folder for each installed version; at the moment I have &lt;code&gt;10.0.18362.1042&lt;/code&gt; on my machine, though there's already some newer ones. &lt;br&gt;
When you open that folder, you'll notice a pretty big (~6GB) file called &lt;code&gt;Flash.vhdx&lt;/code&gt;. This is a virtual hard disk file that contains the emulator's Windows installation. Our goal is to explore the contents of this disk image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Aside: HoloLens 1 emulator&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The HoloLens 1 emulator used the older VHD format for its disk image file. You could just double-click it in explorer and Windows would happily mount it, allowing you to look at the contents without needing any kind of extra tools. Unfortunately, when we try doing that with our HoloLens 2 .vhdx, explorer greets us with an error message:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MpIR-qQI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mlunhpe3gtnygm7x9oob.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MpIR-qQI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mlunhpe3gtnygm7x9oob.png" alt="Mount error message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a minor roadblock, but there are ways to get around it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mounting the HoloLens 2 disk image&lt;/strong&gt;&lt;br&gt;
To get Windows to recognize and let us explore our disk image, we will use a tool called &lt;code&gt;WPImage&lt;/code&gt;, which is part of the ADK.&lt;/p&gt;

&lt;p&gt;Assuming you didn't change the install directory of the ADK, it should be located in &lt;code&gt;C:\Program Files (x86)\Windows Kits\10&lt;/code&gt;. Inside there, look for a folder called &lt;code&gt;tools&lt;/code&gt;. The tools folder should have a &lt;code&gt;bin\i386&lt;/code&gt; subdirectory and inside there should be a program called &lt;code&gt;wpimage.exe&lt;/code&gt;. Open up an elevated PowerShell in that directory.&lt;/p&gt;

&lt;p&gt;Then run the command &lt;code&gt;.\wpimage.exe mount &amp;lt;path to Flash.vhdx&amp;gt;&lt;/code&gt;. If everything works out, you'll likely get output similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ETW Log Path: ...
OS Version: Microsoft Windows NT 10.0.18363.0
Mounting a VHD/X image.
OpenDiskInternal: Mounted virtual disk at phys \\?\PhysicalDrive2
OpenVirtualHardDisk: Waiting for partition MAINOS arrival notification.
MountStoragePool: Name (OSPool), Version (ScVersionWindowsRedstone5), Number of Spaces (1), Staged (true)
MountStoragePool: Attached EFIESPDisk to \\.\PhysicalDrive3
MountStoragePool: Attached MainOSDisk to \\.\PhysicalDrive4
MountStoragePool: Attached BSPDisk to \\.\PhysicalDrive5
MountStoragePool: Attached PreInstalledDisk to \\.\PhysicalDrive6
MountStoragePool: Attached OSDataDisk to \\.\PhysicalDrive7
MountStoragePool: Attached DataDisk to \\.\PhysicalDrive8
MountStoragePool: Attached VIRT_EFIESPDisk to \\.\PhysicalDrive9

        To dismount, run "wpimage.exe dismount -physicaldrive \\.\PhysicalDrive2"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;There's a bunch of information to unpack here. We can see that there are multiple disks mounted; these correspond to partitions of the HoloLens 2 emulator.&lt;/p&gt;

&lt;p&gt;Quick terminology:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EFIESP -&amp;gt; EFI system partition&lt;/li&gt;
&lt;li&gt;MainOS -&amp;gt; Most OS files reside here, e.g. the Windows folder&lt;/li&gt;
&lt;li&gt;BSP -&amp;gt; Board support package. In a "real" HoloLens 2 system image, this means hardware drivers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm interested in the Windows folder right now, so let's explore &lt;code&gt;MainOS&lt;/code&gt; first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exploring a mounted disk&lt;/strong&gt;&lt;br&gt;
Now that the disk is mounted, we want it to be nicely visible through explorer.&lt;/p&gt;

&lt;p&gt;To accomplish that, open Disk Management and look for the MainOS disk.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bSxWw4LI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wuvendyky8a6vguhbatv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bSxWw4LI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wuvendyky8a6vguhbatv.png" alt="Disk Management"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, right-click it and select "Change drive letter and paths". After that, click Add and Mount in the following empty NTFS folder. You can select any folder you want; I created an empty folder at &lt;code&gt;C:\MainOS&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And that's it!&lt;br&gt;
Now you can explore the OS files, which is pretty cool. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;&lt;br&gt;
The HoloLens 2 emulator system image features the GLTF models of Windows Mixed Reality controllers. You'll find them at &lt;code&gt;MainOS\Windows\system32\PerceptionSimulationLeftHandModel.glb&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iWnYmLJ_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oax7t5xx6pkb3vcxph6p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iWnYmLJ_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oax7t5xx6pkb3vcxph6p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>hololens</category>
      <category>windows</category>
      <category>uwp</category>
    </item>
  </channel>
</rss>
