The Cppcheck warning looks correct to me.
When OpenProcess() returns a valid handle then it finished successfully and the handle has to be closed accordingly.
I am not sure if the error checking in case of a successful execution of OpenProcess() does make sense here. I would only expect errors to be set when OpenProcess() failed and the the handle is set to NULL.
Last edit: Safe Online World Ltd. 2020-02-09
The Cppcheck warning looks correct to me.
When
OpenProcess()
returns a valid handle then it finished successfully and the handle has to be closed accordingly.I am not sure if the error checking in case of a successful execution of
OpenProcess()
does make sense here. I would only expect errors to be set whenOpenProcess()
failed and the the handle is set toNULL
.See https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess
and see this link for an example: https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes
Thanks for your suggestion. I've solved this issue. See Here