boost::interprocess message_queue - Windows 7 个低完整性进程
boost::interprocess message_queue - Windows 7 low integrity process
我正在从中等完整性流程创建一个 boost::interprocess::message_queue,如下所示:
permissions p;
p.set_unrestricted();
message_queue queue(create_only, queueName, 1, sizeof(message_args), p);
并从低完整性进程打开队列:
message_queue queue(open_only, queueName);
This fail in Windows with Access denied.
这是因为用于存储 message_queue 的目录在 %ProgramData%
(%ProgramData%\boost_interprocess\
) 中,为此低完整性进程没有写入权限。
有没有办法改变boost存放进程间消息队列的目录?是否有任何其他方法可以使此工作介于中等或高完整性进程和低完整性进程之间?
我在 Windows 7 上使用 boost 1.55,在 Visual Studio 2013 年使用 VC++ 版本 v120 构建。
我自己没有尝试过,但根据 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"). For Windows platforms without that
registry key and Unix systems, shared memory is created in the system
temporary files directory ("/tmp" or similar).
有关详细信息,请参阅 link。
我确实在 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
密钥指向 %ProgramData%
因此您可以尝试将其更改为其他内容或完全删除密钥并查看默认位置是否对每个人都有写权限。
编辑: 我找到了更好的选择。在 interprocess #includes
之前使用 BOOST_INTERPROCESS_SHARED_DIR_PATH
定义新路径。 (在 boost 1.56 中添加)
我正在从中等完整性流程创建一个 boost::interprocess::message_queue,如下所示:
permissions p;
p.set_unrestricted();
message_queue queue(create_only, queueName, 1, sizeof(message_args), p);
并从低完整性进程打开队列:
message_queue queue(open_only, queueName);
This fail in Windows with Access denied.
这是因为用于存储 message_queue 的目录在 %ProgramData%
(%ProgramData%\boost_interprocess\
) 中,为此低完整性进程没有写入权限。
有没有办法改变boost存放进程间消息队列的目录?是否有任何其他方法可以使此工作介于中等或高完整性进程和低完整性进程之间?
我在 Windows 7 上使用 boost 1.55,在 Visual Studio 2013 年使用 VC++ 版本 v120 构建。
我自己没有尝试过,但根据 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"). For Windows platforms without that registry key and Unix systems, shared memory is created in the system temporary files directory ("/tmp" or similar).
有关详细信息,请参阅 link。
我确实在 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
密钥指向 %ProgramData%
因此您可以尝试将其更改为其他内容或完全删除密钥并查看默认位置是否对每个人都有写权限。
编辑: 我找到了更好的选择。在 interprocess #includes
之前使用 BOOST_INTERPROCESS_SHARED_DIR_PATH
定义新路径。 (在 boost 1.56 中添加)