diff 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
line wrap: on
line diff
--- a/common/util.h	Thu Jun 26 17:42:52 2014 +0200
+++ b/common/util.h	Fri Jun 27 10:27:08 2014 +0200
@@ -12,6 +12,11 @@
  */
 #include <stdbool.h>
 
+#ifdef WIN32
+#include <windows.h>
+#include <psapi.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -33,6 +38,21 @@
  */
 bool is_admin();
 
+#ifdef WIN32
+/**@brief Get a copy of the processes owner sid
+ *
+ * Copy the SID of the owner of the process hProcess.
+ *
+ * The returned sid structure has to be freed with free by the caller
+ *
+ * @param[in] hProcess A handle to the process whose user should be obtained.
+ * The process must have the PROCESS_QUERY_INFORMATION access permission.
+ *
+ * @returns A copy of the process owners sid or NULL on error.
+ */
+PSID get_process_owner(HANDLE hProcess);
+#endif
+
 #ifdef __cplusplus
 }
 #endif

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