comparison common/util.h @ 983:427e2e18b8c8

Move Shell functions into util Due to a bug in mingw only one c file may include shlobj.h as there is an unguarded inline definition in there leading to multiple definition errors. Thus the get_program_data get_program_files utility functions.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 29 Aug 2014 17:11:35 +0200
parents 216a65d7fc4b
children 1c1964c27b39 6684e5012b7a
comparison
equal deleted inserted replaced
982:85c497b45488 983:427e2e18b8c8
98 * @returns the expanded, null terminated utf-8 string of the value. 98 * @returns the expanded, null terminated utf-8 string of the value.
99 * or NULL on error. 99 * or NULL on error.
100 */ 100 */
101 char * read_registry_string (const HKEY root, const wchar_t *key, 101 char * read_registry_string (const HKEY root, const wchar_t *key,
102 const wchar_t *name); 102 const wchar_t *name);
103
104 /**@brief Get the utf-8 encoded path to the program files folder.
105 *
106 * Uses SHGetKnownFolderPath to look up the ProgramFiles folder.
107 * @returns a newly allocated string containing the value or NULL on
108 * error.
109 */
110 char * get_program_files_folder ();
111
112 /**@brief Get the path to the program data folder.
113 *
114 * Uses SHGetKnownFolderPath to look up the ProgramData folder.
115 * The return value should be freed with CoTaskMemFree
116 * @returns a reference containing the value or NULL on error.
117 */
118 wchar_t * get_program_data_folder ();
119
120 /**@brief Create a directory with restricted access rights
121 *
122 * This creates a security attributes structure that restricts
123 * write access to the Administrators group but allows everyone to read files
124 * in that directory.
125 * Basically a very complicated version of mkdir path -m 644
126 *
127 * If the directory exists the permissions of that directory are checked if
128 * they are acceptable and true or false is returned accordingly.
129 *
130 * Code based on msdn example:
131 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa446595%28v=vs.85%29.aspx
132 *
133 * @param[in] path Path of the directory to create
134 *
135 * @returns true on success of if the directory exists, false on error
136 */
137 bool create_restricted_directory (LPWSTR path);
138
103 #endif 139 #endif
104 140
105 #ifdef __cplusplus 141 #ifdef __cplusplus
106 } 142 }
107 #endif 143 #endif

http://wald.intevation.org/projects/trustbridge/