Process32Next在Windows 10上无法正常工作 [英] Process32Next not work normally on Windows 10

查看:433
本文介绍了Process32Next在Windows 10上无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,

   我正在尝试使用"Process32Next" API来遍历机器上的运行进程,我按照正常的程序使用这个API,但我发现API无法在Windows 10上返回正确的结果,它找不到所有的
进程机器。相同的代码在Windows 7操作系统中运行良好。

    I'm trying to use "Process32Next" API to traverse running processes on the machine, I'm following the normal procedure to use this API, but I find the API can't return correct result on Windows 10, it can't find all the processes on the machine. Same code works well in Windows 7 OS.

    API不会在Windows 10上返回任何错误,但只是找不到正确的进程列表。我还尝试使用"WTSEnumerateProcessesExW"。然而,API发现它在Windows 10上也不起作用。这个API刚从"pCount"获得计数1。
参数,但实际上机器上运行了30多个进程。

    The API does not return any error on Windows 10, but just can't find correct process list. I also tried to use "WTSEnumerateProcessesExW" API, however found it also not work on Windows 10. This API just got count 1 from "pCount" argument, but there were actually more than 30 processes running on the machine.

   所以我很困惑的是为什么上面的API在Windows 10上无法正常工作,我可以确认在Windows 7上运行良好的完全相同的代码。

    So what I'm confused is why above API can't work normally on Windows 10, I can confirm the exact same codes running well on Windows 7.

    你能帮助指出这个问题的任何可能原因吗?非常感谢你的帮助!

    Could you help to point any possible reason of this issue? Thanks a lot for your help!

最好的问候,

Ray

推荐答案

   非常感谢您的回复!

    Thanks a lot for your reply!

    我的代码实际上遵循您发布的示例网站链接,并且在Windows 7上运行良好,但同样如此代码刚刚在我的Windows 10 VM中按预期运行。

    My code actually followed the sample web link you posted, and it worked well on Windows 7, however, same code just now function as expected in my Windows 10 VM.

   我打印了API的输出,发现它只能列出两个进程:Process32First返回系统进程(ID 0),而Process32Next的for循环只有一个进程:我的程序运行的进程.API不能枚举
其他流程并且不报告任何错误。

    I printed the output of the API and found it could only list two processes: Process32First returned the system process (ID 0), and the for loop of Process32Next only got one process: the process that my program runs in. The API can't enumerate other processes and does not report any errors.

最好的问候


这篇关于Process32Next在Windows 10上无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆