Re: [Boost-bugs] [Boost C++ Libraries] #5120: boost.interprocess.detail tmp_dir_helpers.hpp get_bootstamp(std::string, bool) function problem

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5120: boost.interprocess.detail tmp_dir_helpers.hpp get_bootstamp(std::string, bool) function problem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-03-24 18:45:19


#5120: boost.interprocess.detail tmp_dir_helpers.hpp get_bootstamp(std::string,
bool) function problem
-----------------------------------------------------+----------------------
  Reporter: Darko Nesovic <nesovicdarko@…> | Owner: igaztanaga
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: interprocess
   Version: Boost 1.45.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------------+----------------------

Comment (by petke@…):

 I noticed the same bug. CoInitializeSecurity returns RPC_E_TOO_LATE the
 second time it is called. Isn't it an error for CoInitializeSecurity to be
 called more than once for a process? I'll try and revert the
 get_last_bootup_time to the old version.

 Here is the message I sent to boost-users_at_[hidden] in case you need
 more info:

 I think I have found a bug in the boost interprocess library. I would be
 thankful for any workaround.

 I am maintaining some code that was upgraded to use boost_1_45_0 running
 on windows7.

 We have some dll that creates a file for sharing:

 C:\ProgramData/boost_interprocess/20110321233336.335895/share_memory_segment_somenameengine_0

 The dll launches a exe and shares some memory with it. However this exe
 tries to read the shared memory at location:

 C:\ProgramData/boost_interprocess//share_memory_segment_somenameengine_0

 The folder name "20110321233336.335895" is missing in that path name.

 Debugging this is seems to be because the boost library tries to get the
 windows system boot time by calling
 boost::interprocess::winapi::get_last_bootup_time.. which fails for some
 reason. The weird thing is that the exe (indirectly) calls this twice, and
 the first time it works but not the second time. (The dll also calls it
 twice but that works just fine.)

 In get_wmi_class_attribute the time this if statement evaulates to true,
 next time it does not:
         if( 0 == CoInitializeSecurity( 0, -1, 0, 0,
 RPC_C_AUTHN_LEVEL_PKT_IG, RPC_C_IMP_LEVEL_IMPERSONATE_IG, 0, EOAC_NONE_IG,
 0 ) )

 Here is the call stack for context:

 First time work fine CoInitializeSecurity works..
>
 boost::interprocess::winapi::get_wmi_class_attribute(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & strValue="", const wchar_t * wmi_class=0x01595704, const wchar_t *
 wmi_class_var=0x01595730) Line 1457 C++
 boost::interprocess::winapi::get_last_bootup_time(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & strValue="") Line 1554 C++
 boost::interprocess::winapi::get_last_bootup_time(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & str="") Line 1569 C++
 boost::interprocess::detail::get_bootstamp(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & s="C:\ProgramData/boost_interprocess/", bool add=true) Line 41
 C++
 boost::interprocess::detail::tmp_folder(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & tmp_name="C:\ProgramData/boost_interprocess/") Line 108 C++
 !!!boost::interprocess::detail::create_tmp_and_clean_old(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & tmp_name="C:\ProgramData/boost_interprocess/") Line 134 C++
 !!!boost::interprocess::detail::create_tmp_and_clean_old_and_get_filename(const
 char * filename=0x002502f8,
 std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
 tmp_name="C:\ProgramData/boost_interprocess/") Line 154 C++
 boost::interprocess::shared_memory_object::priv_open_or_create(boost::interprocess::detail::create_enum_t
 type=DoOpen, const char * filename=0x002502f8, boost::interprocess::mode_t
 mode=-2147483648, const boost::interprocess::permissions & perm={...})
 Line 181 C++
 boost::interprocess::shared_memory_object::shared_memory_object(boost::interprocess::open_only_t
 __formal={...}, const char * name=0x002502f8, boost::interprocess::mode_t
 mode=-2147483648) Line 76 C++

 Second time CoInitializeSecurity does not work
>
 boost::interprocess::winapi::get_wmi_class_attribute(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & strValue="", const wchar_t * wmi_class=0x01595704, const wchar_t *
 wmi_class_var=0x01595730) Line 1457 C++
 boost::interprocess::winapi::get_last_bootup_time(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & strValue="") Line 1554 C++
 boost::interprocess::winapi::get_last_bootup_time(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & str="") Line 1569 C++
 boost::interprocess::detail::get_bootstamp(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & s="C:\ProgramData/boost_interprocess/", bool add=true) Line 41
 C++
 boost::interprocess::detail::tmp_folder(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> & tmp_name="C:\ProgramData/boost_interprocess/") Line 108 C++
         !!!boost::interprocess::detail::tmp_filename(const char *
 filename=0x002502f8,
 std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
 tmp_name="C:\ProgramData/boost_interprocess/") Line 114 C++
 !!!boost::interprocess::detail::create_tmp_and_clean_old_and_get_filename(const
 char * filename=0x002502f8,
 std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
 tmp_name="C:\ProgramData/boost_interprocess/") Line 155 C++
 boost::interprocess::shared_memory_object::priv_open_or_create(boost::interprocess::detail::create_enum_t
 type=DoOpen, const char * filename=0x002502f8, boost::interprocess::mode_t
 mode=-2147483648, const boost::interprocess::permissions & perm={...})
 Line 181 C++
 boost::interprocess::shared_memory_object::shared_memory_object(boost::interprocess::open_only_t
 __formal={...}, const char * name=0x002502f8, boost::interprocess::mode_t
 mode=-2147483648) Line 76 C++

 Thanks, Patrik

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5120#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC