我最近需要获得一个进程的完整性级别,我从 MSDN 找到了帮助。示例代码如下所示:
if (GetTokenInformation(hToken, TokenIntegrityLevel,
pTIL, dwLengthNeeded, &dwLengthNeeded))
{
dwIntegrityLevel = *GetSidSubAuthority(pTIL->Label.Sid,
(DWORD)(UCHAR)(*GetSidSubAuthorityCount(pTIL->Label.Sid)-1));
if (dwIntegrityLevel == SECURITY_MANDATORY_LOW_RID)
{
// Low Integrity
wprintf(L"Low Process");
}
else if (dwIntegrityLevel >= SECURITY_MANDATORY_MEDIUM_RID &&
dwIntegrityLevel < SECURITY_MANDATORY_HIGH_RID)
{
// Medium Integrity
wprintf(L"Medium Process");
}
else if (dwIntegrityLevel >= SECURITY_MANDATORY_HIGH_RID)
{
// High Integrity
wprintf(L"High Integrity Process");
}
else if (dwIntegrityLevel >= SECURITY_MANDATORY_SYSTEM_RID)
{
// System Integrity
wprintf(L"System Integrity Process");
}
}
众所周知,
SECURITY_MANDATORY_LOW_RID == 0x00001000L
SECURITY_MANDATORY_MEDIUM_RID == 0x00002000L
SECURITY_MANDATORY_HIGH_RID == 0x00003000L
SECURITY_MANDATORY_SYSTEM_RID == 0x00004000L.
这是我的问题:如果此示例代码是正确的,那么如果进程 A 具有of ,
那么它的完整性级别是多少?和?是不是说有层次的过程也有层次?dwIntegrityLevel
0x00004100L
SECURITY_MANDATORY_HIGH_RID
SECURITY_MANDATORY_SYSTEM_RID
SECURITY_MANDATORY_SYSTEM_RID
SECURITY_MANDATORY_HIGH_RID
如果示例代码错误,那么确定进程完整性级别的正确方法是什么?