title: Working around Windows Store App Sandbox
body: <p>I want to create a Metro app for learning and personal consumption purposes to do all sorts of low-level device API work, such as tracking power consumption, enumerating processes and calculating CPU usage per process, etc... Unfortunately, these Desktop APIs are forbidden from Metro applications.</p>
  
  <p>My first attempt to work around this was to create a non-windows store C++ library, which has the <code>WINAPI_FAMILY</code> variable set correctly in order to use functions like <code>QueryIdleProcessorCycleTime()</code> and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa372675%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>CallNtPowerInformation()</code></a>. Unfortunately, it is this latter function call that fails when I pass it the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa373184(v=vs.85).aspx" rel="nofollow noreferrer"><code>ProcessorInformation</code></a> token in the first argument, with a <code>STATUS_ACCESS_DENIED</code> return code.</p>
  
  <p>Interestingly, <code>CallNtPowerInformation()</code> works just fine when given <code>SystemBatteryState</code> as the first argument, so I imagine there is some kind of access privilege I am missing when running as a Metro app for getting processor info.  I read that Metro apps are run with <a href="https://stackoverflow.com/questions/12040390/how-are-winrt-metro-apps-restrictions-enforced">quite restricted privileges</a>, and so I am looking for a way to increase these privileges to allow my API calls to go through properly.  To test that it is the process privileges and not a coding error, I used the C++ library from a console application, and everything worked just fine.</p>
  
  <p>I would really like to not have to create a second, desktop background process that does all the dirty work and communicates the results to the Metro app over a socket.  I realize this can work, but I would rather have everything housed in the same process space.</p>