我正在使用简单的代码 Test.c-
#include<stdio.h>
int main()
{
printf("hello\n");
while(1);
}
我正在通过 cl.exe 编译器编译此代码并生成 Test.exe。现在我有两种方法可以打开 Test.exe。首先是简单的双击并打开它。在这种情况下,如果我正在检查 Windbg(文件->附加到进程),它会显示
Session: 1 User: .......
现在,如果我使用管理权限从 cmd 打开 Test.exe 并再次检查 Windbg,它会显示
Error 0xD0000022
我认为这是访问冲突错误,这是因为 cmd(admin) 进程不允许对其子 Test.exe 的某些访问权限,我不知道这些访问权限是什么。
是否有任何 api 允许访问并消除此错误。我尝试了这些 api 但没有任何反应-
GetCurrentProcess(); //to get the pseudo handle of current process
SetSecurityInfo(ph,SE_SERVICE,BACKUP_SECURITY_INFORMATION,NULL,NULL,NULL,NULL);
我也以两种方式打开了 safari 浏览器,结果与 Test.exe 相同。请多多指教。
最佳答案
I thing this is a error of access violation and this is happening because cmd(admin) process does not allowing some access rights to its child Test.exe
不完全是。也以管理员权限运行 WinDBG,然后问题就会消失。
关于c++ - 如果应用程序从具有 Windows 管理权限的 cmd 打开,则会出现访问冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26079348/