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

Alexandre Julliard julliard at winehq.org
Tue Sep 8 15:25:34 CDT 2009


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



More information about the wine-devel mailing list