diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/win32/process.c b/win32/process.c index e835be63a..95508264b 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -410,6 +410,7 @@ UNUSED_PARAM | |||
410 | ) | 410 | ) |
411 | { | 411 | { |
412 | PROCESSENTRY32 pe; | 412 | PROCESSENTRY32 pe; |
413 | const char *comm; | ||
413 | 414 | ||
414 | pe.dwSize = sizeof(pe); | 415 | pe.dwSize = sizeof(pe); |
415 | if (!sp) { | 416 | if (!sp) { |
@@ -472,7 +473,21 @@ UNUSED_PARAM | |||
472 | 473 | ||
473 | sp->pid = pe.th32ProcessID; | 474 | sp->pid = pe.th32ProcessID; |
474 | sp->ppid = pe.th32ParentProcessID; | 475 | sp->ppid = pe.th32ParentProcessID; |
475 | safe_strncpy(sp->comm, pe.szExeFile, COMM_LEN); | 476 | |
477 | comm = pe.szExeFile; | ||
478 | if (sp->pid == GetProcessId(GetCurrentProcess())) { | ||
479 | comm = applet_name; | ||
480 | } | ||
481 | else { | ||
482 | char *name, *value; | ||
483 | |||
484 | name = xasprintf("BB_APPLET_%d", sp->pid); | ||
485 | if ((value=getenv(name)) != NULL) { | ||
486 | comm = value; | ||
487 | } | ||
488 | free(name); | ||
489 | } | ||
490 | safe_strncpy(sp->comm, comm, COMM_LEN); | ||
476 | return sp; | 491 | return sp; |
477 | } | 492 | } |
478 | 493 | ||