The Windows code for enumerating printers is not fit for purpose
Categories
(Core :: Printing: Setup, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox81 | --- | fixed |
People
(Reporter: jwatt, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
(Whiteboard: [print2020_v81])
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
I don't currently have a working Windows machine, but I can tell just by looking at the Windows code for enumerating the available printers that it is not fit for purpose. It is using GetProfileStringW
which is for reading data out of Win.ini, and it limits the total length of the names of all printers contatenated together to 1024 bytes.
We need to change this code to use EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, ...)
Assignee | ||
Comment 1•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
Looking at nsDeviceContextSpecWin.cpp, I'd be tempted to do some pretty radical rewriting, as the whole thing looks like an exercise in overengineering; but in the interests of limiting the scope here, I decided to just hack up a patch to just fix EnumerateNativePrinters.
In the process, I noticed that the logging in GetDefaultPrinterName is also broken (it passes a 16-bit string to a %s
format specifier), and the implementation here can also use a proper Win32 API rather than reading a registry string, so I fixed that at the same time.
Comment 3•4 years ago
|
||
I am guessing this will fix bug 1616936.
Updated•4 years ago
|
Comment 5•4 years ago
|
||
bugherder |
Description
•