[Boost-bugs] [Boost C++ Libraries] #9226: On some computer, the Common Appdata is empty in registry, so boost interprocess cannot work.

Subject: [Boost-bugs] [Boost C++ Libraries] #9226: On some computer, the Common Appdata is empty in registry, so boost interprocess cannot work.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-11 07:24:39


#9226: On some computer, the Common Appdata is empty in registry, so boost
interprocess cannot work.
------------------------------+--------------------------
 Reporter: luckyangcheng@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------+--------------------------
 Our application is used by millions of people. I found that about 0.1 ~
 0.3 % computers will miss the registry item, or set to be empty, so lead
 to lots of trouble shooting.

 My suggestion is to use SHGetSpecialFolderPathA instead of get the folder
 from registry, in
 HKEY_LOCALMACHINE\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell
 Folders.

 The code is like this:
 inline void get_shared_documents_folder(std::string &s)
 {
    s.clear();
    char szPath[MAX_PATH];
    if(SHGetSpecialFolderPathA(NULL,szPath,CSIDL_COMMON_APPDATA,FALSE))
    {
            s = szPath;
    }
 }

 Thanks
 Cheng Yang

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9226>
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:14 UTC