MCPcopy Create free account
hub / github.com/ColorCop/ColorCop / GetShellFolderPath

Method GetShellFolderPath

ColorCop/ColorCop.cpp:113–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113BOOL CColorCopApp::GetShellFolderPath(LPCTSTR pShellFolder, LPTSTR pShellPath) {
114 // pShellFolder can be one of the following
115 // AppData, Cache, Cookies, Desktop, Favorites, Fonts, History, NetHood,
116 // Personal, Printhood, Programs, Recent, SendTo, Start Menu, Startup,
117 // Templates, ShellNew
118 DWORD rc;
119 DWORD length = MAX_PATH;
120 DWORD type = REG_SZ;
121 HKEY hkey;
122
123 rc = RegOpenKeyEx(HKEY_CURRENT_USER,
124 _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"),
125 0, KEY_READ, &hkey);
126
127 if (rc == ERROR_SUCCESS) {
128 rc = RegQueryValueEx(hkey, pShellFolder, NULL, &type,
129 reinterpret_cast<BYTE*>(pShellPath), &length);
130 RegCloseKey(hkey);
131 }
132
133 if (rc == ERROR_SUCCESS) {
134 return TRUE;
135 } else {
136 return FALSE;
137 }
138}
139
140CString CColorCopApp::GetSettingsFolder() {
141 CString path;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected