#4895 closed Bugs (fixed)
Wrong temporary path determined by boost::interprocess::managed_shared_memory
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | Boost 1.46.0 | Component: | interprocess |
Version: | Boost 1.45.0 | Severity: | Showstopper |
Keywords: | Cc: |
Description
Creating a boost::interprocess::managed_shared_memory object (create_only) may determine a wrong temporary path for the shared memory file, if the COM environment has already been initialized for the current thread.
The function inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_class, const wchar_t *wmi_class_var) in the file \boost\interprocess\detail\win32_api.hpp doesn't always work correct. It gets called to fetch the last bootup time from WMI. The last bootup is then used to build the temporary path.
The call to CoInitializeSecurity(..) may fail due to various reasons, which are not always a failure. Eg. the CoInitializeSecurity(..) has already been called with different settings (-> HRESULT is 0x80010119).
Remarks for the function mention above:
- The CoInitialize(..) / CoUninitialize(..) call have to be balanced (with RAII).
- Also the CoCreateInstance(..) / Release(..) calls have to be balanced.
Both are constraints are broken due to the several early returns.
- Also the call to CoInitialize may fail - how to deal with that?
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Milestone: | To Be Determined → Boost 1.46.0 |
---|---|
Severity: | Problem → Showstopper |
comment:3 by , 12 years ago
Please try SVN for recent changes. I've balanced all calls and the code supports already initialized security. I'm not an expert in COM issues, so I would need some help with this issue. Thanks for the report.
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
WMI is provoking a lot of problems for Boost Interprocess users. I've decided to remove bootstamp use in windows to obtain kernel persistence in Windows. This means that windows shared memory/queues will survive to reboots, but this behaviour is allowed by POSIX. Using bootstamps to detect reboots is doing more harm than good.
WMI is removed in Boost 1.47
comment:6 by , 11 years ago
Since WMI usage was not removed for 1.47.0 please have a look at my additions to #5392!
comment:7 by , 11 years ago
This has not been fixed in Boost 1.47.0. The svn versions have had this fix for quite some time now.
This may be related to ticket:4907.
Please fix this in boost 1.46 if possible. Or post a patch here and I'll be happy to test it on Windows 7 and Windows XP.