title: How to correctly detect Network drive when running with elevated privileges
body: <p>I am working on an application that needs to correctly detect all used drive letters on Windows. And I use the <code>GetLogicalDrives()</code> function for that. This function works just fine excepts when users launch my application with elevated privileges (i.e., the user logged in with an account belongs to 'Administrators' group and launch my application by choosing "Run as administrator" option). In this case, <code>GetLogicalDrives()</code> fails to detect mapped network drives on the machine.</p>
  
  <p>It seems that the root cause of the problem is that in this scenario Windows runs 2 user sessions in parallel. My application runs in the "elevated privileges" session, while the drive is mapped in the "non-elevated" session:</p>
  
  <p><a href="https://support.microsoft.com/en-us/help/3035277/mapped-drives-are-not-available-from-an-elevated-prompt-when-uac-is-configured-to-prompt-for-credentials-in-windows" rel="nofollow noreferrer">https://support.microsoft.com/en-us/help/3035277/mapped-drives-are-not-available-from-an-elevated-prompt-when-uac-is-configured-to-prompt-for-credentials-in-windows</a></p>
  
  <p>Is there any programmatic workaround for this problem? I tried to relaunch my application in the "non-elevated" session, but don't know how (or if it is even possible). What I tried already is relaunching my application with a restricted token (using <code>CreateRestrictedToken</code>with <code>DISABLE_MAX_PRIVILEGE</code> option), hoping that Windows will somehow figure out that it could now relaunch my application in a "non-elevated" session, but it did not work.</p>