py-setproctitle icon indicating copy to clipboard operation
py-setproctitle copied to clipboard

Provide an interface to read the titles of the running processes on Windows

Open dvarrazzo opened this issue 15 years ago • 2 comments

Originally submitted by daniele.varrazzo as issue 6:

I only know it can be done (see Process Explorer [1]), but how, I don't know.

Also, I wouldn't know if it should be a graphical interface (displaying processes in a tree, allowing to send them signal etc.) or a command line tool. I suppose the first would be more useful from a windows user PoV but more complex to write and with fat dependencies.

Contributions are welcome.

[1] http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

dvarrazzo avatar Mar 02 '10 14:03 dvarrazzo

Comment by daniele.varrazzo:

Sysinternals' "handle" program [1] returns the value as well

C:\dev\setproctitle\build\lib.win32-2.6>c:\Python26\python.exe Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import setproctitle setproctitle.setproctitle("Hello, world!") import os os.getpid() 804

C:\dev>x:\Sistema\sysinternals\handle.exe -p 804 -a

Handle v3.11 Copyright (C) 1997-2005 Mark Russinovich Sysinternals - www.sysinternals.com

18: File C:\dev\setproctitle\build\lib.win32-2.6 39C: Event \BaseNamedObjects\python(804): Hello, world! 3A4: Directory \BaseNamedObjects 3A8: Event [...]

but the source file (that must be no more than a couple of syscalls) is not available anymore [2].

[1] http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx [2] http://technet.microsoft.com/en-us/sysinternals/bb847944.aspx

dvarrazzo avatar Jul 03 '10 14:07 dvarrazzo

You could try modify the buffer returned by GetCommandLineA and GetCommandLineW. Doing so can't change process name, but can change process command line. And it's visible in Task Manager and Process Explorer.

ysc3839 avatar Sep 24 '24 05:09 ysc3839