Issue 28161: Opening CON for write access fails (original) (raw)
When opening the CON device the underlying CreateFile call needs to use either GENERIC_READ or GENERIC_WRITE access, but not both. Currently opening for writing fails as follows:
open('CON', 'wb', buffering=0) Traceback (most recent call last): File "", line 1, in OSError: [WinError 87] The parameter is incorrect: 'CON'
If self->writable is true, it should set access = GENERIC_WRITE
, not access |= GENERIC_WRITE
.
This only applies to CON. It's normal to open CONIN$ and CONOUT$ with both read and write access, and WindowsConsoleIO handles that correctly.