OpenProcess error 87 invalid parameter

后端 未结 3 1536
攒了一身酷
攒了一身酷 2021-01-21 14:18

I\'m trying to write a program which executes make.exe from MinGW distribution in the current directory and makes use of its STDOUT data and exit code. I have a handle to proces

3条回答
  •  一向
    一向 (楼主)
    2021-01-21 14:44

    Although the post is old: I noticed that I got ERROR_INVALID_PARAMETER when the process existed, but owned by different user and/or Windows desktop and/or terminal server session.

    Strange enough, the WTSEnumerateProcess() function does not suffer from this error, but is much more expensive, especially on a system that is already under heavy load with many processes (and a call my even exhaust windows kernel resources).

    So, it is not possible to make a 'real' invalid parameter provided and access errors. I would have expected ERROR_ACCESS_DENIED instead (but a task manager invoked as regular/non-elevated user still shows all processes).

    Look like some inconsistencies in Windows?

提交回复
热议问题