liaocheng

获取管理员权限:

void GainAdminPrivileges(UINT idd, BOOL bWait){  
    CString         strCmd;  
    CString         strApp;  
  
    strCmd.Format (_T("/adminoption %d"), idd);  
  
    CSVPToolBox svpTool;  
    strApp = svpTool.GetPlayerPath();  
  
  
    SHELLEXECUTEINFO execinfo;  
    memset(&execinfo, 0, sizeof(execinfo));  
    execinfo.lpFile         = strApp;  
    execinfo.cbSize         = sizeof(execinfo);  
    execinfo.lpVerb         = _T("runas");  
    execinfo.fMask          = SEE_MASK_NOCLOSEPROCESS;  
    execinfo.nShow          = SW_SHOWDEFAULT;  
    execinfo.lpParameters   = strCmd;  
  
    ShellExecuteEx(&execinfo);  
  
    if(bWait)  
        WaitForSingleObject(execinfo.hProcess, INFINITE);  
}  

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-11-20
  • 2021-12-15
  • 2021-12-26
  • 2022-01-07
  • 2021-08-06
  • 2022-02-25
猜你喜欢
  • 2021-12-01
  • 2021-11-20
  • 2021-06-18
  • 2021-08-18
  • 2021-04-14
相关资源
相似解决方案