简体   繁体   English

TerminateProcess不适用于已验证的进程ID

[英]TerminateProcess doesnt work for verified process id

I am working on application that is supposed to kill a process with a given name. 我正在处理应该杀死具有给定名称的进程的应用程序。 Operating system I use is windows 7. The thing is that for all processes listed in task manager with a non-blank USER NAME field it works fine. 我使用的操作系统是Windows 7.事情是,对于任务管理器中列出的所有进程,使用非空白的USER NAME字段,它可以正常工作。 However when a process has an empty username cannot be killed even by task manager. 但是,当进程具有空用户名时,即使是任务管理器也无法将其杀死。

Can anyone tell me why some processes has no user name. 任何人都可以告诉我为什么有些进程没有用户名。 In my case it is csrss.exe winlogon.exe and unfortunately an old application I want to have killed. 在我的情况下,它是csrss.exe winlogon.exe,不幸的是我想杀死一个旧的应用程序。 All other processes I examined has a proper username. 我检查的所有其他进程都有一个正确的用户名

Is there any way to add a username to existing process ? 有没有办法在现有流程中添加用户名?

Can anybody recomend me better solution killing for killing application than terminateProcess() ? 任何人都可以推荐我更好的杀死应用程序杀死应用程序而不是terminateProcess()?

Those process cannot be terminated because you have no priviledges to do so. 这些过程无法终止,因为您没有这样做的特权。 You would have to execute your application with elevated priviledges for it to work. 您必须使用提升的权限执行您的应用程序才能工作。 There is no other way. 没有其他办法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM