Peter Dons Tychsen donpedro@tdcadsl.dk writes:
GetStdHandle returns a console handle which is not a valid ntdll handle, so you are not testing what you think.
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".
Thanks,
/pedro
----- Original meddelelse -----
Peter Dons Tychsen donpedro@tdcadsl.dk writes:
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.
OK. The "bad handle" is tested by the "deadbeef" handle. Where is the best place to get a really good "wrong class" handle?
Thanks,
/pedro
----- Original meddelelse -----
Peter Dons Tychsen wrote:
OK. The "bad handle" is tested by the "deadbeef" handle. Where is the best place to get a really good "wrong class" handle?
Create it. Event handle will do for example.
Vitaliy.
Thanks V.
However, it would seem that AJ already has commited another fix in ntdlls serial module (which fixes the same bug), so i guess my fix and tests are not valid any more.
Thanks,
/pedro
----- Original meddelelse -----