자원의 무결성 수준을 낮추려면 이렇게 만들 수 있습니다.
SECURITY_DESCRIPTOR sd;
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = &sd;
if(InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION))
{
if(SetSecurityDescriptorDacl(&sd, TRUE, (PACL) NULL, FALSE))
{
PSECURITY_DESCRIPTOR pSD = NULL;
// Try to lower Integrity, if OS is Vista or higher
if(bIsOSVistaOrLater)
{
if(ConvertStringSecurityDescriptorToSecurityDescriptor("S:(ML;;NW;;;LW)", SDDL_REVISION_1, &pSD, NULL))
{
PACL pSacl = NULL;
BOOL fSaclPresent = FALSE;
BOOL fSaclDefaulted = FALSE;
if(GetSecurityDescriptorSacl(pSD, &fSaclPresent, &pSacl, &fSaclDefaulted))
{
if(SetSecurityDescriptorSacl(sa.lpSecurityDescriptor, TRUE, pSacl, FALSE))
{
... = CreateSemaphore(&sa, 1, 1, "xpto");
}
}
}
}
else
{
... = CreateSemaphore(&sa, 1, 1, "xpto");
}
}
}
이에 대한 자세한 내용을보실 수 있습니다 : here
당신은 당신이 "정상"응용 프로그램 서비스에 의해 생성 된 세마포어에 액세스 할 답변을 –