阿虚
Hello World!
Hello World!
提升进程令牌权限
BOOL PrcoessPrivilege() 
{
    BOOL bRet = TRUE;
    LUID Luid;
    HANDLE hToken = NULL;
    TOKEN_PRIVILEGES newState;
    ZeroMemory(&Luid, sizeof(Luid));
    ZeroMemory(&newState, sizeof(newState));
    
    //打开进程令牌
    if ((bRet = OpenProcessToken(GetCurrentProcess(), 
        TOKEN_QUERY|TOKEN_ADJUST_PRIVILEGES, 
        &hToken)) == FALSE) 
        return FALSE;
    
    if ((bRet = LookupPrivilegeValue(NULL, "SeDebugPrivilege", &Luid)) == FALSE) 
        goto __exit;

    newState.PrivilegeCount = 1;
    newState.Privileges[0].Luid.LowPart = Luid.LowPart;
    newState.Privileges[0].Luid.HighPart = Luid.HighPart;
    newState.Privileges[0].Attributes = 2;
    bRet = AdjustTokenPrivileges(hToken, FALSE, &newState, 0x10, NULL, NULL); 
    
__exit:
    if (hToken != NULL)
    {
        ::CloseHandle(hToken);
    }
    return bRet;
}

阿虚

文章作者

发表评论

textsms
account_circle
email

Hello World!

提升进程令牌权限
扫描二维码继续阅读
2015-11-10