Delphi Win32服务“打印机选择无效”; 2008 64位标准服务器上的错误 [英] Delphi Win32 Service "Printer Selected is not valid" error on 2008 64bit standard server

查看:266
本文介绍了Delphi Win32服务“打印机选择无效”; 2008 64位标准服务器上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在delphi 7中开发了一个简单的 win 32服务,该服务执行一些打印操作。所有操作在我们的XP计算机上都可以正常运行,但在目标 Windows 2008标准服务器上无法正常运行。当我在print语句周围尝试try除块时,会导致出现所选打印机无效 错误。

I have developed a simple win 32 service in delphi 7 which performs some print operations. All works fine on our XP machines, but fails on the target Windows 2008 standard server. When I put a try except block around the print statement, it results in the "Printer Selected is not valid" error.

当我检查时将打印机对象用于打印机计数和事件,将打印机对象中所有可用的打印机写到一个文件中,即可正常工作。只有当我尝试执行打印(在任何本地和网络上的打印机上)时,它才会失败。

When I check the Printer object for count of printers and event write out all the printers available in the Printer object to a file, it works fine. Only when I try to perform a print (on any printer local and network), it fails.

基于使用google的大量研究,我发现了很多建议使用本地帐户,网络帐户,特定帐户,LogonAsUser,ImpersonateUser,LoadUserProfile等,但是没有任何作用。我还在已安装的打印机上设置了安全性,每个人都可以使用。

Based on lot of research using google, I found quite a few suggestions to use local acct, network acct, specific acct, LogonAsUser, ImpersonateUser, LoadUserProfile, etc, etc. but nothing is working. I have also set up security on the installed printers to be accessible to everyone.

这件事确实使我发疯。

This thing is really driving me crazy. Any help is greately appreciated.

谢谢

推荐答案

由于会话0隔离是在Vista中引入的。服务始终在会话0中运行,但是在XP和更早版本中,第一个登录的用户也在会话0中运行,因此允许服务访问该用户的桌面(从而允许交互服务)和资源(例如共享和打印机) 。从Vista开始,用户不再在会话0中运行,因此服务不再有权访问用户特定的资源。服务必须模拟要访问的用户帐户。

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.

这篇关于Delphi Win32服务“打印机选择无效”; 2008 64位标准服务器上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆