|I would check the
GetPrinter return value, and call
GetLastError only when it fails.
Are you aware that (MSDN [^]):
Security Alert The pDevMode member in the PRINTER_INFO_2, PRINTER_INFO_8, and PRINTER_INFO_9 structures can be NULL.
When this happens, the printer is unusable until the driver is reinstalled successfully.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke