Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.os.linux.misc    |    Linux-specific topics not covered by oth    |    135,536 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 134,686 of 135,536    |
|    rbowman to All    |
|    Re: Ridiculous Online Programming "Advic    |
|    12 Jan 26 05:24:35    |
      From: bowman@montana.com              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              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca