在 QtService 上使用 QLocalServer :如何为 QLocalServer 创建的命名管道设置安全属性?
我正在尝试在win7上的服务应用程序中使用QLocalServer。 QLocalServer 的 Windows 实现使用命名管道,并且由于 winVista 尝试从 GUI 访问它会导致错误。甚至还有关于它的 QT 错误,但巨魔们在没有任何修复的情况下关闭了它。 所以我的问题是: 有没有办法更改已在服务命名管道中创建的安全属性,以使其可以从 GUI 应用程序访问? 或者唯一的方法是复制粘贴 QT QLocalServer 对象并向其创建管道的代码添加安全属性? 我授予对管道句柄的访问权限
template <class To, class From> inline To* d_ptr(From* ptr)
{
return (To*)QObjectPrivate::get(ptr);
}
...
QLocalServerPrivate* p=d_ptr<QLocalServerPrivate>(this);
但是现在如何处理它们呢?
I am trying to use QLocalServer in service application on win7.
QLocalServer's windows implementation uses named pipes, and since winVista try to access it from GUI causes error. There was even QT bug about it, but trolls closed it without any fixing.
So my question is:
Is there a way to change security attributes of already created in service named pipe to make it accessible from gui applications?
Or the only way is copypaste QT QLocalServer object and add security attributes to its code which creates pipe?
I grant access to pipes handles with
template <class To, class From> inline To* d_ptr(From* ptr)
{
return (To*)QObjectPrivate::get(ptr);
}
...
QLocalServerPrivate* p=d_ptr<QLocalServerPrivate>(this);
But what to do with them now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果相信此管道无法在 LocalAdmin 用户下更改安全属性...
所以我编辑了 QLocalServer,这是我不想做的:(
if believe to this pipe security attributes cannot be changed under LocalAdmin user...
so I edited QLocalServer, which i did not wanted to do :(
几年前我也遇到过同样的问题。也许它已经在最新的 Qt 版本中修复了。我通过下一个解决方法解决了该问题:
I faced with the same problem few years ago. Maybe it already fixed in latest Qt version. I resolved the problem with next workaround: