Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: comp.os.linux.misc Subject: Re: Ridiculous Online Programming "Advice" Date: 12 Jan 2026 05:24:35 GMT Lines: 38 Message-ID: References: <546dnQ79vYkSZP_0nZ2dnZfqnPSdnZ2d@giganews.com> <7y2dnbcmBsiqyP70nZ2dnZfqn_udnZ2d@giganews.com> <10k11ah$6725$1@dont-email.me> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net RnOqWpxVf0FSMUrh36uV+gc6HxE5wTKR9DzmNsk/sydOdKUlp+ Cancel-Lock: sha1:WwyLh/0fp6XqzzlWD+BXvY7jYiQ= sha256:qO3yLgUsnCjQ+II1UjUPixDWye/PQk9vCo0aznmPVd4= User-Agent: Pan/0.162 (Pokrosvk) Xref: csiph.com comp.os.linux.misc:80968 On Sun, 11 Jan 2026 18:12:00 -0500, c186282 wrote: > This is a Python solution - indeed Linux Python. Variants ought to be > doable, not sure how compactly, in a number of other langs. Winders > has 'tasklist' but I don't remember if it's as to-the-point as 'ps'. No. I wrote a Windows version of ps so support would have a tool compatible with the Unix/Linus ps. First you load NtQueryInformationProcess from the native NT API dll, and then call EnumProcesses(). https://learn.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi- enumprocesses Then you iterate the list calling OpenProcess() on each. https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf- processthreadsapi-openprocess Then you make several calls to ReadProcessMemory(), GetProcessTimes(), OpenProcessToken(), and GetTokenInformation() to get the usual stuff reported by ps. Along the way you do a little math since you're dealing with 64 bit integers of 100 nanoseconds. If you're a peon (User) you can't do that but you can open the Registry HKEY_PERFORMANCE_DATA and get some info. Ain't nothing easy in Windows. There is also a version that uses CreateToolhelp32Snapshot(). https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32- createtoolhelp32snapshot