title: How to check if a process has the administrative rights
body: <p>How do I properly check if a process is running with administrative rights? </p>
  
  <p>I checked the <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb776463.aspx" rel="noreferrer"><code>IsUserAnAdim</code> function in MSDN</a>, but it is not recommended as it might be altered or unavailable in subsequent versions of Windows. Instead, it is recommended to use the <code>CheckTokenMembership</code> function.</p>
  
  <p>Then I looked at the alternate example in MSDN from a description of the <code>CheckTokenMembership</code> function. However, there is Stefan Ozminski's comment in MSDN that mentions that this example does not work properly in Windows Vista if <a href="http://en.wikipedia.org/wiki/User_Account_Control" rel="noreferrer">UAC</a> is disabled.</p>
  
  <p>Finally I tried to use Stefan Ozminski's code from MSDN, but it determines that the process has administrative rights even if I launch it under an ordinary user without the administrative rights in Windows 7.</p>