comparison common/util.h @ 505:78959fd970b0

Add is_admin and implement it for windows
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 09:19:53 +0000
parents 17e1c8f37d72
children 175370634226
comparison
equal deleted inserted replaced
504:3cf72c5282e8 505:78959fd970b0
10 /* @file util.h 10 /* @file util.h
11 * @brief The usual useful stuff that fit nowhere else 11 * @brief The usual useful stuff that fit nowhere else
12 */ 12 */
13 #include <stdbool.h> 13 #include <stdbool.h>
14 14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
15 /**@brief Check if the current process is running with elevated privileges. 19 /**@brief Check if the current process is running with elevated privileges.
16 * 20 *
17 * Elevates the current process token to check if it is marked as elevated. 21 * Elevates the current process token to check if it is marked as elevated.
18 * Uses TokenElevation on windows and checks effective UID on Linux. 22 * Uses TokenElevation on windows and checks effective UID on Linux.
19 * 23 *
20 * @returns true if the current process is elevated.*/ 24 * @returns true if the current process is elevated.*/
21 bool is_elevated(); 25 bool is_elevated();
22 26
27 /**@brief Check if the user is in the administrators group.
28 *
29 * The function checks if the account that startet this process
30 * belongs to a user that is a member of the Administrators group.
31 *
32 * @returns True if the user is in the admin group. False otherwise or on error.
33 */
34 bool is_admin();
35
36 #ifdef __cplusplus
37 }
38 #endif
39
23 #endif // COMMON_UTIL_H 40 #endif // COMMON_UTIL_H

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