我有以下用 C 编写的程序:
#include "stdafx.h"
#include <Windows.h>
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, &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();
}
现在,我对令牌的使用比较陌生。当我尝试执行程序时,出现以下错误:
运行时检查失败 #3 - 变量 'required_size' 未经初始化就被使用。
请问我该如何解决这个问题?我想要做的是向用户显示有关当前进程的令牌权限的信息。
我不确切知道 GetTokenInformation 方法中的最后一个变量 (ReturnLength [out]) 的作用。我尝试阅读 msdn 文档,但不了解它的用途。