comparison common/util.h @ 670:175370634226

Move getProcessOwner to util and use it to skip the current user in locate other hives
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 27 Jun 2014 10:27:08 +0200
parents 78959fd970b0
children 4ad764bfb39c
comparison
equal deleted inserted replaced
669:7147550ee15d 670:175370634226
9 #define COMMON_UTIL_H 9 #define COMMON_UTIL_H
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
15 #ifdef WIN32
16 #include <windows.h>
17 #include <psapi.h>
18 #endif
14 19
15 #ifdef __cplusplus 20 #ifdef __cplusplus
16 extern "C" { 21 extern "C" {
17 #endif 22 #endif
18 23
31 * 36 *
32 * @returns True if the user is in the admin group. False otherwise or on error. 37 * @returns True if the user is in the admin group. False otherwise or on error.
33 */ 38 */
34 bool is_admin(); 39 bool is_admin();
35 40
41 #ifdef WIN32
42 /**@brief Get a copy of the processes owner sid
43 *
44 * Copy the SID of the owner of the process hProcess.
45 *
46 * The returned sid structure has to be freed with free by the caller
47 *
48 * @param[in] hProcess A handle to the process whose user should be obtained.
49 * The process must have the PROCESS_QUERY_INFORMATION access permission.
50 *
51 * @returns A copy of the process owners sid or NULL on error.
52 */
53 PSID get_process_owner(HANDLE hProcess);
54 #endif
55
36 #ifdef __cplusplus 56 #ifdef __cplusplus
37 } 57 }
38 #endif 58 #endif
39 59
40 #endif // COMMON_UTIL_H 60 #endif // COMMON_UTIL_H

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