Peter Dons Tychsen donpedro@tdcadsl.dk writes:
Thanks for the comments. Not sure i understand them though.
The whole point of the test was to test what happens when you use a wrong handle. The actual bug i fixed was that it was possible to for programs to send invalid handles to IoControl. Cygwin was infact sending handles to ntdll.dll which originated from GetStdHandle().
So i think using this API for testing is relevant, as the point of the test is to verify that handles of the completely wrong class are rejected, and not just "bad handles".
Yes, but then you should explicitly construct and test both kinds of handles. Using GetStdHandle will either be a wrong class or a bad handle depending on whether stdio is to a file or to a console, so you don't really know which case you are testing. The remapping of console handles happens in kernel32, not in ntdll, so it doesn't really make sense to pass the result of GetStdHandle straight to ntdll.