gio: re-use win32 SID helpers

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau
2022-01-12 17:29:19 +04:00
parent d4a66baadb
commit e66b9489b7
4 changed files with 43 additions and 69 deletions

View File

@@ -207,3 +207,28 @@ _g_win32_sid_to_string (SID *sid, GError **error)
LocalFree (tmp);
return ret;
}
/**
* _g_win32_current_process_sid_string: (skip)
* @error: return location for a #GError, or %NULL
*
* Get the current process SID, as a string.
*
* Returns: A newly-allocated string, or NULL in case of an error.
*/
gchar *
_g_win32_current_process_sid_string (GError **error)
{
SID *sid;
gchar *ret;
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
sid = _g_win32_process_get_access_token_sid (0, error);
if (!sid)
return NULL;
ret = _g_win32_sid_to_string (sid, error);
g_free (sid);
return ret;
}