在我的本地系统服务中,我可能会启动一个应该使用登录的Windows用户的凭据运行的UI进程,但有时,当没有登录用户时,它应该能够从{ {1}}或"安全桌面"同样。
因此,我使用以下构造为其准备用户令牌:
Winlogon
这很好用,除了尽管有很多no privileges且没有高程,我用这种方法启动的UI进程仍然收到太多的系统服务"权利"例如,它可以在//The following pseudo-code snippet is run from the local system service
HANDLE hSelfToken = NULL;
HANDLE hToken2 = NULL;
::OpenProcessToken(::GetCurrentProcess(), TOKEN_ALL_ACCESS, &hSelfToken);
//Remove most of privileges & create restricted token
::CreateRestrictedToken(hSelfToken,
DISABLE_MAX_PRIVILEGE | LUA_TOKEN,
0, NULL,
0, NULL, 0, NULL,
&hToken2);
//Set user session ID for the token where the process will run
::SetTokenInformation(hToken2, TokenSessionId, &dwSessionId, sizeof(dwSessionId));
//The 'hToken2' is later used to call CreateProcessAsUser() to start a user UI process
根文件夹中创建一个文件,或者打开C:\
注册表项进行编写。
所以我很好奇,我还能做些什么来降低孩子的过程。特权?