如何用C语言获取系统的sid信息
展开全部
[cpp] view plain copy
#include <stdio.h>
#include <windows.h>
#define MAX_NAME 256
void ConvertSid(PSID pSid, LPTSTR TextualSid)
{
PSID_IDENTIFIER_AUTHORITY psia = GetSidIdentifierAuthority(pSid);
DWORD sidLen = sprintf(TextualSid, TEXT("S-%lu-"), SID_REVISION);
sidLen += sprintf(TextualSid + strlen(TextualSid), TEXT("%lu"), psia->Value[5]);
int i = 0;
int subAuthorities = *GetSidSubAuthorityCount(pSid);
for (i = 0; i < subAuthorities; i++)
{
sidLen += sprintf(TextualSid + sidLen, TEXT("-%lu"), *GetSidSubAuthority(pSid, i));
}
}
void GetLocalSid(LPTSTR szSid)
#include <stdio.h>
#include <windows.h>
#define MAX_NAME 256
void ConvertSid(PSID pSid, LPTSTR TextualSid)
{
PSID_IDENTIFIER_AUTHORITY psia = GetSidIdentifierAuthority(pSid);
DWORD sidLen = sprintf(TextualSid, TEXT("S-%lu-"), SID_REVISION);
sidLen += sprintf(TextualSid + strlen(TextualSid), TEXT("%lu"), psia->Value[5]);
int i = 0;
int subAuthorities = *GetSidSubAuthorityCount(pSid);
for (i = 0; i < subAuthorities; i++)
{
sidLen += sprintf(TextualSid + sidLen, TEXT("-%lu"), *GetSidSubAuthority(pSid, i));
}
}
void GetLocalSid(LPTSTR szSid)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询