Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86318 - in trunk: boost/interprocess/detail libs/interprocess/doc
From: igaztanaga_at_[hidden]
Date: 2013-10-15 05:07:36


Author: igaztanaga
Date: 2013-10-15 05:07:36 EDT (Tue, 15 Oct 2013)
New Revision: 86318
URL: http://svn.boost.org/trac/boost/changeset/86318

Log:
Fixes #9226 (On some computers, Common Appdata is empty in registry, so boost interprocess cannot work)

Text files modified:
   trunk/boost/interprocess/detail/win32_api.hpp | 14 ++++++++++++++
   trunk/libs/interprocess/doc/interprocess.qbk | 7 ++++---
   2 files changed, 18 insertions(+), 3 deletions(-)

Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp Tue Oct 15 04:54:28 2013 (r86317)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2013-10-15 05:07:36 EDT (Tue, 15 Oct 2013) (r86318)
@@ -31,6 +31,7 @@
 # pragma comment( lib, "oleaut32.lib" )
 # pragma comment( lib, "Ole32.lib" )
 # pragma comment( lib, "Psapi.lib" )
+# pragma comment( lib, "Shell32.lib" ) //SHGetSpecialFolderPathA
 #endif
 
 #if (defined BOOST_INTERPROCESS_WINDOWS)
@@ -170,6 +171,7 @@
 static const unsigned long security_descriptor_revision = 1;
 
 const unsigned long max_record_buffer_size = 0x10000L; // 64K
+const unsigned long max_path = 260;
 
 //Own defines
 static const long SystemTimeOfDayInfoLength = 48;
@@ -979,6 +981,9 @@
 //OleAut32.dll
 extern "C" __declspec(dllimport) long __stdcall VariantClear(wchar_variant * pvarg);
 
+//Shell32.dll
+extern "C" __declspec(dllimport) int __stdcall SHGetSpecialFolderPathA
+ (void* hwnd, const char *pszPath, int csidl, int fCreate);
 
 //EventLog access functions
 
@@ -1761,6 +1766,7 @@
 
 inline void get_shared_documents_folder(std::string &s)
 {
+ #if 0 //Original registry search code
    s.clear();
    void *key;
    if (reg_open_key_ex( hkey_local_machine
@@ -1786,6 +1792,14 @@
          (void)err;
       }
    }
+ #else //registry alternative: SHGetSpecialFolderPathA
+ const int IG_CSIDL_COMMON_APPDATA = 0x0023; // All Users\Application Data
+ s.clear();
+ char szPath[max_path];
+ if(SHGetSpecialFolderPathA(0, szPath, IG_CSIDL_COMMON_APPDATA, 1)) {
+ s = szPath;
+ }
+ #endif
 }
 
 inline void get_registry_value(const char *folder, const char *value_key, std::vector<unsigned char> &s)

Modified: trunk/libs/interprocess/doc/interprocess.qbk
==============================================================================
--- trunk/libs/interprocess/doc/interprocess.qbk Tue Oct 15 04:54:28 2013 (r86317)
+++ trunk/libs/interprocess/doc/interprocess.qbk 2013-10-15 05:07:36 EDT (Tue, 15 Oct 2013) (r86318)
@@ -6715,11 +6715,12 @@
 
 [section:release_notes_boost_1_56_00 Boost 1.56 Release]
 * Fixed bugs:
- * [@https://svn.boost.org/trac/boost/ticket/9221 #9221 ("message_queue deadlock on linux")].
-
+ * [@https://svn.boost.org/trac/boost/ticket/9221 #9221 (['"message_queue deadlock on linux"])].
+ * [@https://svn.boost.org/trac/boost/ticket/9226 #9226 (['"On some computers, Common Appdata is empty in registry, so boost interprocess cannot work"])].
+
 * [*ABI breaking]: [@https://svn.boost.org/trac/boost/ticket/9221 #9221] showed
    that `BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX` option of message queue,
- was completely broken so a ABI break was necessary to have a working implementation.
+ was completely broken so an ABI break was necessary to have a working implementation.
 
 [endsect]
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk