Thanks, those results are interesting. I must admit that I expected bigger difference (like time x2).
as usual, tests on one single machine cannot be taken as an overall answer... those should be extended on a more loaded machine
Given how simple the solution that you attached is, I'm biased towards choosing it. If you're happy if that, I'd say let's use it.
well let's hope it will not trigger errors from process trying to access this pseudo handle for real... I'll update the patch to
1) correctly handle the pseudo value in FreeConsole (maybe other places too)
2) add a FIXME in console_ioctl when using it so that we can detect those potential cases
One note about it, through, new_process server request uses "> 3" check to decide if it should use duplicate_handle() on passed handle, which does not work well with CONSOLE_HANDLE_SHELL_NO_WINDOW being 5. Maybe we should use -1, -2, ... for magic handles instead.
good catch
(need retesting as this zeroes out the ConsoleHandle value in child :-(, and need perhaps to fake this case in the tests somehow...)
well the -1, -2 might also collide with the "magic" handle values (server/handle.c:get_magic_handle()), not sure if it's the best thing
since it's only for ConsoleHandle inheritance, instead of > 3, we'd better test that handle isn't a multiple of four and is between 1 and 5 (even add an helper in condrv.h to test for that)
I'll resend the whole serie then when it's done