mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-08 12:38:01 +02:00
Minor optimization in _dbus_getsid().
MSDN recommands to use GetCurrentProcess() for current process. Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
This commit is contained in:
parent
87d40ec950
commit
4a39439727
1 changed files with 8 additions and 2 deletions
|
|
@ -981,7 +981,7 @@ static BOOL is_winxp_sp3_or_lower()
|
|||
|
||||
/** Gets our SID
|
||||
* @param sid points to sid buffer, need to be freed with LocalFree()
|
||||
* @param process_id the process id for which the sid should be returned
|
||||
* @param process_id the process id for which the sid should be returned (use 0 for current process)
|
||||
* @returns process sid
|
||||
*/
|
||||
dbus_bool_t
|
||||
|
|
@ -993,7 +993,13 @@ _dbus_getsid(char **sid, dbus_pid_t process_id)
|
|||
PSID psid;
|
||||
int retval = FALSE;
|
||||
|
||||
HANDLE process_handle = OpenProcess(is_winxp_sp3_or_lower() ? PROCESS_QUERY_INFORMATION : PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id);
|
||||
HANDLE process_handle;
|
||||
if (process_id == 0)
|
||||
process_handle = GetCurrentProcess();
|
||||
else if (is_winxp_sp3_or_lower())
|
||||
process_handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, process_id);
|
||||
else
|
||||
process_handle = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id);
|
||||
|
||||
if (!OpenProcessToken (process_handle, TOKEN_QUERY, &process_token))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue