1
时,我有写在C下面的代码片段这是应该检索有关程序权限令牌信息:Ç - 缓冲区打印垃圾字符获得令牌信息
char buffer[1000]; //Declaring the buffer where the token information will be stored
int size = sizeof(buffer); //Storing the size of the buffer
DWORD required_size; //A variable storing return information from the GetTokenInformation() method
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);
的主要问题是,当我尝试打印'缓冲区'的内容,只有垃圾信息打印在屏幕上:■我该如何解决这个问题?