title: Getting Token Information
body: <p>I have the following program written in C:</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;Windows.h&gt;
  
  void main()
  {
      char buffer[1000];
      int size = sizeof(buffer);
      PDWORD required_size;
  
      printf("----Application Privileges----\n\n");
      printf("In this program, we are going to obtain information about the application privileges\n\n");
  
      HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, GetCurrentProcessId()); //Opening the current process
      HANDLE token; //Creating a handle for the token
      OpenProcessToken(process, TOKEN_ADJUST_PRIVILEGES, &amp;token); //Opening the process token
  
      GetTokenInformation(token, TokenPrivileges, buffer, size, required_size); //Obtaining the token information
      printf("The following information was obtained with regards to the token privileges: \n\n");
      printf("%s\n\n", buffer);
  
      printf("Press enter to exit the program");
      getchar();
  
  }
  </code></pre>
  
  <p>Now, I am relatively new to the use of tokens.  When I try to execute the program, the following error comes up:</p>
  
  <blockquote>
    <p>Run-Time Check Failure #3 - The variable 'required_size' is being used without being initialized.</p>
  </blockquote>
  
  <p>How can I solve this problem please?  What I want to do is to display information about the token privileges of the current process to the user.</p>
  
  <p>I don't know exactly what the last variable (ReturnLength [out]) in the GetTokenInformation method does.  I tried reading the msdn documentation but did not understand its use.</p>