Delphi Win32 Service “Printer Selected is not valid” error on 2008 64bit standard server

假如想象 提交于 2019-12-04 09:57:52

This is likely due to Session 0 Isolation, which was introduced in Vista. Services always run in Session 0, but in XP and earlier, the first user to log in also runs in Session 0, thus allowing services to access that user's desktop (thus allowing for "Interactive" services) and resources (like shares and printers). In Vista onwards, users never run in Session 0 anymore, so services do not have access to user-specific resources anymore. A service has to impersonate the user account it wants to access.

Always hard to answer an "it doesn't work" question. But I can speculate. Microsoft has warned about printing from a service in the past. I think the problem is that printer drivers are rarely designed to run in the kind of service environment that Windows 2008 provides. Services run in an isolated session, they cannot interact with the desktop anymore. Printer drivers tend to be too chatty, doing stuff like prompting the user that there's a paper jam. Or that it is time to buy a new factory approved toner cartridge. That doesn't work well in session 0, nobody can hear it scream. Quite undiagnosable, you just can't tell why the service seized-up.

Maybe they nailed this down in 2008 and blocked it completely. No idea, you'll find the people that know this at serverfault.com

I get the same kind of error, much google work done an came on http://www.codenewsfast.com/cnf/article//permalink.art-ng1612q9464

It seems that the delphi 2007 printer unit:Printer.pas is not designed for Vista and up. The referenced entry give the option to change the source of Printer.pas. On vista it solved my problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!