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);
的主要問題是,當我嘗試打印'緩衝區'的內容,只有垃圾信息打印在屏幕上:■我該如何解決這個問題?