简体   繁体   English

boost :: interprocess message_queue-Windows 7低完整性进程

[英]boost::interprocess message_queue - Windows 7 low integrity process

I'm creating a boost::interprocess::message_queue from a medium integrity process like so: 我正在从中等完整性过程创建boost :: interprocess :: message_queue,如下所示:

permissions p;
p.set_unrestricted();
message_queue queue(create_only, queueName, 1, sizeof(message_args), p);

And opening the queue from a low integrity process: 并从低完整性过程中打开队列:

message_queue queue(open_only, queueName);

This fails in Windows with Access denied. 在Windows中, Access denied.失败Access denied. This is because the directory used to store the message_queue is in %ProgramData% ( %ProgramData%\\boost_interprocess\\ ), for which low integrity processes do not have write permissions. 这是因为用于存储message_queue的目录位于%ProgramData%%ProgramData%\\boost_interprocess\\ )中,该目录的低完整性进程没有写权限。

Is there any way to change the directory in which boost stores interprocess message queues? 有什么方法可以更改boost存储进程间消息队列的目录? Is there any other way to make this work between a medium- or high-integrity process and a low-integrity process? 还有其他方法可以使此过程在中等或高完整性过程与低完整性过程之间进行吗?

I'm using boost 1.55, on Windows 7, built with VC++ version v120 in Visual Studio 2013. 我正在Windows 7上使用Boost 1.55,在Visual Studio 2013中使用VC ++版本v120构建。

I did not try this myself but that seems to be possible according to boost documentation. 我自己没有尝试过,但是根据boost文档看来这是可能的。

In Windows platforms, if "Common AppData" key is present in the registry, "boost_interprocess" folder is created in that directory (in XP usually "C:\\Documents and Settings\\All Users\\Application Data" and in Vista "C:\\ProgramData"). 在Windows平台中,如果注册表中存在“ Common AppData”项,则将在该目录中创建“ boost_interprocess”文件夹(在XP中通常为“ C:\\ Documents and Settings \\ All Users \\ Application Data”,而在Vista中为“ C:\\ ProgramData”)。 For Windows platforms without that registry key and Unix systems, shared memory is created in the system temporary files directory ("/tmp" or similar). 对于没有该注册表项的Windows平台和Unix系统,共享内存是在系统临时文件目录(“ / tmp”或类似目录)中创建的。

See link for more details. 有关更多详细信息,请参见链接

I did search Windows registry for "Common AppData" key and found it under: 我没有在Windows注册表中搜索“ Common AppData”键,并在以下位置找到了它:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Common AppData key points to %ProgramData% so you can try to change it to something else or remove the key entirely and see if a default location has write permission for everybody. Common AppData密钥指向%ProgramData%因此您可以尝试将其更改为其他名称或完全删除密钥,并查看默认位置是否对所有人都有写权限。

EDIT: I found better alternative. 编辑:我发现更好的选择。 Define new path using BOOST_INTERPROCESS_SHARED_DIR_PATH before interprocess #includes . interprocess #includes之前,使用BOOST_INTERPROCESS_SHARED_DIR_PATH定义新路径。 (Added in boost 1.56) (增加了1.56)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 boost::interprocess::message_queue 在第二个进程中没有收到消息 - boost::interprocess::message_queue no message received in second process boost interprocess message_queue和fork - boost interprocess message_queue and fork boost :: interprocess :: message_queue权限被拒绝 - boost::interprocess::message_queue permission denied 使用boost :: interprocess :: message_queue多个应用程序安全吗? - Is it safe to consume a boost::interprocess::message_queue multiple applications? 错误:“ size_type”不是“ boost :: interprocess :: message_queue”的成员 - error: ‘size_type’ is not a member of ‘boost::interprocess::message_queue’ boost::interprocess message_queue 性能 - 相当慢? - boost::interprocess message_queue performance - rather slow? boost :: interprocess :: message_queue使用Visual C ++停止在发布模式下工作 - boost::interprocess::message_queue stops working in Release mode with visual C++ Boost进程间message_queue具有非常量get_num_msg()。 为什么? - Boost interprocess message_queue has non const get_num_msg(). Why? 我可以通过boost :: interprocess :: message_queue发送C ++类对象吗? - Can I send a C++ class object via boost::interprocess::message_queue? 如何知道boost :: interprocess :: message_queue已从系统中删除? - How to get know that boost::interprocess::message_queue was removed from system?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM