That doesn't look right. There's no guarantee that the handle is for the current process console.
in fact, it's guaranted, because we check before (in the function calling this helper) that the handle is really a console handler and that it's in bare mode one could make it clearer by adding a comment to the helper function saying that those two conditions are met
A+