2013-07-25 60 views

回答

3

可以使用LookupAccountSid功能來做到這一點:

BYTE bBuffer[128]; 
DWORD dwSize = sizeof(bBuffer); 
if (CreateWellKnownSid(WinBuiltinAdministratorsSid, NULL, (PSID)bBuffer, &dwSize)) 
{ 
    wchar_t wchName[128], wchDomain[128]; 
    DWORD cchName = _countof(wchName), cchDomain = _countof(wchDomain); 
    SID_NAME_USE use; 
    if (LookupAccountSid(NULL, (PSID)bBuffer, wchName, &cchName, wchDomain, &cchDomain, &use)) 
    { 
     // wchDomain will now contain something like BUILTIN 
     // wchName will now contain something like Administrators 
    } 
} 
相關問題