EnsureProcessIsClosed function missing correct access rights and does not close handle #249
Description
The process handle that gets passed to WaitForSingleObject in this line is missing the SYNCHRONIZE access right as specified here. This needs to be requested in the adjacent OpenProcess call alongside the PROCESS_TERMINATE access right.
This results in the WaitForSingleObject call to always immediately return with a result that always leads to the explicit forceful termination code path. This fact hides the other issue with this function that the opened process handle is only closed in this code path when it should be closed outside the if.
Furthermore, the result of OpenProcess should be evaluated as it might be NULL.
Nothing breaking, just caused some confusion on our side as we took this function as an example on how to wait for the web view process to finish before doing some clean up on our side.