“访问被拒绝”关于在 Windows 服务程序中的 Mailslot 上写入
我使用 Mailslots(在 Delphi 7 中)作为程序间对话框,一切正常。
但是,当我使用我的一个程序(在 Windows XP 中)作为 Windows 服务时,当另一个(经典管理员用户的)程序尝试写入邮槽时,我收到一条消息“邮槽访问被拒绝”。 我知道这肯定是一个权限问题,因为服务拥有系统权限,但是......解决方案是什么?
I use Mailslots (in Delphi 7) for inter-programs dialog and all is OK.
But when I use one of my program (in Windows XP) as Windows service I have a message "Mailslot Access Denied", when another (classical admin user's) program try to write to the mailslot.
I Understand that it is surely a rights problem since service have SYSTEM rights but...what is the solution ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调用 CreateMailslot() 时,指定一个允许对邮槽进行所有访问的 SECURITY_DESCRIPTOR,例如:
When calling
CreateMailslot()
, specify aSECURITY_DESCRIPTOR
that allows all access to the mailslot, eg:我使用C++ Embarcardero 2010,并且我必须对 Remy Lebeau 的解决方案进行一些修改,因为 CreateMailSlot 函数接收SECURITY_ATTRIBUTES * 类型的指针,而不是 SECURITY_DESCRIPTOR * 类型的指针。
我的 C++ 解决方案是:
注意:在我的例子中,我有三个应用程序:
I use C++ Embarcardero 2010, and I have to do some modifications to the solution of Remy Lebeau because the CreateMailSlot function receive a pointer of type SECURITY_ATTRIBUTES *, and not a pointer of type SECURITY_DESCRIPTOR *.
My solution in C++ is:
Note: In my case I've three applications: