Click here to Skip to main content
13,344,508 members (50,969 online)
Click here to Skip to main content
Add your own
alternative version


58 bookmarked
Posted 14 Jan 2007


, 20 Oct 2007
Rate this:
Please Sign up or sign in to vote.
A processes and threads manager application.

Sample Image - EzProcess.jpg


EzProcess is a GUI executable application that displays information about all running processes: Process Name, Process ID, Parent ID, and Priority. In addition, all the threads (together with their base priority) and loaded modules (DLLs) of the selected process are displayed.


EzProcess is based on seven API Functions, namely, CreateToolhelp32Snapshot, Process32First, Process32Next, Thread32First, Thread32Next, Module32First, and Module32Next.

Getting all running processes

A snapshot is created by calling the CreateToolhelp32Snapshot API function with the TH32CS_SNAPPROCESS OR TH32CS_SNAPTHREAD flags. After that, a call to the Process32First API function retrieves information about the first process encountered in the system snapshot we have created. Finally, calling Process32Next repeatedly, information about all processes recorded in the snapshot is retrieved. The code is:

Invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS OR TH32CS_SNAPTHREAD, NULL
MOV hSnapShot,EAX

;Get first process
MOV ProcEntry32.dwSize,SizeOf PROCESSENTRY32
Invoke Process32First,hSnapShot,ADDR ProcEntry32
    ;Get Next process
    Invoke Process32Next,hSnapShot,ADDR ProcEntry32
    JMP @B

Getting the threads of the selected process

A call to the Thread32First API function retrieves information about the first thread of any process encountered in the snapshot created above. If the identifier of the process that created the thread (ThreadEntry32.th32OwnerProcessID) is the ID of the selected process, then it is displayed. Calling Thread32Next repeatedly and comparing the IDs as explained above, information about all threads of the selected process is retrieved. The code is:

;Get first thread
MOV ThreadEntry32.dwSize,SizeOf THREADENTRY32
Invoke Thread32First,hSnapShot,ADDR ThreadEntry32
    .If ThreadEntry32.th32OwnerProcessID==EDI
    ;Get Next Thread
    Invoke Thread32Next,hSnapShot,ADDR ThreadEntry32
    JMP @B

Getting the modules associated with the selected Process

In order to get the modules associated with the selected process, we need to take a new snapshot that includes the module list of the specified process. Using the newly created snapshot, we iterate through all modules associated with the specified process, by using the API functions Module32First and Module32Next. The code is:

;Let's create a new snapshot that includes the module list of the specified  process
Invoke CreateToolhelp32Snapshot,TH32CS_SNAPMODULE,EDI
;Get first Module
MOV ModuleEntry32.dwSize,SizeOf MODULEENTRY32
Invoke Module32First,EBX,ADDR ModuleEntry32
    ;Get Next Module
    Invoke Module32Next,EBX,ADDR ModuleEntry32
    JMP @B
Invoke CloseHandle,EBX

Extended Functionality

In addition, the EzProcess Processes/Threads Manager is able to kill a selected process. This is done as follows:

Invoke OpenProcess,PROCESS_TERMINATE, FALSE,lvi.lParam ;where lvi.lParam is the process ID
    MOV EBX,EAX ;hProcess
    Invoke TerminateProcess,EBX,0
    .If !EAX
        Invoke ErrorMessage
    Invoke CloseHandle,EBX ;hProcess
    Invoke ErrorMessage

Final Note

EzProcess is a project under heavy development, and Jupiter has undertaken to improve it. You can always check for a newer version at the Projects forum of the WinAsm Studio board.


New version, v1.82, has been released (full source code). You can find it at EzProcess.


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Web Developer
Cyprus Cyprus
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionHow to make all threads active Pin
rajivalochanan_s29-Oct-09 5:21
memberrajivalochanan_s29-Oct-09 5:21 
GeneralPoli Kalo! Pin
manos_crete26-Jan-07 13:02
membermanos_crete26-Jan-07 13:02 
GeneralRe: Poli Kalo! Pin
akyprian26-Jan-07 21:58
memberakyprian26-Jan-07 21:58 
GeneralPotentially really useful! Pin
peterboulton23-Jan-07 2:07
memberpeterboulton23-Jan-07 2:07 
GeneralRe: Potentially really useful! Pin
akyprian23-Jan-07 3:41
memberakyprian23-Jan-07 3:41 
GeneralNice code Pin
qiuqianren23-Jan-07 1:02
memberqiuqianren23-Jan-07 1:02 
GeneralRe: Nice code Pin
akyprian23-Jan-07 3:30
memberakyprian23-Jan-07 3:30 
GeneralRe: Nice code Pin
qiuqianren23-Jan-07 6:09
memberqiuqianren23-Jan-07 6:09 
GeneralWOW! Pin
NoellyB22-Jan-07 21:42
memberNoellyB22-Jan-07 21:42 
GeneralRe: WOW! [modified] Pin
akyprian23-Jan-07 3:19
memberakyprian23-Jan-07 3:19 
NoellyB, thanks for your good words.

I have no idea how to compile it, as I've never worked with assembly language before and don't even want to try it.

You can use WinAsm Studio to open, edit and compile the project.

I've always thought an application this complex would need a TON of assembler code to be of anything useful.

I know, this is a popular legend, but this not true for 32-bit windows development. Have a look at this article.

Is there more to this application than just the code you've shown here?
The only code you don't see is the ownerdawn menus (packaged as a static library). You can find how to do ownerdrawn menus (not a difficult task) at my site.

I'd like to ask though - was there a particular reason you went with assembly language versus another method of building an application of this type? I only ask because it peeks my interest - I'd love to learn assembly-language programming, but have just been scared by the notion of tons of code, and using words like "stack," "heap", "register," "ebx,abx" etc. Any help on how to get started programming in assembly-language would be appreciated as well as answering my question about why you used assembly-language vs. another method

After having developed software using HLL's for years, I use Assembly language for ALL my programming needs: small and very fast applications, no bloat, no dependencies (huge dll's), VERY easy to develop Wink | ;) and above all, I can do anything I want without facing any HLL limitations. You can find free tools, help and support you need to start programming in assembly from the WinAsm Studio site.

-- modified at 2:56 Thursday 25th January, 2007

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 20 Oct 2007
Article Copyright 2007 by akyprian
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid