Description of problem:
The way IOCTL_GET_INFORMATION is handled suggests that if the supplied output buffer is too small, the required size would be passed back to the caller. This doesn't work because we use STATUS_BUFFER_TOO_SMALL (error) as opposed to STATUS_BUFFER_OVERFLOW (warning) and the IO manager will not propagate anything back if the ioctl failed with an error. Switching to the warning code still wouldn't work because we use METHOD_BUFFERED and the IO manager would actually attempt to copy that many bytes back to the userspace buffer and corrupt it.
Interesting read about the topic
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run the vioser-test app (vioserial/app)
2. Type 'i' for info
Serial port information is printed
Created attachment 1139850 [details]
Ioctl failed with code 122_with build 102
I tried this issue with build 102 and a newer build 115.
With the build 102, run vioser-test.exe, type "i", error massage "Ioctl failed with code 122" shown, detail please refer to the attachment1 [details].
With the build 115, run vioser-test.exe, type "i", Serial port information is printed, detail please refer to the attachment2 [details].
According to the comment 0, actual result is "Serial port information is printed", Expected results is "IOCTL fails". But I verified results seem not match the comment 0. So please help to confirm if the actual result and expected result of comment 0 were written reversed? Thanks so much~~
Created attachment 1139851 [details]
Serial port information is printed_with build 115
Hi Peixiu Hou,
Yes, the actual and expected result in comment 0 are reversed. "Serial port information is printed" is the expected result. Sorry about that!
I have encountered a problem with the latest 117 drivers when using IOCTL_GET_INFORMATION. Here is the specific code snippet I have:
ULONG length = 0;
BOOL success = DeviceIoControl(handle,
When using the 102 drivers, this works successfully. But when I use the latest 117 drivers the DeviceIoControl call returns false and GetLastError() returns 1 with a message of "Incorrect function". Not sure if the changes discussed here somehow broke this.
(In reply to Nat Meo from comment #6)
> I have encountered a problem with the latest 117 drivers when using
> IOCTL_GET_INFORMATION. Here is the specific code snippet I have:
> BYTE buffer;
> ULONG length = 0;
> BOOL success = DeviceIoControl(handle,
> When using the 102 drivers, this works successfully. But when I use the
> latest 117 drivers the DeviceIoControl call returns false and GetLastError()
> returns 1 with a message of "Incorrect function". Not sure if the changes
> discussed here somehow broke this.
Yes, they did. The IOCTL code changed (intentionally) but the driver was also supposed to keep responding to the old one for compatibility. The second part somehow didn't make it into the tree.
A huge thank you for the report. If you know that you'll always query driver 117 or later, the workaround is to rebuild the code against the current sources where the code is defined like so:
#define IOCTL_GET_INFORMATION CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
Created attachment 1165801 [details]
Serial port information is normal with build 117
I retested this issue with build 117 driver, step as comment#0, the output serial port information is normal, detail please refer to the attachment, thanks~
change status to Verified according to comment#9
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.