title: SaferCreateLevel SAFER_LEVELID_UNTRUSTED: The application was unable to start correctly (0xc0000142)
body: <p>i'm trying to launch a process (<em>any</em> process) as "<strong>untrusted</strong>" using the <a href="http://msdn.microsoft.com/en-us/library/ms722425%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>SaferCreateLevel</code></a> with the <code>SAFER_LEVELID_UNTRUSTED</code> safer level:</p>
  
  <blockquote>
    <p>Allows programs to execute with access only to resources granted to open well-known groups, blocking access to <strong>Administrator</strong> and <strong>Power User</strong> privileges and personally granted rights.</p>
  </blockquote>
  
  <p>Using the code from Michael Howards DropMyRights MDSN article (<a href="http://msdn.microsoft.com/en-us/library/ms972827.aspx" rel="nofollow noreferrer">Browsing the Web and Reading E-mail Safely as an Administrator</a>) the pseudo-code is:</p>
  
  <pre><code>//get a handler on a Safer level
  hSaferLevel = SaferCreateLevel(SAFER_SCOPEID_USER, SAFER_LEVELID_UNTRUSTED);
  
  //Create a security token out of the safer level handle
  hSecurityToken = SaferComputeTokenFromLevel(hSaferLevel);
  
  //Create process as user
  CreateProcessAsUser(hSecurityToken, "myapp.exe");
  </code></pre>
  
  <p>Except that the process fails to launch:</p>
  
  <blockquote>
    <p>The application was unable to start correctly (0xc0000142).   </p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/81HwV.png" alt="enter image description here"></p>
  
  <p>What's going on here?</p>
  
  <p><strong>Note:</strong> Launching a process at the <code>SAFER_LEVELID_NORMALUSER</code> works fine:</p>
  
  <blockquote>
    <p>Allows programs to execute as a user that does not have <strong>Administrator</strong> or <strong>Power User</strong> user rights. Software can access resources accessible by normal users.</p>
  </blockquote>
  
  <p>Although since everyone already runs as a "<em>Normal User</em>" these days, there's little value in it.</p>
  
  <hr>
  
  <p>My application <strong>is</strong> able to handle running as a "low" user.</p>
  
  <p>The end goal was to run the process with the same privelages as a <strong>MandatoryIntegrity\Low</strong> process would get (although not tagged as "low"). So i tested that. </p>
  
  <p>i used <code>icacls</code> to mark <a href="http://msdn.microsoft.com/en-us/library/bb625960.aspx" rel="nofollow noreferrer">my application to run <strong>Mandatory Integrity Level\Low</strong></a>:</p>
  
  <pre><code>C:\Develop&gt;icacls RTMS.exe /setintegritylevel Low
  processed file: RTMS.exe
  Successfully processed 1 files; Failed processing 0 files
  </code></pre>
  
  <p>And my application launches correctly, and is running at the low integrity level:</p>
  
  <p><a href="https://i.stack.imgur.com/fvxAh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fvxAh.png" alt="enter image description here"></a></p>
  
  <p>While i might be able to use the <a href="http://blogs.msdn.com/b/cjacks/archive/2006/10/24/modifying-the-mandatory-integrity-level-for-a-securable-object-in-windows-vista.aspx" rel="nofollow noreferrer"><code>AddMandatoryAce</code></a> API, or fiddle with the ACLs in the security token myself, i'm curious what's up with an <code>UNTRUSTED</code> Safer level - and why i can't get anything to launch.</p>
  
  <p><strong>Note:</strong> On Windows 7 if you mark <code>calc</code> or <code>notepad</code> as <code>/setintegritylevel low</code> they will fail to launch (no error, just never appear), even <a href="http://msdn.microsoft.com/en-us/library/bb625960.aspx" rel="nofollow noreferrer">though this MSDN article talks about using calc as a test of low integrity level</a>:</p>
  
  <p><img src="https://i.stack.imgur.com/10gkM.gif" alt="enter image description here"></p>