diff options
author | Ron Yorston <rmy@pobox.com> | 2019-01-08 15:38:26 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-01-08 15:38:26 +0000 |
commit | 59701e7f6a483d4aad4dc7088c673cd69fe294c8 (patch) | |
tree | e17a4a69fa80130065a9ce3ad31690530591dbbe /win32 | |
parent | 64a2959683ae6f876966ff81cbd87b1efd14de9d (diff) | |
download | busybox-w32-59701e7f6a483d4aad4dc7088c673cd69fe294c8.tar.gz busybox-w32-59701e7f6a483d4aad4dc7088c673cd69fe294c8.tar.bz2 busybox-w32-59701e7f6a483d4aad4dc7088c673cd69fe294c8.zip |
ps: add user and group columns
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/win32/process.c b/win32/process.c index 37496db7b..b29780be8 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -457,6 +457,7 @@ UNUSED_PARAM | |||
457 | ) | 457 | ) |
458 | { | 458 | { |
459 | PROCESSENTRY32 pe; | 459 | PROCESSENTRY32 pe; |
460 | HANDLE proc; | ||
460 | const char *comm, *name; | 461 | const char *comm, *name; |
461 | BOOL ret; | 462 | BOOL ret; |
462 | 463 | ||
@@ -484,7 +485,6 @@ UNUSED_PARAM | |||
484 | 485 | ||
485 | #if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG | 486 | #if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG |
486 | if (flags & (PSSCAN_STIME|PSSCAN_UTIME|PSSCAN_START_TIME)) { | 487 | if (flags & (PSSCAN_STIME|PSSCAN_UTIME|PSSCAN_START_TIME)) { |
487 | HANDLE proc; | ||
488 | FILETIME crTime, exTime, keTime, usTime; | 488 | FILETIME crTime, exTime, keTime, usTime; |
489 | 489 | ||
490 | if ((proc=OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, | 490 | if ((proc=OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, |
@@ -507,6 +507,15 @@ UNUSED_PARAM | |||
507 | } | 507 | } |
508 | #endif | 508 | #endif |
509 | 509 | ||
510 | if (flags & PSSCAN_UIDGID) { | ||
511 | /* if we can open the process it belongs to us */ | ||
512 | if ((proc=OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID))) { | ||
513 | sp->uid = DEFAULT_UID; | ||
514 | sp->gid = DEFAULT_GID; | ||
515 | CloseHandle(proc); | ||
516 | } | ||
517 | } | ||
518 | |||
510 | sp->pid = pe.th32ProcessID; | 519 | sp->pid = pe.th32ProcessID; |
511 | sp->ppid = pe.th32ParentProcessID; | 520 | sp->ppid = pe.th32ParentProcessID; |
512 | 521 | ||