據我所知,從用戶態角度來說,是不可能的。
網上流傳的兩個提升權限API :公開的AdjustTokenPrivileges or 未公開的RtlAdjustPrivliege 其實只是將進程(線程)Access Token中已經擁有的特權(Previlege)從Disable改爲Enable。
未公開的RtlAdjustPrivilege在內部也是通過調用AdjustTokenPrivileges。而MSDN對AdjustTokenPrivileges的說明如下:
1、The AdjustTokenPrivileges function cannot add new privileges to the access token. It can only enable or disable the token's existing privileges.
2、The NewState parameter can specify privileges that the token does not have, without causing the function to fail. In this case, the function adjusts the privileges that the token does have and ignores the other privileges so that the function succeeds.
網上給的例子之所以成功,原因是:運行“提升權限”程序的Access Token本身就是系統管理員;系統管理員的特權最高。所以,AdjustTokenPrivileges總是成功。