Opened 9 years ago
Last modified 8 years ago
#9226 reopened Bugs
On some computer, the Common Appdata is empty in registry, so boost interprocess cannot work.
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | interprocess |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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
Change History (5)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 9 years ago
SHGetSpecialFolderPathA is not supported. SHGetKnownFolderPath is the new way. Might need to support both the new and the old via #ifdef.
comment:4 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
There is same problem again in 1.57. Path is taken directly from registry entry which is empty on certain environments.
comment:5 by , 8 years ago
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.
Thanks for the report and proposal, it would be implemented as suggested.