Boost C++ Libraries: Ticket #9226: On some computer, the Common Appdata is empty in registry, so boost interprocess cannot work. https://svn.boost.org/trac10/ticket/9226 <p> 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. </p> <p> My suggestion is to use SHGetSpecialFolderPathA instead of get the folder from registry, in HKEY_LOCALMACHINE\SOFTWARE<br />Microsoft<br />Windows<br /><a class="missing wiki">CurrentVersion</a><br />Explorer<br />Shell Folders. </p> <p> The code is like this: inline void get_shared_documents_folder(std::string &amp;s) { </p> <blockquote> <p> s.clear(); char szPath[MAX_PATH]; if(SHGetSpecialFolderPathA(NULL,szPath,CSIDL_COMMON_APPDATA,FALSE)) { </p> <blockquote> <p> s = szPath; </p> </blockquote> <p> } </p> </blockquote> <p> } </p> <p> Thanks Cheng Yang </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9226 Trac 1.4.3 Ion Gaztañaga Sun, 13 Oct 2013 19:24:04 GMT <link>https://svn.boost.org/trac10/ticket/9226#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9226#comment:1</guid> <description> <p> Thanks for the report and proposal, it would be implemented as suggested. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Tue, 15 Oct 2013 09:07:37 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9226#comment:2 https://svn.boost.org/trac10/ticket/9226#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/86318" title="Fixes #9226 (On some computers, Common Appdata is empty in registry, ...">[86318]</a>) Fixes <a class="reopened ticket" href="https://svn.boost.org/trac10/ticket/9226" title="#9226: Bugs: On some computer, the Common Appdata is empty in registry, so boost ... (reopened)">#9226</a> (On some computers, Common Appdata is empty in registry, so boost interprocess cannot work) </p> Ticket Aaron_Wright@… Tue, 15 Apr 2014 18:04:33 GMT <link>https://svn.boost.org/trac10/ticket/9226#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9226#comment:3</guid> <description> <p> SHGetSpecialFolderPathA is not supported. SHGetKnownFolderPath is the new way. Might need to support both the new and the old via #ifdef. </p> </description> <category>Ticket</category> </item> <item> <author>evgeny.panasyuk@…</author> <pubDate>Fri, 06 Mar 2015 12:37:51 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/9226#comment:4 https://svn.boost.org/trac10/ticket/9226#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> There is same problem again in 1.57. Path is taken directly from registry entry which is empty on certain environments. </p> Ticket Aaron_Wright@… Fri, 06 Mar 2015 16:16:32 GMT <link>https://svn.boost.org/trac10/ticket/9226#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9226#comment:5</guid> <description> <p> I found the best way to deal with this is to use a static hidden folder on the C: drive, and bypass all the code that picks a folder based on the Common Appdata and the startup time of the Event service. (Which is another ticket you should look at.) It is almost comical how hard Windows makes this. </p> </description> <category>Ticket</category> </item> </channel> </rss>