Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.misc > #80968

Re: Ridiculous Online Programming "Advice"

From rbowman <bowman@montana.com>
Newsgroups comp.os.linux.misc
Subject Re: Ridiculous Online Programming "Advice"
Date 2026-01-12 05:24 +0000
Message-ID <msjesiF80p4U2@mid.individual.net> (permalink)
References <546dnQ79vYkSZP_0nZ2dnZfqnPSdnZ2d@giganews.com> <msh1ulFqhrqU1@mid.individual.net> <7y2dnbcmBsiqyP70nZ2dnZfqn_udnZ2d@giganews.com> <10k11ah$6725$1@dont-email.me> <A4SdnYq6693as_n0nZ2dnZfqnPWdnZ2d@giganews.com>

Show all headers | View raw


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



Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Ridiculous Online Programming "Advice" c186282 <c186282@nnada.net> - 2026-01-10 20:14 -0500
  Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-11 07:31 +0000
    Re: Ridiculous Online Programming "Advice" c186282 <c186282@nnada.net> - 2026-01-11 02:45 -0500
      Re: Ridiculous Online Programming "Advice" Rich <rich@example.invalid> - 2026-01-11 20:31 +0000
        Re: Ridiculous Online Programming "Advice" c186282 <c186282@nnada.net> - 2026-01-11 18:12 -0500
          Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-12 05:24 +0000
          Re: Ridiculous Online Programming "Advice" Rich <rich@example.invalid> - 2026-01-12 05:57 +0000
      Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-11 22:31 +0000
        Re: Ridiculous Online Programming "Advice" Rich <rich@example.invalid> - 2026-01-12 06:02 +0000
          Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-12 08:05 +0000
    Re: Ridiculous Online Programming "Advice" Nuno Silva <nunojsilva@invalid.invalid> - 2026-01-11 10:32 +0000
      Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-11 22:51 +0000
        Re: Ridiculous Online Programming "Advice" c186282 <c186282@nnada.net> - 2026-01-11 19:31 -0500
          Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-12 07:05 +0000
            Re: Ridiculous Online Programming "Advice" c186282 <c186282@nnada.net> - 2026-01-12 17:42 -0500
        Re: Ridiculous Online Programming "Advice" Nuno Silva <nunojsilva@invalid.invalid> - 2026-01-11 23:57 +0000
          Re: Ridiculous Online Programming "Advice" rbowman <bowman@montana.com> - 2026-01-12 08:07 +0000

csiph-web