PID and memory use for NT processes? 
Author Message
 PID and memory use for NT processes?

I have spent some time playing with the MODLIST code from the MS KB, and
I've got 2 questions about it's use on NT:

1. How do I get the PID? (for instance, if I decide to use something like
KILL and want to pass the PID to it). I changed the code in MODLIST to print
the ProcessID but I get a few processes with duplicates IDs, in fact it
seems that I only have 14 values that are cycled through repeatedly. I guess
I must be reading the wrong value; the code I am using is:

                lRet = GetModuleFileNameExA(hProcess, Modules(1),
ModuleName, nSize)

                'Get the module file name out of the buffer, lRet is how
                'many characters the string is, the rest of the buffer is
                sModName = Left$(ModuleName, lRet)

                'Add the process to the CGI output
                Send sModName & " (" & CStr(hProcess) & ")"

Is the process handle different to the process ID?

2. How do I find out how much memory the process is using? I can't find
anything on the MS KB, and I've tried searching all over the place for
references to the Win32 API and memory. Which API call do I need to use?

BTW: I've modified the MODLIST source to run as a Win-CGI on WebSite, and it
runs under the context of the SYSTEM account, but I don't think that this
should make any difference.


Mon, 05 Nov 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Killing Processes by PID on Win9x/ME/NT/2000

2. VB on NT process id / pid

3. Pid of a particular instance of a process

4. How do I determine my own Process ID (PID)

5. terminating a process by its PID

6. displaying a windows/processes PID from a hwnd

7. Q: How can I get the process name from PID

8. How to tie the dllhost.exe PID to COM+ Application PID programmatically

9. Finding memory used by a process

10. Getting a PID, VB 4.0 32-bit, NT, Shell function

11. NT Process control using VB6

12. Killing a process in NT (without using WMI)


Powered by phpBB® Forum Software