ntdll: Do not accept device control requests with invalid and/or incompa tible handles

Peter Dons Tychsen donpedro at tdcadsl.dk
Thu Sep 10 14:30:19 CDT 2009


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 -----

> Fra: Alexandre Julliard <julliard at winehq.org>
> Til: Peter Dons Tychsen <donpedro at tdcadsl.dk>
> Cc: wine-devel at winehq.org
> Dato: Tir, 08. sep 2009 22:25
> Emne: Re: ntdll: Do not accept device control requests with invalid
> and/or incompatible handles
> 
> Peter Dons Tychsen <donpedro at tdcadsl.dk> writes:
> 
> > +static void test_device_control(void)
> > +{
> > + IO_STATUS_BLOCK io;
> > + NTSTATUS status;
> > +
> > + /* Try using a bugus handle for I/O control */
> > + HANDLE handle = (HANDLE)0xdeadbeef;
> > + status = pNtDeviceIoControlFile(handle, NULL, NULL, NULL, &io,
> IOCTL_SERIAL_SET_BAUD_RATE, NULL, 0, NULL, 0);
> > + ok(status == STATUS_INVALID_HANDLE, "Expected %08X, got %08X\n",
> STATUS_INVALID_HANDLE, status);
> > +
> > + /* Try using an valid (but wrong) handle for I/O control */
> > + handle = GetStdHandle(STD_INPUT_HANDLE);
> > + status = pNtDeviceIoControlFile(handle, NULL, NULL, NULL, &io,
> IOCTL_SERIAL_SET_BAUD_RATE, NULL, 0, NULL, 0);
> > + ok(status == STATUS_INVALID_HANDLE, "Expected %08X, got %08X\n",
> STATUS_INVALID_HANDLE, status);
> 
> GetStdHandle returns a console handle which is not a valid ntdll
> handle,
> so you are not testing what you think.
> 
> --
> Alexandre Julliard
> julliard at winehq.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20090910/822004ce/attachment.htm>


More information about the wine-devel mailing list