title: How can i elevate my process at runtime under win xp
body: <p>My app needs to do some privileged operations at runtime. For example,when the user is first time to run my app, i have to create and format a virtual dirve. I use the undocumented api formatex to do the fomating job, but formatex need administrator privileges. If OS is vista or later, i can prompt UAC dialog with 'COM Elevation Moniker' and it works fine. But on xp, this technique is not suitable, so i use the impersonate method.
  if app is run as limited user, i do formating like this:</p>
  
  <pre><code>CredUIPromptForCredentials() -&gt; prompt to get administrator credentials
  LogonUser()
  ImpersonateLoggedOnUser()
  formatex()
  RevertToSelf()
  </code></pre>
  
  <p>formatex still fail...
  Of course, run my app as administrator will works, but it is not good, my app is installed as per user, not per machine, which should work under current user context, even if the user is a
  limited user.</p>
  
  <p>How can i correctly elevate my app at runtime to do the formating job? Any one help?</p>